Subversion Repositories Kolibri OS

Rev

Rev 4912 | Rev 4914 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4912 Rev 4913
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
 
4
 
5
;-----------------------------------------------------------------------------
5
;-----------------------------------------------------------------------------
6
;                             Color scheme
6
;                             Color scheme
7
 
7
 
8
BLACK_ON_WHITE  equ 0
8
BLACK_ON_WHITE  equ 0
9
MOVIEOS         equ 1
9
MOVIEOS         equ 1
10
WHITE_ON_BLACK  equ 2
10
WHITE_ON_BLACK  equ 2
11
 
11
 
12
;                         format - 0xRRGGBB
12
;                         format - 0xRRGGBB
13
if COLOR_THEME eq MOVIEOS
13
if COLOR_THEME eq MOVIEOS
14
 
14
 
15
        COLOR_BG_NORMAL           = 0x1d272f
15
        COLOR_BG_NORMAL           = 0x1d272f
16
        COLOR_BG_BREAKPOINT       = 0x0000aa
16
        COLOR_BG_BREAKPOINT       = 0x0000aa
17
        COLOR_BG_SELECTED         = 0xec9300
17
        COLOR_BG_SELECTED         = 0xec9300
18
        COLOR_LINE                = 0x00b9a0
18
        COLOR_LINE                = 0x00b9a0
19
        COLOR_TXT_NORMAL          = 0xffffff
19
        COLOR_TXT_NORMAL          = 0xffffff
20
        COLOR_TXT_INACTIVE        = 0x8f7948
20
        COLOR_TXT_INACTIVE        = 0x8f7948
21
        COLOR_TXT_CHANGED         = 0xec9300
21
        COLOR_TXT_CHANGED         = 0xec9300
22
        COLOR_TXT_LABEL           = 0x22b14c
22
        COLOR_TXT_LABEL           = 0x22b14c
23
        COLOR_TXT_SELECTED        = 0x1d272f
23
        COLOR_TXT_SELECTED        = 0x1d272f
24
        COLOR_TXT_HEX             = 0xec9300
24
        COLOR_TXT_HEX             = 0xec9300
25
        COLOR_TXT_BREAKPOINT      = 0xec9300
25
        COLOR_TXT_BREAKPOINT      = 0xec9300
26
 
26
 
27
else if COLOR_THEME eq WHITE_ON_BLACK
27
else if COLOR_THEME eq WHITE_ON_BLACK
28
 
28
 
29
        COLOR_BG_NORMAL           = 0x101010 ; dark grey
29
        COLOR_BG_NORMAL           = 0x101010 ; dark grey
30
        COLOR_BG_BREAKPOINT       = 0xFF0000 ; red
30
        COLOR_BG_BREAKPOINT       = 0xFF0000 ; red
31
        COLOR_BG_SELECTED         = 0x0000FF ; blue
31
        COLOR_BG_SELECTED         = 0x0000FF ; blue
32
        COLOR_LINE                = 0xFFFFFF ; white
32
        COLOR_LINE                = 0xFFFFFF ; white
33
        COLOR_TXT_NORMAL          = 0xFFFFFF ; white
33
        COLOR_TXT_NORMAL          = 0xFFFFFF ; white
34
        COLOR_TXT_INACTIVE        = 0x808080 ; grey
34
        COLOR_TXT_INACTIVE        = 0x808080 ; grey
35
        COLOR_TXT_CHANGED         = 0x00AA00 ; green
35
        COLOR_TXT_CHANGED         = 0x00AA00 ; green
36
        COLOR_TXT_LABEL           = COLOR_TXT_NORMAL
36
        COLOR_TXT_LABEL           = COLOR_TXT_NORMAL
37
        COLOR_TXT_SELECTED        = 0xFFFFFF ; white
37
        COLOR_TXT_SELECTED        = 0xFFFFFF ; white
38
        COLOR_TXT_HEX             = COLOR_TXT_NORMAL
38
        COLOR_TXT_HEX             = COLOR_TXT_NORMAL
39
        COLOR_TXT_BREAKPOINT      = COLOR_TXT_NORMAL
39
        COLOR_TXT_BREAKPOINT      = COLOR_TXT_NORMAL
40
 
40
 
41
else  ; BLACK ON WHITE
41
else  ; BLACK ON WHITE
42
 
42
 
43
        COLOR_BG_NORMAL           = 0xffffff ; white
43
        COLOR_BG_NORMAL           = 0xffffff ; white
44
        COLOR_BG_BREAKPOINT       = 0xFF0000 ; red
44
        COLOR_BG_BREAKPOINT       = 0xFF0000 ; red
45
        COLOR_BG_SELECTED         = 0x0000FF ; blue
45
        COLOR_BG_SELECTED         = 0x0000FF ; blue
46
        COLOR_LINE                = 0x000000 ; black
46
        COLOR_LINE                = 0x000000 ; black
47
        COLOR_TXT_NORMAL          = 0x000000 ; black
47
        COLOR_TXT_NORMAL          = 0x000000 ; black
48
        COLOR_TXT_INACTIVE        = 0x808080 ; grey
48
        COLOR_TXT_INACTIVE        = 0x808080 ; grey
49
        COLOR_TXT_CHANGED         = 0x00AA00 ; green
49
        COLOR_TXT_CHANGED         = 0x00AA00 ; green
50
        COLOR_TXT_LABEL           = COLOR_TXT_NORMAL
50
        COLOR_TXT_LABEL           = COLOR_TXT_NORMAL
51
        COLOR_TXT_SELECTED        = 0xFFFFFF ; white
51
        COLOR_TXT_SELECTED        = 0xFFFFFF ; white
52
        COLOR_TXT_HEX             = COLOR_TXT_NORMAL
52
        COLOR_TXT_HEX             = COLOR_TXT_NORMAL
53
        COLOR_TXT_BREAKPOINT      = COLOR_TXT_NORMAL
53
        COLOR_TXT_BREAKPOINT      = COLOR_TXT_NORMAL
54
 
54
 
55
end if
55
end if
56
 
56
 
57
;-----------------------------------------------------------------------------
57
;-----------------------------------------------------------------------------
58
 
58
 
59
data_width      equ 80
59
data_width              = 80
60
data_x_pos      equ 12
60
data_x_pos              = 12
61
data_x_size     equ data_width*6
61
data_x_size             = data_width*6
62
 
62
 
63
title_x_pos     equ 30
63
title_x_pos             = 30
64
title_y_pos     equ 8
64
title_y_pos             = 8
65
title_y_size    equ 10
65
title_y_size            = 10
66
 
-
 
67
;dump_y_pos      equ (registers_y_pos + registers_y_size + 5)
66
 
68
dump_y_pos      equ (title_y_pos + title_y_size)
67
dump_y_pos              = (title_y_pos + title_y_size)
69
dump_height     equ 6
68
dump_height             = 6
70
dump_y_size     equ (dump_height*10)
69
dump_y_size             = (dump_height*10)
71
 
70
 
72
disasm_y_pos    equ (dump_y_pos + dump_y_size + 4)
71
disasm_y_pos            = (dump_y_pos + dump_y_size + 4)
73
disasm_height   equ 18
72
min_disasm_height       = 18
74
disasm_y_size   equ (disasm_height*10)
73
min_disasm_y_size       = (min_disasm_height*10)
75
 
74
 
76
messages_width  equ data_width
75
messages_width          = data_width
77
messages_height equ 8
76
messages_height         = 8
78
messages_x_pos  equ data_x_pos
77
messages_x_pos          = data_x_pos
79
messages_y_pos  equ (disasm_y_pos + disasm_y_size + 4)
78
min_messages_y_pos      = (disasm_y_pos + min_disasm_y_size + 4)
80
messages_x_size equ messages_width*6
79
messages_x_size         = messages_width*6
81
messages_y_size equ messages_height*10
80
messages_y_size         = messages_height*10
82
 
81
 
83
cmdline_width   equ data_width
82
cmdline_width           = data_width
84
cmdline_x_pos   equ data_x_pos
83
cmdline_x_pos           = data_x_pos
85
cmdline_y_pos   equ (messages_y_pos + messages_y_size + 4)
84
min_cmdline_y_pos       = (min_messages_y_pos + messages_y_size + 4)
86
cmdline_x_size  equ messages_x_size
85
cmdline_x_size          = messages_x_size
87
cmdline_y_size  equ 10
86
cmdline_y_size          = 10
88
 
87
 
89
registers_x_pos equ (data_x_pos + messages_x_size + 4)
88
registers_x_pos         = (data_x_pos + messages_x_size + 4)
90
registers_y_pos equ (title_y_pos + title_y_size - 3)
89
registers_y_pos         = (title_y_pos + title_y_size - 3)
91
registers_x_size equ 134+2*6
90
registers_x_size        = 134+2*6
92
registers_y_size equ (cmdline_y_pos + cmdline_y_size - registers_y_pos+1)
91
registers_y_size        = (min_cmdline_y_pos + cmdline_y_size - registers_y_pos+1)
93
 
92
 
94
wnd_x_size      equ (data_x_pos + messages_x_size + data_x_pos + registers_x_size+3) + 10
93
wnd_x_size              = (data_x_pos + messages_x_size + data_x_pos + registers_x_size+3) + 10
95
wnd_y_size      equ (cmdline_y_pos + cmdline_y_size + data_x_pos)
94
wnd_y_size              = (min_cmdline_y_pos + cmdline_y_size + data_x_pos)
96
 
95
 
97
;-----------------------------------------------------------------------------
96
;-----------------------------------------------------------------------------
98
;                          Entry point
97
;                          Entry point
99
 
98
 
100
; TODO: split all gui part in independent function, move entry point into mtdbg.asm
99
; TODO: split all gui part in independent function, move entry point into mtdbg.asm
101
 
100
 
102
start:
101
start:
103
        ; initialize process heap
102
        ; initialize process heap
104
        mcall   68, 11
103
        mcall   68, 11
105
 
104
 
106
        push    eax
105
        push    eax
107
        fstcw   word [esp]
106
        fstcw   word [esp]
108
        pop     eax
107
        pop     eax
109
        and     ax, not (3 shl 10)
108
        and     ax, not (3 shl 10)
110
        or      ax, 1 shl 10    ; set round-to-minus infinity mode
109
        or      ax, 1 shl 10    ; set round-to-minus infinity mode
111
        push    eax
110
        push    eax
112
        fldcw   word [esp]
111
        fldcw   word [esp]
113
        pop     eax
112
        pop     eax
114
 
113
 
115
        mov     edi, messages
114
        mov     edi, messages
116
        mov     ecx, messages_width*messages_height
115
        mov     ecx, messages_width*messages_height
117
        mov     al, ' '
116
        mov     al, ' '
118
        rep stosb
117
        rep stosb
119
        xor     eax, eax
118
        xor     eax, eax
120
        mov     [messages_pos], eax
119
        mov     [messages_pos], eax
121
        mov     [cmdline_len], eax
120
        mov     [cmdline_len], eax
122
        mov     [cmdline_pos], eax
121
        mov     [cmdline_pos], eax
123
        mov     edi, needzerostart
122
        mov     edi, needzerostart
124
        mov     ecx, (needzeroend-needzerostart+3)/4
123
        mov     ecx, (needzeroend-needzerostart+3)/4
125
        rep stosd
124
        rep stosd
126
        mov     esi, begin_str
125
        mov     esi, begin_str
127
        call    put_message_nodraw
126
        call    put_message_nodraw
128
        ; set event mask - default events and debugging events
127
        ; set event mask - default events and debugging events
129
        mcall   40, 0x107
128
        mcall   40, 0x107
130
        ; set debug messages buffer
129
        ; set debug messages buffer
131
        mov     ecx, dbgbufsize
130
        mov     ecx, dbgbufsize
132
        mov     dword [ecx], 256
131
        mov     dword [ecx], 256
133
        xor     ebx, ebx
132
        xor     ebx, ebx
134
        mov     [ecx+4], ebx
133
        mov     [ecx+4], ebx
135
        mov     al, 69
134
        mov     al, 69
136
        mcall
135
        mcall
137
        mov     esi, i_param
136
        mov     esi, i_param
138
        call    get_arg.skip_spaces
137
        call    get_arg.skip_spaces
139
        test    al, al
138
        test    al, al
140
        jz      dodraw
139
        jz      dodraw
141
        push    esi
140
        push    esi
142
        call    draw_window
141
        call    draw_window
143
        pop     esi
142
        pop     esi
144
        call    OnLoadInit
143
        call    OnLoadInit
145
        jmp     waitevent
144
        jmp     waitevent
146
 
145
 
147
dodraw:
146
dodraw:
148
        call    draw_window
147
        call    draw_window
149
 
148
 
150
waitevent:
149
waitevent:
151
        mcall   10
150
        mcall   10
152
        cmp     al, 9
151
        cmp     al, 9
153
        jz      debugmsg
152
        jz      debugmsg
154
        dec     eax
153
        dec     eax
155
        jz      dodraw
154
        jz      dodraw
156
        dec     eax
155
        dec     eax
157
        jz      keypressed
156
        jz      keypressed
158
        dec     eax
157
        dec     eax
159
        jnz     waitevent
158
        jnz     waitevent
160
        ; button pressed - we have only one button (close)
159
        ; button pressed - we have only one button (close)
161
        mcall   -1
160
        mcall   -1
162
 
161
 
163
; TODO: split in more independent function
162
; TODO: split in more independent function
164
keypressed:
163
keypressed:
165
        mov     al, 2
164
        mov     al, 2
166
        mcall
165
        mcall
167
        shr     eax, 8
166
        shr     eax, 8
168
        cmp     al, 8
167
        cmp     al, 8
169
        jz      .backspace
168
        jz      .backspace
170
        cmp     al, 0xB0
169
        cmp     al, 0xB0
171
        jz      .left
170
        jz      .left
172
        cmp     al, 0xB3
171
        cmp     al, 0xB3
173
        jz      .right
172
        jz      .right
174
        cmp     al, 0x0D
173
        cmp     al, 0x0D
175
        jz      .enter
174
        jz      .enter
176
        cmp     al, 0xB6
175
        cmp     al, 0xB6
177
        jz      .del
176
        jz      .del
178
        cmp     al, 0xB4
177
        cmp     al, 0xB4
179
        jz      .home
178
        jz      .home
180
        cmp     al, 0xB5
179
        cmp     al, 0xB5
181
        jz      .end
180
        jz      .end
182
        cmp     al, 0xB1
181
        cmp     al, 0xB1
183
        jz      .down
182
        jz      .down
184
        cmp     al, 0xB2
183
        cmp     al, 0xB2
185
        jz      .up
184
        jz      .up
186
        cmp     ah, 0x41
185
        cmp     ah, 0x41
187
        jz      F7
186
        jz      F7
188
        cmp     ah, 0x42
187
        cmp     ah, 0x42
189
        jz      F8
188
        jz      F8
190
        cmp     [cmdline_len], cmdline_width
189
        cmp     [cmdline_len], cmdline_width
191
        jae     waitevent
190
        jae     waitevent
192
        push    eax
191
        push    eax
193
        call    clear_cmdline_end
192
        call    clear_cmdline_end
194
        pop     eax
193
        pop     eax
195
        mov     edi, cmdline
194
        mov     edi, cmdline
196
        mov     ecx, [cmdline_len]
195
        mov     ecx, [cmdline_len]
197
        add     edi, ecx
196
        add     edi, ecx
198
        lea     esi, [edi-1]
197
        lea     esi, [edi-1]
199
        sub     ecx, [cmdline_pos]
198
        sub     ecx, [cmdline_pos]
200
        std
199
        std
201
        rep movsb
200
        rep movsb
202
        cld
201
        cld
203
        stosb
202
        stosb
204
        inc     [cmdline_len]
203
        inc     [cmdline_len]
205
        call    draw_cmdline_end
204
        call    draw_cmdline_end
206
        inc     [cmdline_pos]
205
        inc     [cmdline_pos]
207
        call    draw_cursor
206
        call    draw_cursor
208
        jmp     waitevent
207
        jmp     waitevent
209
 
208
 
210
    .backspace:
209
    .backspace:
211
        cmp     [cmdline_pos], 0
210
        cmp     [cmdline_pos], 0
212
        jz      waitevent
211
        jz      waitevent
213
        dec     [cmdline_pos]
212
        dec     [cmdline_pos]
214
 
213
 
215
    .delchar:
214
    .delchar:
216
        call    clear_cmdline_end
215
        call    clear_cmdline_end
217
        mov     edi, [cmdline_pos]
216
        mov     edi, [cmdline_pos]
218
        dec     [cmdline_len]
217
        dec     [cmdline_len]
219
        mov     ecx, [cmdline_len]
218
        mov     ecx, [cmdline_len]
220
        sub     ecx, edi
219
        sub     ecx, edi
221
        add     edi, cmdline
220
        add     edi, cmdline
222
        lea     esi, [edi+1]
221
        lea     esi, [edi+1]
223
        rep movsb
222
        rep movsb
224
        call    draw_cmdline_end
223
        call    draw_cmdline_end
225
        call    draw_cursor
224
        call    draw_cursor
226
        jmp     waitevent
225
        jmp     waitevent
227
 
226
 
228
    .del:
227
    .del:
229
        mov     eax, [cmdline_pos]
228
        mov     eax, [cmdline_pos]
230
        cmp     eax, [cmdline_len]
229
        cmp     eax, [cmdline_len]
231
        jae     waitevent
230
        jae     waitevent
232
        jmp     .delchar
231
        jmp     .delchar
233
 
232
 
234
    .left:
233
    .left:
235
        cmp     [cmdline_pos], 0
234
        cmp     [cmdline_pos], 0
236
        jz      waitevent
235
        jz      waitevent
237
        call    hide_cursor
236
        call    hide_cursor
238
        dec     [cmdline_pos]
237
        dec     [cmdline_pos]
239
        call    draw_cursor
238
        call    draw_cursor
240
        jmp     waitevent
239
        jmp     waitevent
241
 
240
 
242
    .right:
241
    .right:
243
        mov     eax, [cmdline_pos]
242
        mov     eax, [cmdline_pos]
244
        cmp     eax, [cmdline_len]
243
        cmp     eax, [cmdline_len]
245
        jae     waitevent
244
        jae     waitevent
246
        call    hide_cursor
245
        call    hide_cursor
247
        inc     [cmdline_pos]
246
        inc     [cmdline_pos]
248
        call    draw_cursor
247
        call    draw_cursor
249
        jmp     waitevent
248
        jmp     waitevent
250
 
249
 
251
    .home:
250
    .home:
252
        call    hide_cursor
251
        call    hide_cursor
253
        and     [cmdline_pos], 0
252
        and     [cmdline_pos], 0
254
        call    draw_cursor
253
        call    draw_cursor
255
        jmp     waitevent
254
        jmp     waitevent
256
 
255
 
257
    .end:
256
    .end:
258
        call    hide_cursor
257
        call    hide_cursor
259
        mov     eax, [cmdline_len]
258
        mov     eax, [cmdline_len]
260
        mov     [cmdline_pos], eax
259
        mov     [cmdline_pos], eax
261
        call    draw_cursor
260
        call    draw_cursor
262
 
261
 
263
    .up:
262
    .up:
264
    .down:
263
    .down:
265
        jmp     waitevent
264
        jmp     waitevent
266
 
265
 
267
        ; We also trying to execute previous command, if empty command_line
266
        ; We also trying to execute previous command, if empty command_line
268
    .enter:
267
    .enter:
269
        mov     ecx, [cmdline_len]
268
        mov     ecx, [cmdline_len]
270
        test    ecx, ecx
269
        test    ecx, ecx
271
        jnz     .exec_cur
270
        jnz     .exec_cur
272
        mov     cl, byte [cmdline_prev]
271
        mov     cl, byte [cmdline_prev]
273
        cmp     cl, 0
272
        cmp     cl, 0
274
        jz      waitevent
273
        jz      waitevent
275
 
274
 
276
    .exec_prev:
275
    .exec_prev:
277
        mov     esi, cmdline_prev
276
        mov     esi, cmdline_prev
278
        jmp     .exec
277
        jmp     .exec
279
 
278
 
280
    .exec_cur:
279
    .exec_cur:
281
        mov     esi, cmdline
280
        mov     esi, cmdline
282
 
281
 
283
    .exec:
282
    .exec:
284
        mov     byte [esi+ecx], 0
283
        mov     byte [esi+ecx], 0
285
        and     [cmdline_pos], 0
284
        and     [cmdline_pos], 0
286
        push    esi
285
        push    esi
287
        call    clear_cmdline_end
286
        call    clear_cmdline_end
288
        call    draw_cursor
287
        call    draw_cursor
289
        pop     esi
288
        pop     esi
290
        and     [cmdline_len], 0
289
        and     [cmdline_len], 0
291
        ; skip leading spaces
290
        ; skip leading spaces
292
        call    get_arg.skip_spaces
291
        call    get_arg.skip_spaces
293
        cmp     al, 0
292
        cmp     al, 0
294
        jz      waitevent
293
        jz      waitevent
295
        ; now esi points to command
294
        ; now esi points to command
296
        push    esi
295
        push    esi
297
        mov     esi, prompt
296
        mov     esi, prompt
298
        call    put_message_nodraw
297
        call    put_message_nodraw
299
        pop     esi
298
        pop     esi
300
        push    esi
299
        push    esi
301
        call    put_message_nodraw
300
        call    put_message_nodraw
302
 
301
 
303
; TODO: add meaningful name
302
; TODO: add meaningful name
304
z1:
303
z1:
305
        mov     esi, newline
304
        mov     esi, newline
306
        call    put_message
305
        call    put_message
307
        pop     esi
306
        pop     esi
308
        push    esi
307
        push    esi
309
        call    get_arg
308
        call    get_arg
310
        mov     [curarg], esi
309
        mov     [curarg], esi
311
        pop     edi
310
        pop     edi
312
        mov     esi, commands
311
        mov     esi, commands
313
        call    find_cmd
312
        call    find_cmd
314
        mov     eax, aUnknownCommand
313
        mov     eax, aUnknownCommand
315
        jc      .x11
314
        jc      .x11
316
 
315
 
317
        ; check command requirements
316
        ; check command requirements
318
        ; flags field:
317
        ; flags field:
319
        ; &1: command may be called without parameters
318
        ; &1: command may be called without parameters
320
        ; &2: command may be called with parameters
319
        ; &2: command may be called with parameters
321
        ; &4: command may be called without loaded program
320
        ; &4: command may be called without loaded program
322
        ; &8: command may be called with loaded program
321
        ; &8: command may be called with loaded program
323
        mov     eax, [esi+8]
322
        mov     eax, [esi+8]
324
        mov     ecx, [curarg]
323
        mov     ecx, [curarg]
325
        cmp     byte [ecx], 0
324
        cmp     byte [ecx], 0
326
        jz      .noargs
325
        jz      .noargs
327
        test    byte [esi+16], 2
326
        test    byte [esi+16], 2
328
        jz      .x11
327
        jz      .x11
329
        jmp     @f
328
        jmp     @f
330
 
329
 
331
    .noargs:
330
    .noargs:
332
        test    byte [esi+16], 1
331
        test    byte [esi+16], 1
333
        jz      .x11
332
        jz      .x11
334
 
333
 
335
    @@:
334
    @@:
336
        cmp     [debuggee_pid], 0
335
        cmp     [debuggee_pid], 0
337
        jz      .nodebuggee
336
        jz      .nodebuggee
338
        mov     eax, aAlreadyLoaded
337
        mov     eax, aAlreadyLoaded
339
        test    byte [esi+16], 8
338
        test    byte [esi+16], 8
340
        jz      .x11
339
        jz      .x11
341
        jmp     .x9
340
        jmp     .x9
342
 
341
 
343
    .nodebuggee:
342
    .nodebuggee:
344
        mov     eax, need_debuggee
343
        mov     eax, need_debuggee
345
        test    byte [esi+16], 4
344
        test    byte [esi+16], 4
346
        jnz     .x9
345
        jnz     .x9
347
 
346
 
348
    .x11:
347
    .x11:
349
        xchg    esi, eax
348
        xchg    esi, eax
350
        call    put_message
349
        call    put_message
351
 
350
 
352
        ; store cmdline for repeating
351
        ; store cmdline for repeating
353
    .x10:
352
    .x10:
354
        mov     esi, cmdline
353
        mov     esi, cmdline
355
        mov     ecx, [cmdline_len]
354
        mov     ecx, [cmdline_len]
356
 
355
 
357
    @@:
356
    @@:
358
        cmp     ecx, 0
357
        cmp     ecx, 0
359
        jle     .we
358
        jle     .we
360
        mov     al, [esi + ecx]
359
        mov     al, [esi + ecx]
361
        mov     [cmdline_prev + ecx], al
360
        mov     [cmdline_prev + ecx], al
362
        dec     ecx
361
        dec     ecx
363
        jmp     @b
362
        jmp     @b
364
 
363
 
365
    .we:
364
    .we:
366
        mov     [cmdline_len], 0
365
        mov     [cmdline_len], 0
367
        jmp     waitevent
366
        jmp     waitevent
368
 
367
 
369
    .x9:
368
    .x9:
370
        call    dword [esi+4]
369
        call    dword [esi+4]
371
        jmp     .x10
370
        jmp     .x10
372
 
371
 
373
;-----------------------------------------------------------------------------
372
;-----------------------------------------------------------------------------
374
;                            Cmdline handling
373
;                            Cmdline handling
375
 
374
 
376
clear_cmdline_end:
375
clear_cmdline_end:
377
        mov     ebx, [cmdline_pos]
376
        mov     ebx, [cmdline_pos]
378
        mov     ecx, [cmdline_len]
377
        mov     ecx, [cmdline_len]
379
        sub     ecx, ebx
378
        sub     ecx, ebx
380
        imul    ebx, 6
379
        imul    ebx, 6
381
        imul    ecx, 6
380
        imul    ecx, 6
382
        inc     ecx
381
        inc     ecx
383
        add     ebx, cmdline_x_pos
382
        add     ebx, cmdline_x_pos
384
        shl     ebx, 16
383
        shl     ebx, 16
385
        or      ebx, ecx
384
        or      ebx, ecx
386
        mov     ecx, [cmdline_y_pos_dd]
385
        mov     ecx, [cmdline_y_pos_dd]
387
        mov     cx, cmdline_y_size
386
        mov     cx, cmdline_y_size
388
        mov     edx, COLOR_BG_NORMAL
387
        mov     edx, COLOR_BG_NORMAL
389
        ; draw container rectangle/box for cmdline
388
        ; draw container rectangle/box for cmdline
390
        mcall   13
389
        mcall   13
391
        ret
390
        ret
392
 
391
 
393
draw_cmdline:
392
draw_cmdline:
394
        xor     ebx, ebx
393
        xor     ebx, ebx
395
        jmp     @f
394
        jmp     @f
396
 
395
 
397
; TODO: make it local
396
; TODO: make it local
398
draw_cmdline_end:
397
draw_cmdline_end:
399
        mov     ebx, [cmdline_pos]
398
        mov     ebx, [cmdline_pos]
400
 
399
 
401
    @@:
400
    @@:
402
        mov     esi, [cmdline_len]
401
        mov     esi, [cmdline_len]
403
        sub     esi, ebx
402
        sub     esi, ebx
404
 
403
 
405
        mov     ecx, COLOR_TXT_NORMAL
404
        mov     ecx, COLOR_TXT_NORMAL
406
        lea     edx, [cmdline+ebx]
405
        lea     edx, [cmdline+ebx]
407
        imul    ebx, 6
406
        imul    ebx, 6
408
        add     ebx, cmdline_x_pos
407
        add     ebx, cmdline_x_pos
409
        shl     ebx, 16
408
        shl     ebx, 16
410
        mov     bx, word[cmdline_y_pos_dd+4]
409
        mov     bx, word[cmdline_y_pos_dd+4]
411
        inc     bx
410
        inc     bx
412
        ; draw a text string in the window
411
        ; draw a text string in the window
413
        mcall   4
412
        mcall   4
414
        ret
413
        ret
415
 
414
 
416
;-----------------------------------------------------------------------------
415
;-----------------------------------------------------------------------------
417
;                        Working with messages
416
;                        Working with messages
418
; in: esi->ASCIIZ message
417
; in: esi->ASCIIZ message
419
put_message_nodraw:
418
put_message_nodraw:
420
        mov     edx, [messages_pos]
419
        mov     edx, [messages_pos]
421
 
420
 
422
    .m:
421
    .m:
423
        lea     edi, [messages+edx]
422
        lea     edi, [messages+edx]
424
 
423
 
425
    .l:
424
    .l:
426
        lodsb
425
        lodsb
427
        cmp     al, 0
426
        cmp     al, 0
428
        jz      .done
427
        jz      .done
429
        call    test_scroll
428
        call    test_scroll
430
        cmp     al, 10
429
        cmp     al, 10
431
        jz      .newline
430
        jz      .newline
432
        cmp     al, '%'
431
        cmp     al, '%'
433
        jnz     @f
432
        jnz     @f
434
        cmp     dword [esp], z1
433
        cmp     dword [esp], z1
435
        jnz     .format
434
        jnz     .format
436
 
435
 
437
    @@:
436
    @@:
438
        stosb
437
        stosb
439
        inc     edx
438
        inc     edx
440
        jmp     .l
439
        jmp     .l
441
 
440
 
442
    .newline:
441
    .newline:
443
        push    edx
442
        push    edx
444
        mov     ecx, messages_width
443
        mov     ecx, messages_width
445
        xor     eax, eax
444
        xor     eax, eax
446
        xchg    eax, edx
445
        xchg    eax, edx
447
        div     ecx
446
        div     ecx
448
        xchg    eax, edx
447
        xchg    eax, edx
449
        pop     edx
448
        pop     edx
450
        test    eax, eax
449
        test    eax, eax
451
        jz      .m
450
        jz      .m
452
        sub     edx, eax
451
        sub     edx, eax
453
        add     edx, ecx
452
        add     edx, ecx
454
        jmp     .m
453
        jmp     .m
455
 
454
 
456
    .done:
455
    .done:
457
        mov     [messages_pos], edx
456
        mov     [messages_pos], edx
458
        ret
457
        ret
459
 
458
 
460
        ; at this moment all format specs must be %X
459
        ; at this moment all format specs must be %X
461
    .format:
460
    .format:
462
        lodsb   ; get 
461
        lodsb   ; get 
463
        sub     al, '0'
462
        sub     al, '0'
464
        movzx   ecx, al
463
        movzx   ecx, al
465
        lodsb
464
        lodsb
466
        pop     eax
465
        pop     eax
467
        pop     ebp
466
        pop     ebp
468
        push    eax
467
        push    eax
469
        ; write number in ebp with ecx digits
468
        ; write number in ebp with ecx digits
470
        dec     ecx
469
        dec     ecx
471
        shl     ecx, 2
470
        shl     ecx, 2
472
 
471
 
473
    .writenibble:
472
    .writenibble:
474
        push    ecx
473
        push    ecx
475
        call    test_scroll
474
        call    test_scroll
476
        pop     ecx
475
        pop     ecx
477
        mov     eax, ebp
476
        mov     eax, ebp
478
        shr     eax, cl
477
        shr     eax, cl
479
        and     al, 0xF
478
        and     al, 0xF
480
        cmp     al, 10
479
        cmp     al, 10
481
        sbb     al, 69h
480
        sbb     al, 69h
482
        das
481
        das
483
        stosb
482
        stosb
484
        inc     edx
483
        inc     edx
485
        sub     ecx, 4
484
        sub     ecx, 4
486
        jns     .writenibble
485
        jns     .writenibble
487
        jmp     .l
486
        jmp     .l
488
 
487
 
489
test_scroll:
488
test_scroll:
490
        cmp     edx, messages_width*messages_height
489
        cmp     edx, messages_width*messages_height
491
        jnz     .ret
490
        jnz     .ret
492
        push    esi
491
        push    esi
493
        mov     edi, messages
492
        mov     edi, messages
494
        lea     esi, [edi+messages_width]
493
        lea     esi, [edi+messages_width]
495
        mov     ecx, (messages_height-1)*messages_width/4
494
        mov     ecx, (messages_height-1)*messages_width/4
496
        rep movsd
495
        rep movsd
497
        push    eax
496
        push    eax
498
        mov     al, ' '
497
        mov     al, ' '
499
        push    edi
498
        push    edi
500
        push    messages_width
499
        push    messages_width
501
        pop     ecx
500
        pop     ecx
502
        sub     edx, ecx
501
        sub     edx, ecx
503
        rep stosb
502
        rep stosb
504
        pop     edi
503
        pop     edi
505
        pop     eax
504
        pop     eax
506
        pop     esi
505
        pop     esi
507
 
506
 
508
    .ret:
507
    .ret:
509
        ret
508
        ret
510
 
509
 
511
;-----------------------------------------------------------------------------
510
;-----------------------------------------------------------------------------
512
 
511
 
513
put_message:
512
put_message:
514
        call    put_message_nodraw
513
        call    put_message_nodraw
515
 
514
 
516
draw_messages:
515
draw_messages:
517
        ; draw container rectangle/box
516
        ; draw container rectangle/box
518
        mov     ebx, messages_x_pos shl 16
517
        mov     ebx, messages_x_pos shl 16
519
        add     ebx, [messages_x_size_dd+4]
518
        add     ebx, [messages_x_size_dd+4]
520
        mov     ecx, [messages_y_pos_dd]
519
        mov     ecx, [messages_y_pos_dd]
521
        mov     cx, messages_y_size
520
        mov     cx, messages_y_size
522
        mcall   13, , , COLOR_BG_NORMAL
521
        mcall   13, , , COLOR_BG_NORMAL
523
        mov     edx, messages
522
        mov     edx, messages
524
        push    messages_width
523
        push    messages_width
525
        pop     esi
524
        pop     esi
526
        mov     ecx, COLOR_TXT_NORMAL
525
        mov     ecx, COLOR_TXT_NORMAL
527
        mov     ebx, messages_x_pos*10000h
526
        mov     ebx, messages_x_pos*10000h
528
        mov     bx, word[messages_y_pos_dd+4]
527
        mov     bx, word[messages_y_pos_dd+4]
529
 
528
 
530
    @@:
529
    @@:
531
        ; display text string in the window
530
        ; display text string in the window
532
        mcall   4
531
        mcall   4
533
        add     edx, esi
532
        add     edx, esi
534
        add     ebx, 10
533
        add     ebx, 10
535
        cmp     edx, messages+messages_width*messages_height
534
        cmp     edx, messages+messages_width*messages_height
536
        jb      @b
535
        jb      @b
537
        ret
536
        ret
538
 
537
 
539
;-----------------------------------------------------------------------------
538
;-----------------------------------------------------------------------------
540
;                     Show/hide cursor in command line
539
;                     Show/hide cursor in command line
541
 
540
 
542
; TODO: make it cursor.draw and cursor.hide ???
541
; TODO: make it cursor.draw and cursor.hide ???
543
draw_cursor:
542
draw_cursor:
544
        mov     ecx, [cmdline_y_pos_dd+2]
543
        mov     ecx, [cmdline_y_pos_dd+2]
545
        add     cx, cmdline_y_size-1
544
        add     cx, cmdline_y_size-1
546
        mov     ebx, [cmdline_pos]
545
        mov     ebx, [cmdline_pos]
547
        imul    ebx, 6
546
        imul    ebx, 6
548
        add     ebx, cmdline_x_pos
547
        add     ebx, cmdline_x_pos
549
        mov     edx, ebx
548
        mov     edx, ebx
550
        shl     ebx, 16
549
        shl     ebx, 16
551
        or      ebx, edx
550
        or      ebx, edx
552
        mov     edx, COLOR_TXT_NORMAL
551
        mov     edx, COLOR_TXT_NORMAL
553
        ; draw line
552
        ; draw line
554
        mcall   38
553
        mcall   38
555
        ret
554
        ret
556
 
555
 
557
hide_cursor:
556
hide_cursor:
558
        mov     ebx, [cmdline_pos]
557
        mov     ebx, [cmdline_pos]
559
        imul    ebx, 6
558
        imul    ebx, 6
560
        add     ebx, cmdline_x_pos
559
        add     ebx, cmdline_x_pos
561
        shl     ebx, 16
560
        shl     ebx, 16
562
        inc     ebx
561
        inc     ebx
563
        mov     ecx, [cmdline_y_pos_dd]
562
        mov     ecx, [cmdline_y_pos_dd]
564
        mov     cx, cmdline_y_size
563
        mov     cx, cmdline_y_size
565
        mov     edx, COLOR_BG_NORMAL
564
        mov     edx, COLOR_BG_NORMAL
566
        ; draw container rectangle/box
565
        ; draw container rectangle/box
567
        mcall   13
566
        mcall   13
568
        mov     ebx, [cmdline_pos]
567
        mov     ebx, [cmdline_pos]
569
        cmp     ebx, [cmdline_len]
568
        cmp     ebx, [cmdline_len]
570
        jae     .ret
569
        jae     .ret
571
        ; setting up text color scheme and attributes
570
        ; setting up text color scheme and attributes
572
        mov     ecx, COLOR_TXT_NORMAL
571
        mov     ecx, COLOR_TXT_NORMAL
573
        lea     edx, [cmdline+ebx]
572
        lea     edx, [cmdline+ebx]
574
        imul    ebx, 6
573
        imul    ebx, 6
575
        add     ebx, cmdline_x_pos
574
        add     ebx, cmdline_x_pos
576
        shl     ebx, 16
575
        shl     ebx, 16
577
        mov     bx, word[cmdline_y_pos_dd+4]
576
        mov     bx, word[cmdline_y_pos_dd+4]
578
        inc     bx
577
        inc     bx
579
        push    1
578
        push    1
580
        pop     esi
579
        pop     esi
581
        ; draw text string in the window
580
        ; draw text string in the window
582
        mcall   4
581
        mcall   4
583
 
582
 
584
    .ret:
583
    .ret:
585
        ret
584
        ret
586
 
585
 
587
;-----------------------------------------------------------------------------
586
;-----------------------------------------------------------------------------
588
;                       Draw program window title
587
;                       Draw program window title
589
 
588
 
590
; FIXME: something wrong here
589
; FIXME: something wrong here
591
redraw_title:
590
redraw_title:
592
        ; draw container rectangle/box
591
        ; draw container rectangle/box
593
        mov     ebx, [data_x_size_dd+4]
592
        mov     ebx, [data_x_size_dd+4]
594
        add     ebx, title_x_pos*10000h+data_x_pos-title_x_pos
593
        add     ebx, title_x_pos*10000h+data_x_pos-title_x_pos
595
        mcall   13, , title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL
594
        mcall   13, , title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL
596
 
595
 
597
draw_title:
596
draw_title:
598
        mcall   38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE
597
        mcall   38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE
599
        push    NoPrgLoaded_len
598
        push    NoPrgLoaded_len
600
        pop     esi
599
        pop     esi
601
        cmp     [debuggee_pid], 0
600
        cmp     [debuggee_pid], 0
602
        jz      @f
601
        jz      @f
603
        mov     esi, [prgname_len]
602
        mov     esi, [prgname_len]
604
 
603
 
605
    @@:
604
    @@:
606
        imul    ebx, esi, 6
605
        imul    ebx, esi, 6
607
        add     ebx, title_x_pos+4
606
        add     ebx, title_x_pos+4
608
        shl     ebx, 16
607
        shl     ebx, 16
609
        mov     bx, data_x_pos-10-5-6*7
608
        mov     bx, data_x_pos-10-5-6*7
610
        add     bx, word[data_x_size_dd+4]
609
        add     bx, word[data_x_size_dd+4]
611
        cmp     [bSuspended], 0
610
        cmp     [bSuspended], 0
612
        jz      @f
611
        jz      @f
613
        add     ebx, 6
612
        add     ebx, 6
614
 
613
 
615
    @@:
614
    @@:
616
        ; draw line with COLOR_LINE (in edx)
615
        ; draw line with COLOR_LINE (in edx)
617
        mcall
616
        mcall
618
        mov     ebx, [data_x_size_dd+2]
617
        mov     ebx, [data_x_size_dd+2]
619
        add     ebx, (data_x_pos-10+4)*0x10000 + data_x_pos+2
618
        add     ebx, (data_x_pos-10+4)*0x10000 + data_x_pos+2
620
        ; draw line with COLOR_LINE (in edx)
619
        ; draw line with COLOR_LINE (in edx)
621
        mcall
620
        mcall
622
        mov     al, 4
621
        mov     al, 4
623
        mov     ebx, title_x_pos*10000h+title_y_pos
622
        mov     ebx, title_x_pos*10000h+title_y_pos
624
        ; setting up text color scheme and attributes
623
        ; setting up text color scheme and attributes
625
        mov     ecx, COLOR_TXT_NORMAL
624
        mov     ecx, COLOR_TXT_NORMAL
626
        mov     edx, NoPrgLoaded_str
625
        mov     edx, NoPrgLoaded_str
627
        cmp     [debuggee_pid], 0
626
        cmp     [debuggee_pid], 0
628
        jz      @f
627
        jz      @f
629
        mov     edx, [prgname_ptr]
628
        mov     edx, [prgname_ptr]
630
 
629
 
631
    @@:
630
    @@:
632
        ; draw text string in the window
631
        ; draw text string in the window
633
        mcall
632
        mcall
634
        cmp     [debuggee_pid], 0
633
        cmp     [debuggee_pid], 0
635
        jz      .nodebuggee
634
        jz      .nodebuggee
636
        mov     ebx, [data_x_size_dd]
635
        mov     ebx, [data_x_size_dd]
637
        add     ebx, (data_x_pos-10-6*7)*10000h + title_y_pos
636
        add     ebx, (data_x_pos-10-6*7)*10000h + title_y_pos
638
        mov     edx, aRunning
637
        mov     edx, aRunning
639
        push    7
638
        push    7
640
        pop     esi
639
        pop     esi
641
        cmp     [bSuspended], 0
640
        cmp     [bSuspended], 0
642
        jz      @f
641
        jz      @f
643
        add     ebx, 6*10000h
642
        add     ebx, 6*10000h
644
        mov     edx, aPaused
643
        mov     edx, aPaused
645
        dec     esi
644
        dec     esi
646
 
645
 
647
    @@:
646
    @@:
648
        ; draw line with COLOR_LINE (in edx) in one case
647
        ; draw line with COLOR_LINE (in edx) in one case
649
        ; and draw text string with color COLOR_TXT_NORMAL (in ecx) in another
648
        ; and draw text string with color COLOR_TXT_NORMAL (in ecx) in another
650
        mcall
649
        mcall
651
        ret
650
        ret
652
 
651
 
653
    .nodebuggee:
652
    .nodebuggee:
654
        mov     al, 38
653
        mov     al, 38
655
        mov     ebx, [data_x_size_dd+2]
654
        mov     ebx, [data_x_size_dd+2]
656
        add     ebx, (data_x_pos-10-6*7-5)*0x10000 + data_x_pos+2
655
        add     ebx, (data_x_pos-10-6*7-5)*0x10000 + data_x_pos+2
657
        mov     ecx, (title_y_pos+5)*10001h
656
        mov     ecx, (title_y_pos+5)*10001h
658
        mov     edx, COLOR_LINE
657
        mov     edx, COLOR_LINE
659
        jmp     @b
658
        jmp     @b
660
 
659
 
661
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
660
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
662
;;;;;;;;;;;;;;;;;;; REGISTERS PANEL ;;;;;;;;;;;;;;;;;;;;;;;;;;
661
;;;;;;;;;;;;;;;;;;; REGISTERS PANEL ;;;;;;;;;;;;;;;;;;;;;;;;;;
663
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
662
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
664
 
663
 
665
;-----------------------------------------------------------------------------
664
;-----------------------------------------------------------------------------
666
;                      Display common register content
665
;                      Display common register content
667
 
666
 
668
; TODO: add format support (e.g. numerical value, or address offset/pointer)
667
; TODO: add format support (e.g. numerical value, or address offset/pointer)
669
 
668
 
670
; in: esi->value, edx->string, ecx = string length, ebx = coord
669
; in: esi->value, edx->string, ecx = string length, ebx = coord
671
draw_register:
670
draw_register:
672
        push    esi
671
        push    esi
673
        push    edx
672
        push    edx
674
        push    ecx
673
        push    ecx
675
        push    ebp
674
        push    ebp
676
 
675
 
677
        mov     ebp, ecx
676
        mov     ebp, ecx
678
 
677
 
679
        mov     eax, [esi]
678
        mov     eax, [esi]
680
 
679
 
681
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
680
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
682
        cmp     [debuggee_pid], 0
681
        cmp     [debuggee_pid], 0
