X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPico%2FMemory.c;h=2f8e1d6c3615a86e8e3a6c74060b466ebfc160c7;hb=213c16adcb630666f694646645a8ed4bc30c334b;hp=5760324f7364d1409f2dac423f18e5d379584542;hpb=ef4eb506de324df73bcda06f027a20349c69d05f;p=picodrive.git diff --git a/Pico/Pico/Memory.c b/Pico/Pico/Memory.c index 5760324..2f8e1d6 100644 --- a/Pico/Pico/Memory.c +++ b/Pico/Pico/Memory.c @@ -38,12 +38,12 @@ static u32 PicoReadPico8(u32 a) d = ~d; break; - case 0x05: d = (PicoPicohw.pen_pos[0] >> 8) & 3; break; // what is MS bit for? Games read it.. - case 0x07: d = PicoPicohw.pen_pos[0] & 0xff; break; - case 0x09: d = (PicoPicohw.pen_pos[1] >> 8) & 3; break; - case 0x0b: d = PicoPicohw.pen_pos[1] & 0xff; break; + case 0x05: d = (PicoPicohw.pen_pos[0] >> 8); break; // what is MS bit for? Games read it.. + case 0x07: d = PicoPicohw.pen_pos[0] & 0xff; break; + case 0x09: d = (PicoPicohw.pen_pos[1] >> 8); break; + case 0x0b: d = PicoPicohw.pen_pos[1] & 0xff; break; case 0x0d: d = (1 << (PicoPicohw.page & 7)) - 1; break; - case 0x12: d = 0x80; break; + case 0x12: d = PicoPicohw.fifo_bytes == 0 ? 0x80 : 0; break; // guess default: elprintf(EL_UIO, "r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc); break; @@ -72,8 +72,10 @@ static u32 PicoReadPico16(u32 a) goto end; } - if (a == 0x800010) + if (a == 0x800010) d = (PicoPicohw.fifo_bytes > 0x3f) ? 0 : (0x3f - PicoPicohw.fifo_bytes); + else if (a == 0x800012) + d = PicoPicohw.fifo_bytes == 0 ? 0x8000 : 0; // guess elprintf(EL_UIO, "r16: %06x, %04x @%06x", a&0xffffff, d, SekPc); @@ -156,7 +158,12 @@ static void PicoWritePico16(u32 a,u16 d) PicoPicohw.xpcm_ptr++; } } - else if (a == 0x800012) PicoPicohw.r12 = d; + else if (a == 0x800012) { + int r12_old = PicoPicohw.r12; + PicoPicohw.r12 = d; + if (r12_old != d) + PicoReratePico(); + } elprintf(EL_UIO, "w16: %06x, %04x", a&0xffffff, d); }