From: kub Date: Sun, 30 Jun 2024 15:55:37 +0000 (+0200) Subject: sms, add sram in codemasters mapper X-Git-Tag: v2.00~17 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25559e5417bc3f9ca73e006fb070973439795a81;p=picodrive.git sms, add sram in codemasters mapper --- diff --git a/pico/sms.c b/pico/sms.c index 3313e02c..5ac0b919 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -340,7 +340,7 @@ static void write_bank_sega(unsigned short a, unsigned char d) } } -// Codemasters mapper. Similar to Sega, but different addresses, TODO: SRAM +// Codemasters mapper. Similar to Sega, but different addresses static void write_bank_codem(unsigned short a, unsigned char d) { if (a >= 0xc000 || (a & 0x3fff)) return; // address is 0x0000, 0x4000, 0x8000? @@ -352,6 +352,14 @@ static void write_bank_codem(unsigned short a, unsigned char d) d &= bank_mask; z80_map_set(z80_read_map, a, a+0x3fff, Pico.rom + (d << 14), 0); + if (Pico.ms.carthw[1] & 0x80) { + z80_map_set(z80_read_map, 0xa000, 0xbfff, PicoMem.vram+0x4000, 0); + z80_map_set(z80_write_map, 0xa000, 0xbfff, PicoMem.vram+0x4000, 0); + } else { + d = Pico.ms.carthw[2] & bank_mask; + z80_map_set(z80_read_map, 0xa000, 0xbfff, Pico.rom + (d << 14)+0x2000, 0); + z80_map_set(z80_write_map, 0xa000, 0xbfff, xwrite, 1); + } } // MSX mapper. 4 selectable 8KB banks at the top