📄 sdebug.inc
字号:
mov xpos,3
inc ypos
mov color,31h
mov edx,offs hlp0B
call prints
mov color,3Fh
mov eax,offs _system_stack
sub eax,esp
call printeax
jmp get_page_key
;-----------------------------------------------------------------------------
show_page1: ; show GDT
mov ebx,30
mov ecx,60
mov esi,1
mov edi,1
call clearwindow
mov _pagenum,1
mov xpos,2
mov ypos,30
mov edx,offs hlp62
mov color,30h
call prints
mov xpos,3
mov ypos,2
mov edx,offs hlp60
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs hlp61
mov color,31h
call prints
mov xpos,4
add ypos,2
mov edx,offs _gdt_string
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs _gdt_string2
call prints
mov al,00h
call fword ptr __api_off
mov color,3Fh
mov xpos,13
mov ypos,3
mov eax,esi
call printeax
mov xpos,33
mov eax,ecx
call printeax
@@0: lea edx,[esi+ecx-7]
sub edx,_gdt_ptr
mov ebp,22
mov ypos,6
@@1: inc ypos
mov xpos,6
push es ; check Avail
mov es,bx
test byte ptr es:[edx+6],10h
pop es
mov color,3Eh
jnz @@avl
mov color,3Fh
@@avl: mov eax,edx
sub eax,esi
call printax
add xpos,3
push edx
push es ; get Limit 0..15
mov es,bx
mov ax,es:[edx]
add edx,2
pop es
call printax
add xpos,3
push es ; get Base 23..0
mov es,bx
mov eax,es:[edx]
add edx,3
pop es
push eax
shr eax,16
call printal
pop eax
call printax
add xpos,3
push es ; get Acc
mov es,bx
mov ax,es:[edx]
add edx,2
pop es
call printax
add xpos,6
push es ; get Base 24..31
mov es,bx
mov al,es:[edx]
add edx,1
pop es
call printal
pop edx
sub edx,8
cmp edx,esi
jae @@w
mov xpos,1
mov al,20h
push ecx
mov ecx,50
@@x: call printc
loop @@x
pop ecx
@@w: dec ebp
jnz @@1
@@2: call get_key
cmp al,49h
jz @@down
cmp al,51h
jz @@up
cmp al,47h ; Home
jz @@home
cmp al,1 ; ESC
jz info_exit
cmp al,3Bh ; F1 - DPMI
jz show_page0
cmp al,3Ch ; F2 - GDT
jz show_page1
cmp al,3Dh ; F3 - IDT
jz show_page2
cmp al,3Eh ; F4 - ExtMemBlks
jz show_page3
cmp al,3Fh ; F5 - History
jz show_page4
cmp al,40h ; F6 - INT buffers
jz show_page5
cmp al,44h ; F10 - DOS/32A
jz show_page8
jmp @@2
@@up: mov eax,_gdt_ptr
add eax,00B0h
lea edx,[esi+ecx-7]
sub edx,eax
cmp edx,esi
jbe @@2
mov _gdt_ptr,eax
jmp @@0
@@down: mov eax,_gdt_ptr
sub eax,00B0h
jb @@2
mov _gdt_ptr,eax
jmp @@0
@@home: mov _gdt_ptr,0
jmp @@0
;-----------------------------------------------------------------------------
show_page2: ; show IDT
mov ebx,30
mov ecx,60
mov esi,1
mov edi,1
call clearwindow
mov _pagenum,2
mov xpos,2
mov ypos,30
mov edx,offs hlp72
mov color,30h
call prints
mov xpos,3
mov ypos,2
mov edx,offs hlp70
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs hlp71
mov color,31h
call prints
mov xpos,4
add ypos,2
mov edx,offs _idt_string
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs _idt_string2
call prints
mov al,00h
call fword ptr __api_off
mov ecx,edx
mov esi,edi
mov color,3Fh
mov xpos,13
mov ypos,3
mov eax,esi
call printeax
mov xpos,33
mov eax,ecx
call printeax
@@0: lea edx,[esi]
add edx,_idt_ptr
mov ebp,22
mov ypos,6
@@1: inc ypos
mov xpos,6
push es ; check Selector
mov es,bx
mov ax,es:[edx+2]
pop es
cmp ax,__kernel_codesel
mov color,3Eh
jnz @@inst
mov color,3Fh
@@inst: mov eax,edx
sub eax,esi
shr eax,3
call printal
add xpos,6
push edx
push es ; get Offset 0..15
mov es,bx
mov ax,es:[edx]
add edx,2
pop es
call printax
add xpos,6
push es ; get Selector
mov es,bx
mov ax,es:[edx]
add edx,3
pop es
call printax
add xpos,5
push es ; get Type
mov es,bx
mov al,es:[edx]
add edx,1
pop es
test al,01h
mov ah,color
jnz @@m
mov color,3Ah
@@m: call printal
mov color,ah
add xpos,3
push es ; get Offset 16..31
mov es,bx
mov ax,es:[edx]
add edx,2
pop es
call printax
pop edx
add edx,8
lea eax,[esi+ecx+1]
cmp edx,eax
jbe @@w
mov xpos,1
mov al,20h
push ecx
mov ecx,50
@@x: call printc
loop @@x
pop ecx
@@w: dec ebp
jnz @@1
@@2: call get_key
cmp al,49h
jz @@up
cmp al,51h
jz @@down
cmp al,47h ; Home
jz @@home
cmp al,1 ; ESC
jz info_exit
cmp al,3Bh ; F1 - DPMI
jz show_page0
cmp al,3Ch ; F2 - GDT
jz show_page1
cmp al,3Dh ; F3 - IDT
jz show_page2
cmp al,3Eh ; F4 - ExtMemBlks
jz show_page3
cmp al,3Fh ; F5 - History
jz show_page4
cmp al,40h ; F6 - INT buffers
jz show_page5
cmp al,44h ; F10 - DOS/32A
jz show_page8
jmp @@2
@@up: mov eax,_idt_ptr
sub eax,00B0h
jb @@2
mov _idt_ptr,eax
jmp @@0
@@down: mov eax,_idt_ptr
add eax,00B0h
lea edx,[ecx+1]
cmp eax,edx
ja @@2
mov _idt_ptr,eax
jmp @@0
@@home: mov _idt_ptr,0
jmp @@0
;-----------------------------------------------------------------------------
show_page3: ; show Ext Blocks
mov ebx,30
mov ecx,60
mov esi,1
mov edi,1
call clearwindow
mov _pagenum,3
mov xpos,2
mov ypos,30
mov edx,offs hlp82
mov color,30h
call prints
mov xpos,3
mov ypos,2
mov edx,offs hlp80
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs hlp81
mov color,31h
call prints
mov xpos,4
add ypos,2
mov edx,offs _emb_string
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs _emb_string2
call prints
mov al,03h
call fword ptr __api_off
mov xpos,13
mov ypos,3
mov color,3Fh
mov eax,edx
call printeax
mov xpos,32
mov eax,ecx
call printeax
mov xpos,50
mov eax,esi
call printeax
mov _emb_mem_ptr,edx
mov _emb_mem_top,esi
@@0: pushad
mov ebx,22
mov ecx,40
mov esi,4
mov edi,7
call clearwindow
popad
mov ebp,22
xor edi,edi
mov esi,_emb_mem_ptr
mov ypos,7
@@1: call @read_emb
cmp edi,_emb_num
jb @@3
mov xpos,5
mov color,3Fh
push eax
mov eax,edi
call printal
pop eax
mov xpos,12
call printeax
mov xpos,22
mov eax,ecx
call printeax
mov xpos,32
mov eax,edx
test al,al
mov color,3Fh
mov edx,offs _emb_str1
jz @@l1
mov color,3Eh
mov edx,offs _emb_str2
@@l1: call prints
push eax
mov al,'/'
mov color,30h
call printc
pop eax
test ah,ah
mov color,3Ah
mov edx,offs _emb_str3
jz @@l2
mov color,34h
mov edx,offs _emb_str4
@@l2: call prints
inc ypos
dec ebp
jz @@4
@@3: inc edi
cmp esi,_emb_mem_top
jb @@1
@@4: call get_key
cmp al,48h ; up
jz @@upk
cmp al,50h ; down
jz @@dnk
cmp al,49h
jz @@up
cmp al,51h
jz @@down
cmp al,47h ; Home
jz @@home
cmp al,1 ; ESC
jz info_exit
cmp al,3Bh ; F1 - DPMI
jz show_page0
cmp al,3Ch ; F2 - GDT
jz show_page1
cmp al,3Dh ; F3 - IDT
jz show_page2
cmp al,3Eh ; F4 - ExtMemBlks
jz show_page3
cmp al,3Fh ; F5 - History
jz show_page4
cmp al,40h ; F6 - INT buffers
jz show_page5
cmp al,44h ; F10 - DOS/32A
jz show_page8
jmp @@4
@@upk: mov eax,_emb_num
sub eax,1
jc @@home
mov _emb_num,eax
jmp @@0
@@up: mov eax,_emb_num
sub eax,22
jc @@home
mov _emb_num,eax
jmp @@0
@@dnk: mov eax,_emb_num
add eax,1
mov ecx,eax
mov esi,_emb_mem_ptr
@@dk1: cmp esi,_emb_mem_top
jz @@dk2
push eax ecx
call @read_emb
pop ecx eax
test dh,dh
jnz @@dn2
loop @@dn1
mov _emb_num,eax
jmp @@0
@@dk2: jmp @@4
@@dk3: dec _emb_num
jmp @@0
@@down: mov eax,_emb_num
add eax,22
mov ecx,eax
mov esi,_emb_mem_ptr
@@dn1: push eax ecx
call @read_emb
pop ecx eax
test dh,dh
jnz @@dn2
loop @@dn1
mov _emb_num,eax
jmp @@0
@@dn2: jmp @@4
@@home: mov _emb_num,0
jmp @@0
@read_emb:
xor eax,eax ; EAX = base
xor ecx,ecx ; ECX = size
xor edx,edx ; DL = free:0/used:1,DH=ok:0/invalid:1
push es
mov es,bx
mov ecx,es:[esi+04h]
pop es
lea eax,[esi+10h]
btr ecx,31 ; check if memory block is used
setc dl
lea esi,[esi+ecx+10h] ; load addres of next memory block
cmp esi,_emb_mem_ptr
jb @@err
cmp esi,_emb_mem_top ; check if at top of memory
ja @@err
ret
@@err: mov dh,1
ret
;-----------------------------------------------------------------------------
show_page4: ; show Interrupt History
mov ebx,30
mov ecx,60
mov esi,1
mov edi,1
call clearwindow
mov _pagenum,4
mov xpos,2
mov ypos,30
mov edx,offs hlp92
mov color,30h
call prints
mov xpos,3
mov ypos,2
mov edx,offs hlp90
mov color,30h
call prints
mov xpos,4
inc ypos
mov edx,offs hlp91
mov color,31h
call prints
mov eax,__history_bufnum
mov color,3Fh
call printax
cmp __history_bufon,0
jz get_page_key
@@0: pushad
mov ebx,24
mov ecx,56
mov esi,3
mov edi,5
call clearwindow
popad
mov xpos,46
mov ypos,3
mov color,31h
mov edx,offs _hist_str30
cmp __history_intnum,0
jz @@lax
mov edx,offs _hist_str31
cmp __history_intnum,10h
jz @@lax
mov edx,offs _hist_str32
cmp __history_intnum,21h
jz @@lax
mov edx,offs _hist_str33
cmp __history_intnum,31h
jz @@lax
mov edx,offs _hist_str34
cmp __history_intnum,33h
jz @@lax
mov edx,offs _hist_str30
@@lax: call prints
mov ypos,5
mov ecx,__history_bufnum
test ecx,ecx
jz @@done
mov esi,__history_bufbase
mov edx,__history_current
mov ebp,4
mov eax,ecx
sub eax,edx
jbe @@l2
cmp eax,4
jae @@2
mov ebp,eax
@@2: mov eax,__history_bufsize
shr eax,6
sub eax,edx
jbe @@l2
cmp eax,4
jae @@5
mov ebp,eax
@@5: imul edx,40h
add esi,edx
@@l1: mov al,[esi+02h]
cmp __history_intnum,0
jz @@all
cmp __history_intnum,10h
jz @@10h
cmp __history_intnum,21h
jz @@21h
cmp __history_intnum,31h
jz @@31h
cmp __history_intnum,33h
jz @@33h
jmp @@all
@@10h: cmp al,10h
jnz @@next
jmp @@all
@@21h: cmp al,21h
jnz @@next
jmp @@all
@@31h: cmp al,31h
jnz @@next
jmp @@all
@@33h: cmp al,33h
jnz @@next
jmp @@all
@@next: add esi,40h
dec ecx
jnz @@l1
jmp @@l2
@@all: mov xpos,4
mov edx,offs _hist_str01
mov color,31h
call prints
mov ax,[esi+00h] ; Number
inc ax
mov color,3Eh
call printax
mov xpos,18
mov edx,offs _hist_str02
mov color,31h
call prints
mov al,[esi+02h] ; INT nnh
push eax
mov color,3Eh
call printal
mov al,'h'
call printc
mov xpos,26
mov color,31h
mov al,'('
call printc
pop eax
cmp al,10h
mov color,39h
mov edx,offs _hist_str04
jz @@3
cmp al,21h
mov color,3Ah
mov edx,offs _hist_str05
jz @@3
cmp al,31h
mov color,3Bh
mov edx,offs _hist_str06
jz @@3
cmp al,33h
mov color,38h
mov edx,offs _hist_str07
jz @@3
jmp @@4
@@3: call prints
@@4: mov edx,offs _hist_str03
mov color,31h
call prints
mov color,3Eh
mov ax,[esi+0Ch] ; AX
call printax
mov color,31h
mov al,'h'
call printc
mov al,')'
call printc
inc ypos
mov xpos,4
mov color,31h
mov edx,offs _hist_str10
call prints
inc ypos
mov xpos,4
mov edx,offs _hist_str11
call prints
inc ypos
mov xpos,4
mov edx,offs _hist_str12
call prints
inc ypos
mov xpos,4
mov edx,offs _hist_str20
call prints
sub ypos,3
mov color,3Fh
mov xpos,8
mov eax,[esi+04h] ; EFL
call printeax
mov xpos,22
mov eax,[esi+08h] ; EIP
call printeax
inc ypos
mov xpos,8
mov eax,[esi+0Ch] ; EAX
call printeax
mov xpos,22
mov eax,[esi+10h] ; EBX
call printeax
mov xpos,36
mov eax,[esi+14h] ; ECX
call printeax
mov xpos,50
mov eax,[esi+18h] ; EDX
call printeax
inc ypos
mov xpos,8
mov eax,[esi+1Ch] ; ESI
call printeax
mov xpos,22
mov eax,[esi+20h] ; EDI
call printeax
mov xpos,36
mov eax,[esi+24h] ; EBP
call printeax
mov xpos,50
mov eax,[esi+28h] ; ESP
call printeax
inc ypos
mov xpos,7
mov ax,[esi+2Ch] ; CS
call printax
mov xpos,16
mov ax,[esi+30h] ; DS
call printax
mov xpos,25
mov ax,[esi+32h] ; ES
call printax
mov xpos,34
mov ax,[esi+34h] ; SS
call printax
mov xpos,43
mov ax,[esi+36h] ; FS
call printax
mov xpos,52
mov ax,[esi+38h] ; GS
call printax
inc ypos
mov xpos,3
mov al,'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -