diff options
-rw-r--r-- | src/Makefile | 132 | ||||
-rw-r--r-- | src/gfx.c | 2 | ||||
-rw-r--r-- | src/main.c | 16 | ||||
-rw-r--r-- | src/memmenu.c | 56 | ||||
-rw-r--r-- | src/spec.c | 315 | ||||
-rw-r--r-- | src/spec.h | 15 |
6 files changed, 358 insertions, 178 deletions
diff --git a/src/Makefile b/src/Makefile index 347c5d0..179602c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.2 2003-12-24 18:19:00 ianc Exp $ +# $Id: Makefile,v 1.3 2004-01-04 23:28:26 ianc Exp $ # @@ -69,133 +69,3 @@ depend: cd z80; make depend ; cd .. # DO NOT DELETE THIS LINE -- make depend depends on it - -main.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -main.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -main.o: /usr/include/stdio.h /usr/local/include/SDL/SDL.h -main.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h -main.o: /usr/local/include/SDL/SDL_getenv.h -main.o: /usr/local/include/SDL/SDL_error.h -main.o: /usr/local/include/SDL/begin_code.h -main.o: /usr/local/include/SDL/close_code.h -main.o: /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h -main.o: /usr/local/include/SDL/SDL_audio.h -main.o: /usr/local/include/SDL/SDL_byteorder.h -main.o: /usr/local/include/SDL/SDL_cdrom.h -main.o: /usr/local/include/SDL/SDL_joystick.h -main.o: /usr/local/include/SDL/SDL_events.h -main.o: /usr/local/include/SDL/SDL_active.h -main.o: /usr/local/include/SDL/SDL_keyboard.h -main.o: /usr/local/include/SDL/SDL_keysym.h -main.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h -main.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h -main.o: /usr/local/include/SDL/SDL_version.h z80/z80.h spec.h gfx.h gui.h -main.o: memmenu.h config.h exit.h -spec.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -spec.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -spec.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h -spec.o: spec.h z80/z80.h /usr/local/include/SDL/SDL.h -spec.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h -spec.o: /usr/local/include/SDL/SDL_getenv.h -spec.o: /usr/local/include/SDL/SDL_error.h -spec.o: /usr/local/include/SDL/begin_code.h -spec.o: /usr/local/include/SDL/close_code.h -spec.o: /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h -spec.o: /usr/local/include/SDL/SDL_audio.h -spec.o: /usr/local/include/SDL/SDL_byteorder.h -spec.o: /usr/local/include/SDL/SDL_cdrom.h -spec.o: /usr/local/include/SDL/SDL_joystick.h -spec.o: /usr/local/include/SDL/SDL_events.h -spec.o: /usr/local/include/SDL/SDL_active.h -spec.o: /usr/local/include/SDL/SDL_keyboard.h -spec.o: /usr/local/include/SDL/SDL_keysym.h -spec.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h -spec.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h -spec.o: /usr/local/include/SDL/SDL_version.h gfx.h gui.h config.h exit.h -config.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -config.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -config.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h -config.o: exit.h config.h -gfx.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gfx.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -gfx.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h -gfx.o: /usr/include/stdarg.h gfx.h /usr/local/include/SDL/SDL.h -gfx.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h -gfx.o: /usr/local/include/SDL/SDL_getenv.h /usr/local/include/SDL/SDL_error.h -gfx.o: /usr/local/include/SDL/begin_code.h -gfx.o: /usr/local/include/SDL/close_code.h /usr/local/include/SDL/SDL_rwops.h -gfx.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h -gfx.o: /usr/local/include/SDL/SDL_byteorder.h -gfx.o: /usr/local/include/SDL/SDL_cdrom.h -gfx.o: /usr/local/include/SDL/SDL_joystick.h -gfx.o: /usr/local/include/SDL/SDL_events.h -gfx.o: /usr/local/include/SDL/SDL_active.h -gfx.o: /usr/local/include/SDL/SDL_keyboard.h -gfx.o: /usr/local/include/SDL/SDL_keysym.h /usr/local/include/SDL/SDL_mouse.h -gfx.o: /usr/local/include/SDL/SDL_video.h /usr/local/include/SDL/SDL_mutex.h -gfx.o: /usr/local/include/SDL/SDL_quit.h /usr/local/include/SDL/SDL_version.h -gfx.o: exit.h config.h font.h -gui.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gui.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -gui.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h -gui.o: /usr/include/stdarg.h /usr/include/ctype.h /usr/include/runetype.h -gui.o: gui.h /usr/local/include/SDL/SDL.h /usr/local/include/SDL/SDL_main.h -gui.o: /usr/local/include/SDL/SDL_types.h /usr/local/include/SDL/SDL_getenv.h -gui.o: /usr/local/include/SDL/SDL_error.h /usr/local/include/SDL/begin_code.h -gui.o: /usr/local/include/SDL/close_code.h /usr/local/include/SDL/SDL_rwops.h -gui.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h -gui.o: /usr/local/include/SDL/SDL_byteorder.h -gui.o: /usr/local/include/SDL/SDL_cdrom.h -gui.o: /usr/local/include/SDL/SDL_joystick.h -gui.o: /usr/local/include/SDL/SDL_events.h -gui.o: /usr/local/include/SDL/SDL_active.h -gui.o: /usr/local/include/SDL/SDL_keyboard.h -gui.o: /usr/local/include/SDL/SDL_keysym.h /usr/local/include/SDL/SDL_mouse.h -gui.o: /usr/local/include/SDL/SDL_video.h /usr/local/include/SDL/SDL_mutex.h -gui.o: /usr/local/include/SDL/SDL_quit.h /usr/local/include/SDL/SDL_version.h -gui.o: gfx.h exit.h -memmenu.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -memmenu.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -memmenu.o: /usr/include/string.h /usr/include/strings.h memmenu.h z80/z80.h -memmenu.o: spec.h /usr/local/include/SDL/SDL.h -memmenu.o: /usr/local/include/SDL/SDL_main.h -memmenu.o: /usr/local/include/SDL/SDL_types.h -memmenu.o: /usr/local/include/SDL/SDL_getenv.h -memmenu.o: /usr/local/include/SDL/SDL_error.h -memmenu.o: /usr/local/include/SDL/begin_code.h -memmenu.o: /usr/local/include/SDL/close_code.h -memmenu.o: /usr/local/include/SDL/SDL_rwops.h /usr/include/stdio.h -memmenu.o: /usr/local/include/SDL/SDL_timer.h -memmenu.o: /usr/local/include/SDL/SDL_audio.h -memmenu.o: /usr/local/include/SDL/SDL_byteorder.h -memmenu.o: /usr/local/include/SDL/SDL_cdrom.h -memmenu.o: /usr/local/include/SDL/SDL_joystick.h -memmenu.o: /usr/local/include/SDL/SDL_events.h -memmenu.o: /usr/local/include/SDL/SDL_active.h -memmenu.o: /usr/local/include/SDL/SDL_keyboard.h -memmenu.o: /usr/local/include/SDL/SDL_keysym.h -memmenu.o: /usr/local/include/SDL/SDL_mouse.h -memmenu.o: /usr/local/include/SDL/SDL_video.h -memmenu.o: /usr/local/include/SDL/SDL_mutex.h -memmenu.o: /usr/local/include/SDL/SDL_quit.h -memmenu.o: /usr/local/include/SDL/SDL_version.h gfx.h gui.h -exit.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -exit.o: /usr/include/sys/_types.h /usr/include/machine/_types.h -exit.o: /usr/include/stdarg.h exit.h /usr/local/include/SDL/SDL.h -exit.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h -exit.o: /usr/local/include/SDL/SDL_getenv.h -exit.o: /usr/local/include/SDL/SDL_error.h -exit.o: /usr/local/include/SDL/begin_code.h -exit.o: /usr/local/include/SDL/close_code.h -exit.o: /usr/local/include/SDL/SDL_rwops.h /usr/include/stdio.h -exit.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h -exit.o: /usr/local/include/SDL/SDL_byteorder.h -exit.o: /usr/local/include/SDL/SDL_cdrom.h -exit.o: /usr/local/include/SDL/SDL_joystick.h -exit.o: /usr/local/include/SDL/SDL_events.h -exit.o: /usr/local/include/SDL/SDL_active.h -exit.o: /usr/local/include/SDL/SDL_keyboard.h -exit.o: /usr/local/include/SDL/SDL_keysym.h -exit.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h -exit.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h -exit.o: /usr/local/include/SDL/SDL_version.h @@ -190,6 +190,8 @@ void GFXInit(void) SDL_ShowCursor(SDL_DISABLE); SDL_WM_SetCaption("eSPEC","eSPEC"); + + atexit(SDL_Quit); } @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) SPECWritePort, SPECReadPort, SPECReadForDisassem, - NULL); + SPECGetLabel); GFXInit(); @@ -95,13 +95,11 @@ int main(int argc, char *argv[]) Z80GetState(z80,&s1); Z80SingleStep(z80); - Z80GetState(z80,&s2); - if (s2.PC>0x3fff) + if (s2.PC==0) { - printf("PC > 0x3fff - from 0x%4.4x\n",s1.PC); - return 0; + printf("PC zero - prev %4.4x\n",s1.PC); } if (trace) @@ -115,17 +113,17 @@ int main(int argc, char *argv[]) switch (e->key.keysym.sym) { case SDLK_ESCAPE: - if (e->key.state==SDL_RELEASED) + if (e->key.state==SDL_PRESSED) quit=TRUE; break; case SDLK_F11: - if (e->key.state==SDL_RELEASED) + if (e->key.state==SDL_PRESSED) MemoryMenu(z80); break; case SDLK_F12: - if (e->key.state==SDL_RELEASED) + if (e->key.state==SDL_PRESSED) trace=!trace; break; @@ -136,8 +134,6 @@ int main(int argc, char *argv[]) } } - SDL_Quit(); - return EXIT_SUCCESS; } diff --git a/src/memmenu.c b/src/memmenu.c index 516bd36..9e1726b 100644 --- a/src/memmenu.c +++ b/src/memmenu.c @@ -26,6 +26,7 @@ static const char ident[]="$Id$"; #include <stdlib.h> +#include <stdio.h> #include <string.h> #include <ctype.h> @@ -66,7 +67,8 @@ static void DisplayMenu(void) static const char *menu[]= { "1. Disassemble/Hex dump", - "2. Return ", + "2. Disassemble to file ", + "3. Return ", NULL }; @@ -145,12 +147,12 @@ static Z80Word Address(Z80 *z80, const char *p) } -static int EnterAddress(Z80 *z80, Z80Word *w) +static int EnterAddress(const char *prompt, Z80 *z80, Z80Word *w) { unsigned long ul; const char *p; - p=GUIInputString("Address?",""); + p=GUIInputString(prompt ? prompt : "Address?",""); if (*p) { @@ -254,7 +256,7 @@ static void DoDisassem(Z80 *z80, const Z80State *s) case SDLK_RETURN: case SDLK_KP_ENTER: - EnterAddress(z80,&pc); + EnterAddress(NULL,z80,&pc); break; case SDLK_UP: @@ -294,6 +296,46 @@ static void DoDisassem(Z80 *z80, const Z80State *s) } +static void DoDisassemFile(Z80 *z80, const Z80State *s) +{ + static char fname[FILENAME_MAX]=""; + FILE *fp; + Z80Word start; + Z80Word len; + Z80Word prev; + const char *p; + + EnterAddress("Disassemble from?",z80,&start); + EnterAddress("For how many bytes?",z80,&len); + + p=GUIInputString("To file?",fname); + + if (!strlen(p)) + return; + + strcpy(fname,p); + + if (!(fp=fopen(fname,"w"))) + { + GUIMessage("ERROR","Couldn't create file:\n%s",fname); + return; + } + + prev=len; + + while(len<=prev) + { + Z80Word orig=start; + + fprintf(fp,"%4.4x: %s\n",orig,Z80Disassemble(z80,&start)); + prev=len; + len-=(start-orig); + } + + fclose(fp); +} + + /* ---------------------------------------- EXPORTED INTERFACES */ void MemoryMenu(Z80 *z80) @@ -320,8 +362,12 @@ void MemoryMenu(Z80 *z80) DoDisassem(z80,&s); break; - case SDLK_ESCAPE: case SDLK_2: + DoDisassemFile(z80,&s); + break; + + case SDLK_ESCAPE: + case SDLK_3: quit=TRUE; break; @@ -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<TXT_W;f++) { @@ -238,8 +277,8 @@ void DrawScanline(int y) paper=t; } - for(r=7,b=*scr++;r>=0;r--) - if (b&(1<<r)) + for(r=0,b=*scr++;r<8;r++) + if (b&(1<<(8-r))) GFXFastPlot(f*8+r+OFF_X,y,coltable[ink].col); else GFXFastPlot(f*8+r+OFF_X,y,coltable[paper].col); @@ -254,7 +293,7 @@ static void RomPatch(void) { static const Z80Byte save[]= { - 0xed, 0xf0, /* ED F0 illegal op */ + 0xed, SAVE_PATCH, /* ED illegal op */ 0xc9, /* RET */ 0xff /* End of patch */ }; @@ -262,7 +301,7 @@ static void RomPatch(void) static const Z80Byte load[]= { 0x08, /* EX AF,AF' */ - 0xed, 0xf1, /* ED F1 illegal op */ + 0xed, LOAD_PATCH, /* ED illegal op */ 0xc9, /* RET */ 0xff /* End of patch */ }; @@ -298,11 +337,13 @@ static int EDCallback(Z80 *z80, Z80Val data) switch((Z80Byte)data) { - case 0xf0: + case SAVE_PATCH: + puts("Called tape save"); SaveTape(&state); break; - case 0xf1: + case LOAD_PATCH: + puts("Called tape load"); LoadTape(&state); break; @@ -347,7 +388,6 @@ static int CheckTimers(Z80 *z80, Z80Val val) } /* Draw scanline - y=OFF_X-TOPL+scanline; */ y=scanline-TOPL+OFF_Y; @@ -366,7 +406,9 @@ static int CheckTimers(Z80 *z80, Z80Val val) void SPECInit(Z80 *z80) { FILE *fp; - Z80Word f; + int f; + int c; + int r; if (!(fp=fopen(SConfig(CONF_ROMFILE),"rb"))) { @@ -402,6 +444,25 @@ void SPECInit(Z80 *z80) flash=0; flashctr=0; + /* Set up screen + */ + c=0; + r=0; + for(f=0;f<SCRL;f++) + { + line[f]=mem+SCRDATA+(c*8*TXT_W)+(r*TXT_W); + + c++; + + if ((c%8)==0) + { + if (++r==8) + r=0; + else + c-=8; + } + } + GFXStartFrame(); } @@ -469,23 +530,24 @@ Z80Byte SPECReadPort(Z80 *z80, Z80Word port) case 0xfb: /* TODO: ZX Printer */ break; - case 0x01: /* ULA */ - /* Key matrix - */ - b=0; - - for(f=0;f<8;f++) - if (!(hi&(1<<f))) - b&=matrix[f]; - - b|=0xa0; + default: /* ULA */ + if (!(lo&1)) + { + border=(border+1)%16; /* TODO: Remove debug code */ + /* Key matrix + */ + b=0xff; - /* TODO: Emulation of contention */ + for(f=0;f<8;f++) + if (!(hi&(1<<f))) + b&=matrix[f]; - break; + b|=0xa0; - default: - b=0xff; + /* TODO: Emulation of contention? */ + } + else + b=0xff; break; } @@ -499,10 +561,13 @@ void SPECWritePort(Z80 *z80, Z80Word port, Z80Byte val) switch(lo) { - case 0x01: /* ULA */ + case 0xfe: /* ULA */ border=val&0x07; break; + case 0xfb: /* TODO: ZX Printer */ + break; + default: break; } @@ -515,6 +580,206 @@ Z80Byte SPECReadForDisassem(Z80 *z80, Z80Word addr) } +const char *SPECGetLabel(Z80 *z80, Z80Word addr) +{ + static const struct + { + Z80Word addr; + const char *txt; + } label[]= + { + {0x5c00, "KSTATE"}, + {0x5c01, "KSTATE+1"}, + {0x5c02, "KSTATE+2"}, + {0x5c03, "KSTATE+3"}, + {0x5c04, "KSTATE+4"}, + {0x5c05, "KSTATE+5"}, + {0x5c06, "KSTATE+6"}, + {0x5c07, "KSTATE+7"}, + {0x5c08, "LAST_K"}, + {0x5c09, "REPDEL"}, + {0x5c0a, "REPPER"}, + {0x5c0b, "DEFADD"}, + {0x5c0c, "DEFADD+1"}, + {0x5c0d, "K_DATA"}, + {0x5c0e, "TVDATA"}, + {0x5c0f, "TVDATA+1"}, + {0x5c10, "STRMS"}, + {0x5c11, "STRMS+1"}, + {0x5c12, "STRMS+2"}, + {0x5c13, "STRMS+3"}, + {0x5c14, "STRMS+4"}, + {0x5c15, "STRMS+5"}, + {0x5c16, "STRMS+6"}, + {0x5c17, "STRMS+7"}, + {0x5c18, "STRMS+8"}, + {0x5c19, "STRMS+9"}, + {0x5c1a, "STRMS+10"}, + {0x5c1b, "STRMS+11"}, + {0x5c1c, "STRMS+12"}, + {0x5c1d, "STRMS+13"}, + {0x5c1e, "STRMS+14"}, + {0x5c1f, "STRMS+15"}, + {0x5c20, "STRMS+16"}, + {0x5c21, "STRMS+17"}, + {0x5c22, "STRMS+18"}, + {0x5c23, "STRMS+19"}, + {0x5c24, "STRMS+20"}, + {0x5c25, "STRMS+21"}, + {0x5c26, "STRMS+22"}, + {0x5c27, "STRMS+23"}, + {0x5c28, "STRMS+24"}, + {0x5c29, "STRMS+25"}, + {0x5c2a, "STRMS+26"}, + {0x5c2b, "STRMS+27"}, + {0x5c2c, "STRMS+28"}, + {0x5c2d, "STRMS+29"}, + {0x5c2e, "STRMS+30"}, + {0x5c2f, "STRMS+31"}, + {0x5c30, "STRMS+32"}, + {0x5c31, "STRMS+33"}, + {0x5c32, "STRMS+34"}, + {0x5c33, "STRMS+35"}, + {0x5c34, "STRMS+36"}, + {0x5c35, "STRMS+37"}, + {0x5c36, "CHARS"}, + {0x5c37, "CHARS+1"}, + {0x5c38, "RASP"}, + {0x5c39, "PIP"}, + {0x5c3a, "ERR_NR"}, + {0x5c3b, "FLAGS"}, + {0x5c3c, "TV_FLAG"}, + {0x5c3d, "ERR_SP"}, + {0x5c3e, "ERR_SP+1"}, + {0x5c3f, "LIST_SP"}, + {0x5c40, "LIST_SP+1"}, + {0x5c41, "MODE"}, + {0x5c42, "NEWPPC"}, + {0x5c43, "NEWPPC+1"}, + {0x5c44, "NSPPC"}, + {0x5c45, "PPC"}, + {0x5c46, "PPC+1"}, + {0x5c47, "SUBPPC"}, + {0x5c48, "BORDCR"}, + {0x5c49, "E_PPC"}, + {0x5c4a, "E_PPC+1"}, + {0x5c4b, "VARS"}, + {0x5c4c, "VARS+1"}, + {0x5c4d, "DEST"}, + {0x5c4e, "DEST+1"}, + {0x5c4f, "CHANS"}, + {0x5c50, "CHANS+1"}, + {0x5c51, "CURCHL"}, + {0x5c52, "CURCHL+1"}, + {0x5c53, "PROG"}, + {0x5c54, "PROG+1"}, + {0x5c55, "NXTLIN"}, + {0x5c56, "NXTLIN+1"}, + {0x5c57, "DATADD"}, + {0x5c58, "DATADD+1"}, + {0x5c59, "E_LINE"}, + {0x5c5a, "E_LINE+1"}, + {0x5c5b, "K_CUR"}, + {0x5c5c, "K_CUR+1"}, + {0x5c5d, "CH_ADD"}, + {0x5c5e, "CH_ADD+1"}, + {0x5c5f, "X_PTR"}, + {0x5c60, "X_PTR+1"}, + {0x5c61, "WORKSP"}, + {0x5c62, "WORKSP+1"}, + {0x5c63, "STKBOT"}, + {0x5c64, "STKBOT+1"}, + {0x5c65, "STKEND"}, + {0x5c66, "STKEND+1"}, + {0x5c67, "BREG"}, + {0x5c68, "MEM"}, + {0x5c69, "MEM+1"}, + {0x5c6a, "FLAGS2"}, + {0x5c6b, "DF_SZ"}, + {0x5c6c, "S_TOP"}, + {0x5c6d, "S_TOP+1"}, + {0x5c6e, "OLDPPC"}, + {0x5c6f, "OLDPPC+1"}, + {0x5c70, "OSPCC"}, + {0x5c71, "FLAGX"}, + {0x5c72, "STRLEN"}, + {0x5c73, "STRLEN+1"}, + {0x5c74, "T_ADDR"}, + {0x5c75, "T_ADDR+1"}, + {0x5c76, "SEED"}, + {0x5c77, "SEED+1"}, + {0x5c78, "FRAMES"}, + {0x5c79, "FRAMES+1"}, + {0x5c7a, "FRAMES+2"}, + {0x5c7b, "UDG"}, + {0x5c7c, "UDG+1"}, + {0x5c7d, "COORDS_X"}, + {0x5c7e, "COORDS_Y"}, + {0x5c7f, "P_POSN"}, + {0x5c80, "PR_CC"}, + {0x5c82, "ECHO_E"}, + {0x5c83, "ECHO_E+1"}, + {0x5c84, "DF_CC"}, + {0x5c85, "DF_CC+1"}, + {0x5c86, "DFCCL"}, + {0x5c87, "DFCCL+1"}, + {0x5c88, "S_POSN_X"}, + {0x5c89, "S_POSN_Y"}, + {0x5c8a, "S_POSNL_X"}, + {0x5c8b, "S_POSNL_Y"}, + {0x5c8c, "SCR_CT"}, + {0x5c8d, "ATTR_P"}, + {0x5c8e, "MASK_P"}, + {0x5c8f, "ATTR_T"}, + {0x5c90, "MASK_T"}, + {0x5c91, "P_FLAG"}, + {0x5c92, "MEMBOT"}, + {0x5c93, "MEMBOT+1"}, + {0x5c94, "MEMBOT+2"}, + {0x5c95, "MEMBOT+3"}, + {0x5c96, "MEMBOT+4"}, + {0x5c97, "MEMBOT+5"}, + {0x5c98, "MEMBOT+6"}, + {0x5c99, "MEMBOT+7"}, + {0x5c9a, "MEMBOT+8"}, + {0x5c9b, "MEMBOT+9"}, + {0x5c9c, "MEMBOT+10"}, + {0x5c9d, "MEMBOT+11"}, + {0x5c9e, "MEMBOT+12"}, + {0x5c9f, "MEMBOT+13"}, + {0x5ca0, "MEMBOT+14"}, + {0x5ca1, "MEMBOT+15"}, + {0x5ca2, "MEMBOT+16"}, + {0x5ca3, "MEMBOT+17"}, + {0x5ca4, "MEMBOT+18"}, + {0x5ca5, "MEMBOT+19"}, + {0x5ca6, "MEMBOT+20"}, + {0x5ca7, "MEMBOT+21"}, + {0x5ca8, "MEMBOT+22"}, + {0x5ca9, "MEMBOT+23"}, + {0x5caa, "MEMBOT+24"}, + {0x5cab, "MEMBOT+25"}, + {0x5cac, "MEMBOT+26"}, + {0x5cad, "MEMBOT+27"}, + {0x5cae, "MEMBOT+28"}, + {0x5caf, "MEMBOT+29"}, + {0x5cb2, "RAMTOP"}, + {0x5cb3, "RAMTOP+1"}, + {0x5cb4, "P_RAMT"}, + {0x5cb5, "P_RAMT+1"}, + {0, NULL} + }; + + int f; + + for(f=0;label[f].txt;f++) + if (addr==label[f].addr) + return label[f].txt; + + return NULL; +} + + const char *SPECInfo(Z80 *z80) { static char buff[80]={0}; @@ -33,19 +33,20 @@ /* Initialise the SPEC */ -void SPECInit(Z80 *z80); +void SPECInit(Z80 *z80); /* Handle keypresses */ -void SPECKeyEvent(SDL_Event *e); +void SPECKeyEvent(SDL_Event *e); /* Interfaces for the Z80 */ -Z80Byte SPECReadMem(Z80 *z80, Z80Word addr); -void SPECWriteMem(Z80 *z80, Z80Word addr, Z80Byte val); -Z80Byte SPECReadPort(Z80 *z80, Z80Word port); -void SPECWritePort(Z80 *z80, Z80Word port, Z80Byte val); -Z80Byte SPECReadForDisassem(Z80 *z80, Z80Word addr); +Z80Byte SPECReadMem(Z80 *z80, Z80Word addr); +void SPECWriteMem(Z80 *z80, Z80Word addr, Z80Byte val); +Z80Byte SPECReadPort(Z80 *z80, Z80Word port); +void SPECWritePort(Z80 *z80, Z80Word port, Z80Byte val); +Z80Byte SPECReadForDisassem(Z80 *z80, Z80Word addr); +const char *SPECGetLabel(Z80 *z80, Z80Word addr); /* Interfaces for memory menu */ |