Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7677 → Rev 7676

/programs/develop/mtdbg/gui.inc
9,63 → 9,6
MOVIEOS = 1
WHITE_ON_BLACK = 2
 
;-----------------------------------------------------------------------------
; Font
 
FONT equ 0 ; 0 to 3
FONT_MULTIPLIER equ 1 ; 1 to 8
 
;-----------------------------------------------------------------------------
; GUI elements size and position
 
TEXT_Y_CLEARANCE = 1 ; in pixels
 
DATA_WIDTH = 80 ; in characters
DATA_X_POS = 12 ; in pixels
 
TITLE_X_POS = 30 ; in pixels
TITLE_Y_POS = 8 ; in pixels
 
DUMP_HEIGHT = 6 ; in text lines
MIN_DISASM_HEIGHT = 18 ; in text lines
MSG_HEIGHT = 14 ; in text lines
 
;-----------------------------------------------------------------------------
 
if (FONT eq 0)
FONT_X_SIZE = 6*FONT_MULTIPLIER
else
FONT_X_SIZE = 8*FONT_MULTIPLIER
end if
 
if (FONT eq 0)
FONT_Y_SIZE = 9*FONT_MULTIPLIER
else
FONT_Y_SIZE = 16*FONT_MULTIPLIER
end if
 
TITLE_Y_SIZE = (FONT_Y_SIZE + TEXT_Y_CLEARANCE)
DUMP_Y_POS = (TITLE_Y_POS + TITLE_Y_SIZE)
DUMP_Y_SIZE = (DUMP_HEIGHT*(FONT_Y_SIZE + TEXT_Y_CLEARANCE))
DISASM_Y_POS = (DUMP_Y_POS + DUMP_Y_SIZE + 4)
 
MSG_WIDTH = DATA_WIDTH
MSG_X_POS = DATA_X_POS
MSG_X_SIZE = MSG_WIDTH*FONT_X_SIZE
MSG_Y_SIZE = MSG_HEIGHT*(FONT_Y_SIZE + TEXT_Y_CLEARANCE)
 
