forked from libretro/xmil-libretro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debugsub.c
68 lines (60 loc) · 1.76 KB
/
debugsub.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "compiler.h"
#include "dosio.h"
#include "z80core.h"
#include "pccore.h"
#include "iocore.h"
#include "vram.h"
#include "debugsub.h"
/* 状態吐き出し げろりんこ */
static int filenum = 0;
void debugsub_status(void) {
FILEH fh;
OEMCHAR path[32];
char work[512];
OEMSPRINTF(path, OEMTEXT("z80reg.%.3d"), filenum);
fh = file_create_c(path);
if (fh != FILEH_INVALID) {
SPRINTF(work, "PC = %04x\nAF = %04x\nBC = %04x\n" \
"DE = %04x\nHL = %04x\nIX = %04x\n" \
"IY = %04x\nSP = %04x\nAF'= %04x\n" \
"BC'= %04x\nDE'= %04x\nHL'= %04x\n\n" \
"IFF = %.2x\n" \
"IM = %2d\nADRS = %02x%02x\n\n" \
"FNT_YL = %3d\nTXT_YL = %3d\nSCRN_b = %02x\n",
Z80_PC, Z80_AF, Z80_BC, Z80_DE,
Z80_HL, Z80_IX, Z80_IY, Z80_SP,
Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2,
Z80_IFF,
Z80_IM, Z80_I, subcpu.s.vect,
crtc.e.fonty, crtc.e.yl, crtc.s.SCRN_BITS);
file_write(fh, work, (UINT)STRLEN(work));
file_close(fh);
}
OEMSPRINTF(path, OEMTEXT("z80ram.%.3d"), filenum);
fh = file_create_c(path);
if (fh != FILEH_INVALID) {
file_write(fh, mainmem, 0x10000);
file_close(fh);
}
OEMSPRINTF(path, OEMTEXT("x1vram1.%.3d"), filenum);
fh = file_create_c(path);
if (fh != FILEH_INVALID) {
file_write(fh, gram + GRAM_BANK0 + 0x0000, 0x8000);
file_write(fh, gram + GRAM_BANK0 + 0x8000, 0x8000);
file_close(fh);
}
OEMSPRINTF(path, OEMTEXT("x1vram2.%.3d"), filenum);
fh = file_create_c(path);
if (fh != FILEH_INVALID) {
file_write(fh, gram + GRAM_BANK1 + 0x0000, 0x8000);
file_write(fh, gram + GRAM_BANK1 + 0x8000, 0x8000);
file_close(fh);
}
OEMSPRINTF(path, OEMTEXT("x1tram.%.3d"), filenum);
fh = file_create_c(path);
if (fh != FILEH_INVALID) {
file_write(fh, tram, 0x1800);
file_close(fh);
}
filenum++;
}