--- generator/src/memz80.c 2020/03/04 04:46:28 1.1 +++ generator/src/memz80.c 2020/03/04 04:46:33 1.1.1.2 @@ -1,10 +1,4 @@ -/*****************************************************************************/ -/* Generator - Sega Genesis emulation - (c) James Ponder 1997-1998 */ -/*****************************************************************************/ -/* */ -/* memz80.c */ -/* */ -/*****************************************************************************/ +/* Generator is (c) James Ponder, 1997-2001 http://www.squish.net/generator/ */ #include @@ -13,6 +7,7 @@ #include "cpuz80.h" #include "memz80.h" #include "gensound.h" +#include "gensoundi.h" #include "ui.h" /*** forward references ***/ @@ -36,12 +31,11 @@ void memz80_store_psg_byte(uint32 addr, /*** memory map ***/ t_memz80_def memz80_def[] = { - { 0x00, 0x20, memz80_fetch_sram_byte, memz80_store_sram_byte }, - { 0x20, 0x40, memz80_fetch_bad_byte, memz80_store_bad_byte }, + { 0x00, 0x40, memz80_fetch_sram_byte, memz80_store_sram_byte }, { 0x40, 0x41, memz80_fetch_yam_byte, memz80_store_yam_byte }, { 0x41, 0x60, memz80_fetch_bad_byte, memz80_store_bad_byte }, - { 0x60, 0x61, memz80_fetch_bank_byte, memz80_store_bank_byte }, - { 0x61, 0x7F, memz80_fetch_bad_byte, memz80_store_bad_byte }, + { 0x60, 0x70, memz80_fetch_bank_byte, memz80_store_bank_byte }, + { 0x70, 0x7F, memz80_fetch_bad_byte, memz80_store_bad_byte }, { 0x7F, 0x80, memz80_fetch_psg_byte, memz80_store_psg_byte }, { 0x80, 0x100, memz80_fetch_mem_byte, memz80_store_mem_byte }, { 0, 0, NULL, NULL } @@ -84,12 +78,12 @@ void memz80_store_bad_byte(uint32 addr, uint8 memz80_fetch_sram_byte(uint32 addr) { - return (*(uint8 *)(cpuz80_ram+addr)); + return (*(uint8 *)(cpuz80_ram+(addr & 0x1fff))); } void memz80_store_sram_byte(uint32 addr, uint8 data) { - *(uint8 *)(cpuz80_ram+addr) = data; + *(uint8 *)(cpuz80_ram+(addr & 0x1fff)) = data; return; } @@ -99,7 +93,7 @@ uint8 memz80_fetch_yam_byte(uint32 addr) { addr-= 0x4000; if (addr < 4) { - return sound_ym2612fetch(addr); + return soundi_ym2612fetch(addr); } else { LOG_CRITICAL(("[Z80] invalid YAM fetch (byte) 0x%X", addr)); return 0; @@ -111,7 +105,7 @@ void memz80_store_yam_byte(uint32 addr, addr-= 0x4000; /* LOG_USER(("[YAM] (z80) store (byte) 0x%X (%d)", addr, data)); */ if (addr < 4) - sound_ym2612store(addr, data); + soundi_ym2612store(addr, data); else LOG_CRITICAL(("[Z80] invalid YAM store (byte) 0x%X", addr)); }