forked from redcode/SpecEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DebugIDE.asm
107 lines (76 loc) · 3.25 KB
/
DebugIDE.asm
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PopulateIDEDlg PROTO
UpdateIDEReg PROTO :DWORD,:BYTE
UpdateIDERegW PROTO :DWORD,:WORD
DebugIDEDlgProc proc uses ebx esi edi,
hWndDlg :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD
invoke HandleCustomWindowMessages, ADDR IDEDLG, hWndDlg, uMsg, wParam, lParam
.if eax == TRUE
return TRUE
.endif
RESETMSG
OnInitDialog
; set menu ID on main debugger window's menu
mov IDEDLG.Menu_ID, IDM_VIEW_IDE
invoke PopulateIDEDlg
return TRUE
OnShowWindow
invoke PopulateIDEDlg
return TRUE
OnClose
return TRUE
OnDestroy
return NULL
OnCommand
return TRUE
OnDefault
return FALSE
DOMSG
DebugIDEDlgProc endp
UpdateIDEReg proc uses ebx esi edi,
CtrlID: DWORD,
Value: BYTE
local textstring: TEXTSTRING,
pTEXTSTRING:DWORD
invoke INITTEXTSTRING, addr textstring, addr pTEXTSTRING
invoke PrtBase8, pTEXTSTRING, Value
invoke SendDlgItemMessage, IDEDLG.hWnd, CtrlID, WM_SETTEXT, 0, addr textstring
ret
UpdateIDEReg endp
UpdateIDERegW proc uses ebx esi edi,
CtrlID: DWORD,
Value: WORD
local textstring: TEXTSTRING,
pTEXTSTRING:DWORD
invoke INITTEXTSTRING, addr textstring, addr pTEXTSTRING
invoke PrtBase16, pTEXTSTRING, Value, 0
invoke SendDlgItemMessage, IDEDLG.hWnd, CtrlID, WM_SETTEXT, 0, addr textstring
ret
UpdateIDERegW endp
PopulateIDEDlg proc uses esi edi ebx
.if IDEDLG.Visible == TRUE
IDE_ReadStatus IDEHandle
invoke UpdateIDEReg, IDC_IDESTATUS, al
IDE_ReadError IDEHandle
invoke UpdateIDEReg, IDC_IDEERROR, al
IDE_ReadCylinderHigh IDEHandle
mov bh, al
IDE_ReadCylinderLow IDEHandle
mov bl, al
invoke UpdateIDERegW, IDC_IDECYLINDER, bx
IDE_ReadDrive_Head IDEHandle
mov bl, al
and al, 15
invoke UpdateIDEReg, IDC_IDEHEAD, al
and bl, 16
shr bl, 4
invoke UpdateIDEReg, IDC_IDEUNIT, bl
IDE_ReadSectorNumber IDEHandle
invoke UpdateIDEReg, IDC_IDESECTOR, al
IDE_ReadSectorCount IDEHandle
invoke UpdateIDEReg, IDC_IDESECTORCOUNT, al
.endif
ret
PopulateIDEDlg endp