683
        jz      .cd
682
        jz      .cd
684
        cmp     [bSuspended], 0
683
        cmp     [bSuspended], 0
685
        jz      .cd
684
        jz      .cd
686
 
685
 
687
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
686
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
688
        cmp     eax, dword [esi+oldcontext-context]
687
        cmp     eax, dword [esi+oldcontext-context]
689
        je      .cd
688
        je      .cd
690
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
689
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
691
.cd:
690
.cd:
692
        push    eax                       ;store reg value
691
        push    eax                       ;store reg value
693
 
692
 
694
        mov     esi, ebp
693
        mov     esi, ebp
695
        ; draw a text string in the window
694
        ; draw a text string in the window
696
        mcall   4
695
        mcall   4
697
 
696
 
698
        imul    esi, 60000h
697
        imul    esi, 60000h
699
        lea     edx, [ebx+esi]
698
        lea     edx, [ebx+esi]
700
        mov     esi, ecx
699
        mov     esi, ecx
701
        pop     ecx
700
        pop     ecx
702
 
701
 
703
        ; draw a number in the window
702
        ; draw a number in the window
704
        rol     ecx, 16
703
        rol     ecx, 16
705
        mcall   47, 0x00040100
704
        mcall   47, 0x00040100
706
 
705
 
707
        shr     ecx, 16
706
        shr     ecx, 16
708
        add     edx, (4*6+3) shl 16
707
        add     edx, (4*6+3) shl 16
709
        mcall   47
708
        mcall   47
710
 
709
 
711
        pop     ebp
710
        pop     ebp
712
        pop     ecx
711
        pop     ecx
713
        pop     edx
712
        pop     edx
714
        pop     esi
713
        pop     esi
715
        add     edx, ecx
714
        add     edx, ecx
716
        ret
715
        ret
717
 
716
 
718
;-----------------------------------------------------------------------------
717
;-----------------------------------------------------------------------------
719
;                  Display FPU register (ST0 - ST7) content
718
;                  Display FPU register (ST0 - ST7) content
720
;
719
;
721
; in: ebp->index, ebx = coord
720
; in: ebp->index, ebx = coord
722
 
721
 
723
draw_fpu_register_2:
722
draw_fpu_register_2:
724
 
723
 
725
.str_buf  equ esp
724
.str_buf  equ esp
726
.cvt_buf  equ .str_buf+32
725
.cvt_buf  equ .str_buf+32
727
.bcd_man  equ .cvt_buf+16
726
.bcd_man  equ .cvt_buf+16
728
.bcd_exp  equ .bcd_man+10
727
.bcd_exp  equ .bcd_man+10
729
.exp      equ .bcd_exp+10
728
.exp      equ .bcd_exp+10
730
.tmp      equ .exp+4
729
.tmp      equ .exp+4
731
.lcl_end  equ .tmp+4
730
.lcl_end  equ .tmp+4
732
 
731
 
733
        sub     esp, 32+16+10+10+4+4
732
        sub     esp, 32+16+10+10+4+4
734
 
733
 
735
        mov     edi, .str_buf
734
        mov     edi, .str_buf
736
        shl     ebp, 16
735
        shl     ebp, 16
737
        lea     eax, ['ST0:'+ebp]
736
        lea     eax, ['ST0:'+ebp]
738
        stosd
737
        stosd
739
        mov     eax, 0x20202020
738
        mov     eax, 0x20202020
740
        stosd
739
        stosd
741
        stosd
740
        stosd
742
        stosd
741
        stosd
743
        stosd
742
        stosd
744
        stosd
743
        stosd
745
 
744
 
746
        ;int3
745
        ;int3
747
        ;nop
746
        ;nop
748
 
747
 
749
        movzx   eax, word [_fsw]
748
        movzx   eax, word [_fsw]
750
        shr     eax, 11
749
        shr     eax, 11
751
        add     eax, ebp
750
        add     eax, ebp
752
        shr     ebp, 12
751
        shr     ebp, 12
753
        and     eax, 7
752
        and     eax, 7
754
        bt      dword [_ftw], eax
753
        bt      dword [_ftw], eax
755
        jc     .A6M
754
        jc     .A6M
756
 
755
 
757
        mov     dword [.str_buf+8],' emp'
756
        mov     dword [.str_buf+8],' emp'
758
        mov     word [.str_buf+8+4],'ty'
757
        mov     word [.str_buf+8+4],'ty'
759
        jmp     .display
758
        jmp     .display
760
 
759
 
761
        mov     cx, [_st0+ebp+8]
760
        mov     cx, [_st0+ebp+8]
762
        and     cx, 0x7FFF              ;clear sign flag
761
        and     cx, 0x7FFF              ;clear sign flag
763
        jz      .A6M
762
        jz      .A6M
764
 
763
 
765
        cmp     cx, 0x7FFF
764
        cmp     cx, 0x7FFF
766
        jne     .decode
765
        jne     .decode
767
 
766
 
768
        mov     dword [.str_buf+6], ' inv'
767
        mov     dword [.str_buf+6], ' inv'
769
        mov     dword [.str_buf+6+4], 'alid'
768
        mov     dword [.str_buf+6+4], 'alid'
770
        jmp     .display
769
        jmp     .display
771
 
770
 
772
.A6M:
771
.A6M:
773
 
772
 
774
        mov     eax, dword [_st0+ebp]
773
        mov     eax, dword [_st0+ebp]
775
        or      eax, dword [_st0+ebp+4]
774
        or      eax, dword [_st0+ebp+4]
776
        jnz     .decode
775
        jnz     .decode
777
 
776
 
778
        mov     dword [.str_buf+10], ' 0.0'
777
        mov     dword [.str_buf+10], ' 0.0'
779
        jmp     .display
778
        jmp     .display
780
 
779
 
781
.decode:
780
.decode:
782
        fld     tword [_st0+ebp]
781
        fld     tword [_st0+ebp]
783
        fabs
782
        fabs
784
        fld     st0
783
        fld     st0
785
        fldlg2
784
        fldlg2
786
        fld     st1
785
        fld     st1
787
        fyl2x
786
        fyl2x
788
        frndint
787
        frndint
789
        fist    dword [.exp]
788
        fist    dword [.exp]
790
        fld     st0
789
        fld     st0
791
        fbstp   tword [.bcd_exp]
790
        fbstp   tword [.bcd_exp]
792
 
791
 
793
        fldl2t
792
        fldl2t
794
        fmulp
793
        fmulp
795
        fld     st0
794
        fld     st0
796
        frndint
795
        frndint
797
        fxch
796
        fxch
798
        fsub    st,st1
797
        fsub    st,st1
799
 
798
 
800
        f2xm1
799
        f2xm1
801
        fld1
800
        fld1
802
        faddp
801
        faddp
803
        fscale
802
        fscale
804
        fstp    st1
803
        fstp    st1
805
        fdivp
804
        fdivp
806
 
805
 
807
        fist    dword [.tmp]
806
        fist    dword [.tmp]
808
        cmp     dword [.tmp], 10
807
        cmp     dword [.tmp], 10
809
        jae     .fixup
808
        jae     .fixup
810
 
809
 
811
        fstp    st1
810
        fstp    st1
812
        jmp     .done
811
        jmp     .done
813
 
812
 
814
.fixup:
813
.fixup:
815
        fstp st0
814
        fstp st0
816
 
815
 
817
        inc     dword [.exp]
816
        inc     dword [.exp]
818
        fild    dword [.exp]
817
        fild    dword [.exp]
819
        fld     st0
818
        fld     st0
820
        fbstp   tword [.bcd_exp]
819
        fbstp   tword [.bcd_exp]
821
 
820
 
822
        fldl2t
821
        fldl2t
823
        fmulp
822
        fmulp
824
        fld st0
823
        fld st0
825
        frndint
824
        frndint
826
        fxch
825
        fxch
827
        fsub    st,st1
826
        fsub    st,st1
828
 
827
 
829
        f2xm1
828
        f2xm1
830
        fld1
829
        fld1
831
        faddp
830
        faddp
832
        fscale
831
        fscale
833
        fstp    st1
832
        fstp    st1
834
        fdivp
833
        fdivp
835
.done:
834
.done:
836
        fimul   dword [n_digits]
835
        fimul   dword [n_digits]
837
        fbstp   tword [.bcd_man]
836
        fbstp   tword [.bcd_man]
838
 
837
 
839
        lea     edi, [.cvt_buf]
838
        lea     edi, [.cvt_buf]
840
        mov     edx, dword [.bcd_man]
839
        mov     edx, dword [.bcd_man]
841
        mov     ecx, 8
840
        mov     ecx, 8
842
@@:
841
@@:
843
        xor     eax, eax
842
        xor     eax, eax
844
        shld    eax, edx, 4
843
        shld    eax, edx, 4
845
        stosb
844
        stosb
846
        shl     edx, 4
845
        shl     edx, 4
847
        loop    @B
846
        loop    @B
848
 
847
 
849
        lea     esi, [.cvt_buf+7]
848
        lea     esi, [.cvt_buf+7]
850
        lea     edi, [.str_buf+13]
849
        lea     edi, [.str_buf+13]
851
        mov     ecx, 7
850
        mov     ecx, 7
852
        mov     ah, 0x30
851
        mov     ah, 0x30
853
        std
852
        std
854
.skip_z:
853
.skip_z:
855
        lodsb
854
        lodsb
856
        test    al, al
855
        test    al, al
857
        jnz     .body
856
        jnz     .body
858
        loop    .skip_z
857
        loop    .skip_z
859
.body:
858
.body:
860
        add     al, ah
859
        add     al, ah
861
        stosb
860
        stosb
862
        lodsb
861
        lodsb
863
        jcxz    .point
862
        jcxz    .point
864
        loop    .body
863
        loop    .body
865
.point:
864
.point:
866
        dec     edi
865
        dec     edi
867
        add     al, ah
866
        add     al, ah
868
        mov     ah, '.'
867
        mov     ah, '.'
869
        stosw
868
        stosw
870
 
869
 
871
        bt      word [_st0+ebp+8], 15
870
        bt      word [_st0+ebp+8], 15
872
        jnc     .m_sign
871
        jnc     .m_sign
873
        mov     al, '-'
872
        mov     al, '-'
874
        mov     [edi+1], al
873
        mov     [edi+1], al
875
 
874
 
876
.m_sign:
875
.m_sign:
877
        cld
876
        cld
878
 
877
 
879
        mov     dx, word [.bcd_exp]
878
        mov     dx, word [.bcd_exp]
880
        test    dx, dx
879
        test    dx, dx
881
        jz      .display
880
        jz      .display
882
 
881
 
883
        lea     edi, [.str_buf+15]
882
        lea     edi, [.str_buf+15]
884
        mov     ax, 'E '
883
        mov     ax, 'E '
885
        cmp     byte [.bcd_exp+9], 0x80
884
        cmp     byte [.bcd_exp+9], 0x80
886
        jne     .w_e_sign
885
        jne     .w_e_sign
887
        mov     ax, 'E-'
886
        mov     ax, 'E-'
888
 
887
 
889
.w_e_sign:
888
.w_e_sign:
890
        stosw
889
        stosw
891
 
890
 
892
        mov     ecx, 4
891
        mov     ecx, 4
893
.skip_lz:
892
.skip_lz:
894
        xor     eax, eax
893
        xor     eax, eax
895
        shld    ax,dx,4
894
        shld    ax,dx,4
896
        shl     dx, 4
895
        shl     dx, 4
897
        test al, al
896
        test al, al
898
        jnz     .w_exp
897
        jnz     .w_exp
899
        loop    .skip_lz
898
        loop    .skip_lz
900
.w_exp:
899
.w_exp:
901
        add al, 0x30
900
        add al, 0x30
902
        stosb
901
        stosb
903
        xor     eax, eax
902
        xor     eax, eax
904
        shld     ax, dx, 4
903
        shld     ax, dx, 4
905
        shl     dx,4
904
        shl     dx,4
906
        loop    .w_exp
905
        loop    .w_exp
907
 
906
 
908
.display:
907
.display:
909
 
908
 
910
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
909
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
911
        cmp     [debuggee_pid], 0
910
        cmp     [debuggee_pid], 0
912
        jz      .do_label
911
        jz      .do_label
913
        cmp     [bSuspended], 0
912
        cmp     [bSuspended], 0
914
        jz      .do_label
913
        jz      .do_label
915
 
914
 
916
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
915
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
917
 
916
 
918
        mov     eax, dword [_st0+ebp]
917
        mov     eax, dword [_st0+ebp]
919
        cmp     eax, dword [_st0+(oldcontext-context)+ebp]
918
        cmp     eax, dword [_st0+(oldcontext-context)+ebp]
920
        jne     .scol
919
        jne     .scol
921
 
920
 
922
        mov     eax, dword [_st0+ebp+4]
921
        mov     eax, dword [_st0+ebp+4]
923
        cmp     eax, dword [_st0+(oldcontext-context)+ebp+4]
922
        cmp     eax, dword [_st0+(oldcontext-context)+ebp+4]
924
        jne     .scol
923
        jne     .scol
925
 
924
 
926
        mov     ax, word [_st0+ebp+8]
925
        mov     ax, word [_st0+ebp+8]
927
        cmp     ax, word [_st0+(oldcontext-context)+ebp+8]
926
        cmp     ax, word [_st0+(oldcontext-context)+ebp+8]
928
        je      .do_label
927
        je      .do_label
929
 
928
 
930
.scol:
929
.scol:
931
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
930
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
932
 
931
 
933
.do_label:
932
.do_label:
934
        ; draw a text string in the window
933
        ; draw a text string in the window
935
 
934
 
936
        mov     eax, 4
935
        mov     eax, 4
937
        mov     esi, 21
936
        mov     esi, 21
938
        mov     edx, .str_buf
937
        mov     edx, .str_buf
939
        mov     edi, COLOR_BG_NORMAL
938
        mov     edi, COLOR_BG_NORMAL
940
        int     0x40
939
        int     0x40
941
 
940
 
942
        shr     ebp, 4
941
        shr     ebp, 4
943
        add     esp, 32+16+10+10+4+4
942
        add     esp, 32+16+10+10+4+4
944
 
943
 
945
        ret
944
        ret
946
 
945
 
947
 
946
 
948
;-----------------------------------------------------------------------------
947
;-----------------------------------------------------------------------------
949
;                      Show FPU MMX register content
948
;                      Show FPU MMX register content
950
;
949
;
951
; in: ebp index, ebx = coord
950
; in: ebp index, ebx = coord
952
 
951
 
953
draw_mmx_register_2:
952
draw_mmx_register_2:
954
 
953
 
955
        shl     ebp, 4
954
        shl     ebp, 4
956
 
955
 
957
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
956
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
958
        cmp     [debuggee_pid], 0
957
        cmp     [debuggee_pid], 0
959
        jz      .cd
958
        jz      .cd
960
        cmp     [bSuspended], 0
959
        cmp     [bSuspended], 0
961
        jz      .cd
960
        jz      .cd
962
 
961
 
963
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
962
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
964
 
