From 0099ea03c53e20968cc0490a48bd606597044e07 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 29 Sep 2007 11:08:46 +0000 Subject: Support for array-based memory --- arm9/include/z80.h | 5 +++-- arm9/include/z80_config.h | 4 ++-- arm9/source/main.c | 5 +++++ arm9/source/z80_decode.c | 30 ------------------------------ 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/arm9/include/z80.h b/arm9/include/z80.h index e6bdfd9..8ee5dad 100644 --- a/arm9/include/z80.h +++ b/arm9/include/z80.h @@ -65,8 +65,9 @@ typedef union Z80Byte b[2]; } Z80Reg; -extern int Z80_HI_WORD; -extern int Z80_LO_WORD; +#define Z80_LO_WORD 0 +#define Z80_HI_WORD 1 + /* The processor diff --git a/arm9/include/z80_config.h b/arm9/include/z80_config.h index 7e02bb8..307098e 100644 --- a/arm9/include/z80_config.h +++ b/arm9/include/z80_config.h @@ -45,11 +45,11 @@ In this mode the signature of Z80Init changes so that the memory functions are not passed. ALL processor instances share the same memory. -#define ENABLE_ARRAY_MEMORY */ +#define ENABLE_ARRAY_MEMORY #ifdef ENABLE_ARRAY_MEMORY -#define RAMBOT 0x0000 +#define RAMBOT 0x4000 #define RAMTOP 0xffff #endif diff --git a/arm9/source/main.c b/arm9/source/main.c index 235098b..6c8fbbc 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -335,11 +335,16 @@ int main(int argc, char *argv[]) */ keysSetRepeat(30,15); +#ifdef ENABLE_ARRAY_MEMORY + z80 = Z80Init(SPECReadPort, + SPECWritePort); +#else z80 = Z80Init(SPECPeek, SPECPoke, SPECReadPort, SPECWritePort, SPECDisPeek); +#endif if (!z80) { diff --git a/arm9/source/z80_decode.c b/arm9/source/z80_decode.c index 4a24bd4..82912b8 100644 --- a/arm9/source/z80_decode.c +++ b/arm9/source/z80_decode.c @@ -40,9 +40,6 @@ static Z80Byte Stable[512]; static Z80Byte Ztable[512]; -int Z80_HI_WORD; -int Z80_LO_WORD; - #define HI Z80_HI_WORD #define LO Z80_LO_WORD @@ -51,33 +48,6 @@ int Z80_LO_WORD; void Z80_InitialiseInternals(void) { Z80Word f; - Z80Reg r; - - /* Check endianness - */ - r.w=0x1234; - - if (r.b[0] == 0x12) - { - HI=0; - LO=1; - } - else if (r.b[1] == 0x12) - { - HI=1; - LO=0; - } - else - { - exit(1); - } - - /* Check variable sizes - */ - if (CHAR_BIT!=8 || sizeof(Z80Word)!=2) - { - exit(2); - } /* Initialise flag tables */ -- cgit v1.2.3