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

📄 mtrap.lst

📁 比dos下的debug更好的debug程序源码
💻 LST
📖 第 1 页 / 共 3 页
字号:
    249		  75 67	68 20 6D 65 6D+
    250		  6F 72	79 2F 63 6F 72+
    251		  72 75	70 74 20 61 72+
    252		  65 6E	61 00
    253	    0048  47 52	44 42 20 72 65+	 vererr	 db	 "GRDB requires	MSDOS 4.0 or better"
    254		  71 75	69 72 65 73 20+
    255		  4D 53	44 4F 53 20 34+
    256		  2E 30	20 6F 72 20 62+
    257		  65 74	74 65 72
    258	    0069  00			 nomsg	 db	 0
    259
    260					 ;This macro generates a front end for the interrupt handlers installed	for
    261					 ;int 0, 1 and 3.
    262
    263					 entry	 macro	 num
    264						 local	 est
    265					 entry&num:
    266					 if num	EQ 1
    267						 call	 hdwechk
    268						 jc	 est
    269						 call	 swiftrace
    270					 endif
    271					 if num	EQ 3
    272						 call	 swiftrace
    273					 endif
    274					 est:
    275						 push	 gs
    276						 push	 fs
    277						 push	 es
    278						 push	 ds
    279						 pushad
    280						 mov	 al,num
    281						 jmp	 traphandler
    282					 endm
    283
    284						 entry	 0
Turbo Assembler	 Version 5.0	    08-31-98 14:27:45	    Page 6
mtrap.asm



1   285	    006A			 entry0:
1   286	    006A			 ??0000:
1   287	    006A  0F A8				 push	 gs
1   288	    006C  0F A0				 push	 fs
1   289	    006E  06				 push	 es
1   290	    006F  1E				 push	 ds
1   291	    0070  66| 60			 pushad
1   292	    0072  B0 00				 mov	 al,0
1   293	    0074  E9 009E			 jmp	 traphandler
    294						 entry	 1
1   295	    0077			 entry1:
1   296	    0077  E8 0000e			 call	 hdwechk
1   297	    007A  72 05	90 90			 jc	 ??0001
1   298	    007E  E8 0000e			 call	 swiftrace
1   299	    0081			 ??0001:
1   300	    0081  0F A8				 push	 gs
1   301	    0083  0F A0				 push	 fs
1   302	    0085  06				 push	 es
1   303	    0086  1E				 push	 ds
1   304	    0087  66| 60			 pushad
1   305	    0089  B0 01				 mov	 al,1
1   306	    008B  E9 0087			 jmp	 traphandler
    307						 entry	 3
1   308	    008E			 entry3:
1   309	    008E  E8 0000e			 call	 swiftrace
1   310	    0091			 ??0002:
1   311	    0091  0F A8				 push	 gs
1   312	    0093  0F A0				 push	 fs
1   313	    0095  06				 push	 es
1   314	    0096  1E				 push	 ds
1   315	    0097  66| 60			 pushad
1   316	    0099  B0 03				 mov	 al,3
1   317	    009B  EB 78	90			 jmp	 traphandler
    318
    319					 ;
    320					 ; Save	an image of the	regs
    321					 ; This	MUST BE	the first thing	the trap handler calls;	it assumes
    322					 ; there is ONE	PUSH (return address) followed by the DS at the	time
    323					 ; of interrupt	followed by the	interrupt data
    324					 ;
    325	    009E			 saveregs	 PROC
    326	    009E  59				 pop	 cx
    327	    009F  66| 8F 06 002Fr		 pop	 [RegdumpEDI]
    328	    00A4  66| 8F 06 002Br		 pop	 [RegdumpESI]
    329	    00A9  66| 8F 06 0033r		 pop	 [RegdumpEBP]
    330	    00AE  66| 58			 pop	 eax
    331	    00B0  66| 8F 06 001Fr		 pop	 [RegdumpEBX]
    332	    00B5  66| 8F 06 0027r		 pop	 [RegdumpEDX]
    333	    00BA  66| 8F 06 0023r		 pop	 [RegdumpECX]
    334	    00BF  66| 8F 06 001Br		 pop	 [RegdumpEAX]
    335	    00C4  8F 06	0043r			 pop	 [RegdumpDS]
    336	    00C8  8F 06	0041r			 pop	 [RegdumpES]
    337	    00CC  8F 06	0047r			 pop	 [RegdumpFS]
    338	    00D0  8F 06	0049r			 pop	 [RegdumpGS]
    339	    00D4  0F BA	26 004Dr 00		 bt	 [haserr],0	 ; See if an error
    340	    00DA  73 05				 jnc	 short noerr	 ;
    341	    00DC  66| 58			 pop	 eax		 ; Get the error #
