From 3e2e62d3966f4620674e51a424c7c2e734e05235 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 6 Sep 2006 23:35:58 +0000 Subject: Updated to use a function-based memory interface. --- gemma.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gemma.c') diff --git a/gemma.c b/gemma.c index fbf72fc..1074860 100644 --- a/gemma.c +++ b/gemma.c @@ -42,7 +42,6 @@ static const char id[]="$Id$"; */ static Z80 *z80; static Z80Byte mem[0x10000]; -static int memctl[256]; static sig_atomic_t stop=FALSE; @@ -413,6 +412,16 @@ static void DisplayState(DString s, const char *label, /* ---------------------------------------- MEMORY */ +static Z80Byte Peek(Z80 *z80, Z80Word addr) +{ + return mem[addr]; +} + +static void Poke(Z80 *z80, Z80Word addr, Z80Byte b) +{ + mem[addr]=b; +} + static Z80Byte ReadPort(Z80 *z80, Z80Word addr) { Z80Byte b=0xff; @@ -970,11 +979,7 @@ void GEMMA_Stop(void) void GEMMA_Init(GtkWidget *top) { - int f; - - for(f=0;f<256;f++) memctl[f]=1; - - z80=Z80Init(mem,memctl,WritePort,ReadPort); + z80=Z80Init(Peek,Poke,ReadPort,WritePort,Peek); Z80SetPC(z80,0x100); if (!z80) -- cgit v1.2.3