CMD_WIDTH = DATA_WIDTH
CMD_X_POS = DATA_X_POS
CMD_Y_SIZE = (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
 
REGISTERS_Y_POS = DUMP_Y_POS
REGISTERS_X_SIZE = (22+2)*(FONT_X_SIZE) ; 22 characters + 2 spacing
 
wnd_x_size = (DATA_X_POS + MSG_X_SIZE + DATA_X_POS + REGISTERS_X_SIZE + 3) + 10
wnd_y_size = (((DISASM_Y_POS + (MIN_DISASM_HEIGHT*(FONT_Y_SIZE + TEXT_Y_CLEARANCE)) + 4) + MSG_Y_SIZE + 4) + CMD_Y_SIZE + DATA_X_POS)
 
;-----------------------------------------------------------------------------
 
; format - 0xRRGGBB
if COLOR_THEME eq MOVIEOS
 
125,6 → 68,45
 
 
;-----------------------------------------------------------------------------
 
data_width = 80
data_x_pos = 12
data_x_size = data_width*6
 
title_x_pos = 30
title_y_pos = 8
title_y_size = 10
 
dump_y_pos = (title_y_pos + title_y_size)
dump_height = 6
dump_y_size = (dump_height*10)
 
disasm_y_pos = (dump_y_pos + dump_y_size + 4)
min_disasm_height = 18
min_disasm_y_size = (min_disasm_height*10)
 
messages_width = data_width
messages_height = 8
messages_x_pos = data_x_pos
min_messages_y_pos = (disasm_y_pos + min_disasm_y_size + 4)
messages_x_size = messages_width*6
messages_y_size = messages_height*10
 
cmdline_width = data_width
cmdline_x_pos = data_x_pos
min_cmdline_y_pos = (min_messages_y_pos + messages_y_size + 4)
cmdline_x_size = messages_x_size
cmdline_y_size = 10
 
registers_x_pos = (data_x_pos + messages_x_size + 4)
registers_y_pos = (title_y_pos + title_y_size - 3)
registers_x_size = 134+2*6
registers_y_size = (min_cmdline_y_pos + cmdline_y_size - registers_y_pos+1)
 
wnd_x_size = (data_x_pos + messages_x_size + data_x_pos + registers_x_size+3) + 10
wnd_y_size = (min_cmdline_y_pos + cmdline_y_size + data_x_pos)
 
;-----------------------------------------------------------------------------
; Entry point
 
; TODO: split all gui part in independent function, move entry point into mtdbg.asm
143,7 → 125,7
pop eax
 
mov edi, messages
mov ecx, MSG_WIDTH*MSG_HEIGHT
mov ecx, messages_width*messages_height
mov al, ' '
rep stosb
xor eax, eax
156,7 → 138,7
mov esi, begin_str
call put_message_nodraw
; set event mask - default events and debugging events
mcall 40, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG
mcall 40, 0x107
; set debug messages buffer
mov ecx, dbgbufsize
mov dword [ecx], 256
210,10 → 192,10
pop edx
mov edx, [btn2_tab+edx*4]
mov edi, COLOR_BG_NORMAL
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
mov esi, 7
mov ebx, [registers_x_pos_dd]
add ebx, 4*10000h+REGISTERS_Y_POS
add ebx, 4*10000h+registers_y_pos+2
mcall 4
jmp waitevent
 
251,7 → 233,7
jz F7
cmp ah, 0x42
jz F8
cmp [cmdline_len], CMD_WIDTH
cmp [cmdline_len], cmdline_width
jae waitevent
push eax
call clear_cmdline_end
441,14 → 423,14
mov ebx, [cmdline_pos]
mov ecx, [cmdline_len]
sub ecx, ebx
imul ebx, FONT_X_SIZE
imul ecx, FONT_X_SIZE
imul ebx, 6
imul ecx, 6
inc ecx
add ebx, CMD_X_POS
add ebx, cmdline_x_pos
shl ebx, 16
or ebx, ecx
mov ecx, [cmdline_y_pos_dd]
mov cx, CMD_Y_SIZE
mov cx, cmdline_y_size
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box for cmdline
mcall 13
466,10 → 448,10
mov esi, [cmdline_len]
sub esi, ebx
 
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ecx, COLOR_TXT_NORMAL
lea edx, [cmdline+ebx]
imul ebx, FONT_X_SIZE
add ebx, CMD_X_POS
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
mov bx, word[cmdline_y_pos_dd+4]
inc bx
505,7 → 487,7
 
.newline:
push edx
mov ecx, MSG_WIDTH
mov ecx, messages_width
xor eax, eax
xchg eax, edx
div ecx
551,17 → 533,17
jmp .l
 
test_scroll:
cmp edx, MSG_WIDTH*MSG_HEIGHT
cmp edx, messages_width*messages_height
jnz .ret
push esi
mov edi, messages
lea esi, [edi+MSG_WIDTH]
mov ecx, (MSG_HEIGHT-1)*MSG_WIDTH/4
lea esi, [edi+messages_width]
mov ecx, (messages_height-1)*messages_width/4
rep movsd
push eax
mov al, ' '
push edi
push MSG_WIDTH
push messages_width
pop ecx
sub edx, ecx
rep stosb
579,16 → 561,16
 
draw_messages:
; draw container rectangle/box
mov ebx, MSG_X_POS shl 16
mov ebx, messages_x_pos shl 16
add ebx, [messages_x_size_dd+4]
mov ecx, [messages_y_pos_dd]
mov cx, MSG_Y_SIZE
mov cx, messages_y_size
mcall 13, , , COLOR_BG_NORMAL
mov edx, messages
push MSG_WIDTH
push messages_width
pop esi
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ebx, MSG_X_POS*10000h
mov ecx, COLOR_TXT_NORMAL
mov ebx, messages_x_pos*10000h
mov bx, word[messages_y_pos_dd+4]
 
@@:
595,8 → 577,8
; display text string in the window
mcall 4
add edx, esi
add ebx, FONT_Y_SIZE+TEXT_Y_CLEARANCE
cmp edx, messages+MSG_WIDTH*MSG_HEIGHT
add ebx, 10
cmp edx, messages+messages_width*messages_height
jb @b
ret
 
606,14 → 588,14
; TODO: make it cursor.draw and cursor.hide ???
draw_cursor:
mov ecx, [cmdline_y_pos_dd+2]
add cx, CMD_Y_SIZE-1
add cx, cmdline_y_size-1
mov ebx, [cmdline_pos]
imul ebx, FONT_X_SIZE
add ebx, CMD_X_POS
imul ebx, 6
add ebx, cmdline_x_pos
mov edx, ebx
shl ebx, 16
or ebx, edx
mov edx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov edx, COLOR_TXT_NORMAL
; draw line
mcall 38
ret
620,12 → 602,12
 
hide_cursor:
mov ebx, [cmdline_pos]
imul ebx, FONT_X_SIZE
add ebx, CMD_X_POS
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
inc ebx
mov ecx, [cmdline_y_pos_dd]
mov cx, CMD_Y_SIZE
mov cx, cmdline_y_size
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box
mcall 13
633,10 → 615,10
cmp ebx, [cmdline_len]
jae .ret
; setting up text color scheme and attributes
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ecx, COLOR_TXT_NORMAL
lea edx, [cmdline+ebx]
imul ebx, FONT_X_SIZE
add ebx, CMD_X_POS
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
mov bx, word[cmdline_y_pos_dd+4]
inc bx
655,11 → 637,11
redraw_title:
; draw container rectangle/box
mov ebx, [data_x_size_dd+4]
add ebx, TITLE_X_POS*10000h+DATA_X_POS-TITLE_X_POS
mcall 13, , TITLE_Y_POS*10000h+TITLE_Y_SIZE, COLOR_BG_NORMAL
add ebx, title_x_pos*10000h+data_x_pos-title_x_pos
mcall 13, , title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL
 
draw_title:
mcall 38, (DATA_X_POS-2)*10000h+TITLE_X_POS-5, (TITLE_Y_POS+(FONT_Y_SIZE/2))*10001h, COLOR_LINE
mcall 38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE
push NoPrgLoaded_len
pop esi
cmp [debuggee_pid], 0
667,26 → 649,26
mov esi, [prgname_len]
 
@@:
imul ebx, esi, FONT_X_SIZE
add ebx, TITLE_X_POS+4
imul ebx, esi, 6
add ebx, title_x_pos+4
shl ebx, 16
mov bx, DATA_X_POS-10-5-FONT_X_SIZE*7
mov bx, data_x_pos-10-5-6*7
add bx, word[data_x_size_dd+4]
cmp [bSuspended], 0
jz @f
add ebx, FONT_X_SIZE
add ebx, 6
 
@@:
; draw line with COLOR_LINE (in edx)
mcall
mov ebx, [data_x_size_dd+2]
add ebx, (DATA_X_POS-10+4)*0x10000 + DATA_X_POS+2
add ebx, (data_x_pos-10+4)*0x10000 + data_x_pos+2
; draw line with COLOR_LINE (in edx)
mcall
mov al, 4
mov ebx, TITLE_X_POS*10000h+TITLE_Y_POS
mov ebx, title_x_pos*10000h+title_y_pos
; setting up text color scheme and attributes
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ecx, COLOR_TXT_NORMAL
mov edx, NoPrgLoaded_str
cmp [debuggee_pid], 0
jz @f
698,19 → 680,19
cmp [debuggee_pid], 0
jz .nodebuggee
mov ebx, [data_x_size_dd]
add ebx, (DATA_X_POS-10-FONT_X_SIZE*7)*10000h + TITLE_Y_POS
add ebx, (data_x_pos-10-6*7)*10000h + title_y_pos
mov edx, aRunning
push 7
pop esi
cmp [bSuspended], 0
jz @f
add ebx, FONT_X_SIZE*10000h
add ebx, 6*10000h
mov edx, aPaused
dec esi
 
@@:
; draw line with COLOR_LINE (in edx) in one case
; and draw text string with color (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL (in ecx) in another
; and draw text string with color COLOR_TXT_NORMAL (in ecx) in another
mcall
ret
 
717,8 → 699,8
.nodebuggee:
mov al, 38
mov ebx, [data_x_size_dd+2]
add ebx, (DATA_X_POS-10-FONT_X_SIZE*7-5)*0x10000 + DATA_X_POS+2
mov ecx, (TITLE_Y_POS+(FONT_Y_SIZE/2))*10001h
add ebx, (data_x_pos-10-6*7-5)*0x10000 + data_x_pos+2
mov ecx, (title_y_pos+5)*10001h
mov edx, COLOR_LINE
jmp @b
 
742,16 → 724,16
 
mov eax, [esi]
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
cmp eax, dword [esi+oldcontext-context]
je .cd
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd:
push eax ;store reg value
 
759,7 → 741,7
; draw a text string in the window
mcall 4
 
imul esi, FONT_X_SIZE*10000h
imul esi, 60000h
lea edx, [ebx+esi]
mov esi, ecx
pop ecx
769,7 → 751,7
mcall 47, 0x00040100
 
shr ecx, 16
add edx, (4*FONT_X_SIZE+3) shl 16
add edx, (4*6+3) shl 16
mcall 47
 
pop ebp
1025,13 → 1007,13
 
.display:
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .do_label
cmp [bSuspended], 0
jz .do_label
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
 
mov eax, dword [_st0+ebp]
cmp eax, dword [_st0+(oldcontext-context)+ebp]
1046,14 → 1028,16
je .do_label
 
.scol:
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
 
.do_label:
; draw a text string in the window
 
mov eax, 4
mov esi, 23
mov edx, .str_buf
mov edi, COLOR_BG_NORMAL
mcall 4
int 0x40
 
shr ebp, 4
add esp, 32+16+10+10+4+4
1091,13 → 1075,13
stosb
call .hex_2_str
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
 
mov eax, dword [_mm0+ebp]
cmp eax, dword [_mm0+(oldcontext-context)+ebp]
1108,14 → 1092,15
je .cd
 
.scol:
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd:
; draw a text string in the window
 
mov eax, 4
mov esi, 23
mov edx, esp
mov edi, COLOR_BG_NORMAL
mcall 4
int 0x40
shr ebp, 4
add esp, 24
ret
1140,10 → 1125,10
push 8
xor ebp, ebp
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+14*(TEXT_Y_CLEARANCE+FONT_Y_SIZE)
add ebx, 2*10000h+registers_y_pos+142
.draw_regs:
call draw_fpu_register_2
add ebx, FONT_Y_SIZE+TEXT_Y_CLEARANCE
add ebx, 10
inc ebp
dec dword [esp]
jnz .draw_regs
1157,10 → 1142,10
push 8
xor ebp, ebp
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+14*(TEXT_Y_CLEARANCE+FONT_Y_SIZE)
add ebx, 2*10000h+registers_y_pos+142
.draw_regs:
call draw_mmx_register_2
add ebx, FONT_Y_SIZE+TEXT_Y_CLEARANCE
add ebx, 10
inc ebp
dec dword [esp]
jnz .draw_regs
1174,10 → 1159,10
push 8
xor ebp, ebp
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+14*(TEXT_Y_CLEARANCE+FONT_Y_SIZE)
add ebx, 2*10000h+registers_y_pos+232
.draw_regs:
; call draw_sse_register
add ebx, FONT_Y_SIZE+TEXT_Y_CLEARANCE
add ebx, 10
inc ebp
dec dword [esp]
jnz .draw_regs
1200,13 → 1185,13
and byte [edx], not 20h
 
.onoff:
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz .doit
cmp [bSuspended], 0
jz .doit
 
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
bt [_eflags], edi
lahf
bt dword [_eflags + oldcontext - context], edi
1213,7 → 1198,7
rcl ah, 1
test ah, 3
jp .doit
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_CHANGED or 0x40000000)
mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
 
.doit:
mov ah, 0
1230,11 → 1215,11
; Also show current register set (common + MMX, SSE or AVX)
draw_reg_title:
mov edi, COLOR_BG_NORMAL
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
mov esi, 7
cmp [reg_mode], REG_MODE_CPU
jz @f
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@:
movzx edx, [fpu_mode]
mov edx, [btn2_tab+edx*4]
1241,27 → 1226,27
 
; draw a text string in the window
mov ebx, [registers_x_pos_dd]
add ebx, 4*10000h+REGISTERS_Y_POS
add ebx, 4*10000h+registers_y_pos+2
mcall 4
 
cmp [reg_mode], REG_MODE_SSE
jz @f
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@:
mov edx, aSSE
; draw a text string in the window
mov ebx, [registers_x_pos_dd]
add ebx, (7*FONT_X_SIZE+4)*10000h+REGISTERS_Y_POS
add ebx, 46*10000h+registers_y_pos+2
mcall 4
 
cmp [reg_mode], REG_MODE_AVX
jz @f
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@:
mov edx, aAVX
; draw a text string in the window
mov ebx, [registers_x_pos_dd]
add ebx, (14*FONT_X_SIZE+4)*10000h+REGISTERS_Y_POS
add ebx, 88*10000h+registers_y_pos+2
mcall 4
ret
 
1276,42 → 1261,42
pop ecx
mov edx, regs_strs
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+2*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+22
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+3*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+32
add esi, _ebx-_eax
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+4*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+42
add esi, _ecx-_ebx
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+5*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+52
add esi, _edx-_ecx
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+6*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+62
add esi, _esi-_edx
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+7*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+72
add esi, _edi-_esi
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+8*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+82
add esi, _ebp-_edi
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+9*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+92
add esi, _esp-_ebp
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+10*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+102
add esi, _eip-_esp
call draw_register
mov ebx, [registers_x_pos_dd]
add ebx, 2*10000h+REGISTERS_Y_POS+11*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 2*10000h+registers_y_pos+112
 
mov cl, 7
add esi, _eflags-_eip
1324,23 → 1309,23
.fpu:
call draw_fpu_regs
@@:
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE
mov ecx, COLOR_TXT_INACTIVE
cmp [debuggee_pid], 0
jz @f
cmp [bSuspended], 0
jz @f
mov ecx, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ecx, COLOR_TXT_NORMAL
@@:
mov edx, aColon
xor esi, esi
inc esi
mov ebx, [registers_x_pos_dd]
add ebx, 10*10000h+REGISTERS_Y_POS+12*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 10*10000h+registers_y_pos+122
mcall 4
mov edx, flags
 
@@:
add ebx, 2*FONT_X_SIZE*10000h
add ebx, 2*6*10000h
call draw_flag
inc edx
cmp dl, flags_bits and 0xFF
1367,9 → 1352,9
 
; draw container rectangle/box with COLOR_BG_NORMAL
mov ebx, [registers_x_pos_dd]
add ebx, (-1)*10000h+(REGISTERS_X_SIZE+2)
add ebx, (-1)*10000h+(registers_x_size+2)
mov ecx, [registers_y_size_dd+4]
add ecx, ((TITLE_Y_POS+(FONT_Y_SIZE/2))+1)*10000h+2
add ecx, (registers_y_pos-1)*10000h+2
mcall 13, , , COLOR_BG_NORMAL
call draw_reg_title
 
1395,33 → 1380,33
draw_dump:
; draw container rectangle/box in the window
mov ebx, [data_x_size_dd+4]
add ebx, DATA_X_POS*10000h
mcall 13, , DUMP_Y_POS*10000h+DUMP_Y_SIZE, COLOR_BG_NORMAL
add ebx, data_x_pos*10000h
mcall 13, , dump_y_pos*10000h+dump_y_size, COLOR_BG_NORMAL
 
.redraw:
; addresses
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 edi, COLOR_BG_NORMAL
mov esi, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_INACTIVE or 0x40000000)
mov esi, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0
jz @f
cmp [bSuspended], 0
jz @f
mov esi, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL or 0x40000000)
mov esi, (COLOR_TXT_NORMAL or 0x40000000)
@@:
; draw a number in the window
mcall 47
add ecx, 10h
add edx, FONT_Y_SIZE + TEXT_Y_CLEARANCE
cmp dl, DUMP_Y_POS + DUMP_Y_SIZE
add edx, 10
cmp dl, dump_y_pos + dump_y_size
jb @b
; hex dump of data
mov ecx, dumpdata
push ecx
xor ebx, ebx
mov edx, (DATA_X_POS+12*FONT_X_SIZE)*10000h + DUMP_Y_POS
mov edx, (data_x_pos+12*6)*10000h + dump_y_pos
cmp [dumpread], ebx
jz .hexdumpdone1
 