Turbo Assembler	 Version 5.0	    08-31-98 14:27:45	    Page 7
mtrap.asm



    342	    00DE  A3 004Fr			 mov	 [errnum],ax	 ;
    343	    00E1			 noerr:
    344	    00E1  8F 06	003Br			 pop	 word ptr [RegdumpEIP]
    345	    00E5  8F 06	003Fr			 pop	 [RegdumpCS]
    346	    00E9  8F 06	0017r			 pop	 word ptr [RegdumpFLAGS]
    347	    00ED  8C D0				 mov	 ax,ss		 ; Otherwise just save the current
    348	    00EF  A3 0045r			 mov	 [RegdumpSS],ax	 ; stack pointer before	we started pushing
    349	    00F2  66| 89 26 0037r		 mov	 [RegdumpESP],esp	 ;
    350	    00F7  FF E1				 jmp	 cx
    351	    00F9			 saveregs	 ENDP
    352					 ;
    353					 ; Adjust EIP to the trap if it's not int 3
    354					 ;
    355	    00F9			 adjusteip	 PROC
    356	    00F9  83 3E	0051r 03		 cmp	 [trapnum],3	 ; See if int 3
    357	    00FE  75 14				 jnz	 short noadj	 ; No, get out
    358	    0100  66| 8B 1E 003Br		 mov	 ebx,[RegdumpEIP]	 ;
    359	    0105  8E 26	003Fr			 mov	 fs,[RegdumpCS]	 ;
    360	    0109  64: 80 7F FF CC		 cmp	 BYTE PTR fs:[bx-1],0cch ; See if is an	INT 3
    361	    010E  74 04				 jz	 short nodecrement ; Get out if	so
    362	    0110  FF 0E	003Br			 dec	 word ptr [RegdumpEIP]		 ; Else	point at trap
    363	    0114			 nodecrement:
    364	    0114			 noadj:
    365	    0114  C3				 ret
    366	    0115			 adjusteip	 ENDP
    367					 ;
    368					 ; Generic trap	handler, int 1/3
    369					 ;
    370	    0115			 traphandler	 PROC
    371	    0115  FC				 cld
    372	    0116  FB				 sti
    373	    0117  8B 1E	0000			 mov	 bx,dgroup
**Error** mtrap.asm(190) Undefined symbol: dgroup
    374	    011B  8E DB				 mov	 ds,bx
    375	    011D  8E C3				 mov	 es,bx
    376	    011F  C6 06	0000e 00		 mov	 [CtrlBrkPressedInDOS],0
    377	    0124  66| 0F B6 C0			 movzx	 eax,al
    378	    0128  A3 0051r			 mov	 [trapnum],ax
    379	    012B  66| 0F A3 06 0063r		 bt	 [trappop],eax
    380	    0131  73 06	90 90			 jnc	 noerr2
    381	    0135  FF 06	004Dr			 inc	 [haserr]	 ; Set the error flag
    382	    0139			 noerr2:
    383	    0139  BE 0004r			 mov	 si,offset veclist
    384	    013C  E8 0000e			 call	 ReleaseRMInts
    385	    013F  E8 FF5C			 call	 saveregs	 ; Save	Regs
    386	    0142  66| 81 26 0017r     +		 and	 [RegdumpFLAGS],NOT TRAPFLAG ; reset trap flag in flags	image
    387		  FFFFFEFF
    388	    014B  8E 16	0002r			 mov	 ss,[stackseg]	 ; load	our stack
    389	    014F  66| 0F B7 26 0000r		 movzx	 esp,[stackofs]	 ; clear top of	ESP just in case...
    390	    0155  E8 0000e			 call	 disableBreaks	 ; Disable breakpoints if not
    391	    0158  E8 FF9E			 call	 adjusteip	 ; Adjust the EIP to point to the breakpoint
    392	    015B  E8 0000e			 call	 SetDebugPSP
    393	    015E  E8 0000e			 call	 crlf
    394	    0161  83 3E	0051r 03		 cmp	 [trapnum],3	 ; No stats if it is int 3
    395	    0166  74 38				 jz	 short reentry	 ;
    396	    0168  83 3E	0051r 01		 cmp	 [trapnum],1	 ; Or int 1
    397	    016D  74 31				 jz	 short reentry	 ;
Turbo Assembler	 Version 5.0	    08-31-98 14:27:45	    Page 8
mtrap.asm



    398						 PRINT_MESSAGE	 <'Trap: '>
1   399	    016F  E8 0000e			 call	 PrintFollowingMessage
1   400	    0172  54 72	61 70 3A 20 00		 db	 'Trap:	',0
    401	    0179  A1 0051r			 mov	 ax,[trapnum]	 ; Say which one
    402	    017C  E8 0000e			 call	 printbyte	 ;
    403	    017F  E8 0000e			 call	 crlf
    404	    0182  0F BA	36 004Dr 00		 btr	 [haserr],0	 ; If has error
    405	    0188  73 16	90 90			 jnc	 reentry	 ;
    406						 PRINT_MESSAGE	 <'Error: '>
1   407	    018C  E8 0000e			 call	 PrintFollowingMessage
1   408	    018F  45 72	72 6F 72 3A 20+		 db	 'Error: ',0
    409		  00
    410	    0197  A1 004Fr			 mov	 ax,[errnum]	 ; Say which one
    411	    019A  E8 0000e			 call	 printword
    412	    019D  E8 0000e			 call	 crlf
    413					 ; fall	through
    414	    01A0			 traphandler ENDP
    415	    01A0			 reentry PROC
    416	    01A0  E8 0000e			 call	 DisplayRegisters; Display registers
    417	    01A3  66| F7 06 0000e     +		 test	 [trapcount],-1	 ; see if tracing more than 1
    418		  FFFFFFFF
    419	    01AC  74 0A	90 90			 jz	 noretrace
    420	    01B0  66| FF 0E 0000e		 dec	 [trapcount]	 ; yes,	go do another trace
    421	    01B5  E9 0000e			 jmp	 ReTrap
    422	    01B8			 noretrace:
    423	    01B8  E8 0000e			 call	 initflatreal	 ; put us in flat real mode
    424	    01BB  F6 06	0062r FF		 test	 [neederr],-1	 ; test	if an error (startup usually)
    425	    01C0  0F 84	0000			 jz	 InputHandler
**Error** mtrap.asm(235) Undefined symbol: InputHandler
    426	    01C4  8A 26	0062r			 mov	 ah,[neederr]	 ; yes,	kill it
    427	    01C8  C6 06	0062r 00		 mov	 [neederr],0
    428	    01CD  9E				 sahf
    429	    01CE  E8 0000e			 call	 FileLoadErr	 ; display the error message
    430	    01D1  E9 0000			 jmp	 InputHandler	 ; Go do input
**Error** mtrap.asm(240) Undefined symbol: InputHandler
    431
    432	    01D4			 reentry ENDP
    433					 ;
    434					 ; Monitor init	routine, point all traps to point to the monitor handler
    435					 ;
    436
    437	    01D4			 start:
    438	    01D4  8B 1E	0000			 mov	 bx,dgroup	 ; setup
