⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdebug.inc

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 INC
📖 第 1 页 / 共 2 页
字号:
;
; Copyright (C) 1996-2002 Supernar Systems, Ltd. All rights reserved.
;
; Redistribution  and  use  in source and  binary  forms, with or without
; modification,  are permitted provided that the following conditions are
; met:
;
; 1.  Redistributions  of  source code  must  retain  the above copyright
; notice, this list of conditions and the following disclaimer.
;
; 2.  Redistributions  in binary form  must reproduce the above copyright
; notice,  this  list of conditions and  the  following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; 3. The end-user documentation included with the redistribution, if any,
; must include the following acknowledgment:
;
; "This product uses DOS/32 Advanced DOS Extender technology."
;
; Alternately,  this acknowledgment may appear in the software itself, if
; and wherever such third-party acknowledgments normally appear.
;
; 4.  Products derived from this software  may not be called "DOS/32A" or
; "DOS/32 Advanced".
;
; THIS  SOFTWARE AND DOCUMENTATION IS PROVIDED  "AS IS" AND ANY EXPRESSED
; OR  IMPLIED  WARRANTIES,  INCLUDING, BUT  NOT  LIMITED  TO, THE IMPLIED
; WARRANTIES  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED.  IN  NO  EVENT SHALL THE  AUTHORS  OR  COPYRIGHT HOLDERS BE
; LIABLE  FOR  ANY DIRECT, INDIRECT,  INCIDENTAL,  SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF
; SUBSTITUTE  GOODS  OR  SERVICES;  LOSS OF  USE,  DATA,  OR  PROFITS; OR
; BUSINESS  INTERRUPTION) HOWEVER CAUSED AND  ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE)  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
; ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;


.CODE

;-----------------------------------------------------------------------------
_come_here:
	mov	eax,_cpu_ypos
	dec	eax
	mov	eax,_addrbuffer[eax*4]
	mov	_dr0,eax
	and	bptr _dr7[2],0F0h		; LEN=byte, R/W=exec
	or	bptr _dr7[0],003h
	call	restore_video
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	btr	dptr [esp+8],8
	iretd

;-----------------------------------------------------------------------------
_step_over:
	mov	esi,_eip
	call	decode
	mov	eax,dptr cmdbuf[0]
	cmp	eax,'llac'			; check for CALL
	jz	@@doit
	cmp	eax,'pool'			; check for LOOP..
	jz	@@doit
	and	eax,00FFFFFFh
	mov	ebx,00746E69h			;' tni'
	cmp	eax,ebx				; check for INT
	jz	@@doit
	mov	ebx,00706572h			;' per'
	cmp	eax,ebx				; check for REP
	jz	@@doit
	jmp	_trace_into
@@doit:	mov	_dr0,esi
	and	bptr _dr7[2],0F0h		; LEN=byte, R/W=exec
	or	bptr _dr7[0],003h
	call	restore_video
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	btr	dptr [esp+8],8
	iretd

;-----------------------------------------------------------------------------
_jump_over:
	mov	esi,_eip
	call	decode
	mov	eax,dptr cmdbuf[0]
	cmp	eax,'llac'			; check for CALL
	jz	@@doit
	cmp	eax,'pool'			; check for LOOP..
	jz	@@doit
	and	eax,00FFFFFFh
	mov	ebx,00746E69h			;' tni'
	cmp	eax,ebx				; check for INT
	jz	@@doit
	mov	ebx,00706572h			;' per'
	cmp	eax,ebx				; check for REP
	jz	@@doit
	mov	ebx,00706D6Ah			;' pmj'
	cmp	eax,ebx				; check for JMP
	jz	@@doit
	mov	ebx,006F6E6Ah			;' onj'
	cmp	eax,ebx				; check for JNO
	jz	@@doit
	mov	ebx,0065616Ah			;' eaj'
	cmp	eax,ebx				; check for JAE
	jz	@@doit
	mov	ebx,007A6E6Ah			;' znj'
	cmp	eax,ebx				; check for JNZ
	jz	@@doit
	mov	ebx,0065626Ah			;' ebj'
	cmp	eax,ebx				; check for JBE
	jz	@@doit
	mov	ebx,00736E6Ah			;' snj'
	cmp	eax,ebx				; check for JNS
	jz	@@doit
	mov	ebx,0065706Ah			;' epj'
	cmp	eax,ebx				; check for JPE
	jz	@@doit
	mov	ebx,006F706Ah			;' opj'
	cmp	eax,ebx				; check for JPO
	jz	@@doit
	mov	ebx,0065676Ah			;' egj'
	cmp	eax,ebx				; check for JGE
	jz	@@doit
	mov	ebx,00656C6Ah			;' elj'
	cmp	eax,ebx				; check for JLE
	jz	@@doit
	and	eax,0000FFFFh
	mov	ebx,00006F6Ah			;' oj'
	cmp	eax,ebx				; check for JO
	jz	@@doit
	mov	ebx,0000626Ah			;' bj'
	cmp	eax,ebx				; check for JB
	jz	@@doit
	mov	ebx,00007A6Ah			;' zj'
	cmp	eax,ebx				; check for JZ
	jz	@@doit
	mov	ebx,0000616Ah			;' aj'
	cmp	eax,ebx				; check for JA
	jz	@@doit
	mov	ebx,0000736Ah			;' sj'
	cmp	eax,ebx				; check for JS
	jz	@@doit
	mov	ebx,00006C6Ah			;' lj'
	cmp	eax,ebx				; check for JL
	jz	@@doit
	mov	ebx,0000676Ah			;' gj'
	cmp	eax,ebx				; check for JG
	jz	@@doit
	jmp	_trace_into
@@doit:	mov	_dr0,esi
	and	bptr _dr7[2],0F0h		; LEN=byte, R/W=exec
	or	bptr _dr7[0],003h
	call	restore_video
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	btr	dptr [esp+8],8
	iretd

;-----------------------------------------------------------------------------
_trace_into:
	mov	esi,_eip
	call	decode
	mov	eax,dptr cmdbuf[0]
	and	eax,00FFFFFFh
	mov	ebx,00746E69h			;' tni'
	cmp	eax,ebx				; check for INT
	jz	_step_over
	and	bptr _dr7[2],0F0h		; LEN=byte, R/W=exec
	and	bptr _dr7[0],0FCh
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	bts	dptr [esp+8],8
	iretd

;-----------------------------------------------------------------------------
_return_to:
	mov	ecx,1024			; try 1024 instructions
	mov	esi,_eip
@@l0:	mov	ebp,esi
	call	decode
	mov	eax,dptr cmdbuf[0]
	mov	ebx,'teri'
	cmp	eax,ebx				; check for IRET
	jz	@@l1
	and	eax,00FFFFFFh
	mov	ebx,00746572h			;' ter'
	cmp	eax,ebx				; check for RET
	jz	@@l1
	mov	ebx,00706D6Ah			;' pmj'
	cmp	eax,ebx				; check for JMP
	jz	@@l1
	loop	@@l0
	ret
@@l1:	cmp	ecx,512
	jnz	@@l2
	ret
@@l2:	mov	_dr0,ebp
	and	bptr _dr7[2],0F0h
	or	bptr _dr7[0],003h
	call	restore_video
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	btr	dptr [esp+8],8
	iretd


;-----------------------------------------------------------------------------
_proceed:
	call	restore_video
	call	restore_state
	mov	ebp,_ebp
	mov	ds,_ds
	btr	dptr [esp+8],8
	iretd

;-----------------------------------------------------------------------------
_new_address:
	mov	eax,_cpu_ypos
	dec	eax
	mov	eax,_addrbuffer[eax*4]
	mov	_eip,eax
	jmp	repaint_text

;-----------------------------------------------------------------------------
_break_pnt:
	mov	eax,_cpu_ypos
	dec	eax
	mov	edx,_addrbuffer[eax*4]		; EDX = addr of breakpoint
	mov	ebx,1
	mov	ecx,0Ch
@@l0:	cmp	_dr0[ebx*4],edx
	jz	@@l1
	inc	ebx
	shl	cl,2
	jnz	@@l0
	mov	ebx,1
	mov	ecx,0Ch
	mov	al,bptr _dr7[0]
@@l00:	test	al,cl
	jz	@@l2
	inc	ebx
	shl	cl,2
	jnz	@@l00
	ret
@@l1:	mov	_dr0[ebx*4],0
	not	cl
	and	bptr _dr7[0],cl
	jmp	repaint_text
@@l2:	mov	_dr0[ebx*4],edx
	or	bptr _dr7[0],cl
	mov	ax,0FFF0h
	lea	ecx,[ebx*4]
	rol	ax,cl
	and	wptr _dr7[2],ax
	jmp	repaint_text


