summaryrefslogtreecommitdiff
path: root/gemma.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-09-06 23:35:58 +0000
committerIan C <ianc@noddybox.co.uk>2006-09-06 23:35:58 +0000
commit3e2e62d3966f4620674e51a424c7c2e734e05235 (patch)
treed32da044922666a28cf5b587b1493324b7c14525 /gemma.c
parent3261fd65167abc52aefa288ac71a1dc14b82ad16 (diff)
Updated to use a function-based memory interface.
Diffstat (limited to 'gemma.c')
-rw-r--r--gemma.c17
1 files changed, 11 insertions, 6 deletions
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)