diff options
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -4,7 +4,7 @@ * Note that zero-page addressing is not fully emulated yet; it will still address the zero-page section of memory but the instructions still take an address of length 4. This will be fixed later when the whole system is functional. - * + * There are a few special keywords which have particular debugging meaning */ #include"include.h" @@ -17,12 +17,30 @@ int charToNum (char c, int mul) { } } +void debug_print(){ + printf("\nacc:\t%x\nX:\t%x\nY:\t%x\nstack:\t%x\nflags:\t%x", acc, X, Y, S, P); +} + int main(){ char c; unsigned char a, b; while(true){ // Pass 1 - c = getchar(); if (c == EOF) break; + c = getchar(); + if (c == EOF) break; + switch(c){ + case D: case d: + debug_print(); + break; + case M: case m: + int m = 0; + for(int i = 1; i <= 1000; i *= 10){ + m += charToNum(getchar(), 1000/i); + } + printf("Address %d has %x", m, Memory[m]); + break; + + } a += charToNum(c, 0x10); // Pass 2 c = getchar(); if (c == EOF) break; |