963
 
965
        mov     eax, dword [_mm0+ebp]
964
        mov     eax, dword [_mm0+ebp]
966
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp]
965
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp]
967
        jne     .scol
966
        jne     .scol
968
 
967
 
969
        mov     eax, dword [_mm0+ebp+4]
968
        mov     eax, dword [_mm0+ebp+4]
970
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp+4]
969
        cmp     eax, dword [_mm0+(oldcontext-context)+ebp+4]
971
        je     .cd
970
        je     .cd
972
 
971
 
973
.scol:
972
.scol:
974
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
973
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
975
.cd:
974
.cd:
976
        mov     eax, ebp
975
        mov     eax, ebp
977
        shl     eax, 16-4
976
        shl     eax, 16-4
978
        add     eax, 'MM0='
977
        add     eax, 'MM0='
979
        push    eax                           ;write label into stack
978
        push    eax                           ;write label into stack
980
 
979
 
981
        ; draw a text string in the window
980
        ; draw a text string in the window
982
 
981
 
983
        mov     eax, 4
982
        mov     eax, 4
984
        mov     esi, eax
983
        mov     esi, eax
985
        mov     edx, esp
984
        mov     edx, esp
986
        mov     edi, COLOR_BG_NORMAL
985
        mov     edi, COLOR_BG_NORMAL
987
        int     0x40
986
        int     0x40
988
 
987
 
989
        mov     esi, ecx
988
        mov     esi, ecx
990
        mov     [esp], ebx
989
        mov     [esp], ebx
991
 
990
 
992
        mov     ecx, dword [_mm0+ebp+4]
991
        mov     ecx, dword [_mm0+ebp+4]
993
        rol     ecx, 16
992
        rol     ecx, 16
994
        lea     edx, [ebx+0x180000]
993
        lea     edx, [ebx+0x180000]
995
        mov     ebx, 0x00040100
994
        mov     ebx, 0x00040100
996
        mcall   47                        ;word #3
995
        mcall   47                        ;word #3
997
 
996
 
998
        shr     ecx, 16
997
        shr     ecx, 16
999
        add     edx, (4*6+3) shl 16
998
        add     edx, (4*6+3) shl 16
1000
        mcall   47                        ;word #2
999
        mcall   47                        ;word #2
1001
 
1000
 
1002
        mov     ecx, dword [_mm0+ebp]
1001
        mov     ecx, dword [_mm0+ebp]
1003
        rol     ecx, 16
1002
        rol     ecx, 16
1004
        add     edx, (4*6+3) shl 16
1003
        add     edx, (4*6+3) shl 16
1005
        mcall   47                        ;word #1
1004
        mcall   47                        ;word #1
1006
 
1005
 
1007
        shr     ecx, 16
1006
        shr     ecx, 16
1008
        add     edx, (4*6+3) shl 16
1007
        add     edx, (4*6+3) shl 16
1009
        mcall   47                        ;word #0
1008
        mcall   47                        ;word #0
1010
 
1009
 
1011
        pop     ebx
1010
        pop     ebx
1012
 
1011
 
1013
        shr     ebp, 4
1012
        shr     ebp, 4
1014
        ret
1013
        ret
1015
 
1014
 
1016
; TODO add SSE registers
1015
; TODO add SSE registers
1017
; TODO add AVX registers
1016
; TODO add AVX registers
1018
 
1017
 
1019
;-----------------------------------------------------------------------------
1018
;-----------------------------------------------------------------------------
1020
;                   Display contents of EFLAGS register
1019
;                   Display contents of EFLAGS register
1021
draw_flag:
1020
draw_flag:
1022
        movzx   edi, byte [edx+7]
1021
        movzx   edi, byte [edx+7]
1023
        bt      [_eflags], edi
1022
        bt      [_eflags], edi
1024
        jc      .on
1023
        jc      .on
1025
        or      byte [edx], 20h
1024
        or      byte [edx], 20h
1026
        jmp     .onoff
1025
        jmp     .onoff
1027
 
1026
 
1028
    .on:
1027
    .on:
1029
        and     byte [edx], not 20h
1028
        and     byte [edx], not 20h
1030
 
1029
 
1031
    .onoff:
1030
    .onoff:
1032
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1031
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1033
        cmp     [debuggee_pid], 0
1032
        cmp     [debuggee_pid], 0
1034
        jz      .doit
1033
        jz      .doit
1035
        cmp     [bSuspended], 0
1034
        cmp     [bSuspended], 0
1036
        jz      .doit
1035
        jz      .doit
1037
 
1036
 
1038
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
1037
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
1039
        bt      [_eflags], edi
1038
        bt      [_eflags], edi
1040
        lahf
1039
        lahf
1041
        bt      dword [_eflags + oldcontext - context], edi
1040
        bt      dword [_eflags + oldcontext - context], edi
1042
        rcl     ah, 1
1041
        rcl     ah, 1
1043
        test    ah, 3
1042
        test    ah, 3
1044
        jp      .doit
1043
        jp      .doit
1045
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
1044
        mov     ecx, (COLOR_TXT_CHANGED or 0x40000000)
1046
 
1045
 
1047
    .doit:
1046
    .doit:
1048
        mov     ah, 0
1047
        mov     ah, 0
1049
        mov     edi, COLOR_BG_NORMAL
1048
        mov     edi, COLOR_BG_NORMAL
1050
        ; draw a text string in the window in one case
1049
        ; draw a text string in the window in one case
1051
        ; and a number in another
1050
        ; and a number in another
1052
        ; color scheme same as for previously called function (was in ecx)
1051
        ; color scheme same as for previously called function (was in ecx)
1053
        mcall
1052
        mcall
1054
        ret
1053
        ret
1055
 
1054
 
1056
;-----------------------------------------------------------------------------
1055
;-----------------------------------------------------------------------------
1057
;                      Draw registers frame title
1056
;                      Draw registers frame title
1058
 
1057
 
1059
; Also show current register set (common + MMX, SSE or AVX)
1058
; Also show current register set (common + MMX, SSE or AVX)
1060
draw_reg_title:
1059
draw_reg_title:
1061
        mov     edi, COLOR_BG_NORMAL
1060
        mov     edi, COLOR_BG_NORMAL
1062
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
1061
        mov     ecx, (COLOR_TXT_NORMAL or 0x40000000)
1063
        mov     esi, 7
1062
        mov     esi, 7
1064
        cmp     [reg_mode], REG_MODE_CPU
1063
        cmp     [reg_mode], REG_MODE_CPU
1065
        jz      @f
1064
        jz      @f
1066
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1065
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1067
    @@:
1066
    @@:
1068
        mov     edx, aMain
1067
        mov     edx, aMain
1069
        ; draw a text string in the window
1068
        ; draw a text string in the window
1070
        mov     ebx, [registers_x_pos_dd]
1069
        mov     ebx, [registers_x_pos_dd]
1071
        add     ebx, 4*10000h+registers_y_pos+2
1070
        add     ebx, 4*10000h+registers_y_pos+2
1072
        mcall   4
1071
        mcall   4
1073
 
1072
 
1074
        cmp     [reg_mode], REG_MODE_SSE
1073
        cmp     [reg_mode], REG_MODE_SSE
1075
        jz      @f
1074
        jz      @f
1076
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1075
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1077
    @@:
1076
    @@:
1078
        mov     edx, aSSE
1077
        mov     edx, aSSE
1079
        ; draw a text string in the window
1078
        ; draw a text string in the window
1080
        mov     ebx, [registers_x_pos_dd]
1079
        mov     ebx, [registers_x_pos_dd]
1081
        add     ebx, 46*10000h+registers_y_pos+2
1080
        add     ebx, 46*10000h+registers_y_pos+2
1082
        mcall   4
1081
        mcall   4
1083
 
1082
 
1084
        cmp     [reg_mode], REG_MODE_AVX
1083
        cmp     [reg_mode], REG_MODE_AVX
1085
        jz      @f
1084
        jz      @f
1086
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1085
        mov     ecx, (COLOR_TXT_INACTIVE or 0x40000000)
1087
    @@:
1086
    @@:
1088
        mov     edx, aAVX
1087
        mov     edx, aAVX
1089
        ; draw a text string in the window
1088
        ; draw a text string in the window
1090
        mov     ebx, [registers_x_pos_dd]
1089
        mov     ebx, [registers_x_pos_dd]
1091
        add     ebx, 88*10000h+registers_y_pos+2
1090
        add     ebx, 88*10000h+registers_y_pos+2
1092
        mcall   4
1091
        mcall   4
1093
        ret
1092
        ret
1094
 
1093
 
1095
;-----------------------------------------------------------------------------
1094
;-----------------------------------------------------------------------------
1096
;                Display common registers set + MMX + FPU
1095
;                Display common registers set + MMX + FPU
1097
 
1096
 
1098
draw_main_registers:
1097
draw_main_registers:
1099
; TODO: add support for FPU ST0-ST7 registers
1098
; TODO: add support for FPU ST0-ST7 registers
1100
        mov     edi, COLOR_BG_NORMAL
1099
        mov     edi, COLOR_BG_NORMAL
1101
        mov     esi, _eax
1100
        mov     esi, _eax
1102
        push    4
1101
        push    4
1103
        pop     ecx
1102
        pop     ecx
1104
        mov     edx, regs_strs
1103
        mov     edx, regs_strs
1105
        mov     ebx, [registers_x_pos_dd]
1104
        mov     ebx, [registers_x_pos_dd]
1106
        add     ebx, 2*10000h+registers_y_pos+22
1105
        add     ebx, 2*10000h+registers_y_pos+22
1107
        call    draw_register
1106
        call    draw_register
1108
        mov     ebx, [registers_x_pos_dd]
1107
        mov     ebx, [registers_x_pos_dd]
1109
        add     ebx, 2*10000h+registers_y_pos+32
1108
        add     ebx, 2*10000h+registers_y_pos+32
1110
        add     esi, _ebx-_eax
1109
        add     esi, _ebx-_eax
1111
        call    draw_register
1110
        call    draw_register
1112
        mov     ebx, [registers_x_pos_dd]
1111
        mov     ebx, [registers_x_pos_dd]
1113
        add     ebx, 2*10000h+registers_y_pos+42
1112
        add     ebx, 2*10000h+registers_y_pos+42
1114
        add     esi, _ecx-_ebx
1113
        add     esi, _ecx-_ebx
1115
        call    draw_register
1114
        call    draw_register
1116
        mov     ebx, [registers_x_pos_dd]
1115
        mov     ebx, [registers_x_pos_dd]
1117
        add     ebx, 2*10000h+registers_y_pos+52
1116
        add     ebx, 2*10000h+registers_y_pos+52
1118
        add     esi, _edx-_ecx
1117
        add     esi, _edx-_ecx
1119
        call    draw_register
1118
        call    draw_register
1120
        mov     ebx, [registers_x_pos_dd]
1119
        mov     ebx, [registers_x_pos_dd]
1121
        add     ebx, 2*10000h+registers_y_pos+62
1120
        add     ebx, 2*10000h+registers_y_pos+62
1122
        add     esi, _esi-_edx
1121
        add     esi, _esi-_edx
1123
        call    draw_register
1122
        call    draw_register
1124
        mov     ebx, [registers_x_pos_dd]
1123
        mov     ebx, [registers_x_pos_dd]
1125
        add     ebx, 2*10000h+registers_y_pos+72
1124
        add     ebx, 2*10000h+registers_y_pos+72
1126
        add     esi, _edi-_esi
1125
        add     esi, _edi-_esi
1127
        call    draw_register
1126
        call    draw_register
1128
        mov     ebx, [registers_x_pos_dd]
1127
        mov     ebx, [registers_x_pos_dd]
1129
        add     ebx, 2*10000h+registers_y_pos+82
1128
        add     ebx, 2*10000h+registers_y_pos+82
1130
        add     esi, _ebp-_edi
1129
        add     esi, _ebp-_edi
1131
        call    draw_register
1130
        call    draw_register
1132
        mov     ebx, [registers_x_pos_dd]
1131
        mov     ebx, [registers_x_pos_dd]
1133
        add     ebx, 2*10000h+registers_y_pos+92
1132
        add     ebx, 2*10000h+registers_y_pos+92
1134
        add     esi, _esp-_ebp
1133
        add     esi, _esp-_ebp
1135
        call    draw_register
1134
        call    draw_register
1136
        mov     ebx, [registers_x_pos_dd]
1135
        mov     ebx, [registers_x_pos_dd]
1137
        add     ebx, 2*10000h+registers_y_pos+102
1136
        add     ebx, 2*10000h+registers_y_pos+102
1138
        add     esi, _eip-_esp
1137
        add     esi, _eip-_esp
1139
        call    draw_register
1138
        call    draw_register
1140
        mov     ebx, [registers_x_pos_dd]
1139
        mov     ebx, [registers_x_pos_dd]
1141
        add     ebx, 2*10000h+registers_y_pos+112
1140
        add     ebx, 2*10000h+registers_y_pos+112
1142
 
1141
 
1143
        mov     cl, 7
1142
        mov     cl, 7
1144
        add     esi, _eflags-_eip
1143
        add     esi, _eflags-_eip
1145
        call    draw_register
1144
        call    draw_register
1146
        mov     cl, 4
1145
        mov     cl, 4
1147
 
1146
 
1148
    ; MMX registers
1147
    ; MMX registers
1149
 
1148
 
1150
        push    ebp
1149
        push    ebp
1151
 
1150
 
1152
        push    8
1151
        push    8
1153
        xor     ebp, ebp
1152
        xor     ebp, ebp
1154
        mov     ebx, [registers_x_pos_dd]
1153
        mov     ebx, [registers_x_pos_dd]
1155
        add     ebx, 2*10000h+registers_y_pos+142
1154
        add     ebx, 2*10000h+registers_y_pos+142
1156
 
1155
 
1157
align 4
1156
align 4
1158
.draw_mmx_regs:
1157
.draw_mmx_regs:
1159
 
1158
 
1160
        call    draw_mmx_register_2
1159
        call    draw_mmx_register_2
1161
        add     ebx, 10
1160
        add     ebx, 10
1162
        inc     ebp
1161
        inc     ebp
1163
        dec     dword [esp]
1162
        dec     dword [esp]
1164
        jnz     .draw_mmx_regs
1163
        jnz     .draw_mmx_regs
1165
 
1164
 
1166
;FPU registers
1165
;FPU registers
1167
 
1166
 
1168
        ;int3
1167
        ;int3
1169
        ;nop
1168
        ;nop
1170
 
1169
 
1171
        mov     [esp], byte 8
1170
        mov     [esp], byte 8
1172
        xor     ebp, ebp
1171
        xor     ebp, ebp
1173
        mov     ebx, [registers_x_pos_dd]
1172
        mov     ebx, [registers_x_pos_dd]
1174
        add     ebx, 2*10000h+registers_y_pos+232
1173
        add     ebx, 2*10000h+registers_y_pos+232
1175
 
1174
 
1176
align 4
1175
align 4
1177
.draw_fpu_regs:
1176
.draw_fpu_regs:
1178
 
