emu48-mirror/DUMP.C
Gwenhael Le Moine c3ab4004ad
1996-02-01: Historic version 0.37
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
2024-03-19 22:11:59 +01:00

95 lines
No EOL
2.7 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (C) 1995 Sebastien Carlier
*/
#include <stdlib.h>
#include <stdio.h>
FILE *in;
unsigned char A[16], B[16], C[16], D[16], ST[4];
unsigned char R0[16], R1[16], R2[16], R3[16], R4[16];
unsigned char HST, P, CARRY, MODE, INTP, INTE, INTD, SHUTDN;
unsigned char ioram[64];
unsigned long pc, d0, d1, OUT, IN, rstk[8], rstkp, t1, t2;
unsigned long ucfg[5], base[6], size[5];
unsigned short crc;
void Ndisp(unsigned char *a, int s) {
while (s--) putchar((a[s]<10)?(a[s]+'0'):(a[s]-10+'A'));
return;
}
int main(int argc, char *argv[]) {
int i;
if (argc!=2)
in = fopen("saturn", "rb");
else
in = fopen(argv[1], "rb");
if (in == NULL) return 1;
fread(A, 16, 1, in);
fread(B, 16, 1, in);
fread(C, 16, 1, in);
fread(D, 16, 1, in);
fread(R0, 16, 1, in);
fread(R1, 16, 1, in);
fread(R2, 16, 1, in);
fread(R3, 16, 1, in);
fread(R4, 16, 1, in);
fread(&pc, 4, 1, in);
fread(&d0, 4, 1, in);
fread(&d1, 4, 1, in);
fread(&OUT, 4, 1, in);
fread(&IN, 4, 1, in);
fread(ST, 4, 1, in);
HST = fgetc(in);
if (!P) P = fgetc(in); else fseek(in, 1, SEEK_CUR);
CARRY = fgetc(in);
MODE = fgetc(in);
INTP = fgetc(in);
INTE = fgetc(in);
INTD = fgetc(in);
SHUTDN = fgetc(in);
fread(rstk, 32, 1, in);
rstkp = fgetc(in);
for (i=0; i<5; i++) {
ucfg[i] = fgetc(in);
fread(&base[i], 4, 1, in);
fread(&size[i], 4, 1, in);
}
fread(ioram, 64, 1, in);
t1 = fgetc(in);
fread(&t2, 4, 1, in);
fread(&crc, 4, 1, in);
/* fread(&display, sizeof(display_t), 1, in);*/
fclose(in);
printf(" A="); Ndisp(A, 16); putchar('\t');
printf(" B="); Ndisp(B, 16); putchar('\t');
printf(" C="); Ndisp(C, 16); putchar('\n');
printf(" D="); Ndisp(D, 16); putchar('\t');
printf("R0="); Ndisp(R0, 16); putchar('\t');
printf("R1="); Ndisp(R1, 16); putchar('\n');
printf("R2="); Ndisp(R2, 16); putchar('\t');
printf("R3="); Ndisp(R3, 16); putchar('\t');
printf("R4="); Ndisp(R4, 16); putchar('\n');
printf("PC=%05lX\tD0=%05lX\tD1=%05lX\n", pc, d0, d1);
printf("OUT=%03lX\tIN=%04lX\tST=", OUT, IN); Ndisp(ST, 4); putchar('\n');
printf("HST=%X\tP=%i\tCARRY=%c\tMODE=%2i\n", HST, P, CARRY?'Y':'N', MODE);
printf("INTP=%c\tINTE=%c\tINTD=%c\tSHUTDN=%c\n", INTP?'Y':'N', INTE?'Y':'N',
INTD?'Y':'N', SHUTDN?'Y':'N');
printf("RSTK(%ld): ", rstkp);
for (i=0; i<8; i++) printf("%05lX ", rstk[i]); putchar('\n');
printf("IORAM: ");
for (i=0; i<64; i++) {
putchar((ioram[i]<10)?(ioram[i]+'0'):(ioram[i]-10+'A'));
if ((i&0xf) == 0xf) putchar(' ');
}
putchar('\n');
printf("T1=%1lX T2=%08lX CRC=%04X\n", t1, t2, crc);
for (i=0; i<5; i++)
printf("Module %d: cfg=%ld base=%05lX size=%05lX\n", i, ucfg[i], base[i], size[i]);
return 0;
}