//#define __debug_io2\r
//#define rdprintf dprintf\r
#define rdprintf(...)\r
+#define wrdprintf(...)\r
\r
// -----------------------------------------------------------------\r
\r
d = Pico_mcd->s68k_regs[4]<<8;\r
goto end;\r
case 6:\r
- d = Pico_mcd->m.hint_vector;\r
+ d = *(u16 *)(Pico_mcd->bios + 0x72);\r
goto end;\r
case 8:\r
d = Read_CDC_Host(0);\r
Pico_mcd->s68k_regs[3] = d; // really use s68k side register\r
return;\r
case 6:\r
- dprintf("FIXME hint[2]: %02x @%06x", (u8)d, SekPc);\r
Pico_mcd->bios[0x72 + 1] = d; // simple hint vector changer\r
return;\r
case 7:\r
- dprintf("FIXME hint[3]: %02x @%06x", (u8)d, SekPc);\r
Pico_mcd->bios[0x72] = d;\r
- dprintf("vector is now %08x", PicoRead32(0x70));\r
+ dprintf("hint vector set to %08x", PicoRead32(0x70));\r
return;\r
case 0xe:\r
//dprintf("m68k: comm flag: %02x", d);\r
}\r
\r
\r
+#define READ_FONT_DATA(basemask) \\r
+{ \\r
+ unsigned int fnt = *(unsigned int *)(Pico_mcd->s68k_regs + 0x4c); \\r
+ unsigned int col0 = (fnt >> 8) & 0x0f, col1 = (fnt >> 12) & 0x0f; \\r
+ if (fnt & (basemask << 0)) d = col1 ; else d = col0; \\r
+ if (fnt & (basemask << 1)) d |= col1 << 4; else d |= col0 << 4; \\r
+ if (fnt & (basemask << 2)) d |= col1 << 8; else d |= col0 << 8; \\r
+ if (fnt & (basemask << 3)) d |= col1 << 12; else d |= col0 << 12; \\r
+}\r
+\r
\r
static u32 s68k_reg_read16(u32 a)\r
{\r
case 0x34: // fader\r
d = 0; // no busy bit\r
goto end;\r
+ case 0x50: // font data (check: Lunar 2, Silpheed)\r
+ READ_FONT_DATA(0x00100000);\r
+ goto end;\r
+ case 0x52:\r
+ READ_FONT_DATA(0x00010000);\r
+ goto end;\r
+ case 0x54:\r
+ READ_FONT_DATA(0x10000000);\r
+ goto end;\r
+ case 0x56:\r
+ READ_FONT_DATA(0x01000000);\r
+ goto end;\r
}\r
\r
d = (Pico_mcd->s68k_regs[a]<<8) | Pico_mcd->s68k_regs[a+1];\r
\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
- dprintf("m68k_wram r8: [%06x] @%06x", a, SekPc);\r
+ wrdprintf("m68k_wram r8: [%06x] @%06x", a, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000)\r
// allow access in any mode, like Gens does\r
d = Pico_mcd->word_ram2M[(a^1)&0x3ffff];\r
}\r
- dprintf("ret = %02x", (u8)d);\r
+ wrdprintf("ret = %02x", (u8)d);\r
goto end;\r
}\r
\r
\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
- dprintf("m68k_wram r16: [%06x] @%06x", a, SekPc);\r
+ wrdprintf("m68k_wram r16: [%06x] @%06x", a, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000)\r
// allow access in any mode, like Gens does\r
d = *(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe));\r
}\r
- dprintf("ret = %04x", d);\r
+ wrdprintf("ret = %04x", d);\r
goto end;\r
}\r
\r
\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
- dprintf("m68k_wram r32: [%06x] @%06x", a, SekPc);\r
+ wrdprintf("m68k_wram r32: [%06x] @%06x", a, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000) { // cell arranged\r
// allow access in any mode, like Gens does\r
u16 *pm=(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe)); d = (pm[0]<<16)|pm[1];\r
}\r
- dprintf("ret = %08x", d);\r
+ wrdprintf("ret = %08x", d);\r
goto end;\r
}\r
\r
\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
- dprintf("m68k_wram w8: [%06x] %02x @%06x", a, d, SekPc);\r
+ wrdprintf("m68k_wram w8: [%06x] %02x @%06x", a, d, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000)\r
\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
- dprintf("m68k_wram w16: [%06x] %04x @%06x", a, d, SekPc);\r
+ wrdprintf("m68k_wram w16: [%06x] %04x @%06x", a, d, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000)\r
// word RAM\r
if ((a&0xfc0000)==0x200000) {\r
if (d != 0) // don't log clears\r
- dprintf("m68k_wram w32: [%06x] %08x @%06x", a, d, SekPc);\r
+ wrdprintf("m68k_wram w32: [%06x] %08x @%06x", a, d, SekPc);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
int bank = Pico_mcd->s68k_regs[3]&1;\r
if (a >= 0x220000) { // cell arranged\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1ff;\r
rdprintf("s68k_regs r8: [%02x] @ %06x", a, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68)\r
+ if (a >= 0x58 && a < 0x68)\r
d = gfx_cd_read(a&~1);\r
else d = s68k_reg_read16(a&~1);\r
if ((a&1)==0) d>>=8;\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
// test: batman returns\r
- dprintf("s68k_wram2M r8: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram2M r8: [%06x] @%06x", a, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];\r
// allow access in any mode, like Gens does\r
d = Pico_mcd->word_ram2M[(a^1)&0x3ffff];\r
}\r
- dprintf("ret = %02x", (u8)d);\r
+ wrdprintf("ret = %02x", (u8)d);\r
goto end;\r
}\r
\r
// word RAM (1M area)\r
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff\r
int bank;\r
- dprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r
d = Pico_mcd->word_ram1M[bank][(a^1)&0x1ffff];\r
- dprintf("ret = %02x", (u8)d);\r
+ wrdprintf("ret = %02x", (u8)d);\r
goto end;\r
}\r
\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1fe;\r
rdprintf("s68k_regs r16: [%02x] @ %06x", a, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68)\r
+ if (a >= 0x58 && a < 0x68)\r
d = gfx_cd_read(a);\r
else d = s68k_reg_read16(a);\r
rdprintf("ret = %04x", d);\r
\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
- dprintf("s68k_wram2M r16: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram2M r16: [%06x] @%06x", a, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
d = Pico_mcd->word_ram1M[bank][((a>>1)^1)&0x1ffff];\r
// allow access in any mode, like Gens does\r
d = *(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe));\r
}\r
- dprintf("ret = %04x", d);\r
+ wrdprintf("ret = %04x", d);\r
goto end;\r
}\r
\r
// word RAM (1M area)\r
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff\r
int bank;\r
- dprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r
d = *(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe));\r
- dprintf("ret = %04x", d);\r
+ wrdprintf("ret = %04x", d);\r
goto end;\r
}\r
\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1fe;\r
rdprintf("s68k_regs r32: [%02x] @ %06x", a, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68)\r
+ if (a >= 0x58 && a < 0x68)\r
d = (gfx_cd_read(a)<<16)|gfx_cd_read(a+2);\r
else d = (s68k_reg_read16(a)<<16)|s68k_reg_read16(a+2);\r
rdprintf("ret = %08x", d);\r
\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
- dprintf("s68k_wram2M r32: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram2M r32: [%06x] @%06x", a, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
a >>= 1;\r
// allow access in any mode, like Gens does\r
u16 *pm=(u16 *)(Pico_mcd->word_ram2M+(a&0x3fffe)); d = (pm[0]<<16)|pm[1];\r
}\r
- dprintf("ret = %08x", d);\r
+ wrdprintf("ret = %08x", d);\r
goto end;\r
}\r
\r
// word RAM (1M area)\r
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff\r
int bank;\r
- dprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k);\r
+ wrdprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r
u16 *pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1];\r
- dprintf("ret = %08x", d);\r
+ wrdprintf("ret = %08x", d);\r
goto end;\r
}\r
\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1ff;\r
rdprintf("s68k_regs w8: [%02x] %02x @ %06x", a, d, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68)\r
+ if (a >= 0x58 && a < 0x68)\r
gfx_cd_write(a&~1, (d<<8)|d);\r
else s68k_reg_write8(a,d);\r
return;\r
\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
- dprintf("s68k_wram2M w8: [%06x] %02x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram2M w8: [%06x] %02x @%06x", a, d, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
if (a&1) d &= 0x0f;\r
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff\r
int bank;\r
if (d)\r
- dprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1fe;\r
rdprintf("s68k_regs w16: [%02x] %04x @ %06x", a, d, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68)\r
+ if (a >= 0x58 && a < 0x68)\r
gfx_cd_write(a, d);\r
else {\r
if (a == 0xe) { // special case, 2 byte writes would be handled differently\r
\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
- dprintf("s68k_wram2M w16: [%06x] %04x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram2M w16: [%06x] %04x @%06x", a, d, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
d &= ~0xf0; d |= d >> 8;\r
if ((a&0xfe0000)==0x0c0000) { // 0c0000-0dffff\r
int bank;\r
if (d)\r
- dprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r
if ((a&0xfffe00) == 0xff8000) {\r
a &= 0x1fe;\r
rdprintf("s68k_regs w32: [%02x] %08x @ %06x", a, d, SekPcS68k);\r
- if (a >= 0x50 && a < 0x68) {\r
+ if (a >= 0x58 && a < 0x68) {\r
gfx_cd_write(a, d>>16);\r
gfx_cd_write(a+2, d&0xffff);\r
} else {\r
\r
// word RAM (2M area)\r
if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
- dprintf("s68k_wram2M w32: [%06x] %08x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram2M w32: [%06x] %08x @%06x", a, d, SekPcS68k);\r
if (Pico_mcd->s68k_regs[3]&4) { // 1M decode mode?\r
int bank = !(Pico_mcd->s68k_regs[3]&1);\r
a >>= 1;\r
int bank;\r
u16 *pm;\r
if (d)\r
- dprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPcS68k);\r
+ wrdprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPcS68k);\r
if (!(Pico_mcd->s68k_regs[3]&4))\r
dprintf("s68k_wram1M FIXME: wrong mode");\r
bank = !(Pico_mcd->s68k_regs[3]&1);\r