X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=debug.c;h=7e60196089b68d11d0c6dbdf823e68a77e70d284;hp=e3f947a3c185037f59cb8a0f423ed1732be99b2e;hb=d0c28c349ddfb8393568037f68bddbe8979ce0df;hpb=3385b366632d03745033fa6b19faabf60219bc6b diff --git a/debug.c b/debug.c index e3f947a..7e60196 100644 --- a/debug.c +++ b/debug.c @@ -3,19 +3,22 @@ // DEBUG.C - Debugging Messages // Copyright (C) 199x Landon Dyer, 2011-2012 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 -// Source Utilised with the Kind Permission of Landon Dyer +// Source utilised with the kind permission of Landon Dyer // #include "debug.h" -#include "sect.h" #include "amode.h" +#include "direct.h" #include "mark.h" +#include "sect.h" +#include "token.h" -static int siztab[4] = {3, 5, 9, 9}; + +static int siztab[4] = { 3, 5, 9, 9 }; // -// Print 'c' Visibly +// Print 'c' visibly // int visprt(char c) { @@ -40,14 +43,15 @@ TOKEN * printexpr(TOKEN * tp) switch ((int)*tp++) { case SYMBOL: - printf("`%s' ", ((SYM *)*tp)->sname); - ++tp; +// printf("`%s' ", ((SYM *)*tp)->sname); + printf("`%s' ", symbolPtr[*tp]->sname); + tp++; break; case CONST: - printf("$%ux ", *tp++); + printf("$%X ", *tp++); break; case ACONST: - printf("ACONST=($%ux,$%ux) ", *tp, tp[1]); + printf("ACONST=($%X,$%X) ", *tp, tp[1]); tp += 2; break; default: @@ -57,7 +61,7 @@ TOKEN * printexpr(TOKEN * tp) } } - printf(";\n"); +// printf(";\n"); return tp + 1; } @@ -69,7 +73,7 @@ int chdump(CHUNK * ch, int format) { while (ch != NULL) { - printf("chloc=$%08ux, chsize=$%ux\n", ch->chloc, ch->ch_size); + printf("chloc=$%08X, chsize=$%X\n", ch->chloc, ch->ch_size); mdump(ch->chptr, ch->ch_size, format, ch->chloc); ch = ch->chnext; } @@ -94,14 +98,14 @@ int fudump(CHUNK * ch) p.cp = ch->chptr; ep = ch->chptr + ch->ch_size; - while(p.cp < ep) + while (p.cp < ep) { attr = *p.wp++; loc = *p.lp++; file = *p.wp++; line = *p.wp++; - printf("$%04x $%08ux %d.%d: ", (int)attr, loc, (int)file, (int)line); + printf("$%04X $%08X %d.%d: ", (int)attr, loc, (int)file, (int)line); if (attr & FU_EXPR) { @@ -111,9 +115,17 @@ int fudump(CHUNK * ch) } else { - printf("`%s' ;\n", (*p.sy)->sname); - ++p.lp; + printf("`%s' ;", (*p.sy)->sname); + p.sy++; + } + + if ((attr & 0x0F00) == FU_JR) + { + printf(" *=$%X", *p.lp); + p.lp++; } + + printf("\n"); } ch = ch->chnext; @@ -139,11 +151,8 @@ int mudump(void) for(mch=firstmch; mch!=NULL; mch=mch->mcnext) { - printf("mch=$%08ux mcptr=$%08ux mcalloc=$%ux mcused=$%x\n", - (uint32_t)mch, - (mch->mcptr.lw), - mch->mcalloc, - (mch->mcused)); + printf("mch=$%p mcptr=$%08X mcalloc=$%X mcused=$%X\n", + mch, (mch->mcptr.lw), mch->mcalloc, (mch->mcused)); p = mch->mcptr; @@ -163,8 +172,8 @@ int mudump(void) if (w & MSYMBOL) symbol = *p.sy++; - printf("m=$%04x to=%d loc=$%ux from=%d siz=%s", - w, w & 0x00ff, loc, from, (w & MLONG) ? "long" : "word"); + printf("m=$%04X to=%d loc=$%X from=%d siz=%s", + w, w & 0x00FF, loc, from, (w & MLONG) ? "long" : "word"); if (symbol != NULL) printf(" sym=`%s'", symbol->sname); @@ -178,12 +187,14 @@ int mudump(void) // -// Dump memory from 'start' for 'count' bytes; `flg' is the following ORed together: +// Dump memory from 'start' for 'count' bytes; `flg' is the following ORed +// together: // 0 - bytes // 1 - words // 2 - longwords // -// if `base' is not -1, then print it at the start of each line, incremented accordingly. +// if `base' is not -1, then print it at the start of each line, incremented +// accordingly. // int mdump(char * start, LONG count, int flg, LONG base) { @@ -207,21 +218,21 @@ int mdump(char * start, LONG count, int flg, LONG base) j = i; if (base != -1) - printf("%08ux ", base); + printf("%08X ", base); } switch (flg & 3) { case 0: - printf("%02x ", start[i] & 0xff); + printf("%02X ", start[i] & 0xff); ++i; break; case 1: - printf("%02x%02x ", start[i] & 0xff, start[i+1] & 0xff); + printf("%02X%02X ", start[i] & 0xff, start[i+1] & 0xff); i += 2; break; case 2: - printf("%02x%02x%02x%02x ", start[i] & 0xff, start[i+1] & 0xff, + printf("%02X%02X%02X%02X ", start[i] & 0xff, start[i+1] & 0xff, start[i+2] & 0xff, start[i+3] & 0xff); i += 4; break; @@ -233,8 +244,8 @@ int mdump(char * start, LONG count, int flg, LONG base) base += 1 << (flg & 3); } - // Print remaining bit of ascii; the hairy expression computes the number of - // spaces to print to make the ascii line up nicely. + // Print remaining bit of ASCII; the hairy expression computes the number + // of spaces to print to make the ASCII line up nicely. if (j != i) { k = ((16 - (i - j)) / (1 << (flg & 3))) * siztab[flg & 3]; @@ -268,20 +279,20 @@ int dumptok(TOKEN * tk) if (*tk >= 128) { - printf("REG=%ud", *tk++ - 128); + printf("REG=%u", *tk++ - 128); continue; } switch ((int)*tk++) { case CONST: // CONST - printf("CONST=%ud", *tk++); + printf("CONST=%u", *tk++); break; case STRING: // STRING
- printf("STRING='%s'", (char *)*tk++); + printf("STRING='%s'", string[*tk++]); break; case SYMBOL: // SYMBOL
- printf("SYMBOL='%s'", (char *)*tk++); + printf("SYMBOL='%s'", string[*tk++]); break; case EOL: // End of line printf("EOL"); @@ -323,17 +334,17 @@ int dumptok(TOKEN * tk) // -// Dump Everything +// Dump everything // int dump_everything(void) { int i; - for(i = 1; i < NSECTS; ++i) + for(i=1; i