diff options
Diffstat (limited to 'src/memmenu.c')
-rw-r--r-- | src/memmenu.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/src/memmenu.c b/src/memmenu.c index c2f5da7..49bc93f 100644 --- a/src/memmenu.c +++ b/src/memmenu.c @@ -27,6 +27,7 @@ static const char ident[]="$Id$"; #include <stdlib.h> #include <string.h> +#include <ctype.h> #include "memmenu.h" #include "zx81.h" @@ -104,7 +105,49 @@ static const char *FlagString(Z80Byte flag) } -static int EnterAddress(Z80Word *w) +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 Z80Word Address(Z80 *z80, const char *p) +{ + Z80State s; + + Z80GetState(z80,&s); + + if (StrEq(p,"AF")) + return s.AF; + else if (StrEq(p,"BC")) + return s.BC; + else if (StrEq(p,"DE")) + return s.DE; + else if (StrEq(p,"HL")) + return s.HL; + else if (StrEq(p,"IX")) + return s.IX; + else if (StrEq(p,"IY")) + return s.IY; + else if (StrEq(p,"SP")) + return s.SP; + else if (StrEq(p,"PC")) + return s.PC; + + return (Z80Word)strtoul(p,NULL,0); +} + + +static int EnterAddress(Z80 *z80, Z80Word *w) { unsigned long ul; const char *p; @@ -113,7 +156,7 @@ static int EnterAddress(Z80Word *w) if (*p) { - ul=strtoul(p,NULL,0); + ul=Address(z80,p); if (ul>0xffff) { @@ -213,7 +256,7 @@ static void DoDisassem(Z80 *z80, const Z80State *s) case SDLK_RETURN: case SDLK_KP_ENTER: - EnterAddress(&pc); + EnterAddress(z80,&pc); break; case SDLK_UP: |