;-----------------------------------------------------------------------------
_swap_screen:
	call	restore_video
	call	get_key
	call	video_init
	call	show_text
	call	show_stack
	call	show_cursor
	jmp	screen_on

_redraw_now:
	call	restore_video
	call	video_init
	call	clearkeytab
	call	show_text
	call	show_regs
	call	show_data
	call	show_mode
	call	show_stack
	call	show_cursor
	jmp	switch_to_cpu



;-----------------------------------------------------------------------------
_show_info:
	mov	ebx,30
	mov	ecx,60
	mov	esi,1
	mov	edi,1
	call	clearwindow
	call	clear_cmdline
	mov	xpos,1
	mov	ypos,49
	mov	edx,offs hlp00
	call	prints
	cmp	_pagenum,0
	jz	show_page0
	cmp	_pagenum,1
	jz	show_page1
	cmp	_pagenum,2
	jz	show_page2
	cmp	_pagenum,3
	jz	show_page3
	cmp	_pagenum,4
	jz	show_page4
	cmp	_pagenum,5
	jz	show_page5
	cmp	_pagenum,8
	jz	show_page8

get_page_key:
	call	get_key
	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	get_page_key

info_exit:
	call	show_text_clr
	call	print_cmdline
	jmp	show_cursor


show_page0:
	mov	ebx,30
	mov	ecx,60
	mov	esi,1
	mov	edi,1
	call	clearwindow
	mov	_pagenum,0

	mov	xpos,3
	mov	ypos,2
	mov	edx,offs hlp01
	mov	color,30h
	call	prints

	mov	xpos,3			; show DPMI function AX=0400h
	add	ypos,2
	mov	edx,offs hlp10
	mov	color,30h
	call	prints
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp11
	mov	color,31h
	call	prints
	mov	ax,0400h
	push	ds es fs gs
	int	31h
	pop	gs fs es ds
	push	dx cx bx
	mov	color,3Fh
	call	printax
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp12
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp13
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp14
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax

	mov	xpos,3			; show DPMI function AX=0500h
	add	ypos,2
	mov	edx,offs hlp20
	mov	color,30h
	call	prints
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp21
	mov	color,31h
	call	prints
	sub	esp,48
	mov	edi,esp
	mov	ax,0500h
	int	31h
	mov	eax,[esp+00h]
	mov	ebx,[esp+18h]
	add	esp,48
	mov	color,3Fh
	call	printeax
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp22
	mov	color,31h
	call	prints
	mov	eax,ebx
	shl	eax,12
	mov	color,3Fh
	call	printeax

	mov	xpos,3			; show DPMI function AX=0100h
	add	ypos,2
	mov	edx,offs hlp25
	mov	color,30h
	call	prints
	mov	xpos,4
	inc	ypos
	mov	edx,offs hlp26
	mov	color,31h
	call	prints
	mov	ax,0100h
	mov	bx,-1
	int	31h
	movzx	eax,bx
	shl	eax,4
	mov	color,3Fh
	call	printeax

	mov	xpos,37			; show DPMI function AX=0A00h
	mov	ypos,4
	mov	edx,offs hlp30
	mov	color,30h
	call	prints
	mov	xpos,38
	inc	ypos
	mov	edx,offs hlp31
	mov	color,31h
	call	prints
	mov	ax,0A00h
	push	ds es fs gs
	mov	esi,offs hlpid
	int	31h
	pop	gs fs es ds
	push	dx cx bx
	mov	color,3Fh
	call	printax
	mov	xpos,38
	inc	ypos
	mov	edx,offs hlp32
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax
	mov	xpos,38
	inc	ypos
	mov	edx,offs hlp33
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax
	mov	xpos,38
	inc	ypos
	mov	edx,offs hlp34
	mov	color,31h
	call	prints
	pop	ax
	mov	color,3Fh
	call	printax

	mov	xpos,37			; show DPMI function AX=0E00h
	add	ypos,2
	mov	edx,offs hlp40
	mov	color,30h
	call	prints
	mov	xpos,38
	inc	ypos
	mov	edx,offs hlp41
	mov	color,31h
	call	prints
	mov	ax,0E00h
	push	ds es fs gs
	int	31h
	pop	gs fs es ds
	mov	color,3Fh
	call	printax

	mov	xpos,2				; show Selectors
	add	ypos,7
	mov	color,30h
	mov	edx,offs hlp50
	call	prints

	mov	color,31h
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp51
	call	prints
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp52
	call	prints
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp53
	call	prints
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp54
	call	prints
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp55
	call	prints
	mov	xpos,3
	inc	ypos
	mov	edx,offs hlp56
	call	prints

	mov	color,3Fh
	mov	xpos,6
	sub	ypos,5
	mov	eax,_cs
	call	printax
	mov	xpos,6
	inc	ypos
	mov	eax,_ds
	call	printax
	mov	xpos,6
	inc	ypos
	mov	eax,_es
	call	printax
	mov	xpos,6
	inc	ypos
	mov	eax,_ss
	call	printax
	mov	xpos,6
	inc	ypos
	mov	eax,_fs
	call	printax
	mov	xpos,6
	inc	ypos
	mov	eax,_gs
	call	printax

	mov	xpos,13
	sub	ypos,5
	mov	eax,_cs_base
	call	printeax
	mov	xpos,13
	inc	ypos
	mov	eax,_ds_base
	call	printeax
	mov	xpos,13
	inc	ypos
	mov	eax,_es_base
	call	printeax
	mov	xpos,13
	inc	ypos
	mov	eax,_ss_base
	call	printeax
	mov	xpos,13
	inc	ypos
	mov	eax,_fs_base
	call	printeax
	mov	xpos,13
	inc	ypos
	mov	eax,_gs_base
	call	printeax

	mov	xpos,24
	sub	ypos,5
	mov	eax,_cs_limit
	call	printeax
	mov	xpos,24
	inc	ypos
	mov	eax,_ds_limit
	call	printeax
	mov	xpos,24
	inc	ypos
	mov	eax,_es_limit
	call	printeax
	mov	xpos,24
	inc	ypos
	mov	eax,_ss_limit
	call	printeax
	mov	xpos,24
	inc	ypos
	mov	eax,_fs_limit
	call	printeax
	mov	xpos,24
	inc	ypos
	mov	eax,_gs_limit
	call	printeax

	mov	xpos,35
	sub	ypos,5
	movzx	eax,_cs_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints
	mov	xpos,35
	inc	ypos
	movzx	eax,_ds_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints
	mov	xpos,35
	inc	ypos
	movzx	eax,_es_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints
	mov	xpos,35
	inc	ypos
	movzx	eax,_ss_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints
	mov	xpos,35
	inc	ypos
	movzx	eax,_fs_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints
	mov	xpos,35
	inc	ypos
	movzx	eax,_gs_acc
	shr	eax,15
	lea	edx,_acc_typeg[eax*8]
	call	prints

	mov	xpos,42
	sub	ypos,5
	movzx	eax,_cs_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints
	mov	xpos,42
	inc	ypos
	movzx	eax,_ds_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints
	mov	xpos,42
	inc	ypos
	movzx	eax,_es_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints
	mov	xpos,42
	inc	ypos
	movzx	eax,_ss_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints
	mov	xpos,42
	inc	ypos
	movzx	eax,_fs_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints
	mov	xpos,42
	inc	ypos
	movzx	eax,_gs_acc
	shr	eax,14
	and	eax,1
	lea	edx,_acc_typeb[eax*8]
	call	prints

	mov	xpos,50
	sub	ypos,5
	movzx	eax,_cs_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc
	mov	xpos,50
	inc	ypos
	movzx	eax,_ds_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc
	mov	xpos,50
	inc	ypos
	movzx	eax,_es_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc
	mov	xpos,50
	inc	ypos
	movzx	eax,_ss_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc
	mov	xpos,50
	inc	ypos
	movzx	eax,_fs_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc
	mov	xpos,50
	inc	ypos
	movzx	eax,_gs_acc
	shr	eax,1
	and	eax,7
	add	eax,30h
	call	printc

	mov	xpos,56
	sub	ypos,5
	mov	ax,_cs_acc
	call	printax
	mov	xpos,56
	inc	ypos
	mov	ax,_ds_acc
	call	printax
	mov	xpos,56
	inc	ypos
	mov	ax,_es_acc
	call	printax
	mov	xpos,56
	inc	ypos
	mov	ax,_ss_acc
	call	printax
	mov	xpos,56
	inc	ypos
	mov	ax,_fs_acc
	call	printax
	mov	xpos,56
	inc	ypos
	mov	ax,_gs_acc
	call	printax

	mov	xpos,3
	add	ypos,4
	mov	color,31h
	mov	edx,offs hlp0A
	call	prints
	mov	color,3Fh
	mov	eax,__page_faults
	call	printeax

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -