📄 follow.inc
字号:
;=============================================================================
; Insight, real-mode debugger for MS DOS / PC DOS / FreeDOS.
; Copyright (c) Victor M. Gamayunov, Sergey Pimenov, 1993, 96, 97, 2002.
; Modifications by Oleg O. Chukaev (2006, 2007).
;-----------------------------------------------------------------------------
; follow.inc
; ...
;-----------------------------------------------------------------------------
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
;=============================================================================
;=============================================================================
; dump_reference
;-----------------------------------------------------------------------------
dump_reference:
call unasm_cur_line
cmp byte [memory_flag],0
je @@exit
call calc_mem_address
push si
push dx
call update_dump_window
@@exit:
clc
ret
;=============================================================================
; dump_cur_line
;-----------------------------------------------------------------------------
dump_cur_line:
push word [cur_line_ip]
push word [unasm_seg]
call update_dump_window
;=============================================================================
; dump_user_screen
;-----------------------------------------------------------------------------
dump_user_screen:
mov ax,old_screen
push ax
push cs
call update_dump_window
;=============================================================================
; dump_esdi
;-----------------------------------------------------------------------------
dump_esdi:
push word [cpu_regs+REG_DI]
push word [cpu_regs+REG_ES]
call update_dump_window
;=============================================================================
; dump_dssi
;-----------------------------------------------------------------------------
dump_dssi:
push word [cpu_regs+REG_SI]
push word [cpu_regs+REG_DS]
call update_dump_window
;=============================================================================
; dump_esbx
;-----------------------------------------------------------------------------
dump_esbx:
push word [cpu_regs+REG_BX]
push word [cpu_regs+REG_ES]
call update_dump_window
;=============================================================================
; dump_ssbp
;-----------------------------------------------------------------------------
dump_ssbp:
push word [cpu_regs+REG_BP]
push word [cpu_regs+REG_SS]
call update_dump_window
;=============================================================================
; dump_dxax
;-----------------------------------------------------------------------------
dump_dxax:
push word [cpu_regs+REG_AX]
push word [cpu_regs+REG_DX]
call update_dump_window
;=============================================================================
; dump_dsdx
;-----------------------------------------------------------------------------
dump_dsdx:
push word [cpu_regs+REG_DX]
push word [cpu_regs+REG_DS]
call update_dump_window
;=============================================================================
; dump_essi
;-----------------------------------------------------------------------------
dump_essi:
push word [cpu_regs+REG_SI]
push word [cpu_regs+REG_ES]
call update_dump_window
;=============================================================================
; dump_dsdi
;-----------------------------------------------------------------------------
dump_dsdi:
push word [cpu_regs+REG_DI]
push word [cpu_regs+REG_DS]
call update_dump_window
;=============================================================================
; dump_csip
;-----------------------------------------------------------------------------
dump_csip:
push word [cpu_regs+REG_IP]
push word [cpu_regs+REG_CS]
call update_dump_window
;=============================================================================
; update_dump_window
;-----------------------------------------------------------------------------
update_dump_window:
pop word [dump_proc]
pop word [new_dump_seg]
pop word [new_dump_offs]
call pushr
mov ax,[dump_proc]
mov bx,update_dump_window-dump_csip
sub ax,bx
cmp ax,dump_esdi
jb @@set_dump
mov [data_watch_temp],ax
sub ax,dump_esdi
div bl
mov bl,5
mul bl
add ax,data_watch_labels
mov [data_watch_label],ax
@@set_dump:
mov ax,[new_dump_offs]
mov dx,[new_dump_seg]
; cmp dump_offs,ax
; jne @@UpdateDump
; cmp dump_seg,dx
; je @@Exit
@@update_dump:
mov [dump_offs],ax
mov [dump_seg],dx
call update_dump
@@exit:
call popr
clc
ret
;=============================================================================
; set_code_mark_[0-9]
;-----------------------------------------------------------------------------
set_code_mark_0:
call set_code_mark
set_code_mark_1:
call set_code_mark
set_code_mark_2:
call set_code_mark
set_code_mark_3:
call set_code_mark
set_code_mark_4:
call set_code_mark
set_code_mark_5:
call set_code_mark
set_code_mark_6:
call set_code_mark
set_code_mark_7:
call set_code_mark
set_code_mark_8:
call set_code_mark
set_code_mark_9:
call set_code_mark
;=============================================================================
; set_code_mark
;-----------------------------------------------------------------------------
set_code_mark:
pop di
mov bx,set_code_mark_1
call find_code_mark
or [code_mark_exist],ax
call check_shift
jnz @@set_data_mark
mov ax,[cur_line]
stosw
mov ax,[cur_ip]
stosw
mov ax,[unasm_seg]
stosw
mov ax,[cur_line_ip]
stosw
jmp update_commands
@@set_data_mark:
mov ax,-1
stosw
mov ax,[dump_offs]
stosw
mov ax,[dump_seg]
stosw
jmp update_commands
;=============================================================================
; clear_code_mark_[0-9]
;-----------------------------------------------------------------------------
clear_code_mark_0:
call clear_code_mark
clear_code_mark_1:
call clear_code_mark
clear_code_mark_2:
call clear_code_mark
clear_code_mark_3:
call clear_code_mark
clear_code_mark_4:
call clear_code_mark
clear_code_mark_5:
call clear_code_mark
clear_code_mark_6:
call clear_code_mark
clear_code_mark_7:
call clear_code_mark
clear_code_mark_8:
call clear_code_mark
clear_code_mark_9:
call clear_code_mark
;=============================================================================
; clear_code_mark
;-----------------------------------------------------------------------------
clear_code_mark:
pop di
mov bx,clear_code_mark_1
call find_code_mark
mov si,di
jz jump_beep_return
not ax
and [code_mark_exist],ax
jmp update_commands
;=============================================================================
; code_mark_[0-9]
;-----------------------------------------------------------------------------
code_mark_0:
call code_mark
code_mark_1:
call code_mark
code_mark_2:
call code_mark
code_mark_3:
call code_mark
code_mark_4:
call code_mark
code_mark_5:
call code_mark
code_mark_6:
call code_mark
code_mark_7:
call code_mark
code_mark_8:
call code_mark
code_mark_9:
call code_mark
;=============================================================================
; code_mark
;-----------------------------------------------------------------------------
code_mark:
pop di
mov bx,code_mark_1
call find_code_mark
mov si,di
jump_beep_return:
jz beep_return
lodsw
cmp ax,0ffffh
je @@set_dump_pos
call push_unasm_pos
mov [cur_line],ax
lodsw
mov [cur_ip],ax
lodsw
mov [unasm_seg],ax
jmp update_commands
@@set_dump_pos:
lodsw
mov [dump_offs],ax
lodsw
mov [dump_seg],ax
jmp update_dump
;=============================================================================
; find_code_mark
;-----------------------------------------------------------------------------
find_code_mark:
sub di,bx
xchg ax,di
mov bl,3
div bl
mov di,ax
shl di,1
shl di,1
shl di,1
add di,code_mark_buff
xchg ax,cx
mov ax,1
shl ax,cl
test [code_mark_exist],ax
cld
ret
;=============================================================================
; follow
;-----------------------------------------------------------------------------
follow:
test byte [ref_flags],RF_FOLLOW
jz beep_return
call push_unasm_pos
mov ax,[follow_seg]
mov [unasm_seg],ax
mov ax,[follow_offs]
mov [cur_ip],ax
mov word [cur_line],0
jmp update_commands
;=============================================================================
; previous
;-----------------------------------------------------------------------------
previous:
cld
mov si,[follow_stack_ptr]
cmp si,follow_stack ;??? offset
jae beep_return
lodsw
mov [cur_line],ax
lodsw
mov [cur_ip],ax
lodsw
mov [unasm_seg],ax
mov [follow_stack_ptr],si
jmp update_commands
beep_return:
jmp beep
;=============================================================================
; push_unasm_pos
;-----------------------------------------------------------------------------
push_unasm_pos:
push ax
push si
mov si,[follow_stack_ptr]
cmp si,follow_stack_btm
jbe @@stack_full
sub si,2
mov ax,[unasm_seg]
mov [si],ax
sub si,2
mov ax,[cur_ip]
mov [si],ax
sub si,2
mov ax,[cur_line]
mov [si],ax
mov [follow_stack_ptr],si
@@exit:
pop si
pop ax
ret
@@stack_full:
call beep
jmp @@exit
;=============================================================================
; check_shared_area
;-----------------------------------------------------------------------------
check_shared_area:
push si
mov si,[buf_pos_mark]
mov word [buf_pos_mark],window_buffer
jmp ..@check_code_mark
_check_shared_area:
push si
..@check_code_mark:
cmp si,code_mark_buff
jbe @@check_stack
mov word [code_mark_exist],0
mov si,code_mark_msg
call error_message
jmp @@exit_2
@@check_stack:
cmp si,[follow_stack_ptr]
jbe @@exit_1
mov si,follow_stack_msg
call message_box
@@exit_2:
mov word [follow_stack_ptr],follow_stack
@@exit_1:
pop si
ret
;=============================================================================
; unasm_cur_line
;-----------------------------------------------------------------------------
unasm_cur_line:
push si
push bp
mov si,[cur_ip]
xor bp,bp
@@next_cpu_line:
call unassemble
inc bp
cmp bp,[cur_line]
jbe @@next_cpu_line
pop bp
pop si
ret
;=============================================================================
; find_first_byte
;-----------------------------------------------------------------------------
find_first_byte:
xor cx,cx
@@next_byte:
es lodsb
mov dl,RF_PREFIX
cmp al,26h
je @@next
cmp al,36h
je @@next
cmp al,2Eh
je @@next
cmp al,3Eh
je @@next
cmp al,64h
je @@check_cpu
cmp al,65h
je @@check_cpu
cmp al,67h
je @@check_cpu
cmp al,66h
jne @@normal_exit
mov dl,RF_ADDRESS_32
@@check_cpu:
cmp byte [cpu_type],a386
jb @@exit
or [ref_flags],dl
@@next:
loop @@next_byte
stc
ret
@@normal_exit:
clc
@@exit:
ret
;=============================================================================
; get_ref_addresses
;-----------------------------------------------------------------------------
get_ref_addresses:
call pushr
and byte [ref_flags],RF_FOLLOW
mov si,bx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -