MTDBG: cleaned up, removed old code in gui.inc

git-svn-id: svn://kolibrios.org@4890 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-04-24 12:23:56 +00:00
parent 82f569ed2c
commit b130452317
3 changed files with 55 additions and 158 deletions

View File

@ -124,9 +124,6 @@ start:
mov esi, begin_str
call put_message_nodraw
; set event mask - default events and debugging events
;push 40
;pop eax
;mov ebx, 0x107
mcall 40, 0x107
; set debug messages buffer
mov ecx, dbgbufsize
@ -149,8 +146,6 @@ dodraw:
call draw_window
waitevent:
;push 10
;pop eax
mcall 10
cmp al, 9
jz debugmsg
@ -161,8 +156,6 @@ waitevent:
dec eax
jnz waitevent
; button pressed - we have only one button (close)
;push -1
;pop eax
mcall -1
; TODO: split in more independent function
@ -382,8 +375,6 @@ clear_cmdline_end:
mov ebx, [cmdline_pos]
mov ecx, [cmdline_len]
sub ecx, ebx
;push 13
;pop eax
imul ebx, 6
imul ecx, 6
inc ecx
@ -391,8 +382,6 @@ clear_cmdline_end:
shl ebx, 16
or ebx, ecx
mov ecx, cmdline_y_pos*10000h + cmdline_y_size
; setting up container color scheme
; COLOR_BG_NORMAL was 0xFFFFFF
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box for cmdline
mcall 13
@ -409,17 +398,14 @@ draw_cmdline_end:
@@:
mov esi, [cmdline_len]
sub esi, ebx
;push 4
;pop eax
; setting up text color scheme and attributes
; was 'xor ecx, ecx'
mov ecx, COLOR_TXT_NORMAL
lea edx, [cmdline+ebx]
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
or ebx, cmdline_y_pos+1
; draw a text string in the window, color in ecx
; draw a text string in the window
mcall 4
ret
@ -524,21 +510,12 @@ put_message:
call put_message_nodraw
draw_messages:
;push 13
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, messages_x_pos*10000h+messages_x_size
;mov ecx, messages_y_pos*10000h+messages_y_size
; draw container rectanle/box
; COLOR_BG_NORMAL was 0xFFFFFF
; draw container rectangle/box
mcall 13, messages_x_pos*10000h+messages_x_size, messages_y_pos*10000h+messages_y_size, COLOR_BG_NORMAL
mov edx, messages
push messages_width
pop esi
; setting up text color scheme/attributes
; was 'xor ecx, ecx'
mov ecx, COLOR_TXT_NORMAL
;mov al, 4
mov ebx, messages_x_pos*10000h+messages_y_pos
@@:
@ -600,20 +577,10 @@ hide_cursor:
; FIXME: something wrong here
redraw_title:
;push 13
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, title_x_pos*10000h + data_x_pos+data_x_size-title_x_pos
;mov ecx, title_y_pos*10000h + title_y_size
; draw container rectangle/box
; color was 0xFFFFFF
mcall 13, title_x_pos*10000h+data_x_pos+data_x_size-title_x_pos, title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL
draw_title:
;mov al, 38
;mov ebx, (data_x_pos-2)*10000h + title_x_pos-5
;mov ecx, (title_y_pos+5)*10001h
; draw line with COLOR_LINE (in edx)
mcall 38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE
push NoPrgLoaded_len
pop esi
@ -689,40 +656,30 @@ draw_register:
push esi
mov eax, esi
mov esi, ecx
; setting up registers colors
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi
mov edi, [eax]
cmp dword [eax+oldcontext-context], edi
pop edi
jz .cd
; changed register color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd:
;push 4
;pop eax
; draw a text string in the window
mcall 4
imul esi, 60000h
lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 80101h
mov esi, ecx
pop ecx
; draw a number in the window
; color in the esi (same value as for usual text)
mcall 47, 80101h
lea ebx, [edx+60000h*18]
mov esi, ecx
@ -741,17 +698,13 @@ draw_fpu_register:
push esi
mov eax, esi
mov esi, ecx
; setting up registers color
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi
mov edi, [eax]
@ -765,19 +718,13 @@ draw_fpu_register:
jz .cd
.scol:
; changed register color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd:
;push 4
;pop eax
; draw a text string in the window
mcall 4
imul esi, 60000h
lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 40100101h ; [20] show 16 chars set [30] bit - qword
mov esi, ecx
pop ecx
; draw a number in the window
@ -801,17 +748,13 @@ draw_mmx_register:
push esi
mov eax, esi
mov esi, ecx
; setting up registers color
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi
mov edi, [eax]
@ -825,19 +768,14 @@ draw_mmx_register:
jz .cd
.scol:
; changed color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd:
;push 4
;pop eax
; draw a text string in the window
mcall 4
imul esi, 60000h
lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 40100101h ; [20] show 16 chars set [30] bit - qword
mov esi, ecx
pop ecx
; draw a number in the window
@ -867,17 +805,12 @@ draw_flag:
and byte [edx], not 20h
.onoff:
; setting up registers colors
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .doit
cmp [bSuspended], 0
jz .doit
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
bt [_eflags], edi
lahf
@ -885,14 +818,10 @@ draw_flag:
rcl ah, 1
test ah, 3
jp .doit
; changed color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.doit:
mov ah, 0
; background color for text string or number
; was 0xFFFFFF - white
mov edi, COLOR_BG_NORMAL
; draw a text string in the window in one case
; and a number in another
@ -1002,10 +931,7 @@ draw_main_registers:
mov ebx, (registers_x_pos+2)*10000h+registers_y_pos+212
add esi, _mm7-_mm6
call draw_mmx_register
;mov al, 4
; setting up text color
; inactive color
; was 0x808080 - grey
mov ecx, COLOR_TXT_INACTIVE
cmp [debuggee_pid], 0
jz @f
@ -1200,19 +1126,8 @@ draw_dump:
;-----------------------------------------------------------------------------
; Display disassembled code
; @@@@@ WAS:
; redraw_disasm:
; push 13
; pop eax
; mov edx, 0xFFFFFF
; mov ebx, data_x_pos*10000h + data_x_size
; mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
; mcall
;
; @@@@@ NOW:
draw_disasm:
.redraw:
mov eax, [disasm_start_pos]
mov [disasm_cur_pos], eax
and [disasm_cur_str], 0
@ -1229,9 +1144,6 @@ draw_disasm:
mov cl, 11
; setting up background color for disassembled text
mov edx, COLOR_BG_NORMAL
;mov ebx, data_x_pos*10000h + data_x_size
;push 13
;pop eax
; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
mcall 13, data_x_pos*10000h+data_x_size
pop ebx
@ -1302,15 +1214,13 @@ draw_disasm:
; draw container rectangle/box for disassembled text
; color in edx
mcall 13
;mov al, 47
;mov ebx, 80100h
mov edx, [disasm_cur_str]
imul edx, 10
add edx, data_x_pos*10000h + disasm_y_pos
;mov ecx, ebp
; draw a number in the window, color in esi
mcall 47, 80100h, ebp
;mov al, 4
lea ebx, [edx+8*6*10000h]
mov ecx, esi ; text color
push 2
@ -1347,7 +1257,7 @@ draw_disasm:
cmp esi, ebp
pop esi
jbe .drawhex
;mov al, 4
lea ebx, [edx-6*10000h]
; copy color value from esi
mov ecx, esi
@ -1370,7 +1280,7 @@ draw_disasm:
mov ebx, [disasm_cur_str]
imul ebx, 10
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
;mov al, 4
; draw a text string in the window, color in ecx
mcall 4
inc [disasm_cur_str]
@ -1387,14 +1297,8 @@ draw_disasm:
sub eax, ecx
shl eax, 16
add ecx, eax
;push 13
;pop eax
;mov ebx, data_x_pos*65536 + data_x_size
; set backroung color for disassembly container
; was 0xFFFFFF - white
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box with color COLOR_BG_NORMAL (in edx)
mcall 13, data_x_pos*65536+data_x_size
; Draw filled rectangle
mcall 13, data_x_pos*10000h+data_x_size, , COLOR_BG_NORMAL
@@:
ret
@ -1417,7 +1321,7 @@ update_disasm_eip:
@@:
cmp [_eip], eax
jz draw_disasm.redraw
jz draw_disasm
push ecx
call disasm_instr
pop ecx
@ -1433,14 +1337,7 @@ update_disasm_eip_force:
update_disasm:
cmp [debuggee_pid], 0
jz .no
;push 69
;pop eax
;push 6
;pop ebx
;mov ecx, [debuggee_pid]
;mov edi, disasm_buffer
;mov edx, 256
;mov esi, [disasm_start_pos]
mcall 69, 6, [debuggee_pid], 256, [disasm_start_pos], disasm_buffer
cmp eax, -1
jnz @f
@ -1453,7 +1350,7 @@ update_disasm:
@@:
mov [disasm_buf_size], eax
call restore_from_breaks
jmp draw_disasm.redraw
jmp draw_disasm
;-----------------------------------------------------------------------------
@ -1563,7 +1460,7 @@ draw_window:
call redraw_title
call draw_registers
call draw_dump
call draw_disasm.redraw
call draw_disasm
; end of window redraw
mcall 12, 2

View File

@ -1341,7 +1341,7 @@ OnBp:
call put_message
.ret:
jmp draw_disasm.redraw
jmp draw_disasm
OnBpmb:
mov dh, 0011b

View File

@ -313,7 +313,7 @@ OnLoadSymbols:
call sort
mov esi, aSymbolsLoaded
call put_message
jmp draw_disasm.redraw
jmp draw_disasm
;-----------------------------------------------------------------------------
;