|
|
| version 1.3, 2003/11/22 12:49:48 | version 1.11, 2004/07/01 11:42:54 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "strres.h" | #include "strres.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "i286.h" | #include "cpucore.h" |
| #include "memory.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "debugsub.h" | #include "debugsub.h" |
| Line 60 static const char file_i286cs[] = "i286_ | Line 59 static const char file_i286cs[] = "i286_ |
| static const char file_i286ds[] = "i286_ds.%.3u"; | static const char file_i286ds[] = "i286_ds.%.3u"; |
| static const char file_i286es[] = "i286_es.%.3u"; | static const char file_i286es[] = "i286_es.%.3u"; |
| static const char file_i286ss[] = "i286_ss.%.3u"; | static const char file_i286ss[] = "i286_ss.%.3u"; |
| static const char file_i286txt[] = "i286txt.%.3u"; | |
| static const char file_memorybin[] = "memory.bin"; | static const char file_memorybin[] = "memory.bin"; |
| static const char str_register[] = \ | static const char str_register[] = \ |
| Line 101 const char *debugsub_regs(void) { | Line 99 const char *debugsub_regs(void) { |
| static char work[256]; | static char work[256]; |
| SPRINTF(work, str_register, I286_AX, I286_BX, I286_CX, I286_DX, | SPRINTF(work, str_register, CPU_AX, CPU_BX, CPU_CX, CPU_DX, |
| I286_SP, I286_BP, I286_SI, I286_DI, | CPU_SP, CPU_BP, CPU_SI, CPU_DI, |
| I286_DS, I286_ES, I286_SS, I286_CS, I286_IP); | CPU_DS, CPU_ES, CPU_SS, CPU_CS, CPU_IP); |
| milstr_ncat(work, debugsub_flags(I286_FLAG), sizeof(work)); | milstr_ncat(work, debugsub_flags(CPU_FLAG), sizeof(work)); |
| milstr_ncat(work, CRCONST, sizeof(work)); | milstr_ncat(work, CRCONST, sizeof(work)); |
| return(work); | return(work); |
| } | } |
| static void writeseg(const char *fname, UINT32 addr, UINT limit) { | |
| FILEH fh; | |
| UINT size; | |
| BYTE buf[0x400]; // Stack 0x1000 -> 0x400 | |
| fh = file_create_c(fname); | |
| if (fh == FILEH_INVALID) { | |
| return; | |
| } | |
| limit = min(limit, 0xffff); | |
| limit++; | |
| while(limit) { | |
| size = min(limit, sizeof(buf)); | |
| MEML_READ(addr, buf, size); | |
| file_write(fh, buf, size); | |
| addr += size; | |
| limit -= size; | |
| } | |
| file_close(fh); | |
| } | |
| void debugsub_status(void) { | void debugsub_status(void) { |
| static int filenum = 0; | static int filenum = 0; |
| Line 124 const char *p; | Line 144 const char *p; |
| SPRINTF(work, str_picstat, | SPRINTF(work, str_picstat, |
| pic.pi[0].imr, pic.pi[0].irr, pic.pi[0].isr, | pic.pi[0].imr, pic.pi[0].irr, pic.pi[0].isr, |
| pic.pi[1].imr, pic.pi[1].irr, pic.pi[1].isr, | pic.pi[1].imr, pic.pi[1].irr, pic.pi[1].isr, |
| mouseif.portc, sysport.c); | mouseif.upd8255.portc, sysport.c); |
| file_write(fh, work, strlen(work)); | file_write(fh, work, strlen(work)); |
| file_close(fh); | file_close(fh); |
| } | } |
| SPRINTF(work, file_i286cs, filenum); | SPRINTF(work, file_i286cs, filenum); |
| fh = file_create_c(work); | writeseg(work, CS_BASE, 0xffff); |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, &mem[CS_BASE], 0x10000); | |
| file_close(fh); | |
| } | |
| SPRINTF(work, file_i286ds, filenum); | SPRINTF(work, file_i286ds, filenum); |
| fh = file_create_c(work); | writeseg(work, DS_BASE, 0xffff); |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, &mem[DS_BASE], 0x10000); | |
| file_close(fh); | |
| } | |
| SPRINTF(work, file_i286es, filenum); | SPRINTF(work, file_i286es, filenum); |
| fh = file_create_c(work); | writeseg(work, ES_BASE, 0xffff); |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, &mem[ES_BASE], 0x10000); | |
| file_close(fh); | |
| } | |
| SPRINTF(work, file_i286ss, filenum); | SPRINTF(work, file_i286ss, filenum); |
| fh = file_create_c(work); | writeseg(work, SS_BASE, 0xffff); |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, &mem[SS_BASE], 0x10000); | |
| file_close(fh); | |
| } | |
| SPRINTF(work, file_i286txt, filenum); | |
| fh = file_create_c(work); | |
| if (fh != FILEH_INVALID) { | |
| file_write(fh, &mem[0xa0000], 0x4000); | |
| file_close(fh); | |
| } | |
| filenum++; | filenum++; |
| } | } |
| Line 169 void debugsub_memorydump(void) { | Line 167 void debugsub_memorydump(void) { |
| fh = file_create_c(file_memorybin); | fh = file_create_c(file_memorybin); |
| if (fh != FILEH_INVALID) { | if (fh != FILEH_INVALID) { |
| // for (i=0; i<34; i++) { | for (i=0; i<34; i++) |
| for (i=0; i<64; i++) { | // for (i=0; i<64; i++) |
| { | |
| file_write(fh, mem + i*0x8000, 0x8000); | file_write(fh, mem + i*0x8000, 0x8000); |
| } | } |
| file_close(fh); | file_close(fh); |