diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 118 | ||||
-rw-r--r-- | src/main.c | 12 | ||||
-rw-r--r-- | src/memmenu.c | 164 | ||||
-rw-r--r-- | src/snap.c | 5 | ||||
-rw-r--r-- | src/spec.c | 103 | ||||
-rw-r--r-- | src/spec.h | 13 |
6 files changed, 272 insertions, 143 deletions
diff --git a/src/Makefile b/src/Makefile index a0c3354..4dfec79 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.11 2004-08-27 23:55:16 ianc Exp $ +# $Id: Makefile,v 1.12 2006-09-11 00:35:48 ianc Exp $ # @@ -31,8 +31,6 @@ CFLAGS = -g -Wall -Werror -pedantic -ansi -O2 TARGET = espec -Z80LIB = z80/z80.a - SOURCE = main.c \ spec.c \ snap.c \ @@ -42,7 +40,11 @@ SOURCE = main.c \ memmenu.c \ util.c \ kbbmp.c \ - exit.c + exit.c \ + expr.c \ + z80.c \ + z80_decode.c \ + z80_dis.c OBJECTS = main.o \ spec.o \ @@ -53,34 +55,33 @@ OBJECTS = main.o \ memmenu.o \ util.o \ kbbmp.o \ - exit.o + exit.o \ + expr.o \ + z80.o \ + z80_decode.o \ + z80_dis.o -CFLAGS += -Iz80 `sdl-config --cflags` +CFLAGS += `sdl-config --cflags` -DENABLE_DISASSEM -LIBS = $(Z80LIB) `sdl-config --libs` -#LIBS = $(Z80LIB) `sdl-config --static-libs` -lncurses -lX11 +LIBS = `sdl-config --libs` -$(TARGET): $(OBJECTS) $(Z80LIB) +$(TARGET): $(OBJECTS) $(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) -$(Z80LIB): z80/*.[ch] - cd z80; make "EXTERNAL_CFLAGS=`sdl-config --cflags`" ; cd .. - clean: rm -f $(TARGET) $(TARGET).exe $(OBJECTS) core - cd z80; make clean; cd .. depend: makedepend -- $(CFLAGS) -- $(SOURCE) if test -e Makefile ; then rm -f Makefile.bak ; fi - 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/machine/ansi.h /usr/include/stdio.h -main.o: /usr/include/string.h /usr/local/include/SDL11/SDL.h -main.o: /usr/local/include/SDL11/SDL_main.h +main.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +main.o: /usr/include/machine/_types.h /usr/include/stdio.h +main.o: /usr/include/string.h /usr/include/strings.h +main.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h main.o: /usr/local/include/SDL11/SDL_types.h main.o: /usr/local/include/SDL11/SDL_getenv.h main.o: /usr/local/include/SDL11/SDL_error.h @@ -100,12 +101,13 @@ main.o: /usr/local/include/SDL11/SDL_mouse.h main.o: /usr/local/include/SDL11/SDL_video.h main.o: /usr/local/include/SDL11/SDL_mutex.h main.o: /usr/local/include/SDL11/SDL_quit.h -main.o: /usr/local/include/SDL11/SDL_version.h z80/z80.h spec.h gfx.h gui.h +main.o: /usr/local/include/SDL11/SDL_version.h z80.h spec.h gfx.h gui.h main.o: memmenu.h config.h kbbmp.h exit.h util.h spec.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -spec.o: /usr/include/machine/ansi.h /usr/include/stdio.h -spec.o: /usr/include/string.h spec.h z80/z80.h /usr/local/include/SDL11/SDL.h -spec.o: /usr/local/include/SDL11/SDL_main.h +spec.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +spec.o: /usr/include/machine/_types.h /usr/include/stdio.h +spec.o: /usr/include/string.h /usr/include/strings.h spec.h z80.h +spec.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h spec.o: /usr/local/include/SDL11/SDL_types.h spec.o: /usr/local/include/SDL11/SDL_getenv.h spec.o: /usr/local/include/SDL11/SDL_error.h @@ -128,13 +130,17 @@ spec.o: /usr/local/include/SDL11/SDL_quit.h spec.o: /usr/local/include/SDL11/SDL_version.h snap.h gfx.h gui.h config.h spec.o: exit.h util.h snap.o: snap.h /usr/include/stdlib.h /usr/include/sys/cdefs.h -snap.o: /usr/include/machine/ansi.h /usr/include/stdio.h z80/z80.h util.h +snap.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +snap.o: /usr/include/machine/_types.h /usr/include/stdio.h z80.h util.h config.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -config.o: /usr/include/machine/ansi.h /usr/include/stdio.h -config.o: /usr/include/string.h exit.h config.h +config.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +config.o: /usr/include/machine/_types.h /usr/include/stdio.h +config.o: /usr/include/string.h /usr/include/strings.h exit.h config.h gfx.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gfx.o: /usr/include/machine/ansi.h /usr/include/stdio.h /usr/include/string.h -gfx.o: /usr/include/stdarg.h gfx.h /usr/local/include/SDL11/SDL.h +gfx.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +gfx.o: /usr/include/machine/_types.h /usr/include/stdio.h +gfx.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h +gfx.o: gfx.h /usr/local/include/SDL11/SDL.h gfx.o: /usr/local/include/SDL11/SDL_main.h gfx.o: /usr/local/include/SDL11/SDL_types.h gfx.o: /usr/local/include/SDL11/SDL_getenv.h @@ -157,10 +163,22 @@ gfx.o: /usr/local/include/SDL11/SDL_mutex.h gfx.o: /usr/local/include/SDL11/SDL_quit.h gfx.o: /usr/local/include/SDL11/SDL_version.h exit.h config.h font.h gui.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gui.o: /usr/include/machine/ansi.h /usr/include/stdio.h /usr/include/string.h -gui.o: /usr/include/stdarg.h /usr/include/ctype.h /usr/include/runetype.h -gui.o: gui.h gfx.h /usr/local/include/SDL11/SDL.h -gui.o: /usr/local/include/SDL11/SDL_main.h +gui.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +gui.o: /usr/include/machine/_types.h /usr/include/stdio.h +gui.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h +gui.o: /usr/include/ctype.h /usr/include/_ctype.h /usr/include/runetype.h +gui.o: /usr/include/unistd.h /usr/include/sys/types.h +gui.o: /usr/include/machine/endian.h /usr/include/sys/_pthreadtypes.h +gui.o: /usr/include/sys/select.h /usr/include/sys/_sigset.h +gui.o: /usr/include/sys/_timeval.h /usr/include/sys/timespec.h +gui.o: /usr/include/sys/unistd.h /usr/include/dirent.h +gui.o: /usr/include/sys/dirent.h /usr/include/sys/stat.h +gui.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/param.h +gui.o: /usr/include/sys/syslimits.h /usr/include/sys/signal.h +gui.o: /usr/include/machine/signal.h /usr/include/machine/trap.h +gui.o: /usr/include/machine/param.h /usr/include/sys/limits.h +gui.o: /usr/include/machine/_limits.h gui.h gfx.h +gui.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h gui.o: /usr/local/include/SDL11/SDL_types.h gui.o: /usr/local/include/SDL11/SDL_getenv.h gui.o: /usr/local/include/SDL11/SDL_error.h @@ -182,9 +200,11 @@ gui.o: /usr/local/include/SDL11/SDL_mutex.h gui.o: /usr/local/include/SDL11/SDL_quit.h gui.o: /usr/local/include/SDL11/SDL_version.h exit.h util.h memmenu.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -memmenu.o: /usr/include/machine/ansi.h /usr/include/stdio.h -memmenu.o: /usr/include/string.h /usr/include/ctype.h /usr/include/runetype.h -memmenu.o: memmenu.h z80/z80.h spec.h /usr/local/include/SDL11/SDL.h +memmenu.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +memmenu.o: /usr/include/machine/_types.h /usr/include/stdio.h +memmenu.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h +memmenu.o: /usr/include/_ctype.h /usr/include/runetype.h memmenu.h z80.h +memmenu.o: spec.h /usr/local/include/SDL11/SDL.h memmenu.o: /usr/local/include/SDL11/SDL_main.h memmenu.o: /usr/local/include/SDL11/SDL_types.h memmenu.o: /usr/local/include/SDL11/SDL_getenv.h @@ -207,11 +227,21 @@ memmenu.o: /usr/local/include/SDL11/SDL_mutex.h memmenu.o: /usr/local/include/SDL11/SDL_quit.h memmenu.o: /usr/local/include/SDL11/SDL_version.h gfx.h gui.h util.h util.o: /usr/include/stdio.h /usr/include/sys/cdefs.h -util.o: /usr/include/machine/ansi.h /usr/include/string.h -util.o: /usr/include/stdarg.h util.h /usr/include/stdlib.h exit.h +util.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +util.o: /usr/include/machine/_types.h /usr/include/string.h +util.o: /usr/include/strings.h /usr/include/stdarg.h /usr/include/sys/param.h +util.o: /usr/include/sys/types.h /usr/include/machine/endian.h +util.o: /usr/include/sys/_pthreadtypes.h /usr/include/sys/select.h +util.o: /usr/include/sys/_sigset.h /usr/include/sys/_timeval.h +util.o: /usr/include/sys/timespec.h /usr/include/sys/syslimits.h +util.o: /usr/include/sys/signal.h /usr/include/machine/signal.h +util.o: /usr/include/machine/trap.h /usr/include/machine/param.h +util.o: /usr/include/sys/limits.h /usr/include/machine/_limits.h util.h +util.o: /usr/include/stdlib.h exit.h kbbmp.o: kbbmp.h exit.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -exit.o: /usr/include/machine/ansi.h /usr/include/stdarg.h exit.h +exit.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +exit.o: /usr/include/machine/_types.h /usr/include/stdarg.h exit.h exit.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h exit.o: /usr/local/include/SDL11/SDL_types.h exit.o: /usr/local/include/SDL11/SDL_getenv.h @@ -233,3 +263,19 @@ exit.o: /usr/local/include/SDL11/SDL_video.h exit.o: /usr/local/include/SDL11/SDL_mutex.h exit.o: /usr/local/include/SDL11/SDL_quit.h exit.o: /usr/local/include/SDL11/SDL_version.h +expr.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +expr.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +expr.o: /usr/include/machine/_types.h /usr/include/stdio.h +expr.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h +expr.o: /usr/include/_ctype.h /usr/include/runetype.h +z80.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +z80.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +z80.o: /usr/include/machine/_types.h /usr/include/string.h +z80.o: /usr/include/strings.h z80.h z80_private.h +z80_decode.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +z80_decode.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +z80_decode.o: /usr/include/machine/_types.h z80.h z80_private.h +z80_dis.o: /usr/include/stdio.h /usr/include/sys/cdefs.h +z80_dis.o: /usr/include/sys/_null.h /usr/include/sys/_types.h +z80_dis.o: /usr/include/machine/_types.h /usr/include/string.h +z80_dis.o: /usr/include/strings.h /usr/include/stdarg.h z80.h z80_private.h @@ -84,15 +84,9 @@ int main(int argc, char *argv[]) trace=IConfig(CONF_TRACE); - z80=Z80Init(SPECWriteMem, - SPECReadMem, - SPECWriteWord, - SPECReadWord, - SPECWritePort, - SPECReadPort, - SPECReadForDisassem); - - Z80SetLabels(z80,SPECGetLabel()); + z80=Z80Init(SPECPeek,SPECPoke,SPECReadPort,SPECWritePort,SPECDisPeek); + + /* Z80SetLabels(z80,SPECGetLabel()); */ GFXInit(); diff --git a/src/memmenu.c b/src/memmenu.c index a194e55..9e470d1 100644 --- a/src/memmenu.c +++ b/src/memmenu.c @@ -35,6 +35,7 @@ static const char ident[]="$Id$"; #include "gfx.h" #include "gui.h" #include "util.h" +#include "expr.h" #include <SDL.h> @@ -57,6 +58,9 @@ static const char ident_h[]=ESPEC_MEMMENU_H; #define TRACE "trace" #define TRACEMEM_WIN 10 +#define HI(w) (((w)&0xff00)>>8) +#define LO(w) ((w)&0xff) + /* ---------------------------------------- TYPES */ @@ -95,10 +99,131 @@ static int lodged=FALSE; /* ---------------------------------------- PROTOS */ static int Instruction(Z80 *z80, Z80Val data); +static int Address(Z80 *z80, const char *p, Z80Word *addr); +static int Expand(void *client, const char *p, long *res); /* ---------------------------------------- PRIVATE FUNCTIONS */ +static int StrEq(const char *a, const char *b) +{ + while(*a && *b && tolower(*a)==tolower(*b)) + { + a++; + b++; + } + + if (*a || *b) + return FALSE; + else + return TRUE; +} + + +static int Address(Z80 *z80, const char *p, Z80Word *addr) +{ + long e=0; + + if (ExprEval(p,&e,Expand,z80)) + { + *addr=e; + return TRUE; + } + else + { + return FALSE; + } +} + +static int Expand(void *client, const char *p, long *res) +{ + Z80State s; + int ok=TRUE; + + Z80GetState(client,&s); + + if (StrEq(p,"AF")) + *res=s.AF; + else if (StrEq(p,"BC")) + *res=s.BC; + else if (StrEq(p,"DE")) + *res=s.DE; + else if (StrEq(p,"HL")) + *res=s.HL; + else if (StrEq(p,"IX")) + *res=s.IX; + else if (StrEq(p,"IY")) + *res=s.IY; + else if (StrEq(p,"SP")) + *res=s.SP; + else if (StrEq(p,"PC")) + *res=s.PC; + else if (StrEq(p,"A")) + *res=HI(s.AF); + else if (StrEq(p,"F")) + *res=LO(s.AF); + else if (StrEq(p,"B")) + *res=HI(s.BC); + else if (StrEq(p,"C")) + *res=LO(s.BC); + else if (StrEq(p,"D")) + *res=HI(s.DE); + else if (StrEq(p,"E")) + *res=LO(s.DE); + else if (StrEq(p,"H")) + *res=HI(s.HL); + else if (StrEq(p,"L")) + *res=LO(s.HL); + else if (StrEq(p,"AF_")) + *res=s.AF_; + else if (StrEq(p,"BC_")) + *res=s.BC_; + else if (StrEq(p,"DE_")) + *res=s.DE_; + else if (StrEq(p,"HL_")) + *res=s.HL_; + else if (StrEq(p,"A_")) + *res=HI(s.AF_); + else if (StrEq(p,"F_")) + *res=LO(s.AF_); + else if (StrEq(p,"B_")) + *res=HI(s.BC_); + else if (StrEq(p,"C_")) + *res=LO(s.BC_); + else if (StrEq(p,"D_")) + *res=HI(s.DE_); + else if (StrEq(p,"E_")) + *res=LO(s.DE_); + else if (StrEq(p,"H_")) + *res=HI(s.HL_); + else if (StrEq(p,"L_")) + *res=LO(s.HL_); + else if (StrEq(p,"IM")) + *res=s.IM; + else if (StrEq(p,"R")) + *res=s.R; + else if (StrEq(p,"IFF1")) + *res=s.IFF1; + else if (StrEq(p,"IFF2")) + *res=s.IFF2; + else if (p[0]=='@') + { + Z80Word n; + + if (Address(client,p+1,&n)) + { + *res=SPECDisPeek(client,n); + } + else + { + ok=FALSE; + } + } + + return ok; +} + + static int BreaksActive(void) { int f; @@ -276,24 +401,20 @@ void DisplayZ80State(Z80State *s, int y, Uint32 col) static int EnterAddress(const char *prompt, Z80 *z80, Z80Word *w) { const char *p; - char *error; long l; p=GUIInputString(prompt ? prompt : "Address?",""); if (*p) { - if (!Z80Expression(z80,p,&l,&error)) + if (ExprEval(p,&l,Expand,z80)) { - GUIMessage(eMessageBox, - "ERROR","%s",error ? error:"Invalid expression"); - - free(error); + *w=(Z80Word)l; + return TRUE; } else { - *w=(Z80Word)l; - return TRUE; + GUIMessage(eMessageBox,"ERROR","%s",ExprError()); } } @@ -351,7 +472,7 @@ static void DoDisassem(Z80 *z80, const Z80State *s) { Z80Byte b; - b=SPECReadForDisassem(z80,curr); + b=SPECDisPeek(z80,curr); GFXPrint(40+n*24,y,WHITE,"%2.2x",(int)b); @@ -499,8 +620,8 @@ static void GetMemTrace(Z80 *z80, MemTrace *t, Z80Word from, int count) { Z80Word w; - w=(Z80Word)SPECReadForDisassem(z80,from)| - (Z80Word)SPECReadForDisassem(z80,from+1)<<8; + w=(Z80Word)SPECDisPeek(z80,from)| + (Z80Word)SPECDisPeek(z80,from+1)<<8; t[f].addr=from; t[f].val=w; @@ -533,7 +654,7 @@ static int Instruction(Z80 *z80, Z80Val data) { long l; - if (Z80Expression(z80,bpoint.expr[f],&l,NULL)) + if (ExprEval(bpoint.expr[f],&l,Expand,z80)) { if (l) brk=bpoint.expr[f]; @@ -769,7 +890,6 @@ static void PlaybackTrace(Z80 *z80) static int DoAddBreakpoint(Z80 *z80) { const char *expr; - char *error; long l; expr=GUIInputString("Expression?",""); @@ -777,24 +897,14 @@ static int DoAddBreakpoint(Z80 *z80) if (!*expr) return -1; - if (!Z80Expression(z80,expr,&l,&error)) + if (ExprEval(expr,&l,Expand,z80)) { - if (error) - { - GUIMessage(eMessageBox,"INVALID EXPRESSION","%s",error); - free(error); - } - else - { - GUIMessage(eMessageBox,"ERROR","Expression is invalid"); - free(error); - } - - return -1; + return AddBreak(z80,expr); } else { - return AddBreak(z80,expr); + GUIMessage(eMessageBox,"INVALID EXPRESSION","%s",ExprError()); + return -1; } } @@ -104,7 +104,6 @@ int TAPLoad(FILE *fp, Z80Byte id, Z80Word *addr, Z80Word *len, SNAP_Poke poke) if (!fp) { - Debug("No file to load!\n"); return FALSE; } @@ -121,13 +120,10 @@ int TAPLoad(FILE *fp, Z80Byte id, Z80Word *addr, Z80Word *len, SNAP_Poke poke) type=GetByte(fp); csum=id; - Debug("blen=%u type=%u id=%u\n",blen,type,id); - /* Have we found the requested block? */ if (id==type) { - Debug("Matched type\n"); /* Knock of block type */ blen--; @@ -161,7 +157,6 @@ int TAPLoad(FILE *fp, Z80Byte id, Z80Word *addr, Z80Word *len, SNAP_Poke poke) /* Check the checksum */ - Debug("csum = %d, tape csum = %d\n",csum,tape_csum); return csum==tape_csum; } else @@ -71,15 +71,13 @@ static FILE *tape_out; #define SCRDATA 0x4000 #define ATTR 0x5800 -#define ATTR_AT(x,y) \ - mem[ATTR+(x)+((y)/8)*32] +#define ATTR_AT(x,y) mem[ATTR+(x)+((y)/8)*32] static const int OFF_X=(GFX_WIDTH-SCR_W)/2; static const int OFF_Y=(GFX_HEIGHT-SCR_H)/2; static Z80Byte mem[0x10000]; - /* Number of cycles per scan lines and scan line control */ static Z80Val SCAN_CYCLES=224; @@ -210,6 +208,7 @@ static const MatrixMap keymap[]= /* ---------------------------------------- DEBUG FUNCTIONS */ +#if 0 static const char *FlagString(Z80Byte flag) { static char s[]="76543210"; @@ -240,24 +239,12 @@ static void DumpZ80(Z80 *z80) printf("IFF1=%2.2x IFF2=%2.2x\n",s.IFF1,s.IFF2); printf("%s\n",Z80Disassemble(z80,&s.PC)); } +#endif /* ---------------------------------------- PRIVATE FUNCTIONS */ -static Z80Byte Peek(Z80Word addr) -{ - return mem[addr]; -} - - -static void Poke(Z80Word addr, Z80Byte val) -{ - if (addr>=ROMLEN) - mem[addr]=val; -} - - -void DrawScanlineAt(int y, int sline) +static void DrawScanlineAt(int y, int sline) { int aline; int f,r; @@ -336,6 +323,31 @@ static void RomPatch(void) } +Z80Byte SPECPeek(Z80 *cpu, Z80Word addr) +{ + return mem[addr]; +} + + +Z80Byte SnapPeek(Z80Word addr) +{ + return mem[addr]; +} + + +void SPECPoke(Z80 *cpu, Z80Word addr, Z80Byte val) +{ + if (addr>=ROMLEN) + mem[addr]=val; +} + + +void SnapPoke(Z80Word addr, Z80Byte val) +{ + if (addr>=ROMLEN) + mem[addr]=val; +} + static int EDCallback(Z80 *z80, Z80Val data) { @@ -352,7 +364,11 @@ static int EDCallback(Z80 *z80, Z80Val data) } else { - if (TAPSave(tape_out,HIBYTE(state.AF),&state.IX,&state.DE,Peek)) + if (TAPSave(tape_out, + HIBYTE(state.AF), + &state.IX, + &state.DE, + SnapPeek)) { state.AF|=eZ80_Carry; } @@ -362,7 +378,6 @@ static int EDCallback(Z80 *z80, Z80Val data) } } - DumpZ80(z80); Z80SetState(z80,&state); break; @@ -376,17 +391,22 @@ static int EDCallback(Z80 *z80, Z80Val data) } else { - if (TAPLoad(tape_in,HIBYTE(state.AF),&state.IX,&state.DE,Poke)) + if (TAPLoad(tape_in, + HIBYTE(state.AF), + &state.IX, + &state.DE, + SnapPoke)) { state.AF|=eZ80_Carry; + state.BC=0xb001; } else { state.AF&=~eZ80_Carry; + state.BC=0xff01; } } - DumpZ80(z80); Z80SetState(z80,&state); break; @@ -512,39 +532,6 @@ void SPECKeyEvent(SDL_Event *e) } -Z80Byte SPECReadMem(Z80 *z80, Z80Word addr) -{ - /* TODO: Emulation of contention */ - return mem[addr]; -} - - -void SPECWriteMem(Z80 *z80, Z80Word addr, Z80Byte val) -{ - if (addr>=ROMLEN) - mem[addr]=val; -} - - -Z80Word SPECReadWord(Z80 *z80, Z80Word addr) -{ - /* TODO: Emulation of contention */ - return (Z80Word)mem[addr]|(Z80Word)mem[addr+1]<<8; -} - - -void SPECWriteWord(Z80 *z80, Z80Word addr, Z80Word val) -{ - if (addr>=ROMLEN) - mem[addr]=val&0xff; - - addr++; - - if (addr>=ROMLEN) - mem[addr]=val>>8; -} - - Z80Byte SPECReadPort(Z80 *z80, Z80Word port) { Z80Byte lo=port&0xff; @@ -606,12 +593,7 @@ void SPECWritePort(Z80 *z80, Z80Word port, Z80Byte val) } -Z80Byte SPECReadForDisassem(Z80 *z80, Z80Word addr) -{ - return mem[addr]; -} - - +/* const Z80Label *SPECGetLabel(void) { static const Z80Label label[]= @@ -804,6 +786,7 @@ const Z80Label *SPECGetLabel(void) return label; } +*/ const char *SPECInfo(Z80 *z80) @@ -44,14 +44,15 @@ void SPECKeyEvent(SDL_Event *e); /* Interfaces for the Z80 */ -Z80Byte SPECReadMem(Z80 *z80, Z80Word addr); -void SPECWriteMem(Z80 *z80, Z80Word addr, Z80Byte val); -Z80Word SPECReadWord(Z80 *z80, Z80Word addr); -void SPECWriteWord(Z80 *z80, Z80Word addr, Z80Word val); +Z80Byte SPECPeek(Z80 *z80, Z80Word addr); +void SPECPoke(Z80 *z80, Z80Word addr, Z80Byte val); + +#define SPECDisPeek SPECPeek + Z80Byte SPECReadPort(Z80 *z80, Z80Word port); void SPECWritePort(Z80 *z80, Z80Word port, Z80Byte val); -Z80Byte SPECReadForDisassem(Z80 *z80, Z80Word addr); -const Z80Label *SPECGetLabel(void); + +/* const Z80Label *SPECGetLabel(void); */ /* Interfaces for memory menu */ |