From a08ee7dc825192d933d836514252e09bbcf313dc Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 4 Jan 2004 23:28:26 +0000 Subject: Devel snapshot - still doesn't work --- src/spec.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 290 insertions(+), 25 deletions(-) (limited to 'src/spec.c') diff --git a/src/spec.c b/src/spec.c index a8cb9eb..6ace002 100644 --- a/src/spec.c +++ b/src/spec.c @@ -20,7 +20,7 @@ ------------------------------------------------------------------------- - Provides the emulation for the SPEC + Provides the emulation for the Spectrum */ static const char ident[]="$Id$"; @@ -51,6 +51,9 @@ static const int ROMLEN=0x4000; static const int ROM_SAVE=0x4c6; static const int ROM_LOAD=0x562; +#define LOAD_PATCH 0xf0 +#define SAVE_PATCH 0xf1 + /* The SPEC screen */ #define GFX_W 320 @@ -95,6 +98,8 @@ static int border=0; #define NVAL 235 /* Normal RGB intensity */ #define BVAL 255 /* Bright RGB intensity */ +static Z80Byte *line[SCRL]; /* Accelerators to screen data */ + static struct { Uint32 col; @@ -197,6 +202,40 @@ static const MatrixMap keymap[]= }; +/* ---------------------------------------- DEBUG FUNCTIONS +static const char *FlagString(Z80Byte flag) +{ + static char s[]="76543210"; + static char c[]="SZ5H3PNC"; + int f; + + for(f=0;f<8;f++) + if (flag&(1<<(7-f))) + s[f]=c[f]; + else + s[f]='-'; + + return s; +} + + +static void DumpZ80(Z80 *z80) +{ + Z80State s; + + Z80GetState(z80,&s); + + printf("---------------------------------\n"); + printf("PC=%4.4x A=%2.2x F=%s\n",s.PC,s.AF>>8,FlagString(s.AF&0xff)); + printf("BC=%4.4x DE=%4.4x HL=%4.4x\n",s.BC,s.DE,s.HL); + printf("IX=%4.4x IY=%4.4x SP=%4.4x\n",s.IX,s.IY,s.SP); + printf("I=%2.2x IM=%2.2x R=%2.2x\n",s.I,s.IM,s.R); + printf("IFF1=%2.2x IFF2=%2.2x\n",s.IFF1,s.IFF2); + printf("%s\n",Z80Disassemble(z80,&s.PC)); +} +*/ + + /* ---------------------------------------- PRIVATE FUNCTIONS */ void DrawScanline(int y) @@ -216,7 +255,7 @@ void DrawScanline(int y) { GFXLock(); - scr=mem+SCRDATA+aline*TXT_W; + scr=line[aline]; for(f=0;f=0;r--) - if (b&(1<