X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdump.c;h=51650c975c3a6367840c9a353724603ee95a8e21;hb=b591284405a5b29213db6250c830e1f63d11a4f0;hp=d07c40f37320a80d7c4f4e30f6b91cad4c11b39e;hpb=fd17e19672d6df5bdde0568e29ef7c462429735c;p=YACASL2.git diff --git a/src/dump.c b/src/dump.c index d07c40f..51650c9 100644 --- a/src/dump.c +++ b/src/dump.c @@ -1,23 +1,5 @@ #include "casl2.h" - -/* WORD値を2進数表記に変換 */ -char *word2bit(const WORD word) -{ - WORD mask = 0x8000; - char *bit, *p; - bit = malloc(16 + 1); - p = bit; - while(mask > 0){ - if((word & mask) == 0) { - *p++ = '0'; - } else { - *p++ = '1'; - } - mask = (mask >> 1); - } - *p = '\0'; - return bit; -} +#include "exec.h" /* COMET IIのメモリを表示 */ void dumpmemory() @@ -26,7 +8,7 @@ void dumpmemory() int i; /* Header */ fprintf(stdout, "#%04X: adr :", PR); - for(i = 0; i < col; i++) { + for(i = 0; i < memsize && i < col; i++) { fprintf(stdout, " %04X", i); } fprintf(stdout, "\n"); @@ -49,13 +31,8 @@ void dspregister() { int i; for(i = 0; i < REGSIZE; i++ ) { - if(logicalmode == true) { - fprintf(stdout, "#%04X: GR%d: %6d = #%04X = %s\n", - PR, i, GR[i], GR[i], word2bit(GR[i])); - } else { - fprintf(stdout, "#%04X: GR%d: %6d = #%04X = %s\n", - PR, i, (short)GR[i], GR[i], word2bit(GR[i])); - } + fprintf(stdout, "#%04X: GR%d: ", PR, i); + print_dumpword(GR[i], (&execmode)->logical); } fprintf(stdout, "#%04X: SP: %6d = #%04X = %s\n", PR, SP, SP, word2bit(SP)); fprintf(stdout, "#%04X: PR: %6d = #%04X = %s\n", PR, PR, PR, word2bit(PR));