**Error** mtrap.asm(248) Undefined symbol: dgroup
    439	    01D8  8E DB				 mov	 ds,bx
    440	    01DA  8C 06	0060r			 mov	 [psp],es	 ; our PSP
    441	    01DE  8E C3				 mov	 es,bx		 ;set ES to DX
    442	    01E0  8C D0				 mov	 ax,ss		 ; have	to adjust stack	to be DS-relative
    443	    01E2  2B C3				 sub	 ax,bx		 ; the disassembler requires it
    444	    01E4  C1 E0	04			 shl	 ax,4		 ;to segment
    445	    01E7  03 C4				 add	 ax,sp		 ;add in the stack pointer
    446	    01E9  8E D3				 mov	 ss,bx		 ;set SS to DS
    447	    01EB  8B E0				 mov	 sp,ax		 ;and new stack	based on DS
    448	    01ED  8C 16	0002r			 mov	 [stackseg],ss
    449	    01F1  89 26	0000r			 mov	 [stackofs],sp
    450						 PRINT_MESSAGE	 <"GRDB	version	",30h +VERID/10,'.',30h	+ VERID	MOD 10,	" Copyright +
    451					 (c) LADsoft",13,10,13,10>
Turbo Assembler	 Version 5.0	    08-31-98 14:27:45	    Page 9
mtrap.asm



1   452	    01F5  E8 0000e			 call	 PrintFollowingMessage
1   453	    01F8  47 52	44 42 20 76 65+		 db	 "GRDB version ",30h +VERID/10,'.',30h + VERID MOD 10, " Copyright (c)	    +
    454		  72 73	69 6F 6E 20 30+	 LADsoft",13,10,13,10,0
    455		  2E 30	20 43 6F 70 79+
    456		  72 69	67 68 74 20 28+
    457		  63 29	20 4C 41 44 73+
    458		  6F 66	74 0D 0A 0D 0A+
    459		  00
**Error** mtrap.asm(260) PRINT_MESSAGE(2) Undefined symbol: VERID
    460	    0223  B4 30				 mov	 ah,30h				 ; dos version check
    461	    0225  CD 21				 int	 21h
    462	    0227  3C 04				 cmp	 al,4
    463	    0229  BA 0048r			 mov	 dx,offset cs:vererr
    464	    022C  0F 82	008C			 jc	 errx
    465	    0230  86 E0				 xchg	 ah,al
    466	    0232  A3 004Br			 mov	 [dosver],ax
    467	    0235  06				 push	 es				 ; get indos flag
    468	    0236  B4 34				 mov	 ah,34h
    469	    0238  CD 21				 int	 21h
    470	    023A  89 1E	0053r			 mov	 word ptr [indos],bx
    471	    023E  8C 06	0055r			 mov	 word ptr [indos+2],es
    472	    0242  07				 pop	 es
    473	    0243  E8 0000e			 call	 checkcpu			 ; validate CPU
    474	    0246  BA 0000r			 mov	 dx,offset cs:cpuerr
    475	    0249  72 71	90 90			 jc	 errx
    476	    024D  E8 0000e			 call	 ResizeMem			 ; cut mem back
    477	    0250  BA 0028r			 mov	 dx,offset cs:memerr
    478	    0253  72 67	90 90			 jc	 errx
    479	    0257  E8 0000			 call	 IntSnapshot			 ; grab	the ints so we can
**Error** mtrap.asm(281) Undefined symbol: IntSnapshot
    480											 ; restoire context later
    481	    025A  BA 0028r			 mov	 dx,offset cs:memerr
    482	    025D  72 4F	90 90			 jc	 errx2
    483	    0261  BE 0057r			 mov	 si,offset grdbname	 ; create data spaces for
    484	    0264  E8 0000e			 call	 MakeEmptyProg			 ; empty prog
    485	    0267  BA 0028r			 mov	 dx,offset cs:memerr
    486	    026A  72 42	90 90			 jc	 errx2
    487	    026E  E8 0000e			 call	 ReadOptions			 ; read	the options disk file
    488	    0271  E8 0000			 call	 FloatCheck			 ; check for an	FP coprocessor
**Error** mtrap.asm(290) Undefined symbol: FloatCheck
    489
    490	    0274  1E				 push	 ds				 ; parse command line params
    491	    0275  8E 1E	0060r			 mov	 ds,[psp]
    492	    0279  BE 0081			 mov	 si,81h
    493	    027C  E8 0000e			 call	 ParseProgName
    494	    027F  1F				 pop	 ds
    495	    0280  F6 06	0000e FF		 test	 [loadfile],-1			 ; load	program

⌨️ 快捷键说明

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