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