1431,7 → 1416,7
; draw a number in the window
mcall
pop ebx
add edx, 3*FONT_X_SIZE*10000h
add edx, 3*6*10000h
inc ecx
inc ebx
test bl, 15
1438,10 → 1423,10
jz .16
test bl, 7
jnz @f
add edx, 2*FONT_X_SIZE*10000h - (FONT_Y_SIZE+TEXT_Y_CLEARANCE) + FONT_X_SIZE*(3*10h+2)*10000h
add edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
 
.16:
add edx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE) - FONT_X_SIZE*(3*10h+2)*10000h
add edx, 10 - 6*(3*10h+2)*10000h
 
@@:
cmp ebx, [dumpread]
1457,7 → 1442,7
pop esi
 
.hexdumploop2:
cmp edx, DUMP_HEIGHT*10h
cmp edx, dump_height*10h
jae .hexdumpdone2
push edx
mov edx, aQuests
1464,41 → 1449,41
; draw text string with color in ecx, copied from esi
mcall
pop edx
add ebx, 3*FONT_X_SIZE*10000h
add ebx, 3*6*10000h
inc edx
test dl, 15
jz .16x
test dl, 7
jnz .hexdumploop2
add ebx, 2*FONT_X_SIZE*10000h - (FONT_Y_SIZE+TEXT_Y_CLEARANCE) + FONT_X_SIZE*(3*10h+2)*10000h
add ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
 