1177
 
1179
        call    draw_fpu_register_2
1178
        call    draw_fpu_register_2
1180
        add     ebx, 10
1179
        add     ebx, 10
1181
        inc     ebp
1180
        inc     ebp
1182
        dec     dword [esp]
1181
        dec     dword [esp]
1183
        jnz     .draw_fpu_regs
1182
        jnz     .draw_fpu_regs
1184
        pop     eax                         ;restore stack
1183
        pop     eax                         ;restore stack
1185
        pop     ebp
1184
        pop     ebp
1186
 
1185
 
1187
        mov     ecx, COLOR_TXT_INACTIVE
1186
        mov     ecx, COLOR_TXT_INACTIVE
1188
        cmp     [debuggee_pid], 0
1187
        cmp     [debuggee_pid], 0
1189
        jz      @f
1188
        jz      @f
1190
        cmp     [bSuspended], 0
1189
        cmp     [bSuspended], 0
1191
        jz      @f
1190
        jz      @f
1192
        mov     ecx, COLOR_TXT_NORMAL
1191
        mov     ecx, COLOR_TXT_NORMAL
1193
    @@:
1192
    @@:
1194
        mov     edx, aColon
1193
        mov     edx, aColon
1195
        xor     esi, esi
1194
        xor     esi, esi
1196
        inc     esi
1195
        inc     esi
1197
        mov     ebx, [registers_x_pos_dd]
1196
        mov     ebx, [registers_x_pos_dd]
1198
        add     ebx, 10*10000h+registers_y_pos+122
1197
        add     ebx, 10*10000h+registers_y_pos+122
1199
        mcall   4
1198
        mcall   4
1200
        mov     edx, flags
1199
        mov     edx, flags
1201
 
1200
 
1202
    @@:
1201
    @@:
1203
        add     ebx, 2*6*10000h
1202
        add     ebx, 2*6*10000h
1204
        call    draw_flag
1203
        call    draw_flag
1205
        inc     edx
1204
        inc     edx
1206
        cmp     dl, flags_bits and 0xFF
1205
        cmp     dl, flags_bits and 0xFF
1207
        jnz     @b
1206
        jnz     @b
1208
        ret
1207
        ret
1209
 
1208
 
1210
;-----------------------------------------------------------------------------
1209
;-----------------------------------------------------------------------------
1211
;                  Draw SSE registers set
1210
;                  Draw SSE registers set
1212
 
1211
 
1213
draw_sse_registers:
1212
draw_sse_registers:
1214
 
1213
 
1215
        ret
1214
        ret
1216
 
1215
 
1217
;-----------------------------------------------------------------------------
1216
;-----------------------------------------------------------------------------
1218
;                  Draw AVX registers set
1217
;                  Draw AVX registers set
1219
 
1218
 
1220
draw_avx_registers:
1219
draw_avx_registers:
1221
 
1220
 
1222
        ret
1221
        ret
1223
 
1222
 
1224
;-----------------------------------------------------------------------------
1223
;-----------------------------------------------------------------------------
1225
;                 Draw all registers sets
1224
;                 Draw all registers sets
1226
draw_registers:
1225
draw_registers:
1227
 
1226
 
1228
        ; draw container rectangle/box with COLOR_BG_NORMAL
1227
        ; draw container rectangle/box with COLOR_BG_NORMAL
1229
        mov     ebx, [registers_x_pos_dd]
1228
        mov     ebx, [registers_x_pos_dd]
1230
        add     ebx, (-1)*10000h+(registers_x_size+2)
1229
        add     ebx, (-1)*10000h+(registers_x_size+2)
1231
        mov     ecx, [registers_y_size_dd+4]
1230
        mov     ecx, [registers_y_size_dd+4]
1232
        add     ecx, (registers_y_pos-1)*10000h+2
1231
        add     ecx, (registers_y_pos-1)*10000h+2
1233
        mcall   13, , , COLOR_BG_NORMAL
1232
        mcall   13, , , COLOR_BG_NORMAL
1234
        call    draw_reg_title
1233
        call    draw_reg_title
1235
 
1234
 
1236
    .redraw:
1235
    .redraw:
1237
        cmp     [reg_mode], REG_MODE_CPU
1236
        cmp     [reg_mode], REG_MODE_CPU
1238
        jnz     @f
1237
        jnz     @f
1239
        call    draw_main_registers
1238
        call    draw_main_registers
1240
        ret
1239
        ret
1241
 
1240
 
1242
    @@:
1241
    @@:
1243
        cmp     [reg_mode], REG_MODE_SSE
1242
        cmp     [reg_mode], REG_MODE_SSE
1244
        jnz     @f
1243
        jnz     @f
1245
        call    draw_sse_registers
1244
        call    draw_sse_registers
1246
        ret
1245
        ret
1247
 
1246
 
1248
    @@:
1247
    @@:
1249
        call    draw_avx_registers
1248
        call    draw_avx_registers
1250
        ret
1249
        ret
1251
 
1250
 
1252
;-----------------------------------------------------------------------------
1251
;-----------------------------------------------------------------------------
1253
;                     Display memory dump
1252
;                     Display memory dump
1254
 
1253
 
1255
draw_dump:
1254
draw_dump:
1256
        ; draw container rectangle/box in the window
1255
        ; draw container rectangle/box in the window
1257
        mov     ebx, [data_x_size_dd+4]
1256
        mov     ebx, [data_x_size_dd+4]
1258
        add     ebx, data_x_pos*10000h
1257
        add     ebx, data_x_pos*10000h
1259
        mcall   13, , dump_y_pos*10000h+dump_y_size, COLOR_BG_NORMAL
1258
        mcall   13, , dump_y_pos*10000h+dump_y_size, COLOR_BG_NORMAL
1260
 
1259
 
1261
    .redraw:
1260
    .redraw:
1262
        ; addresses
1261
        ; addresses
1263
        mov     ebx, 80100h
1262
        mov     ebx, 80100h
1264
        mov     edx, data_x_pos*10000h + dump_y_pos
1263
        mov     edx, data_x_pos*10000h + dump_y_pos
1265
        mov     ecx, [dumppos]
1264
        mov     ecx, [dumppos]
1266
        mov     edi, COLOR_BG_NORMAL
1265
        mov     edi, COLOR_BG_NORMAL
1267
        mov     esi, (COLOR_TXT_INACTIVE or 0x40000000)
1266
        mov     esi, (COLOR_TXT_INACTIVE or 0x40000000)
1268
        cmp     [debuggee_pid], 0
1267
        cmp     [debuggee_pid], 0
1269
        jz      @f
1268
        jz      @f
1270
        cmp     [bSuspended], 0
1269
        cmp     [bSuspended], 0
1271
        jz      @f
1270
        jz      @f
1272
        mov     esi, (COLOR_TXT_NORMAL or 0x40000000)
1271
        mov     esi, (COLOR_TXT_NORMAL or 0x40000000)
1273
    @@:
1272
    @@:
1274
        ; draw a number in the window
1273
        ; draw a number in the window
1275
        mcall   47
1274
        mcall   47
1276
        add     ecx, 10h
1275
        add     ecx, 10h
1277
        add     edx, 10
1276
        add     edx, 10
1278
        cmp     dl, dump_y_pos + dump_y_size
1277
        cmp     dl, dump_y_pos + dump_y_size
1279
        jb      @b
1278
        jb      @b
1280
        ; hex dump of data
1279
        ; hex dump of data
1281
        mov     ecx, dumpdata
1280
        mov     ecx, dumpdata
1282
        push    ecx
1281
        push    ecx
1283
        xor     ebx, ebx
1282
        xor     ebx, ebx
1284
        mov     edx, (data_x_pos+12*6)*10000h + dump_y_pos
1283
        mov     edx, (data_x_pos+12*6)*10000h + dump_y_pos
1285
        cmp     [dumpread], ebx
1284
        cmp     [dumpread], ebx
1286
        jz      .hexdumpdone1
1285
        jz      .hexdumpdone1
1287
 
1286
 
1288
    .hexdumploop1:
1287
    .hexdumploop1:
1289
        push    ebx
1288
        push    ebx
1290
        mov     ebx, 20101h
1289
        mov     ebx, 20101h
1291
        ; draw a number in the window
1290
        ; draw a number in the window
1292
        mcall
1291
        mcall
1293
        pop     ebx
1292
        pop     ebx
1294
        add     edx, 3*6*10000h
1293
        add     edx, 3*6*10000h
1295
        inc     ecx
1294
        inc     ecx
1296
        inc     ebx
1295
        inc     ebx
1297
        test    bl, 15
1296
        test    bl, 15
1298
        jz      .16
1297
        jz      .16
1299
        test    bl, 7
1298
        test    bl, 7
1300
        jnz     @f
1299
        jnz     @f
1301
        add     edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
1300
        add     edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
1302
 
1301
 
1303
    .16:
1302
    .16:
1304
        add     edx, 10 - 6*(3*10h+2)*10000h
1303
        add     edx, 10 - 6*(3*10h+2)*10000h
1305
 
1304
 
1306
    @@:
1305
    @@:
1307
        cmp     ebx, [dumpread]
1306
        cmp     ebx, [dumpread]
1308
        jb      .hexdumploop1
1307
        jb      .hexdumploop1
1309
 
1308
 
1310
    .hexdumpdone1:
1309
    .hexdumpdone1:
1311
        mov     al, 4
1310
        mov     al, 4
1312
        ; copy color value from esi to ecx
1311
        ; copy color value from esi to ecx
1313
        ; to draw text string with 'mcall 4'
1312
        ; to draw text string with 'mcall 4'
1314
        mov     ecx, esi
1313
        mov     ecx, esi
1315
        xchg    ebx, edx
1314
        xchg    ebx, edx
1316
        push    2
1315
        push    2
1317
        pop     esi
1316
        pop     esi
1318
 
1317
 
1319
    .hexdumploop2:
1318
    .hexdumploop2:
1320
        cmp     edx, dump_height*10h
1319
        cmp     edx, dump_height*10h
1321
        jae     .hexdumpdone2
1320
        jae     .hexdumpdone2
1322
        push    edx
1321
        push    edx
1323
        mov     edx, aQuests
1322
        mov     edx, aQuests
1324
        ; draw text string with color in ecx, copied from esi
1323
        ; draw text string with color in ecx, copied from esi
1325
        mcall
1324
        mcall
1326
        pop     edx
1325
        pop     edx
1327
        add     ebx, 3*6*10000h
1326
        add     ebx, 3*6*10000h
1328
        inc     edx
1327
        inc     edx
1329
        test    dl, 15
1328
        test    dl, 15
1330
        jz      .16x
1329
        jz      .16x
1331
        test    dl, 7
1330
        test    dl, 7
1332
        jnz     .hexdumploop2
1331
        jnz     .hexdumploop2
1333
        add     ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
1332
        add     ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
1334
 
1333
 
1335
    .16x:
1334
    .16x:
1336
        add     ebx, 10 - 6*(3*10h+2)*10000h
1335
        add     ebx, 10 - 6*(3*10h+2)*10000h
1337
        jmp     .hexdumploop2
1336
        jmp     .hexdumploop2
1338
 
1337
 
1339
    .hexdumpdone2:
1338
    .hexdumpdone2:
1340
        dec     esi
1339
        dec     esi
1341
        ; colon, minus signs
1340
        ; colon, minus signs
1342
        mov     ebx, (data_x_pos+8*6)*10000h + dump_y_pos
1341
        mov     ebx, (data_x_pos+8*6)*10000h + dump_y_pos
1343
        mov     edx, aColon
1342
        mov     edx, aColon
1344
 
1343
 
1345
    @@:
1344
    @@:
1346
        mcall
1345
        mcall
1347
        add     ebx, 10
1346
        add     ebx, 10
1348
        cmp     bl, dump_y_pos+dump_height*10
1347
        cmp     bl, dump_y_pos+dump_height*10
1349
        jb      @b
1348
        jb      @b
1350
        mov     ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos
1349
        mov     ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos
1351
        mov     edx, aMinus
1350
        mov     edx, aMinus
1352
 
1351
 
1353
    @@:
1352
    @@:
1354
        mcall
1353
        mcall
1355
        add     ebx, 10
1354
        add     ebx, 10
1356
        cmp     bl, dump_y_pos+dump_height*10
1355
        cmp     bl, dump_y_pos+dump_height*10
1357
        jb      @b
1356
        jb      @b
1358
        ; ASCII data
1357
        ; ASCII data
1359
        mov     ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
1358
        mov     ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
1360
        pop     edx
1359
        pop     edx
1361
        push    dump_height*10h
1360
        push    dump_height*10h
1362
 
1361
 
1363
    .asciiloop:
1362
    .asciiloop:
1364
        push    edx
1363
        push    edx
1365
        cmp     byte [edx], 20h
1364
        cmp     byte [edx], 20h
1366
        jae     @f
1365
        jae     @f
1367
        mov     edx, aPoint
1366
        mov     edx, aPoint
1368
 
1367
 
1369
    @@:
1368
    @@:
1370
        ; draw a text string in the window, color in ecx
1369
        ; draw a text string in the window, color in ecx
1371
        mcall
1370
        mcall
1372
        pop     edx
1371
        pop     edx
1373
        inc     edx
1372
        inc     edx
1374
        add     ebx, 6*10000h
1373
        add     ebx, 6*10000h
1375
        dec     dword [esp]
1374
        dec     dword [esp]
1376
        jz      .asciidone
1375
        jz      .asciidone
1377
        test    byte [esp], 15
1376
        test    byte [esp], 15
1378
        jnz     .asciiloop
1377
        jnz     .asciiloop
1379
        add     ebx, 10 - 6*10h*10000h
1378
        add     ebx, 10 - 6*10h*10000h
1380
        jmp     .asciiloop
1379
        jmp     .asciiloop
1381
 
1380
 
1382
    .asciidone:
1381
    .asciidone:
1383
        pop     ecx
1382
        pop     ecx
1384
        ret
1383
        ret
1385
 
1384
 
1386
;-----------------------------------------------------------------------------
1385
;-----------------------------------------------------------------------------
1387
;                   Display disassembled code
1386
;                   Display disassembled code
1388
 
1387
 
1389
draw_disasm:
1388
draw_disasm:
1390
 
1389
 
1391
        mov     eax, [disasm_start_pos]
1390
        mov     eax, [disasm_start_pos]
1392
        mov     [disasm_cur_pos], eax
1391
        mov     [disasm_cur_pos], eax
1393
        and     [disasm_cur_str], 0
1392
        and     [disasm_cur_str], 0
1394
 
1393
 
1395
    .loop:
1394
    .loop:
1396
        mov     eax, [disasm_cur_pos]
1395
        mov     eax, [disasm_cur_pos]
1397
        call    find_symbol
1396
        call    find_symbol
1398
        jc      .nosymb
1397
        jc      .nosymb
1399
        mov     ebx, [disasm_cur_str]
1398
        mov     ebx, [disasm_cur_str]
1400
        imul    ebx, 10
1399
        imul    ebx, 10
1401
        push    ebx
