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