This source file includes following definitions.
- dumpmemory
- dspregister
1 #include "exec.h"
2
3
4 void dumpmemory(WORD start, WORD end)
5 {
6 const WORD col = 0x10;
7 WORD mod = 0;
8
9 fprintf(stdout, "#%04X: adr :", sys->cpu->pr);
10 if(end > sys->memsize) {
11 end = sys->memsize;
12 }
13 for(int i = 0; i < sys->memsize && i < col; i++) {
14 fprintf(stdout, " %04X", i);
15 }
16 fprintf(stdout, "\n");
17 fprintf(stdout, " -------------------------------------------------------------------------------------\n");
18
19 for(int i = start; i < end; i++) {
20 mod = i % col;
21 if(mod == 0 || i == start) {
22 fprintf(stdout, "#%04X: %04X: ", sys->cpu->pr, i);
23 }
24 if(i == start) {
25 for(int j = 0; j < mod; j++) {
26 fprintf(stdout, " ");
27 }
28 }
29 fprintf(stdout, "%04X", sys->memory[i]);
30 if((i > 0 && (i + 1) % col == 0) || (i + 1) == end) {
31 fprintf(stdout, "\n");
32 } else {
33 fprintf(stdout, " ");
34 }
35 }
36 }
37
38 void dspregister()
39 {
40 char *sp = word2bit(sys->cpu->sp);
41 char *pr = word2bit(sys->cpu->pr);
42 char *fr = word2bit(sys->cpu->fr);
43 enum {
44 L3BIT = 16 - 3,
45 };
46 for(int i = 0; i < GRSIZE; i++ ) {
47 fprintf(stdout, "#%04X: GR%d: ", sys->cpu->pr, i);
48 print_dumpword(sys->cpu->gr[i], execmode.logical);
49 fprintf(stdout, "\n");
50 }
51 fprintf(stdout, "#%04X: SP: %6d = #%04X = %s\n", sys->cpu->pr, sys->cpu->sp, sys->cpu->sp, sp);
52 fprintf(stdout, "#%04X: PR: %6d = #%04X = %s\n", sys->cpu->pr, sys->cpu->pr, sys->cpu->pr, pr);
53 fprintf(stdout, "#%04X: FR (OF SF ZF): %s\n", sys->cpu->pr, fr + L3BIT);
54 FREE(sp);
55 FREE(pr);
56 FREE(fr);
57 }