1400
        push    ebx
1402
        lea     ecx, [ebx+disasm_y_pos-1]
1401
        lea     ecx, [ebx+disasm_y_pos-1]
1403
        shl     ecx, 16
1402
        shl     ecx, 16
1404
        mov     cl, 11
1403
        mov     cl, 11
1405
        ; setting up background color for disassembled text
1404
        ; setting up background color for disassembled text
1406
        mov     edx, COLOR_BG_NORMAL
1405
        mov     edx, COLOR_BG_NORMAL
1407
        ; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
1406
        ; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
1408
        mov     ebx, [data_x_size_dd+4]
1407
        mov     ebx, [data_x_size_dd+4]
1409
        add     ebx, data_x_pos*10000h
1408
        add     ebx, data_x_pos*10000h
1410
        mcall   13
1409
        mcall   13
1411
        pop     ebx
1410
        pop     ebx
1412
        ; copy color value from edx (COLOR_BG_NORMAL)
1411
        ; copy color value from edx (COLOR_BG_NORMAL)
1413
        mov     edi, edx
1412
        mov     edi, edx
1414
        add     ebx, (data_x_pos+6*2)*10000h+disasm_y_pos
1413
        add     ebx, (data_x_pos+6*2)*10000h+disasm_y_pos
1415
        mov     edx, esi
1414
        mov     edx, esi
1416
 
1415
 
1417
    @@:
1416
    @@:
1418
        lodsb
1417
        lodsb
1419
        test    al, al
1418
        test    al, al
1420
        jnz     @b
1419
        jnz     @b
1421
        mov     byte [esi-1], ':'
1420
        mov     byte [esi-1], ':'
1422
        sub     esi, edx
1421
        sub     esi, edx
1423
        ; normal color
1422
        ; normal color
1424
        ; was 0x40000000
1423
        ; was 0x40000000
1425
        mov     ecx, (COLOR_TXT_LABEL or 0x40000000)
1424
        mov     ecx, (COLOR_TXT_LABEL or 0x40000000)
1426
        mov     al, 4
1425
        mov     al, 4
1427
        ; draw a text string in the window with color COLOR_TXT_NORMAL in ecx
1426
        ; draw a text string in the window with color COLOR_TXT_NORMAL in ecx
1428
        mcall
1427
        mcall
1429
        mov     byte [esi+edx-1], 0
1428
        mov     byte [esi+edx-1], 0
1430
        lea     esi, [esi*3]
1429
        lea     esi, [esi*3]
1431
        movzx   ecx, bx
1430
        movzx   ecx, bx
1432
        shr     ebx, 16
1431
        shr     ebx, 16
1433
        lea     ebx, [ebx+esi*2]
1432
        lea     ebx, [ebx+esi*2]
1434
        shl     ecx, 16
1433
        shl     ecx, 16
1435
        mov     cl, 10
1434
        mov     cl, 10
1436
        imul    ebx, 10001h
1435
        imul    ebx, 10001h
1437
        sub     bx, data_x_pos
1436
        sub     bx, data_x_pos
1438
        sub     bx, word[data_x_size_dd+4]
1437
        sub     bx, word[data_x_size_dd+4]
1439
        neg     bx
1438
        neg     bx
1440
        mov     al, 13
1439
        mov     al, 13
1441
        ; copy color value from edi
1440
        ; copy color value from edi
1442
        mov     edx, edi
1441
        mov     edx, edi
1443
        ; draw container rectangle/box for disassembled text, color in edx
1442
        ; draw container rectangle/box for disassembled text, color in edx
1444
        mcall
1443
        mcall
1445
        inc     [disasm_cur_str]
1444
        inc     [disasm_cur_str]
1446
        mov     eax, [disasm_height_dd]
1445
        mov     eax, [disasm_height_dd]
1447
        cmp     [disasm_cur_str], eax
1446
        cmp     [disasm_cur_str], eax
1448
        jae     .loopend
1447
        jae     .loopend
1449
 
1448
 
1450
    .nosymb:
1449
    .nosymb:
1451
        push    [disasm_cur_pos]
1450
        push    [disasm_cur_pos]
1452
        call    disasm_instr
1451
        call    disasm_instr
1453
        pop     ebp
1452
        pop     ebp
1454
        jc      .loopend
1453
        jc      .loopend
1455
        mov     edx, COLOR_BG_NORMAL
1454
        mov     edx, COLOR_BG_NORMAL
1456
        mov     esi, COLOR_TXT_NORMAL
1455
        mov     esi, COLOR_TXT_NORMAL
1457
        mov     ebx, data_x_pos*10000h
1456
        mov     ebx, data_x_pos*10000h
1458
        add     ebx, [data_x_size_dd+4]
1457
        add     ebx, [data_x_size_dd+4]
1459
        mov     ecx, [disasm_cur_str]
1458
        mov     ecx, [disasm_cur_str]
1460
        imul    ecx, 10*10000h
1459
        imul    ecx, 10*10000h
1461
        add     ecx, (disasm_y_pos-1)*10000h + 10
1460
        add     ecx, (disasm_y_pos-1)*10000h + 10
1462
        mov     eax, ebp
1461
        mov     eax, ebp
1463
        pushad
1462
        pushad
1464
        call    find_enabled_breakpoint
1463
        call    find_enabled_breakpoint
1465
        popad
1464
        popad
1466
        jnz     .nobp
1465
        jnz     .nobp
1467
        mov     edx, COLOR_BG_BREAKPOINT
1466
        mov     edx, COLOR_BG_BREAKPOINT
1468
        mov     esi, COLOR_TXT_BREAKPOINT
1467
        mov     esi, COLOR_TXT_BREAKPOINT
1469
    .nobp:
1468
    .nobp:
1470
 
1469
 
1471
        mov     eax, [_eip]
1470
        mov     eax, [_eip]
1472
        cmp     eax, ebp
1471
        cmp     eax, ebp
1473
        jnz     .notcurrent
1472
        jnz     .notcurrent
1474
        mov     edx, COLOR_BG_SELECTED
1473
        mov     edx, COLOR_BG_SELECTED
1475
        mov     esi, COLOR_TXT_SELECTED
1474
        mov     esi, COLOR_TXT_SELECTED
1476
    .notcurrent:
1475
    .notcurrent:
1477
        push    esi     ; Save color value for disassembled text
1476
        push    esi     ; Save color value for disassembled text
1478
 
1477
 
1479
        ; draw container rectangle/box for disassembled text
1478
        ; draw container rectangle/box for disassembled text
1480
        ; color in edx
1479
        ; color in edx
1481
        mcall   13
1480
        mcall   13
1482
 
1481
 
1483
        mov     edx, [disasm_cur_str]
1482
        mov     edx, [disasm_cur_str]
1484
        imul    edx, 10
1483
        imul    edx, 10
1485
        add     edx, data_x_pos*10000h + disasm_y_pos
1484
        add     edx, data_x_pos*10000h + disasm_y_pos
1486
        ; draw a number in the window, color in esi
1485
        ; draw a number in the window, color in esi
1487
        mcall   47, 80100h, ebp
1486
        mcall   47, 80100h, ebp
1488
 
1487
 
1489
        lea     ebx, [edx+8*6*10000h]
1488
        lea     ebx, [edx+8*6*10000h]
1490
        mov     ecx, esi    ; text color
1489
        mov     ecx, esi    ; text color
1491
        push    2
1490
        push    2
1492
        pop     esi
1491
        pop     esi
1493
        mov     edx, aColon
1492
        mov     edx, aColon
1494
        ; draw the colon
1493
        ; draw the colon
1495
        mcall   4
1494
        mcall   4
1496
        push    9
1495
        push    9
1497
        pop     edi
1496
        pop     edi
1498
        lea     edx, [ebx+2*6*10000h]
1497
        lea     edx, [ebx+2*6*10000h]
1499
        mov     ecx, ebp
1498
        mov     ecx, ebp
1500
        sub     ecx, [disasm_start_pos]
1499
        sub     ecx, [disasm_start_pos]
1501
        add     ecx, disasm_buffer
1500
        add     ecx, disasm_buffer
1502
 
1501
 
1503
        mov     esi, COLOR_TXT_HEX
1502
        mov     esi, COLOR_TXT_HEX
1504
        mov     eax, [_eip]
1503
        mov     eax, [_eip]
1505
        cmp     eax, ebp
1504
        cmp     eax, ebp
1506
        jnz     @f
1505
        jnz     @f
1507
        mov     esi, COLOR_TXT_SELECTED
1506
        mov     esi, COLOR_TXT_SELECTED
1508
  @@:
1507
  @@:
1509
    .drawhex:
1508
    .drawhex:
1510
        ; draw a number in the window, color in esi
1509
        ; draw a number in the window, color in esi
1511
        mcall   47, 20101h
1510
        mcall   47, 20101h
1512
        add     edx, 6*3*10000h
1511
        add     edx, 6*3*10000h
1513
        inc     ecx
1512
        inc     ecx
1514
        inc     ebp
1513
        inc     ebp
1515
        cmp     ebp, [disasm_cur_pos]
1514
        cmp     ebp, [disasm_cur_pos]
1516
        jae     .hexdone
1515
        jae     .hexdone
1517
        dec     edi
1516
        dec     edi
1518
        jnz     .drawhex
1517
        jnz     .drawhex
1519
        push    esi
1518
        push    esi
1520
        mov     esi, [disasm_cur_pos]
1519
        mov     esi, [disasm_cur_pos]
1521
        dec     esi
1520
        dec     esi
1522
        cmp     esi, ebp
1521
        cmp     esi, ebp
1523
        pop     esi
1522
        pop     esi
1524
        jbe     .drawhex
1523
        jbe     .drawhex
1525
 
1524
 
1526
        lea     ebx, [edx-6*10000h]
1525
        lea     ebx, [edx-6*10000h]
1527
        ; copy color value from esi
1526
        ; copy color value from esi
1528
        mov     ecx, esi
1527
        mov     ecx, esi
1529
        push    3
1528
        push    3
1530
        pop     esi
1529
        pop     esi
1531
        mov     edx, aDots
1530
        mov     edx, aDots
1532
        ; draw a text string in the window, color in ecx
1531
        ; draw a text string in the window, color in ecx
1533
        mcall   4
1532
        mcall   4
1534
 
1533
 
1535
    .hexdone:
1534
    .hexdone:
1536
        pop     esi
1535
        pop     esi
1537
        xor     eax, eax
1536
        xor     eax, eax
1538
        mov     edi, disasm_string
1537
        mov     edi, disasm_string
1539
        mov     edx, edi
1538
        mov     edx, edi
1540
        or      ecx, -1
1539
        or      ecx, -1
1541
        repnz scasb
1540
        repnz scasb
1542
        not     ecx
1541
        not     ecx
1543
        dec     ecx
1542
        dec     ecx
1544
        xchg    ecx, esi
1543
        xchg    ecx, esi
1545
        mov     ebx, [disasm_cur_str]
1544
        mov     ebx, [disasm_cur_str]
1546
        imul    ebx, 10
1545
        imul    ebx, 10
1547
        add     ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
1546
        add     ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
1548
 
1547
 
1549
        ; draw a text string in the window, color in ecx
1548
        ; draw a text string in the window, color in ecx
1550
        mcall   4
1549
        mcall   4
1551
        inc     [disasm_cur_str]
1550
        inc     [disasm_cur_str]
1552
        mov     eax, [disasm_height_dd]
1551
        mov     eax, [disasm_height_dd]
1553
        cmp     [disasm_cur_str], eax
1552
        cmp     [disasm_cur_str], eax
1554
        jb      .loop
1553
        jb      .loop
1555
 
1554
 
1556
    .loopend:
1555
    .loopend:
1557
        mov     ecx, [disasm_height_dd]
1556
        mov     ecx, [disasm_height_dd]
1558
        sub     ecx, [disasm_cur_str]
1557
        sub     ecx, [disasm_cur_str]
1559
        jz      @f
1558
        jz      @f
1560
        imul    ecx, 10
1559
        imul    ecx, 10
1561
        inc     ecx
1560
        inc     ecx
1562
        mov     eax, disasm_y_pos
1561
        mov     eax, disasm_y_pos
1563
        add     eax, [disasm_y_size_dd+4]
1562
        add     eax, [disasm_y_size_dd+4]
1564
        sub     eax, ecx
1563
        sub     eax, ecx
1565
        shl     eax, 16
1564
        shl     eax, 16
1566
        add     ecx, eax
1565
        add     ecx, eax
1567
        ; Draw filled rectangle
1566
        ; Draw filled rectangle
1568
        mov     ebx, [data_x_size_dd+4]
1567
        mov     ebx, [data_x_size_dd+4]
1569
        add     ebx, data_x_pos*10000h
1568
        add     ebx, data_x_pos*10000h
1570
        mcall   13, , , COLOR_BG_NORMAL
1569
        mcall   13, , , COLOR_BG_NORMAL
1571
 
1570
 
1572
    @@:
1571
    @@:
1573
        ret
1572
        ret
1574
 
1573
 
1575
;-----------------------------------------------------------------------------
1574
;-----------------------------------------------------------------------------
1576
 
1575
 
1577
; TODO: cleanup of this function, make some global labels local
1576
; TODO: cleanup of this function, make some global labels local
1578
update_disasm_eip:
1577
update_disasm_eip:
1579
; test if instruction at eip is showed
1578
; test if instruction at eip is showed
1580
        mov     ecx, [disasm_height_dd+4]
1579
        mov     ecx, [disasm_height_dd+4]
1581
        mov     eax, [disasm_start_pos]
1580
        mov     eax, [disasm_start_pos]
1582
        mov     [disasm_cur_pos], eax
1581
        mov     [disasm_cur_pos], eax
1583
 
1582
 
1584
    .l:
1583
    .l:
1585
        mov     eax, [disasm_cur_pos]
1584
        mov     eax, [disasm_cur_pos]
1586
        call    find_symbol
1585
        call    find_symbol
1587
        jc      @f
1586
        jc      @f
1588
        dec     ecx
1587
        dec     ecx
1589
        jz      .m
1588
        jz      .m
1590
 
1589
 
1591
    @@:
1590
    @@:
1592
        cmp     [_eip], eax
1591
        cmp     [_eip], eax
1593
        jz      draw_disasm
1592
        jz      draw_disasm
1594
        push    ecx
1593
        push    ecx
1595
        call    disasm_instr
1594
        call    disasm_instr
1596
        pop     ecx
1595
        pop     ecx
1597
        jc      .m
1596
        jc      .m
1598
        loop    .l
1597
        loop    .l
1599
 
1598
 
1600
    .m:
1599
    .m:
1601
 
1600
 
1602
update_disasm_eip_force:
1601
update_disasm_eip_force:
1603
        mov     eax, [_eip]
1602
        mov     eax, [_eip]
1604
        mov     [disasm_start_pos], eax
1603
        mov     [disasm_start_pos], eax
1605
 
1604
 
1606
update_disasm:
1605
update_disasm:
1607
        cmp     [debuggee_pid], 0
1606
        cmp     [debuggee_pid], 0
1608
        jz      .no
1607
        jz      .no
1609
 
1608
 
1610
        mcall   69, 6, [debuggee_pid], 256, [disasm_start_pos], disasm_buffer
1609
        mcall   69, 6, [debuggee_pid], 256, [disasm_start_pos], disasm_buffer
1611
        cmp     eax, -1
1610
        cmp     eax, -1
1612
        jnz     @f
1611
        jnz     @f
1613
        mov     esi, read_mem_err
1612
        mov     esi, read_mem_err
1614
        call    put_message
1613
        call    put_message
1615
 
1614
 
1616
    .no:
1615
    .no:
1617
        xor     eax, eax
1616
        xor     eax, eax
1618
 
1617
 
1619
    @@:
1618
    @@:
1620
        mov     [disasm_buf_size], eax
1619
        mov     [disasm_buf_size], eax
1621
        call    restore_from_breaks
1620
        call    restore_from_breaks
1622
        jmp     draw_disasm
1621
        jmp     draw_disasm
1623
 
1622
 
1624
 
1623
 
1625
;-----------------------------------------------------------------------------
1624
;-----------------------------------------------------------------------------
1626
;                               Draw main window
1625
;                               Draw main window
1627
 
1626
 
1628
draw_window:
1627
draw_window:
1629
        ; start window redraw
1628
        ; start window redraw
1630
        mcall   12, 1
1629
        mcall   12, 1
1631
 
1630
 
1632
        ; define window
1631
        ; define window
1633
        mcall   0, wnd_x_size, wnd_y_size, (COLOR_BG_NORMAL or 0x33000000), ,caption_str
1632
        mcall   0, wnd_x_size, wnd_y_size, (COLOR_BG_NORMAL or 0x33000000), ,caption_str
1634
 
1633
 
1635
        ; Get actual window size
1634
        ; Get actual window size
1636
        mcall   9, thread_info, -1
1635
        mcall   9, thread_info, -1
1637
 
1636
 
1638
        ; Check if window is rolled up
1637
        ; Check if window is rolled up
1639
        test    [thread_info.wnd_state], 100b
1638
        test    [thread_info.wnd_state], 100b
1640
        jnz     .done
1639
        jnz     .done
1641
 
1640
 
1642
        ; Check if window isnt smaller then permisseable
1641
        ; Check if window isnt smaller then permisseable
1643
        mov     eax, [thread_info.box.width]            ; window xsize
1642
        mov     eax, [thread_info.box.width]            ; window xsize
1644
        mov     ebx, [thread_info.box.height]           ; ysize
1643
        mov     ebx, [thread_info.box.height]           ; ysize
1645
        mov     edx, [thread_info.client_box.width]     ; work area xsize
1644
        mov     edx, [thread_info.client_box.width]     ; work area xsize
1646
        mov     esi, [thread_info.client_box.height]    ; ysize
1645
        mov     esi, [thread_info.client_box.height]    ; ysize
1647
        sub     eax, edx
1646
        sub     eax, edx
1648
        sub     ebx, esi
1647
        sub     ebx, esi
1649
 
1648
 
1650
        cmp     edx, wnd_x_size
1649
        cmp     edx, wnd_x_size
1651
        jae     .x_ok
1650
        jae     .x_ok
1652
        mov     edx, wnd_x_size
1651
        mov     edx, wnd_x_size
1653
  .x_ok:
1652
  .x_ok:
1654
        add     edx, eax
1653
        add     edx, eax
1655
 
1654
 
1656
        cmp     esi, wnd_y_size
1655
        cmp     esi, wnd_y_size
1657
        jae     .y_ok
1656
        jae     .y_ok
1658
        mov     esi, wnd_y_size
1657
        mov     esi, wnd_y_size
1659
  .y_ok:
1658
  .y_ok:
1660
        add     esi, ebx
1659
        add     esi, ebx
1661
        mcall   67, -1, -1      ; set the new sizes
1660
        mcall   67, -1, -1      ; set the new sizes
1662
 
1661
 
1663
        ; (re)calculate coordinates of GUI elements
1662
        ; (re)calculate coordinates of GUI elements
1664
        mov     eax, [thread_info.client_box.width]
1663
        mov     eax, [thread_info.client_box.width]
1665
        sub     eax, data_x_pos + data_x_pos + registers_x_size+3
1664
        sub     eax, data_x_pos + data_x_pos + registers_x_size+3
1666
        mov     [data_x_size_dd+4], eax
1665
        mov     [data_x_size_dd+4], eax
1667
        mov     [messages_x_size_dd+4], eax
1666
        mov     [messages_x_size_dd+4], eax
1668
        shl     eax, 16
1667
        shl     eax, 16
1669
        mov     [data_x_size_dd], eax
1668
        mov     [data_x_size_dd], eax
1670
        mov     [messages_x_size_dd], eax
1669
        mov     [messages_x_size_dd], eax
1671
        shr     eax, 16
1670
        shr     eax, 16
1672
        add     eax, data_x_pos + 4
1671
        add     eax, data_x_pos + 4
1673
        mov     [registers_x_pos_dd+4], eax
1672
        mov     [registers_x_pos_dd+4], eax
1674
        shl     eax, 16
1673
        shl     eax, 16
1675
        mov     [registers_x_pos_dd], eax
1674
        mov     [registers_x_pos_dd], eax
1676
 
1675
 
1677
        mov     eax, [thread_info.client_box.height]
1676
        mov     eax, [thread_info.client_box.height]
1678
        sub     eax, cmdline_y_size + data_x_pos
1677
        sub     eax, cmdline_y_size + data_x_pos
1679
        mov     [cmdline_y_pos_dd+4], eax
1678
        mov     [cmdline_y_pos_dd+4], eax
1680
        shl     eax, 16
1679
        shl     eax, 16
1681
        mov     [cmdline_y_pos_dd], eax
1680
        mov     [cmdline_y_pos_dd], eax
1682
        shr     eax, 16
1681
        shr     eax, 16
1683
        sub     eax, messages_y_size + 4
1682
        sub     eax, messages_y_size + 4
1684
        mov     [messages_y_pos_dd+4], eax
1683
        mov     [messages_y_pos_dd+4], eax
1685
        shl     eax, 16
1684
        shl     eax, 16
1686
        mov     [messages_y_pos_dd], eax
1685
        mov     [messages_y_pos_dd], eax
1687
        shr     eax, 16
1686
        shr     eax, 16
1688
        sub     eax, disasm_y_pos + 4
1687
        sub     eax, disasm_y_pos + 4
1689
        mov     [disasm_y_size_dd+4], eax
1688
        mov     [disasm_y_size_dd+4], eax
1690
        shl     eax, 16
1689
        shl     eax, 16
1691
        mov     [disasm_y_size_dd], eax
1690
        mov     [disasm_y_size_dd], eax
1692
        shr     eax, 16
1691
        shr     eax, 16
1693
        mov     ecx, 10
1692
        mov     ecx, 10
1694
        xor     edx, edx
1693
        xor     edx, edx
1695
        div     ecx
1694
        div     ecx
1696
        mov     [disasm_height_dd], eax
1695
        mov     [disasm_height_dd], eax
1697
 
1696
 
1698
        mov     eax, [thread_info.client_box.height]
1697
        mov     eax, [thread_info.client_box.height]
1699
        sub     eax, data_x_pos + registers_y_pos-1
1698
        sub     eax, data_x_pos + registers_y_pos-1
1700
        mov     [registers_y_size_dd+4], eax
1699
        mov     [registers_y_size_dd+4], eax
1701
        shl     eax, 16
1700
        shl     eax, 16
1702
        mov     [registers_y_size_dd], eax
1701
        mov     [registers_y_size_dd], eax
1703
 
1702
 
1704
        ; messages frame
1703
        ; messages frame
1705
        mov     ebx, [messages_x_size_dd+4]
1704
        mov     ebx, [messages_x_size_dd+4]
1706
        add     ebx, (messages_x_pos-2)*10000h + (messages_x_pos+2)
1705
        add     ebx, (messages_x_pos-2)*10000h + (messages_x_pos+2)
1707
        push    ebx
1706
        push    ebx
1708
        mov     ecx, [messages_y_pos_dd+2]
1707
        mov     ecx, [messages_y_pos_dd+2]
1709
        add     ecx, -2*10001h
1708
        add     ecx, -2*10001h
1710
        mov     edx, COLOR_LINE
1709
        mov     edx, COLOR_LINE
1711
        mcall   38
1710
        mcall   38
1712
        add     ecx, (messages_y_size+2+2)*10001h
1711
        add     ecx, (messages_y_size+2+2)*10001h
1713
        mcall
1712
        mcall
1714
        mov     ebx, (messages_x_pos-2)*10001h
1713
        mov     ebx, (messages_x_pos-2)*10001h
1715
        push    ebx
1714
        push    ebx
1716
        mov     ecx, [messages_y_pos_dd+2]
1715
        mov     ecx, [messages_y_pos_dd+2]
1717
        add     ecx, (-2*10000h) + (messages_y_size+2)
1716
        add     ecx, (-2*10000h) + (messages_y_size+2)
1718
        mcall
1717
        mcall
1719
        mov     ebx, [messages_x_size_dd+2]
1718
        mov     ebx, [messages_x_size_dd+2]
1720
        add     ebx, (messages_x_pos+2)*10001h
1719
        add     ebx, (messages_x_pos+2)*10001h
1721
        push    ebx
1720
        push    ebx
1722
        mcall
1721
        mcall
1723
 
1722
 
1724
        ; command line frame
1723
        ; command line frame
1725
        mov     ecx, [cmdline_y_pos_dd+2]
1724
        mov     ecx, [cmdline_y_pos_dd+2]
1726
        add     ecx, (-2*10000h) + (cmdline_y_size+2)
1725
        add     ecx, (-2*10000h) + (cmdline_y_size+2)
1727
        pop     ebx
1726
        pop     ebx
1728
        mcall
1727
        mcall
1729
        pop     ebx
1728
        pop     ebx
1730
        mcall
1729
        mcall
1731
        pop     ebx
1730
        pop     ebx
1732
        mov     ecx, [cmdline_y_pos_dd+2]
1731
        mov     ecx, [cmdline_y_pos_dd+2]
1733
        add     ecx, (cmdline_y_size+2)*10001h
1732
        add     ecx, (cmdline_y_size+2)*10001h
1734
 
1733
 
1735
        mcall
1734
        mcall
1736
        mov     ecx, [cmdline_y_pos_dd+2]
1735
        mov     ecx, [cmdline_y_pos_dd+2]
1737
        add     ecx, (-2*10001h)
1736
        add     ecx, (-2*10001h)
1738
        mcall
1737
        mcall
1739
 
1738
 
1740
        ; registers frame
1739
        ; registers frame
1741
        mov     ebx, [registers_x_pos_dd]
1740
        mov     ebx, [registers_x_pos_dd]
1742
        add     ebx, (-2) shl 16 + (registers_x_size+3)
1741
        add     ebx, (-2) shl 16 + (registers_x_size+3)
1743
        mov     ecx, (registers_y_pos-2) shl 16 + 1
1742
        mov     ecx, (registers_y_pos-2) shl 16 + 1
1744
        mov     edx, COLOR_LINE
1743
        mov     edx, COLOR_LINE
1745
        mcall   13                      ; top
1744
        mcall   13                      ; top
1746
        mov     ebx, [registers_x_pos_dd]
1745
        mov     ebx, [registers_x_pos_dd]
1747
        add     ebx, ((-2)+(registers_x_size+3)) shl 16 +1
1746
        add     ebx, ((-2)+(registers_x_size+3)) shl 16 +1
1748
        mov     ecx, [registers_y_size_dd+4]
1747
        mov     ecx, [registers_y_size_dd+4]
1749
        add     ecx, (registers_y_pos-2) shl 16 + (+3+1)
1748
        add     ecx, (registers_y_pos-2) shl 16 + (+3+1)
1750
        mcall                           ; right
1749
        mcall                           ; right
1751
        mov     ebx, [registers_x_pos_dd]
1750
        mov     ebx, [registers_x_pos_dd]
1752
        add     ebx, (-2) shl 16 + (registers_x_size+3)
1751
        add     ebx, (-2) shl 16 + (registers_x_size+3)
1753
        mov     ecx, [registers_y_size_dd]
1752
        mov     ecx, [registers_y_size_dd]
1754
        add     ecx, ((registers_y_pos-2)+(+3)) shl 16 + 1
1753
        add     ecx, ((registers_y_pos-2)+(+3)) shl 16 + 1
1755
        mcall                           ; bottom
1754
        mcall                           ; bottom
1756
 
1755
 
1757
        ; messages
1756
        ; messages
1758
        call    draw_messages
1757
        call    draw_messages
1759
 
1758
 
1760
        ; command line & cursor
1759
        ; command line & cursor
1761
        call    draw_cmdline
1760
        call    draw_cmdline
1762
        call    draw_cursor
1761
        call    draw_cursor
1763
 
1762
 
1764
        ; title & registers & dump & disasm
1763
        ; title & registers & dump & disasm
1765
        mov     ebx, (data_x_pos-2)*10001h
1764
        mov     ebx, (data_x_pos-2)*10001h
1766
        mov     ecx, (title_y_pos+5)*10000h + (-2)
1765
        mov     ecx, (title_y_pos+5)*10000h + (-2)
1767
        add     ecx, [messages_y_pos_dd+4]
1766
        add     ecx, [messages_y_pos_dd+4]
1768
        mov     edx, COLOR_LINE
1767
        mov     edx, COLOR_LINE
1769
        mcall   38
1768
        mcall   38
1770
        mov     ebx, [data_x_size_dd+2]
1769
        mov     ebx, [data_x_size_dd+2]
1771
        add     ebx, (data_x_pos+2)*10001h
1770
        add     ebx, (data_x_pos+2)*10001h
1772
        mcall
1771
        mcall
1773
        mov     ebx, [data_x_size_dd+4]
1772
        mov     ebx, [data_x_size_dd+4]
1774
        add     ebx, (data_x_pos-2)*10000h + (data_x_pos+2)
1773
        add     ebx, (data_x_pos-2)*10000h + (data_x_pos+2)
1775
        mov     ecx, (disasm_y_pos-4)*10001h
1774
        mov     ecx, (disasm_y_pos-4)*10001h
1776
        mcall
1775
        mcall
1777
 
1776
 
1778
        ; redraw whole window again
1777
        ; redraw whole window again
1779
        call    redraw_title
1778
        call    redraw_title
1780
        call    draw_registers
1779
        call    draw_registers
1781
        call    draw_dump
1780
        call    draw_dump
1782
        call    draw_disasm
1781
        call    draw_disasm
1783
 
1782
 
1784
 
1783
 
1785
  .done:
1784
  .done:
1786
        ; end of window redraw
1785
        ; end of window redraw
1787
        mcall   12, 2
1786
        mcall   12, 2
1788
        ret
1787
        ret
1789
 
1788
 
1790
; vim: ft=fasm tabstop=4
1789
; vim: ft=fasm tabstop=4