diff --git a/genplus-gx/core/cart_hw/sms_cart.c b/genplus-gx/core/cart_hw/sms_cart.c index 1d3728e1c4..87d58c1648 100644 --- a/genplus-gx/core/cart_hw/sms_cart.c +++ b/genplus-gx/core/cart_hw/sms_cart.c @@ -44,6 +44,7 @@ #define MAPPER_TEREBI (0x01) #define MAPPER_RAM_8K_EXT1 (0x02) #define MAPPER_RAM_8K_EXT2 (0x03) +#define MAPPER_OMV (0x04) #define MAPPER_SEGA (0x10) #define MAPPER_SEGA_X (0x11) #define MAPPER_93C46 (0x12) @@ -55,7 +56,7 @@ #define MAPPER_MSX (0x21) #define MAPPER_MSX_NEMESIS (0x22) -#define GAME_DATABASE_CNT (211) +#define GAME_DATABASE_CNT (214) typedef struct { @@ -95,7 +96,7 @@ static const rominfo_t game_list[GAME_DATABASE_CNT] = {0x445525E2, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */ {0x83F0EEDE, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Street Master (KR) */ {0xA05258F5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */ - {0x06965ED9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */ + {0x06965ED9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */ {0x77EFE84A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */ {0xF89AF3CC, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Knightmare II - The Maze of Galious (KR) */ {0x9195C34C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 3 (KR) */ @@ -153,6 +154,11 @@ static const rominfo_t game_list[GAME_DATABASE_CNT] = {0xAAAC12CF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Rally-X (TW) */ {0xD2EDD329, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */ + /* games requiring 2K internal RAM (Othello Multivision hardware) */ + {0x7F7F009D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_OMV, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Circus Charlie (KR) */ + {0x77DB4704, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_OMV, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Q*Bert */ + {0xC5A67B95, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_OMV, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Othello Multivision BIOS */ + /* games requiring Japanese region setting */ {0x71DEBA5A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */ {0xC9DD4E5F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop (Super Arkanoid) */ @@ -727,18 +733,30 @@ static void mapper_reset(void) z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10]; } } - else + + /* Othello Multivision hardware */ + else if (cart_rom.mapper == MAPPER_OMV) { - /* $C000-$FFFF mapped to 2k mirrored RAM */ + /* $C000-$FFFF mapped to 2k internal RAM (mirrored) */ for (i = 0x30; i < 0x40; i++) { z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x01) << 10]; } } + + /* default SG-1000 hardware */ + else + { + /* $C000-$FFFF mapped to 1k internal RAM (mirrored) */ + for (i = 0x30; i < 0x40; i++) + { + z80_readmap[i] = z80_writemap[i] = &work_ram[0]; + } + } } else { - /* $C000-$FFFF mapped to 8k internal RAM (mirrored) */ + /* Master System / Game Gear hardware: $C000-$FFFF mapped to 8k internal RAM (mirrored) */ for (i = 0x30; i < 0x40; i++) { z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10]; @@ -761,17 +779,17 @@ static void mapper_reset(void) return; } - /* reset default $0000-$BFFF mapping */ + /* by default, $0000-$BFFF is mapped to ROM (first 48k) */ + for (i = 0x00; i < 0x30; i++) + { + z80_readmap[i] = &slot.rom[i << 10]; + z80_writemap[i] = cart.rom + 0x510000; /* unused area */ + } + + /* reset cartridge hardware mapping */ if (slot.mapper < MAPPER_SEGA) { - /* $0000-$BFFF mapped to ROM (48k) */ - for (i = 0x00; i < 0x30; i++) - { - z80_readmap[i] = &slot.rom[i << 10]; - z80_writemap[i] = cart.rom + 0x510000; /* unused area */ - } - - /* cartridge extra RAM enabled by default with 32K ROM */ + /* cartridge extra RAM enabled by default with 32K ROM (The Castle) */ if (slot.pages <= 0x20) { /* $8000-$BFFF mapped to 8k external RAM (mirrored) */ @@ -793,22 +811,16 @@ static void mapper_reset(void) } else { - /* $0000-$BFFF mapped to ROM by default */ - for (i = 0x00; i < 0x30; i++) - { - z80_readmap[i] = &slot.rom[i << 10]; - z80_writemap[i] = cart.rom + 0x510000; /* unused area */ - } - - /* reset default ROM paging */ + /* reset ROM paging hardware */ if (slot.mapper & MAPPER_KOREA_8K) { + /* 8k pages */ mapper_8k_w(0,slot.fcr[0]); mapper_8k_w(1,slot.fcr[1]); mapper_8k_w(2,slot.fcr[2]); mapper_8k_w(3,slot.fcr[3]); - /* Nemesis special case */ + /* "Nemesis" mapper specific */ if (slot.mapper == MAPPER_MSX_NEMESIS) { /* first 8k page is mapped to last 8k ROM bank */ @@ -820,6 +832,7 @@ static void mapper_reset(void) } else { + /* 16k pages */ mapper_16k_w(0,slot.fcr[0]); mapper_16k_w(1,slot.fcr[1]); mapper_16k_w(2,slot.fcr[2]); diff --git a/genplus-gx/core/cd_hw/scd.c b/genplus-gx/core/cd_hw/scd.c index 378ac3f086..4aa8ca7d3e 100644 --- a/genplus-gx/core/cd_hw/scd.c +++ b/genplus-gx/core/cd_hw/scd.c @@ -1201,8 +1201,8 @@ void scd_reset(int hard) scd.dmna = 0; /* H-INT default vector */ - *(uint16 *)(m68k.memory_map[0].base + 0x70) = 0x00FF; - *(uint16 *)(m68k.memory_map[0].base + 0x72) = 0xFFFF; + *(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x70) = 0x00FF; + *(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x72) = 0xFFFF; /* Power ON initial values (MAIN-CPU side) */ scd.regs[0x00>>1].w = 0x0002; @@ -1405,7 +1405,7 @@ int scd_context_save(uint8 *state) save_param(&s68k.poll, sizeof(s68k.poll)); /* H-INT default vector */ - tmp16 = *(uint16 *)(m68k.memory_map[0].base + 0x72); + tmp16 = *(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x72); save_param(&tmp16, 2); /* SUB-CPU internal state */ @@ -1606,7 +1606,7 @@ int scd_context_load(uint8 *state) /* H-INT default vector */ load_param(&tmp16, 2); - *(uint16 *)(m68k.memory_map[0].base + 0x72) = tmp16; + *(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x72) = tmp16; /* SUB-CPU internal state */ load_param(&s68k.cycles, sizeof(s68k.cycles)); diff --git a/genplus-gx/core/vdp_render.c b/genplus-gx/core/vdp_render.c index 9496e51ab0..3677232cf1 100644 --- a/genplus-gx/core/vdp_render.c +++ b/genplus-gx/core/vdp_render.c @@ -1142,8 +1142,7 @@ void color_update_m5(int index, unsigned int data) /* Graphics I */ void render_bg_m0(int line) { - uint8 color, pattern; - uint16 name; + uint8 color, name, pattern; uint8 *lb = &linebuf[0][0x20]; uint8 *nt = &vram[((reg[2] << 10) & 0x3C00) + ((line & 0xF8) << 2)]; @@ -1190,7 +1189,7 @@ void render_bg_m1(int line) do { - pattern = pg[*nt++]; + pattern = pg[*nt++ << 3]; *lb++ = 0x10 | ((color >> (((pattern >> 7) & 1) << 2)) & 0x0F); *lb++ = 0x10 | ((color >> (((pattern >> 6) & 1) << 2)) & 0x0F); @@ -1298,8 +1297,6 @@ void render_bg_m2(int line) void render_bg_m3(int line) { uint8 color; - uint16 name; - uint8 *lb = &linebuf[0][0x20]; uint8 *nt = &vram[((reg[2] << 10) & 0x3C00) + ((line & 0xF8) << 2)]; uint8 *pg = &vram[((reg[4] << 11) & 0x3800) + ((line >> 2) & 7)]; @@ -1309,8 +1306,7 @@ void render_bg_m3(int line) do { - name = *nt++; - color = pg[name << 3]; + color = pg[*nt++ << 3]; *lb++ = 0x10 | ((color >> 4) & 0x0F); *lb++ = 0x10 | ((color >> 4) & 0x0F); @@ -1328,7 +1324,6 @@ void render_bg_m3(int line) void render_bg_m3x(int line) { uint8 color; - uint16 name; uint8 *pg; uint8 *lb = &linebuf[0][0x20]; @@ -1349,8 +1344,7 @@ void render_bg_m3x(int line) do { - name = *nt++; - color = pg[name << 3]; + color = pg[*nt++ << 3]; *lb++ = 0x10 | ((color >> 4) & 0x0F); *lb++ = 0x10 | ((color >> 4) & 0x0F); diff --git a/output/dll/libgenplusgx.dll b/output/dll/libgenplusgx.dll index 1f81f662ac..5397ae168c 100644 Binary files a/output/dll/libgenplusgx.dll and b/output/dll/libgenplusgx.dll differ