|
|
| version 1.1, 2003/10/16 17:59:10 | version 1.7, 2005/02/04 05:32:25 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "resource.h" | #include "resource.h" |
| #include "np2.h" | #include "np2.h" |
| #include "i286.h" | |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "viewer.h" | #include "viewer.h" |
| #include "viewcmn.h" | #include "viewcmn.h" |
| #include "viewmenu.h" | #include "viewmenu.h" |
| #include "viewmem.h" | #include "viewmem.h" |
| #include "viewreg.h" | #include "viewreg.h" |
| #include "cpucore.h" | |
| #if !defined(CPUCORE_IA32) | |
| static void viewreg_paint(NP2VIEW_T *view, RECT *rc, HDC hdc) { | static void viewreg_paint(NP2VIEW_T *view, RECT *rc, HDC hdc) { |
| LONG y; | LONG y; |
| DWORD pos; | DWORD pos; |
| char str[128]; | char str[128]; |
| HFONT hfont; | HFONT hfont; |
| I286REGS *r; | I286STAT *r; |
| hfont = CreateFont(16, 0, 0, 0, 0, 0, 0, 0, | hfont = CreateFont(16, 0, 0, 0, 0, 0, 0, 0, |
| SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, | SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, |
| DEFAULT_QUALITY, FIXED_PITCH, "£Í£Ó ¥´¥·¥Ã¥¯"); | DEFAULT_QUALITY, FIXED_PITCH, np2viewfont); |
| SetTextColor(hdc, 0xffffff); | SetTextColor(hdc, 0xffffff); |
| SetBkColor(hdc, 0x400000); | SetBkColor(hdc, 0x400000); |
| hfont = (HFONT)SelectObject(hdc, hfont); | hfont = (HFONT)SelectObject(hdc, hfont); |
| if (view->lock) { | if (view->lock) { |
| if (view->buf1.type != ALLOCTYPE_REG) { | if (view->buf1.type != ALLOCTYPE_REG) { |
| if (viewcmn_alloc(&view->buf1, sizeof(I286REGS))) { | if (viewcmn_alloc(&view->buf1, sizeof(i286core.s))) { |
| view->lock = FALSE; | view->lock = FALSE; |
| viewmenu_lock(view); | viewmenu_lock(view); |
| } | } |
| else { | else { |
| view->buf1.type = ALLOCTYPE_REG; | view->buf1.type = ALLOCTYPE_REG; |
| CopyMemory(view->buf1.ptr, &i286r, sizeof(I286REGS)); | CopyMemory(view->buf1.ptr, &i286core.s, sizeof(i286core.s)); |
| } | } |
| viewcmn_putcaption(view); | viewcmn_putcaption(view); |
| } | } |
| Line 41 static void viewreg_paint(NP2VIEW_T *vie | Line 42 static void viewreg_paint(NP2VIEW_T *vie |
| pos = view->pos; | pos = view->pos; |
| if (view->lock) { | if (view->lock) { |
| r = (I286REGS *)view->buf1.ptr; | r = (I286STAT *)view->buf1.ptr; |
| } | } |
| else { | else { |
| r = &i286r; | r = &i286core.s; |
| } | } |
| for (y=0; y<rc->bottom && pos<4; y+=16, pos++) { | for (y=0; y<rc->bottom && pos<4; y+=16, pos++) { |
| switch(pos) { | switch(pos) { |
| case 0: | case 0: |
| wsprintf(str, "AX=%04x BX=%04x CX=%04x DX=%04x", | wsprintf(str, "AX=%.4x BX=%.4x CX=%.4x DX=%.4x", |
| r->w.ax, r->w.bx, r->w.cx, r->w.dx); | r->r.w.ax, r->r.w.bx, r->r.w.cx, r->r.w.dx); |
| break; | break; |
| case 1: | case 1: |
| wsprintf(str, "SP=%04x BP=%04x SI=%04x DI=%04x", | wsprintf(str, "SP=%.4x BP=%.4x SI=%.4x DI=%.4x", |
| r->w.sp, r->w.bp, r->w.si, r->w.di); | r->r.w.sp, r->r.w.bp, r->r.w.si, r->r.w.di); |
| break; | break; |
| case 2: | case 2: |
| wsprintf(str, "DS=%04x ES=%04x SS=%04x CS=%04x", | wsprintf(str, "CS=%.4x DS=%.4x ES=%.4x SS=%.4x", |
| r->w.ds, r->w.es, r->w.ss, r->w.cs); | r->r.w.cs, r->r.w.ds, r->r.w.es, r->r.w.ss); |
| break; | break; |
| case 3: | case 3: |
| wsprintf(str, "IP=%04x %s", | wsprintf(str, "IP=%.4x %s", |
| r->w.ip, debugsub_flags(r->w.flag)); | r->r.w.ip, debugsub_flags(r->r.w.flag)); |
| break; | break; |
| } | } |
| TextOut(hdc, 0, y, str, strlen(str)); | TextOut(hdc, 0, y, str, strlen(str)); |
| } | } |
| DeleteObject(SelectObject(hdc, hfont)); | DeleteObject(SelectObject(hdc, hfont)); |
| } | } |
| #else | |
| static void viewreg_paint(NP2VIEW_T *view, RECT *rc, HDC hdc) { | |
| LONG y; | |
| DWORD pos; | |
| char str[128]; | |
| HFONT hfont; | |
| I386STAT *r; | |
| hfont = CreateFont(16, 0, 0, 0, 0, 0, 0, 0, | |
| SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, | |
| DEFAULT_QUALITY, FIXED_PITCH, np2viewfont); | |
| SetTextColor(hdc, 0xffffff); | |
| SetBkColor(hdc, 0x400000); | |
| hfont = (HFONT)SelectObject(hdc, hfont); | |
| if (view->lock) { | |
| if (view->buf1.type != ALLOCTYPE_REG) { | |
| if (viewcmn_alloc(&view->buf1, sizeof(i386core.s))) { | |
| view->lock = FALSE; | |
| viewmenu_lock(view); | |
| } | |
| else { | |
| view->buf1.type = ALLOCTYPE_REG; | |
| CopyMemory(view->buf1.ptr, &i386core.s, sizeof(i386core.s)); | |
| } | |
| viewcmn_putcaption(view); | |
| } | |
| } | |
| pos = view->pos; | |
| if (view->lock) { | |
| r = (I386STAT *)view->buf1.ptr; | |
| } | |
| else { | |
| r = &i386core.s; | |
| } | |
| for (y=0; y<rc->bottom && pos<4; y+=16, pos++) { | |
| switch(pos) { | |
| case 0: | |
| wsprintf(str, "EAX=%.8x EBX=%.8x ECX=%.8x EDX=%.8x", | |
| r->cpu_regs.reg[CPU_EAX_INDEX].d, | |
| r->cpu_regs.reg[CPU_EBX_INDEX].d, | |
| r->cpu_regs.reg[CPU_ECX_INDEX].d, | |
| r->cpu_regs.reg[CPU_EDX_INDEX].d); | |
| break; | |
| case 1: | |
| wsprintf(str, "ESP=%.8x EBP=%.8x ESI=%.8x EDI=%.8x", | |
| r->cpu_regs.reg[CPU_ESP_INDEX].d, | |
| r->cpu_regs.reg[CPU_EBP_INDEX].d, | |
| r->cpu_regs.reg[CPU_ESI_INDEX].d, | |
| r->cpu_regs.reg[CPU_EDI_INDEX].d); | |
| break; | |
| case 2: | |
| wsprintf(str, "CS=%.4x DS=%.4x ES=%.4x " \ | |
| "FS=%.4x GS=%.4x SS=%.4x", | |
| r->cpu_regs.sreg[CPU_CS_INDEX], | |
| r->cpu_regs.sreg[CPU_DS_INDEX], | |
| r->cpu_regs.sreg[CPU_ES_INDEX], | |
| r->cpu_regs.sreg[CPU_FS_INDEX], | |
| r->cpu_regs.sreg[CPU_GS_INDEX], | |
| r->cpu_regs.sreg[CPU_SS_INDEX]); | |
| break; | |
| case 3: | |
| wsprintf(str, "EIP=%.8x %s", | |
| r->cpu_regs.eip.d, | |
| debugsub_flags(r->cpu_regs.eflags.d)); | |
| break; | |
| } | |
| TextOut(hdc, 0, y, str, strlen(str)); | |
| } | |
| DeleteObject(SelectObject(hdc, hfont)); | |
| } | |
| #endif | |
| LRESULT CALLBACK viewreg_proc(NP2VIEW_T *view, | LRESULT CALLBACK viewreg_proc(NP2VIEW_T *view, |
| HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { | HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { |
| Line 109 void viewreg_init(NP2VIEW_T *dst, NP2VIE | Line 187 void viewreg_init(NP2VIEW_T *dst, NP2VIE |
| dst->mul = 1; | dst->mul = 1; |
| dst->pos = 0; | dst->pos = 0; |
| } | } |