From: kub Date: Sun, 27 Feb 2022 11:12:15 +0000 (+0000) Subject: sms, add sg-1000 on-cart RAM mapping X-Git-Tag: v2.00~332 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=216c9f17fa4a23b0a8ff738d158a0e2990559155;p=picodrive.git sms, add sg-1000 on-cart RAM mapping --- diff --git a/pico/sms.c b/pico/sms.c index 1829276c..c045d610 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -458,15 +458,16 @@ static void write_bank_jang(unsigned short a, unsigned char d) static void write_bank_x8k(unsigned short a, unsigned char d) { // 8KB address range @ 0x2000 - if ((a&0xe000) != 0x2000) return; + if ((a&0xe000) != 0x2000 && (a&0xe000) != 0x8000) return; // this is only available on SG-1000 if (Pico.ms.mapper != PMS_MAP_8KBRAM && (Pico.ms.mapper || !(Pico.m.hardware & PMS_HW_SG))) return; elprintf(EL_Z80BNK, "bank x8k %04x %02x @ %04x", a, d, z80_pc()); Pico.ms.mapper = PMS_MAP_8KBRAM; - ((unsigned char *)PicoMem.vram)[a+0x6000] = d; - z80_map_set(z80_read_map, 0x2000, 0x3fff, PicoMem.vram+0x4000, 0); - z80_map_set(z80_write_map, 0x2000, 0x3fff, PicoMem.vram+0x4000, 0); + ((unsigned char *)PicoMem.vram)[(a&0x1fff)+0x8000] = d; + a &= 0xe000; + z80_map_set(z80_read_map, a, a+0x1fff, PicoMem.vram+0x4000, 0); + z80_map_set(z80_write_map, a, a+0x1fff, PicoMem.vram+0x4000, 0); } // TODO auto-selecting is not really reliable.