From 25559e5417bc3f9ca73e006fb070973439795a81 Mon Sep 17 00:00:00 2001 From: kub Date: Sun, 30 Jun 2024 17:55:37 +0200 Subject: [PATCH] sms, add sram in codemasters mapper --- pico/sms.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.39.5