mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
32x, add disabling via ADEN (for testpico)
This commit is contained in:
parent
0e2e188e1e
commit
9f7abd68df
2 changed files with 33 additions and 8 deletions
|
@ -124,6 +124,20 @@ void Pico32xStartup(void)
|
||||||
emu_32x_startup();
|
emu_32x_startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pico32xShutdown(void)
|
||||||
|
{
|
||||||
|
sh2_finish(&msh2);
|
||||||
|
sh2_finish(&ssh2);
|
||||||
|
|
||||||
|
Pico32x.vdp_regs[6] = P32XS_RV;
|
||||||
|
|
||||||
|
rendstatus_old = -1;
|
||||||
|
|
||||||
|
PicoIn.AHW &= ~PAHW_32X;
|
||||||
|
PicoMemSetup();
|
||||||
|
emu_32x_startup();
|
||||||
|
}
|
||||||
|
|
||||||
void p32x_reset_sh2s(void)
|
void p32x_reset_sh2s(void)
|
||||||
{
|
{
|
||||||
elprintf(EL_32X, "sh2 reset");
|
elprintf(EL_32X, "sh2 reset");
|
||||||
|
@ -195,13 +209,11 @@ void PicoPower32x(void)
|
||||||
|
|
||||||
void PicoUnload32x(void)
|
void PicoUnload32x(void)
|
||||||
{
|
{
|
||||||
sh2_finish(&msh2);
|
Pico32xShutdown();
|
||||||
sh2_finish(&ssh2);
|
|
||||||
if (Pico32xMem != NULL)
|
if (Pico32xMem != NULL)
|
||||||
plat_munmap(Pico32xMem, sizeof(*Pico32xMem));
|
plat_munmap(Pico32xMem, sizeof(*Pico32xMem));
|
||||||
Pico32xMem = NULL;
|
Pico32xMem = NULL;
|
||||||
|
|
||||||
PicoIn.AHW &= ~PAHW_32X;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PicoReset32x(void)
|
void PicoReset32x(void)
|
||||||
|
@ -452,7 +464,7 @@ void sync_sh2s_normal(unsigned int m68k_target)
|
||||||
|
|
||||||
elprintf(EL_32X, "sh2 sync to %u", m68k_target);
|
elprintf(EL_32X, "sh2 sync to %u", m68k_target);
|
||||||
|
|
||||||
if (!(Pico32x.regs[0] & P32XS_nRES)) {
|
if (!(Pico32x.regs[0] & P32XS_nRES) || !(Pico32x.regs[0] & P32XS_ADEN)) {
|
||||||
msh2.m68krcycles_done = ssh2.m68krcycles_done = m68k_target;
|
msh2.m68krcycles_done = ssh2.m68krcycles_done = m68k_target;
|
||||||
return; // rare
|
return; // rare
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,10 @@ static void p32x_reg_write8(u32 a, u32 d)
|
||||||
REG8IN16(r, 0x00) = d & 0x80;
|
REG8IN16(r, 0x00) = d & 0x80;
|
||||||
return;
|
return;
|
||||||
case 0x01: // adapter ctl: RES and ADEN writable
|
case 0x01: // adapter ctl: RES and ADEN writable
|
||||||
if ((d ^ r[0]) & d & P32XS_nRES)
|
if ((d ^ r[0]) & ~d & P32XS_ADEN) {
|
||||||
|
d |= P32XS_nRES;
|
||||||
|
Pico32xShutdown();
|
||||||
|
} else if ((d ^ r[0]) & d & P32XS_nRES)
|
||||||
p32x_reset_sh2s();
|
p32x_reset_sh2s();
|
||||||
REG8IN16(r, 0x01) &= ~(P32XS_nRES|P32XS_ADEN);
|
REG8IN16(r, 0x01) &= ~(P32XS_nRES|P32XS_ADEN);
|
||||||
REG8IN16(r, 0x01) |= d & (P32XS_nRES|P32XS_ADEN);
|
REG8IN16(r, 0x01) |= d & (P32XS_nRES|P32XS_ADEN);
|
||||||
|
@ -581,7 +584,10 @@ static void p32x_reg_write16(u32 a, u32 d)
|
||||||
|
|
||||||
switch (a/2) {
|
switch (a/2) {
|
||||||
case 0x00/2: // adapter ctl
|
case 0x00/2: // adapter ctl
|
||||||
if ((d ^ r[0]) & d & P32XS_nRES)
|
if ((d ^ r[0]) & ~d & P32XS_ADEN) {
|
||||||
|
d |= P32XS_nRES;
|
||||||
|
Pico32xShutdown();
|
||||||
|
} else if ((d ^ r[0]) & d & P32XS_nRES)
|
||||||
p32x_reset_sh2s();
|
p32x_reset_sh2s();
|
||||||
r[0] &= ~(P32XS_FM|P32XS_nRES|P32XS_ADEN);
|
r[0] &= ~(P32XS_FM|P32XS_nRES|P32XS_ADEN);
|
||||||
r[0] |= d & (P32XS_FM|P32XS_nRES|P32XS_ADEN);
|
r[0] |= d & (P32XS_FM|P32XS_nRES|P32XS_ADEN);
|
||||||
|
@ -1240,7 +1246,10 @@ void PicoWrite8_32x(u32 a, u32 d)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (a == 7) {
|
||||||
|
r[0x06/2] &= ~P32XS_RV;
|
||||||
|
r[0x06/2] |= d & P32XS_RV;
|
||||||
|
}
|
||||||
// allow only COMM for now
|
// allow only COMM for now
|
||||||
if ((a & 0x30) == 0x20) {
|
if ((a & 0x30) == 0x20) {
|
||||||
u8 *r8 = (u8 *)r;
|
u8 *r8 = (u8 *)r;
|
||||||
|
@ -1269,6 +1278,10 @@ void PicoWrite16_32x(u32 a, u32 d)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (a == 6) {
|
||||||
|
r[0x06/2] &= ~P32XS_RV;
|
||||||
|
r[0x06/2] |= d & P32XS_RV;
|
||||||
|
}
|
||||||
|
|
||||||
// allow only COMM for now
|
// allow only COMM for now
|
||||||
if ((a & 0x30) == 0x20)
|
if ((a & 0x30) == 0x20)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue