mtdbg: flickering reduced

git-svn-id: svn://kolibrios.org@998 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2009-01-24 19:26:02 +00:00
parent 77889c54ce
commit 0be9a1a504

View File

@ -573,16 +573,18 @@ draw_register:
mov eax, esi mov eax, esi
mov esi, ecx mov esi, ecx
; color ; color
mov ecx, 808080h mov ecx, 40808080h
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .cd jz .cd
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .cd jz .cd
xor ecx, ecx mov ecx, 40000000h
push edi
mov edi, [eax] mov edi, [eax]
cmp dword [eax+oldcontext-context], edi cmp dword [eax+oldcontext-context], edi
pop edi
jz .cd jz .cd
mov ecx, 0x00AA00 mov ecx, 0x4000AA00
.cd: .cd:
push 4 push 4
pop eax pop eax
@ -609,32 +611,34 @@ draw_flag:
.on: .on:
and byte [edx], not 20h and byte [edx], not 20h
.onoff: .onoff:
mov ecx, 808080h mov ecx, 40808080h
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .doit jz .doit
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .doit jz .doit
xor ecx, ecx mov ecx, 40000000h
bt [_eflags], edi bt [_eflags], edi
lahf lahf
bt dword [_eflags + oldcontext - context], edi bt dword [_eflags + oldcontext - context], edi
rcl ah, 1 rcl ah, 1
test ah, 3 test ah, 3
jp .doit jp .doit
mov ecx, 0x00AA00 mov ecx, 0x4000AA00
.doit: .doit:
mov ah, 0 mov ah, 0
mov edi, 0xFFFFFF
mcall mcall
ret ret
redraw_registers: draw_registers:
push 13 push 13
pop eax pop eax
mov edx, 0xFFFFFF mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size mov ebx, data_x_pos*10000h + data_x_size
mov ecx, registers_y_pos*10000h + registers_y_size mov ecx, registers_y_pos*10000h + registers_y_size
mcall mcall
draw_registers: redraw_registers:
mov edi, 0xFFFFFF
mov esi, _eax mov esi, _eax
push 4 push 4
pop ecx pop ecx
@ -684,25 +688,26 @@ draw_registers:
jnz @b jnz @b
ret ret
redraw_dump: draw_dump:
push 13 push 13
pop eax pop eax
mov edx, 0xFFFFFF mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size mov ebx, data_x_pos*10000h + data_x_size
mov ecx, dump_y_pos*10000h + dump_y_size mov ecx, dump_y_pos*10000h + dump_y_size
mcall mcall
draw_dump: redraw_dump:
; addresses ; addresses
mov al, 47 mov al, 47
mov ebx, 80100h mov ebx, 80100h
mov edx, data_x_pos*10000h + dump_y_pos mov edx, data_x_pos*10000h + dump_y_pos
mov ecx, [dumppos] mov ecx, [dumppos]
mov esi, 808080h mov edi, 0xFFFFFF
mov esi, 40808080h
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz @f jz @f
cmp [bSuspended], 0 cmp [bSuspended], 0
jz @f jz @f
xor esi, esi mov esi, 40000000h
@@: @@:
mcall mcall
add ecx, 10h add ecx, 10h
@ -710,44 +715,48 @@ draw_dump:
cmp dl, dump_y_pos + dump_y_size cmp dl, dump_y_pos + dump_y_size
jb @b jb @b
; hex dump of data ; hex dump of data
mov ebx, 20101h
mov ecx, dumpdata mov ecx, dumpdata
push ecx push ecx
xor edi, edi xor ebx, ebx
mov edx, (data_x_pos+12*6)*10000h + dump_y_pos mov edx, (data_x_pos+12*6)*10000h + dump_y_pos
cmp [dumpread], edi cmp [dumpread], ebx
jz .hexdumpdone1 jz .hexdumpdone1
.hexdumploop1: .hexdumploop1:
push ebx
mov ebx, 20101h
mcall mcall
pop ebx
add edx, 3*6*10000h add edx, 3*6*10000h
inc ecx inc ecx
inc edi inc ebx
test edi, 15 test bl, 15
jz .16 jz .16
test edi, 7 test bl, 7
jnz @f jnz @f
add edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h add edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
.16: .16:
add edx, 10 - 6*(3*10h+2)*10000h add edx, 10 - 6*(3*10h+2)*10000h
@@: @@:
cmp edi, [dumpread] cmp ebx, [dumpread]
jb .hexdumploop1 jb .hexdumploop1
.hexdumpdone1: .hexdumpdone1:
mov al, 4 mov al, 4
mov ecx, esi mov ecx, esi
mov ebx, edx xchg ebx, edx
push 2 push 2
pop esi pop esi
mov edx, aQuests
.hexdumploop2: .hexdumploop2:
cmp edi, dump_height*10h cmp edx, dump_height*10h
jae .hexdumpdone2 jae .hexdumpdone2
push edx
mov edx, aQuests
mcall mcall
pop edx
add ebx, 3*6*10000h add ebx, 3*6*10000h
inc edi inc edx
test edi, 15 test dl, 15
jz .16x jz .16x
test edi, 7 test dl, 7
jnz .hexdumploop2 jnz .hexdumploop2
add ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h add ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
.16x: .16x:
@ -772,8 +781,8 @@ draw_dump:
jb @b jb @b
; ASCII data ; ASCII data
mov ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos mov ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
mov edi, dump_height*10h
pop edx pop edx
push dump_height*10h
.asciiloop: .asciiloop:
push edx push edx
cmp byte [edx], 20h cmp byte [edx], 20h
@ -784,22 +793,23 @@ draw_dump:
pop edx pop edx
inc edx inc edx
add ebx, 6*10000h add ebx, 6*10000h
dec edi dec dword [esp]
jz .asciidone jz .asciidone
test edi, 15 test byte [esp], 15
jnz .asciiloop jnz .asciiloop
add ebx, 10 - 6*10h*10000h add ebx, 10 - 6*10h*10000h
jmp .asciiloop jmp .asciiloop
.asciidone: .asciidone:
pop ecx
ret ret
redraw_disasm: redraw_disasm:
push 13 ; push 13
pop eax ; pop eax
mov edx, 0xFFFFFF ; mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size ; mov ebx, data_x_pos*10000h + data_x_size
mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1) ; mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
mcall ; mcall
draw_disasm: draw_disasm:
mov eax, [disasm_start_pos] mov eax, [disasm_start_pos]
mov [disasm_cur_pos], eax mov [disasm_cur_pos], eax
@ -817,11 +827,24 @@ draw_disasm:
jnz @b jnz @b
mov byte [esi-1], ':' mov byte [esi-1], ':'
sub esi, edx sub esi, edx
xor ecx, ecx mov ecx, 40000000h
mov edi, 0xFFFFFF
push 4 push 4
pop eax pop eax
mcall mcall
mov byte [esi+edx-1], 0 mov byte [esi+edx-1], 0
lea esi, [esi*3]
movzx ecx, bx
shr ebx, 16
lea ebx, [ebx+esi*2]
shl ecx, 16
mov cl, 10
imul ebx, 10001h
sub bx, data_x_pos+data_x_size
neg bx
mov al, 13
mov edx, edi
mcall
inc [disasm_cur_str] inc [disasm_cur_str]
cmp [disasm_cur_str], disasm_height cmp [disasm_cur_str], disasm_height
jae .loopend jae .loopend
@ -831,6 +854,7 @@ draw_disasm:
pop ebp pop ebp
jc .loopend jc .loopend
xor esi, esi ; default color: black xor esi, esi ; default color: black
mov edx, 0xFFFFFF ; default background: white
mov ebx, data_x_pos*10000h + data_x_size mov ebx, data_x_pos*10000h + data_x_size
mov ecx, [disasm_cur_str] mov ecx, [disasm_cur_str]
imul ecx, 10*10000h imul ecx, 10*10000h
@ -840,22 +864,18 @@ draw_disasm:
call find_enabled_breakpoint call find_enabled_breakpoint
popad popad
jnz .nored jnz .nored
push 13 mov edx, 0xFF0000 ; use background: red
pop eax
mov edx, 0xFF0000
mcall
.nored: .nored:
mov eax, [_eip] mov eax, [_eip]
cmp eax, ebp cmp eax, ebp
jnz .noblue jnz .noblue
push 13 mov edx, 0x0000FF ; use background: blue
pop eax
mov edx, 0x0000FF
mcall
mov esi, 0xFFFFFF ; on blue bgr, use white color mov esi, 0xFFFFFF ; on blue bgr, use white color
.noblue: .noblue:
push 47 push 13
pop eax pop eax
mcall
mov al, 47
mov ebx, 80100h mov ebx, 80100h
mov edx, [disasm_cur_str] mov edx, [disasm_cur_str]
imul edx, 10 imul edx, 10
@ -865,7 +885,7 @@ draw_disasm:
mov al, 4 mov al, 4
lea ebx, [edx+8*6*10000h] lea ebx, [edx+8*6*10000h]
mov ecx, esi mov ecx, esi
push 1 push 2
pop esi pop esi
mov edx, aColon mov edx, aColon
mcall mcall
@ -873,12 +893,12 @@ draw_disasm:
pop edi pop edi
lea edx, [ebx+2*6*10000h] lea edx, [ebx+2*6*10000h]
mov esi, ecx mov esi, ecx
mov al, 47
mov ebx, 20101h
mov ecx, ebp mov ecx, ebp
sub ecx, [disasm_start_pos] sub ecx, [disasm_start_pos]
add ecx, disasm_buffer add ecx, disasm_buffer
.drawhex: .drawhex:
mov al, 47
mov ebx, 20101h
mcall mcall
add edx, 6*3*10000h add edx, 6*3*10000h
inc ecx inc ecx
@ -919,6 +939,20 @@ draw_disasm:
cmp [disasm_cur_str], disasm_height cmp [disasm_cur_str], disasm_height
jb .loop jb .loop
.loopend: .loopend:
mov ecx, disasm_height
sub ecx, [disasm_cur_str]
jz @f
imul ecx, 10
mov eax, disasm_y_pos + disasm_y_size
sub eax, ecx
shl eax, 16
add ecx, eax
push 13
pop eax
mov ebx, data_x_pos*65536 + data_x_size
mov edx, 0xFFFFFF
mcall
@@:
ret ret
update_disasm_eip: update_disasm_eip:
@ -978,9 +1012,45 @@ draw_window:
xor eax, eax xor eax, eax
mov ebx, wnd_x_size mov ebx, wnd_x_size
mov ecx, wnd_y_size mov ecx, wnd_y_size
mov edx, 14FFFFFFh mov edx, 54FFFFFFh
mov edi, caption_str mov edi, caption_str
mcall mcall
; clear unused areas
mov al, 48
push 4
pop ebx
mcall
cmp eax, title_y_pos
jb @f
push registers_y_pos
pop eax
@@:
push registers_y_pos
pop ecx
push eax
sub ecx, eax
shl eax, 16
add ecx, eax
mov ebx, 5*10000h + (wnd_x_size-9)
push 13
pop eax
mcall
mov ecx, (registers_y_pos+registers_y_size)*10000h + (dump_y_pos-registers_y_pos-registers_y_size)
mcall
mov ecx, (dump_y_pos+dump_y_size)*10000h + (disasm_y_pos-dump_y_pos-dump_y_size)
mcall
mov ecx, (disasm_y_pos+disasm_y_size)*10000h + (messages_y_pos-disasm_y_pos-disasm_y_size)
mcall
mov ecx, (messages_y_pos+messages_y_size)*10000h + (wnd_y_size-messages_y_pos-messages_y_size-4)
mcall
mov ebx, 5*10000h + (data_x_pos-5)
pop ecx
imul ecx, 10001h
sub cx, wnd_y_size-4
neg cx
mcall
mov ebx, (data_x_pos+data_x_size)*10000h + (wnd_x_size-data_x_pos-data_x_size-4)
mcall
; messages frame ; messages frame
mov al, 38 mov al, 38
mov ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2) mov ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2)
@ -1025,10 +1095,10 @@ draw_window:
mcall mcall
mov ecx, (disasm_y_pos-4)*10001h mov ecx, (disasm_y_pos-4)*10001h
mcall mcall
call draw_title call redraw_title
call draw_registers call draw_registers
call draw_dump call draw_dump
call draw_disasm call redraw_disasm
; end redraw ; end redraw
push 12 push 12
pop eax pop eax
@ -5609,7 +5679,7 @@ cgrp15:
caption_str db 'Kolibri Debugger',0 caption_str db 'Kolibri Debugger',0
caption_len = $ - caption_str caption_len = $ - caption_str
begin_str db 'Kolibri Debugger, version 0.31',10 begin_str db 'Kolibri Debugger, version 0.32',10
db 'Hint: type "help" for help, "quit" for quit' db 'Hint: type "help" for help, "quit" for quit'
newline db 10,0 newline db 10,0
prompt db '> ',0 prompt db '> ',0
@ -5878,6 +5948,7 @@ aPaused db 'Paused'
aPoint db 0x1C aPoint db 0x1C
aMinus db '-' aMinus db '-'
aColon db ':' aColon db ':'
aSpace db ' '
aQuests db '??' aQuests db '??'
aDots db '...' aDots db '...'
aParseError db 'Parse error',10,0 aParseError db 'Parse error',10,0