.16x:
add ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE) - FONT_X_SIZE*(3*10h+2)*10000h
add ebx, 10 - 6*(3*10h+2)*10000h
jmp .hexdumploop2
 
.hexdumpdone2:
dec esi
; colon, minus signs
mov ebx, (DATA_X_POS+8*FONT_X_SIZE)*10000h + DUMP_Y_POS
mov ebx, (data_x_pos+8*6)*10000h + dump_y_pos
mov edx, aColon
 
@@:
mcall
add ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
cmp bl, DUMP_Y_POS+DUMP_HEIGHT*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 10
cmp bl, dump_y_pos+dump_height*10
jb @b
mov ebx, (DATA_X_POS+(12+3*8)*FONT_X_SIZE)*10000h + DUMP_Y_POS
mov ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos
mov edx, aMinus
 
@@:
mcall
add ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
cmp bl, DUMP_Y_POS+DUMP_HEIGHT*(FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, 10
cmp bl, dump_y_pos+dump_height*10
jb @b
; ASCII data
mov ebx, (DATA_X_POS+(12+3*10h+2+2)*FONT_X_SIZE)*10000h + DUMP_Y_POS
mov ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
pop edx
push DUMP_HEIGHT*10h
push dump_height*10h
 
.asciiloop:
push edx
1511,12 → 1496,12
mcall
pop edx
inc edx
add ebx, FONT_X_SIZE*10000h
add ebx, 6*10000h
dec dword [esp]
jz .asciidone
test byte [esp], 15
jnz .asciiloop
add ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE) - FONT_X_SIZE*10h*10000h
add ebx, 10 - 6*10h*10000h
jmp .asciiloop
 
.asciidone:
1537,9 → 1522,9
call find_symbol
jc .nosymb
mov ebx, [disasm_cur_str]
imul ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
imul ebx, 10
push ebx
lea ecx, [ebx+DISASM_Y_POS-1]
lea ecx, [ebx+disasm_y_pos-1]
shl ecx, 16
mov cl, 11
; setting up background color for disassembled text
1546,12 → 1531,12
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
mov ebx, [data_x_size_dd+4]
add ebx, DATA_X_POS*10000h
add ebx, data_x_pos*10000h
mcall 13
pop ebx
; copy color value from edx (COLOR_BG_NORMAL)
mov edi, edx
add ebx, (DATA_X_POS+FONT_X_SIZE*2)*10000h+DISASM_Y_POS
add ebx, (data_x_pos+6*2)*10000h+disasm_y_pos
mov edx, esi
 
@@:
1562,7 → 1547,7
sub esi, edx
; normal color
; was 0x40000000
mov ecx, ((FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_LABEL or 0x40000000)
mov ecx, (COLOR_TXT_LABEL or 0x40000000)
mov al, 4
; draw a text string in the window with color COLOR_TXT_NORMAL in ecx
mcall
1574,7 → 1559,7
shl ecx, 16
mov cl, 10
imul ebx, 10001h
sub bx, DATA_X_POS
sub bx, data_x_pos
sub bx, word[data_x_size_dd+4]
neg bx
mov al, 13
1593,12 → 1578,12
pop ebp
jc .loopend
mov edx, COLOR_BG_NORMAL
mov esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_NORMAL
mov ebx, DATA_X_POS*10000h
mov esi, COLOR_TXT_NORMAL
mov ebx, data_x_pos*10000h
add ebx, [data_x_size_dd+4]
mov ecx, [disasm_cur_str]
imul ecx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)*10000h
add ecx, (DISASM_Y_POS-1)*10000h + (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
imul ecx, 10*10000h
add ecx, (disasm_y_pos-1)*10000h + 10
mov eax, ebp
pushad
call find_enabled_breakpoint
1605,7 → 1590,7
popad
jnz .nobp
mov edx, COLOR_BG_BREAKPOINT
mov esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_BREAKPOINT
mov esi, COLOR_TXT_BREAKPOINT
.nobp:
 
mov eax, [_eip]
1612,7 → 1597,7
cmp eax, ebp
jnz .notcurrent
mov edx, COLOR_BG_SELECTED
mov esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
mov esi, COLOR_TXT_SELECTED
.notcurrent:
push esi ; Save color value for disassembled text
 
1621,12 → 1606,12
mcall 13
 
mov edx, [disasm_cur_str]
imul edx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add edx, DATA_X_POS*10000h + DISASM_Y_POS
imul edx, 10
add edx, data_x_pos*10000h + disasm_y_pos
; draw a number in the window, color in esi
mcall 47, 80100h, ebp
 
lea ebx, [edx+8*FONT_X_SIZE*10000h]
lea ebx, [edx+8*6*10000h]
mov ecx, esi ; text color
push 2
pop esi
1635,21 → 1620,21
mcall 4
push 9
pop edi
lea edx, [ebx+2*FONT_X_SIZE*10000h]
lea edx, [ebx+2*6*10000h]
mov ecx, ebp
sub ecx, [disasm_start_pos]
add ecx, disasm_buffer
 
mov esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_HEX
mov esi, COLOR_TXT_HEX
mov eax, [_eip]
cmp eax, ebp
jnz @f
mov esi, (FONT and 11b) shl 28 or ((FONT_MULTIPLIER - 1) and 111b) shl 24 or COLOR_TXT_SELECTED
mov esi, COLOR_TXT_SELECTED
@@:
.drawhex:
; draw a number in the window, color in esi
mcall 47, 20101h
add edx, FONT_X_SIZE*3*10000h
add edx, 6*3*10000h
inc ecx
inc ebp
cmp ebp, [disasm_cur_pos]
1663,7 → 1648,7
pop esi
jbe .drawhex
 
lea ebx, [edx-FONT_X_SIZE*10000h]
lea ebx, [edx-6*10000h]
; copy color value from esi
mov ecx, esi
push 3
1683,8 → 1668,8
dec ecx
xchg ecx, esi
mov ebx, [disasm_cur_str]
imul ebx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
add ebx, (DATA_X_POS+FONT_X_SIZE*40)*10000h+DISASM_Y_POS
imul ebx, 10
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
 
; draw a text string in the window, color in ecx
mcall 4
1697,9 → 1682,9
mov ecx, [disasm_height_dd]
sub ecx, [disasm_cur_str]
jz @f
imul ecx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
imul ecx, 10
inc ecx
mov eax, DISASM_Y_POS
mov eax, disasm_y_pos
add eax, [disasm_y_size_dd+4]
sub eax, ecx
shl eax, 16
1706,7 → 1691,7
add ecx, eax
; Draw filled rectangle
mov ebx, [data_x_size_dd+4]
add ebx, DATA_X_POS*10000h
add ebx, data_x_pos*10000h
mcall 13, , , COLOR_BG_NORMAL
 
@@:
1802,7 → 1787,7
 
; (re)calculate coordinates of GUI elements
mov eax, [thread_info.client_box.width]
sub eax, DATA_X_POS + DATA_X_POS + REGISTERS_X_SIZE+3
sub eax, data_x_pos + data_x_pos + registers_x_size+3
mov [data_x_size_dd+4], eax
mov [messages_x_size_dd+4], eax
shl eax, 16
1809,34 → 1794,34
mov [data_x_size_dd], eax
mov [messages_x_size_dd], eax
shr eax, 16
add eax, DATA_X_POS + 4
add eax, data_x_pos + 4
mov [registers_x_pos_dd+4], eax
shl eax, 16
mov [registers_x_pos_dd], eax
 
mov eax, [thread_info.client_box.height]
sub eax, CMD_Y_SIZE + DATA_X_POS
sub eax, cmdline_y_size + data_x_pos
mov [cmdline_y_pos_dd+4], eax
shl eax, 16
mov [cmdline_y_pos_dd], eax
shr eax, 16
sub eax, MSG_Y_SIZE + 4
sub eax, messages_y_size + 4
mov [messages_y_pos_dd+4], eax
shl eax, 16
mov [messages_y_pos_dd], eax
shr eax, 16
sub eax, DISASM_Y_POS + 4
sub eax, disasm_y_pos + 4
mov [disasm_y_size_dd+4], eax
shl eax, 16
mov [disasm_y_size_dd], eax
shr eax, 16
mov ecx, (FONT_Y_SIZE+TEXT_Y_CLEARANCE)
mov ecx, 10
xor edx, edx
div ecx
mov [disasm_height_dd], eax
 
mov eax, [thread_info.client_box.height]
sub eax, DATA_X_POS + TITLE_Y_POS+(FONT_Y_SIZE/2)+2
sub eax, data_x_pos + registers_y_pos-1
mov [registers_y_size_dd+4], eax
shl eax, 16
mov [registers_y_size_dd], eax
1843,27 → 1828,27
 
; messages frame
mov ebx, [messages_x_size_dd+4]
add ebx, (MSG_X_POS-2)*10000h + (MSG_X_POS+2)
add ebx, (messages_x_pos-2)*10000h + (messages_x_pos+2)
push ebx
mov ecx, [messages_y_pos_dd+2]
add ecx, -2*10001h
mov edx, COLOR_LINE
mcall 38
add ecx, (MSG_Y_SIZE+2+2)*10001h
add ecx, (messages_y_size+2+2)*10001h
mcall
mov ebx, (MSG_X_POS-2)*10001h
mov ebx, (messages_x_pos-2)*10001h
push ebx
mov ecx, [messages_y_pos_dd+2]
add ecx, (-2*10000h) + (MSG_Y_SIZE+2)
add ecx, (-2*10000h) + (messages_y_size+2)
mcall
mov ebx, [messages_x_size_dd+2]
add ebx, (MSG_X_POS+2)*10001h
add ebx, (messages_x_pos+2)*10001h
push ebx
mcall
 
; command line frame
mov ecx, [cmdline_y_pos_dd+2]
add ecx, (-2*10000h) + (CMD_Y_SIZE+2)
add ecx, (-2*10000h) + (cmdline_y_size+2)
pop ebx
mcall
pop ebx
1870,7 → 1855,7
mcall
pop ebx
mov ecx, [cmdline_y_pos_dd+2]
add ecx, (CMD_Y_SIZE+2)*10001h
add ecx, (cmdline_y_size+2)*10001h
 
mcall
mov ecx, [cmdline_y_pos_dd+2]
1879,19 → 1864,19
 
; registers frame
mov ebx, [registers_x_pos_dd]
add ebx, (-2) shl 16 + (REGISTERS_X_SIZE+3)
mov ecx, (TITLE_Y_POS+(FONT_Y_SIZE/2)) shl 16 + 1
add ebx, (-2) shl 16 + (registers_x_size+3)
mov ecx, (registers_y_pos-2) shl 16 + 1
mov edx, COLOR_LINE
mcall 13 ; top
mov ebx, [registers_x_pos_dd]
add ebx, ((-2)+(REGISTERS_X_SIZE+3)) shl 16 + 1
add ebx, ((-2)+(registers_x_size+3)) shl 16 +1
mov ecx, [registers_y_size_dd+4]
add ecx, (TITLE_Y_POS+(FONT_Y_SIZE/2)) shl 16 + (+3+1)
add ecx, (registers_y_pos-2) shl 16 + (+3+1)
mcall ; right
mov ebx, [registers_x_pos_dd]
add ebx, (-2) shl 16 + (REGISTERS_X_SIZE+3+1)
add ebx, (-2) shl 16 + (registers_x_size+3)
mov ecx, [registers_y_size_dd]
add ecx, ((TITLE_Y_POS+(FONT_Y_SIZE/2))+4) shl 16 + 1
add ecx, ((registers_y_pos-2)+(+3)) shl 16 + 1
mcall ; bottom
 
; messages
1902,22 → 1887,22
call draw_cursor
 
; title & registers & dump & disasm
mov ebx, (DATA_X_POS-2)*10001h
mov ecx, (TITLE_Y_POS+(FONT_Y_SIZE/2))*10000h + (-2)
mov ebx, (data_x_pos-2)*10001h
mov ecx, (title_y_pos+5)*10000h + (-2)
add ecx, [messages_y_pos_dd+4]
mov edx, COLOR_LINE
mcall 38
mov ebx, [data_x_size_dd+2]
add ebx, (DATA_X_POS+2)*10001h
add ebx, (data_x_pos+2)*10001h
mcall
mov ebx, [data_x_size_dd+4]
add ebx, (DATA_X_POS-2)*10000h + (DATA_X_POS+2)
mov ecx, (DISASM_Y_POS-4)*10001h
add ebx, (data_x_pos-2)*10000h + (data_x_pos+2)
mov ecx, (disasm_y_pos-4)*10001h
mcall
 
mov ebx, [registers_x_pos_dd]
add ebx, (-1) shl 16 + REGISTERS_X_SIZE + 1
mov ecx, (REGISTERS_Y_POS - 2) shl 16 + FONT_Y_SIZE + TEXT_Y_CLEARANCE
add ebx, (4 shl 16) + 42
mov ecx, (registers_y_pos shl 16) + 11
mov edx, (1 shl 30) + 2
mov esi, 0x00808080
mcall 8
/programs/develop/mtdbg/mtdbg.asm
119,7 → 119,7
get_dump:
mov edi, dumpdata
mov esi, [edi-4]
mov edx, DUMP_HEIGHT*10h
mov edx, dump_height*10h
mov ecx, edx
xor eax, eax
push edi
1130,7 → 1130,7
mov esi, [curarg]
cmp byte [esi], 0
jnz .param
add [dumppos], DUMP_HEIGHT*10h
add [dumppos], dump_height*10h
jmp .doit
 
.param:
2176,11 → 2176,7
 
aAVX db '[ AVX ]'
aMSR db '[ MSR ]'
if (FONT eq 0 )
aPoint db 0x1C
else
aPoint db 0x1F
end if
aMinus db '-'
aColon db ':'
aSpace db ' '
2330,14 → 2326,14
 
 
messages_pos dd ?
messages rb MSG_HEIGHT*MSG_WIDTH
messages rb messages_height*messages_width
 
cmdline rb CMD_WIDTH+1
cmdline rb cmdline_width+1
cmdline_len dd ?
cmdline_pos dd ?
curarg dd ?
 
cmdline_prev rb CMD_WIDTH+1
cmdline_prev rb cmdline_width+1
 
was_temp_break db ?
symbol_section db ?
2439,7 → 2435,7
proc_num dd ?
dumpread dd ?
dumppos dd ?
dumpdata rb DUMP_HEIGHT*10h
dumpdata rb dump_height*10h
 
; breakpoint structure:
; dword +0: address