| version 1.3, 2004/03/09 16:31:17 | version 1.12, 2005/02/07 14:46:07 | 
| Line 6 | Line 6 | 
 | #include        "iocore.h" | #include        "iocore.h" | 
 | #include        "debugsub.h" | #include        "debugsub.h" | 
 |  |  | 
 |  | void debugwriteseg(const char *fname, const descriptor_t *sd, | 
 |  | UINT32 addr, UINT32 size); | 
 |  | void debugpageptr(UINT32 addr); | 
 |  |  | 
 |  |  | 
 | #if defined(MACOS) | #if defined(MACOS) | 
 | #define CRLITERAL       "\r" | #define CRLITERAL       "\r" | 
| Line 65  static const char str_register[] = | Line 69  static const char str_register[] = | 
 | "EAX=%.8x  EBX=%.8x  ECX=%.8x  EDX=%.8x" CRLITERAL      \ | "EAX=%.8x  EBX=%.8x  ECX=%.8x  EDX=%.8x" CRLITERAL      \ | 
 | "ESP=%.8x  EBP=%.8x  ESI=%.8x  EDI=%.8x" CRLITERAL      \ | "ESP=%.8x  EBP=%.8x  ESI=%.8x  EDI=%.8x" CRLITERAL      \ | 
 | "DS=%.4x  ES=%.4x  SS=%.4x  CS=%.4x  "                          \ | "DS=%.4x  ES=%.4x  SS=%.4x  CS=%.4x  "                          \ | 
| "EIP=%.8x  "; | "EIP=%.8x  " CRLITERAL; | 
 | static const char str_picstat[] =                                                                               \ | static const char str_picstat[] =                                                                               \ | 
| CRLITERAL "PIC0=%.2x:%.2x:%.2x"                                         \ | "PIC0=%.2x:%.2x:%.2x" CRLITERAL                                         \ | 
| CRLITERAL "PIC1=%.2x:%.2x:%.2x"                                         \ | "PIC1=%.2x:%.2x:%.2x" CRLITERAL                                         \ | 
| CRLITERAL "8255PORTC = %.2x / system-port = %.2x"; | "8255PORTC = %.2x / system-port = %.2x" CRLITERAL; | 
 |  |  | 
 |  |  | 
 | const char *debugsub_flags(UINT16 flag) { | const char *debugsub_flags(UINT16 flag) { | 
| Line 111  void debugwriteseg(const char *fname, co | Line 115  void debugwriteseg(const char *fname, co | 
 | UINT32 addr, UINT32 size) { | UINT32 addr, UINT32 size) { | 
 |  |  | 
 | FILEH   fh; | FILEH   fh; | 
| BYTE    buf[0x1000]; | UINT8   buf[0x1000]; | 
 | UINT32  limit; | UINT32  limit; | 
 |  |  | 
 | limit = sd->u.seg.limit; | limit = sd->u.seg.limit; | 
| Line 136  void debugwriteseg(const char *fname, co | Line 140  void debugwriteseg(const char *fname, co | 
 |  |  | 
 | void debugsub_status(void) { | void debugsub_status(void) { | 
 |  |  | 
| static int                      filenum = 0; | static int              filenum = 0; | 
| FILEH                   fh; | FILEH           fh; | 
| char                    work[512]; | char            work[512]; | 
| const char                      *p; | const char              *p; | 
 |  |  | 
 | SPRINTF(work, file_i386reg, filenum); | SPRINTF(work, file_i386reg, filenum); | 
 | fh = file_create_c(work); | fh = file_create_c(work); | 
| Line 149  const char   *p; | Line 153  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)); | 
|  |  | 
|  | SPRINTF(work, "CS = %.8x:%.8x" CRLITERAL, | 
|  | CPU_STAT_SREGBASE(CPU_CS_INDEX), | 
|  | CPU_STAT_SREGLIMIT(CPU_CS_INDEX)); | 
 | file_write(fh, work, strlen(work)); | file_write(fh, work, strlen(work)); | 
 |  |  | 
 | file_close(fh); | file_close(fh); | 
 | } | } | 
 |  |  | 
 | SPRINTF(work, file_i386cs, filenum); | SPRINTF(work, file_i386cs, filenum); | 
| debugwriteseg(work, &CPU_STAT_SREG(CPU_CS_INDEX), 0, 0x10000); | debugwriteseg(work, &CPU_STAT_SREG(CPU_CS_INDEX), CPU_EIP & 0xffff0000, 0x10000); | 
 | SPRINTF(work, file_i386ds, filenum); | SPRINTF(work, file_i386ds, filenum); | 
 | debugwriteseg(work, &CPU_STAT_SREG(CPU_DS_INDEX), 0, 0x10000); | debugwriteseg(work, &CPU_STAT_SREG(CPU_DS_INDEX), 0, 0x10000); | 
 | SPRINTF(work, file_i386es, filenum); | SPRINTF(work, file_i386es, filenum); | 
 | debugwriteseg(work, &CPU_STAT_SREG(CPU_ES_INDEX), 0, 0x10000); | debugwriteseg(work, &CPU_STAT_SREG(CPU_ES_INDEX), 0, 0x10000); | 
 | SPRINTF(work, file_i386ss, filenum); | SPRINTF(work, file_i386ss, filenum); | 
| debugwriteseg(work, &CPU_STAT_SREG(CPU_SS_INDEX), 0, 0x10000); | debugwriteseg(work, &CPU_STAT_SREG(CPU_SS_INDEX), CPU_ESP & 0xffff0000, 0x10000); | 
 | filenum++; | filenum++; | 
 | } | } | 
 |  |  | 
| Line 172  void debugsub_memorydump(void) { | Line 182  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++) |  | 
| { |  | 
 | file_write(fh, mem + i*0x8000, 0x8000); | file_write(fh, mem + i*0x8000, 0x8000); | 
 | } | } | 
 | file_close(fh); | file_close(fh); | 
 | } | } | 
 | } | } | 
 |  |  | 
 |  | void debugsub_memorydumpall(void) { | 
 |  |  | 
 |  | FILEH   fh; | 
 |  |  | 
 |  | fh = file_create_c(file_memorybin); | 
 |  | if (fh != FILEH_INVALID) { | 
 |  | file_write(fh, mem, 0x110000); | 
 |  | if (CPU_EXTMEMSIZE > 0x10000) { | 
 |  | file_write(fh, CPU_EXTMEM + 0x10000, CPU_EXTMEMSIZE - 0x10000); | 
 |  | } | 
 |  | file_close(fh); | 
 |  | } | 
 |  | } | 
 |  |  | 
 |  |  | 
 | #if 1   // 俺用デバグ | #if 1   // 俺用デバグ | 
 |  |  |