exceptn.asm
来自「开放源码的编译器open watcom 1.6.0版的源代码」· 汇编 代码 · 共 2,536 行 · 第 1/5 页
ASM
2,536 行
mov edx,offset ResHeader
mov ah,40h
mov ecx,ResHeaderLen
mov ebx,d[@@Handle]
int 21h
mov edx,offset SelHeader
mov ah,40h
mov ecx,SelHeaderLen
mov ebx,d[@@Handle]
int 21h
mov es,ExcepDSeg
assume es:_cwMain
mov es,es:RealSegment
assume es:nothing
mov esi,fs:d[EPSP_Resource]
@@LookLoop: push esi
mov ebp,ResNum ;get number of entries.
mov edi,esi
add esi,ResHead+ResNum
add edi,ResHead
@@r0: cmp es:b[edi],Res_PSP
jz @@r1_0
cmp es:b[edi],Res_SEL
jnz @@r1
@@r1_0: mov ax,fs:w[EPSP_DPMIMem]
cmp es:w[esi],ax
jz @@r1
;
@@SEL: pushad
mov edi,offset DebugHeader
mov eax,es:[esi]
mov cx,4
call Bin2Hex
mov b[edi],' '
inc edi
mov ebx,es:[esi]
sys GetSelDet32
push ecx
mov eax,edx
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
pop eax
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
mov eax,es:[esi]
lar eax,eax
test eax,0000100000000000b
mov ebx,'EDOC'
jnz @@dc0
mov ebx,'ATAD'
@@dc0: mov [edi],ebx
add edi,4
mov b[edi],' '
inc edi
mov eax,es:[esi]
lar eax,eax
mov bx,"61"
test eax,00400000h
jz @@Use32It
mov bx,"23"
@@Use32It: mov [edi],bx
add edi,2
mov b[edi],' '
inc edi
inc TotalSelectors
;
;See if there is a memory block that matches this selector.
;
mov ebx,es:[esi]
sys GetSelDet32
mov ebx,edx
pushad
mov esi,fs:d[EPSP_Resource]
@@s2: push esi
mov ebp,ResNum ;get number of entries.
mov edi,esi
add esi,ResHead+ResNum
add edi,ResHead
@@s0: cmp es:b[edi],Res_MEM ;Anything here?
jnz @@s1
mov eax,fs:d[EPSP_INTMem]
cmp es:[esi],eax
jz @@s1
cmp fs:w[EPSP_DPMIMem],0
jz @@nodpmi
pushad
mov bx,fs:w[EPSP_DPMIMem]
sys GetSelDet32
cmp es:[esi],edx
popad
jz @@s1
@@nodpmi: ;
cmp ebx,es:[esi] ;Fits this block?
jnz @@s1
pop esi
clc
jmp @@s3
;
@@s1: add esi,4
inc edi
dec ebp
jnz @@s0
pop esi
mov esi,es:[esi+8] ;link to next list.
or esi,esi
jnz @@s2
;
;Have a look in the MCB list.
;
cmp fs:d[EPSP_mcbHead],0
jz @@nomcbsel
mov esi,fs:d[EPSP_mcbHead]
@@mcbs0: mov edi,esi
add esi,mcbChunkLen
@@mcbs1: mov eax,esi
add eax,mcbLen
cmp ebx,eax
jnz @@mcbs2
clc
jmp @@s3
@@mcbs2: cmp es:b[esi+mcbNext],"M"
jz @@mcbs3
mov esi,es:[edi+mcbChunkNext]
or esi,esi
jz @@nomcbsel
jmp @@mcbs0
@@mcbs3: movzx eax,es:w[esi+mcbNextSize]
add eax,mcbLen
add esi,eax
jmp @@mcbs1
@@nomcbsel: stc
@@s3: popad
jc @@r4
;
mov b[edi],'Y'
jmp @@r5
;
@@r4: mov d[edi],'N'
;
@@r5: inc edi
mov b[edi],' '
inc edi
;
mov eax,es:[esi]
mov bx,fs:w[EPSP_SegBase]
cmp ax,bx
jc @@r2
mov bx,fs:w[EPSP_SegSize]
add bx,fs:w[EPSP_SegBase]
cmp ax,bx
jnc @@r2
mov bx,fs:w[EPSP_SegBase]
shr bx,3
shr ax,3
sub ax,bx
inc ax
mov ecx,4
call Bin2Hex
jmp @@r20
;
@@r2: mov d[edi],'xxxx'
add edi,4
;
@@r20: mov b[edi],13
mov b[edi+1],10
mov b[edi+2],'$'
add edi,2
push edi
pop ecx
sub ecx,offset DebugHeader
mov edx,offset DebugHeader
mov ah,40h
mov ebx,d[@@Handle]
int 21h
popad
;
@@r1: add esi,4
inc edi
dec ebp
jnz @@r0
pop edi
mov esi,es:[edi+8] ;link to next list.
or esi,esi
jnz @@LookLoop
;
mov edi,offset TotalSelsNum
mov eax,TotalSelectors
mov ecx,4
call Bin2Hex
mov ecx,TotalSelsTLen
mov edx,offset TotalSelsText
mov ah,40h
mov ebx,d[@@Handle]
int 21h
;
;Now do memory blocks.
;
mov edx,offset MemHeader
mov ah,40h
mov ecx,MemHeaderLen
mov ebx,d[@@Handle]
int 21h
;
mov esi,fs:d[EPSP_Resource]
mov es,ExcepDSeg
assume es:_cwMain
mov es,es:RealSegment
assume es:nothing
@@mLookLoop: push esi
mov ebp,ResNum ;get number of entries.
mov edi,esi
add esi,ResHead+ResNum
add edi,ResHead
@@m0: cmp es:b[edi],Res_MEM
jnz @@m1
mov eax,fs:d[EPSP_INTMem]
cmp es:[esi],eax
jz @@m1
cmp fs:w[EPSP_DPMIMem],0
jz @@nodpmimem
pushad
mov bx,fs:w[EPSP_DPMIMem]
sys GetSelDet32
cmp es:[esi],edx
popad
jz @@m1
;
@@nodpmimem: ;Check if this is an MCB block.
;
push edi
cmp fs:d[EPSP_mcbHead],0
jz @@MEM
mov ebx,es:[esi]
mov edi,fs:d[EPSP_mcbHead]
@@mcbmc0: cmp ebx,edi
jz @@mcbmc1
mov edi,es:[edi+mcbChunkNext]
or edi,edi
jz @@MEM
jmp @@mcbmc0
;
@@mcbmc1: ;Update Total memory value and skip this block.
;
mov eax,es:[esi+8]
add eax,4095
and eax,0fffff000h
add TotalLinearMem+4,eax
pop edi
jmp @@m1
@@MEM: pop edi
pushad
mov edi,offset DebugHeader
mov eax,es:[esi+4]
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
mov eax,es:[esi]
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
mov eax,es:[esi+8]
add TotalLinearMem,eax
push eax
add eax,4095
and eax,0fffff000h
add TotalLinearMem+4,eax
pop eax
inc TotalLinearMem+8
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
;
mov b[edi],13
mov b[edi+1],10
mov b[edi+2],'$'
add edi,2
push edi
pop ecx
push es
sub ecx,offset DebugHeader
mov edx,offset DebugHeader
mov ah,40h
mov ebx,d[@@Handle]
int 21h
pop es
popad
;
@@m1: add esi,4
inc edi
dec ebp
jnz @@m0
pop edi
mov esi,es:[edi+8] ;link to next list.
or esi,esi
jnz @@mLookLoop
;
;Now print MCB controlled blocks.
;
cmp fs:d[EPSP_mcbHead],0
jz @@nomcbdis
mov esi,fs:d[EPSP_mcbHead]
@@mcb0: mov edi,esi
add esi,mcbChunkLen
@@mcb1: cmp es:b[esi+mcbFreeUsed],"J" ;Free block?
jz @@mcb2
mov eax,fs:d[EPSP_INTMem]
sub eax,mcbLen
cmp esi,eax
jz @@mcb2
cmp fs:w[EPSP_DPMIMem],0
jz @@nodpmimemhere
pushad
mov bx,fs:w[EPSP_DPMIMem]
sys GetSelDet32
sub edx,mcbLen
cmp esi,edx
popad
jz @@mcb2
@@nodpmimemhere:
pushad
mov edi,offset DebugHeader
mov eax,esi
add eax,mcbLen
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
mov eax,esi
add eax,mcbLen
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
movzx eax,es:w[esi+mcbNextSize]
inc TotalLinearMem+8
mov cx,8
push eax
call Bin2Hex
mov b[edi],' '
inc edi
pop eax
add TotalLinearMem,eax
;
mov b[edi],13
mov b[edi+1],10
mov b[edi+2],'$'
add edi,2
push edi
pop ecx
push es
sub ecx,offset DebugHeader
mov edx,offset DebugHeader
mov ah,40h
mov ebx,d[@@Handle]
int 21h
pop es
popad
@@mcb2: cmp es:b[esi+mcbNext],"M" ;end of the chain?
jz @@mcb3
mov esi,es:[edi+mcbChunkNext]
or esi,esi
jnz @@mcb0
jmp @@nomcbdis
;
@@mcb3: movzx eax,es:w[esi+mcbNextSize]
add eax,mcbLen
add esi,eax
jmp @@mcb1
;
@@nomcbdis: ;Display totals.
;
mov edi,offset TotalMemNum1
mov eax,TotalLinearMem
mov ecx,8
call Bin2Hex
mov edi,offset TotalMemNum2
mov eax,TotalLinearMem+4
mov ecx,8
call Bin2Hex
mov edi,offset TotalMemNum3
mov eax,TotalLinearMem+8
mov ecx,8
call Bin2Hex
mov ecx,TotalMemTLen
mov edx,offset TotalMemText
mov ah,40h
mov ebx,d[@@Handle]
int 21h
;
;Now do lock details.
;
mov edx,offset LockHeader
mov ah,40h
mov ecx,LockHeaderLen
mov ebx,d[@@Handle]
int 21h
;
mov esi,fs:d[EPSP_Resource]
@@lLookLoop: push esi
mov ebp,ResNum ;get number of entries.
mov edi,esi
add esi,ResHead+ResNum
add edi,ResHead
@@l0: cmp es:b[edi],Res_LOCK
jnz @@l1
;
@@LOCK: pushad
mov edi,offset DebugHeader
mov eax,es:[esi]
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
mov eax,es:[esi+4]
mov cx,8
call Bin2Hex
mov b[edi],' '
inc edi
;
mov b[edi],13
mov b[edi+1],10
mov b[edi+2],'$'
add edi,2
push edi
pop ecx
sub ecx,offset DebugHeader
mov edx,offset DebugHeader
mov ah,40h
mov ebx,d[@@Handle]
int 21h
popad
;
@@l1: add esi,4
inc edi
dec ebp
jnz @@l0
pop edi
mov esi,es:[edi+8] ;link to next list.
or esi,esi
jnz @@lLookLoop
;
;Now do DOS memory details.
;
mov edx,offset DosMemHeader
mov ah,40h
mov ecx,DosMemHeaderLen
mov ebx,d[@@Handle]
int 21h
;
mov esi,fs:d[EPSP_Resource]
@@dmLookLoop: push esi
mov ebp,ResNum ;get number of entries.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?