📄 disas.asm
字号:
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMB proc near
mov eaMode,1
call get_modregrm
mov al,0
call out_ea
mov al,0
call out_imm
ret
RMIMMB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMWN proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,1
call out_imm
ret
RMIMMWN endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMDN proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,2
call out_imm
ret
RMIMMDN endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMW proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,1
call out_imm
ret
RMIMMW endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMD proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,2
call out_imms
ret
RMIMMD endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMW8 proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,0
call out_imm
ret
RMIMMW8 endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMIMMD8 proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,0
call out_imms
ret
RMIMMD8 endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLYB proc near
mov eaMode,1
call get_modregrm
mov al,0
call out_ea
ret
RMONLYB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_NW_C proc near
call RMONLYW
test eaMode,128
jnz @@0
call ea2Real ;get address.
mov dTargetEIP,eax ;setup for execution.
mov dTargetCS,cx
@@0: mov ReturnCode,RetCode_CALLea
ret
RMONLY_NW_C endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_FW_C proc near
mov eaMode,4
call get_modregrm
mov al,1
call out_ea
mov ReturnCode,RetCode_CALLFea
ret
RMONLY_FW_C endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_ND_C proc near
call RMONLYD
test eaMode,128
jnz @@0
call ea2Real ;get address.
mov dTargetEIP,eax ;setup for execution.
mov dTargetCS,cx
@@0: mov ReturnCode,RetCode_CALLea32
ret
RMONLY_ND_C endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_FD_C proc near
call RMONLYD
mov ReturnCode,RetCode_CALLFea32
ret
RMONLY_FD_C endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_NW_J proc near
call RMONLYW
mov ReturnCode,RetCode_JMPea
ret
RMONLY_NW_J endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_FW_J proc near
mov eaMode,4
call get_modregrm
mov al,1
call out_ea
mov ReturnCode,RetCode_JMPFea
ret
RMONLY_FW_J endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_ND_J proc near
call RMONLYD
mov ReturnCode,RetCode_JMPea32
ret
RMONLY_ND_J endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLY_FD_J proc near
call RMONLYD
mov ReturnCode,RetCode_JMPFea32
ret
RMONLY_FD_J endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLYW proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
ret
RMONLYW endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMONLYD proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
ret
RMONLYD endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
;
;Convert ea variables to seg:offset address.
;
ea2Real proc near
mov eax,eaOffset
;
mov dl,eaSeg
or dl,dl
jnz @@SegOK
;
cmp eaIndex,0 ;any index?
jz @@Ind32
test eaIndex,128 ;16 bit?
jnz @@Ind32
;
mov dh,eaIndex
and dh,127
dec dh
mov dl,3+1 ;default to DS.
cmp dh,1+1
jc @@SegOK
mov dl,2+1 ;default to SS.
cmp dh,3+1
jc @@SegOK
mov dl,3+1 ;default to DS.
cmp dh,5+1
jc @@SegOK
mov dl,2+1 ;default to SS.
jmp @@SegOK
;
@@Ind32: mov dh,eaReg
and dh,127
dec dh
mov dl,3+1 ;default to DS.
cmp dh,4
jc @@SegOK
cmp dh,5+1
jnc @@SegOK
mov dl,2+1 ;default to SS.
@@SegOK: ;
mov bl,eaReg
or bl,bl
jz @@NoReg
dec bl
mov cl,bl
and ebx,127
and cl,128
mov ebx,[ea2DebugRegs+ebx*4]
mov ebx,[ebx]
or cl,cl
jnz @@GotReg
movzx ebx,bx
@@GotReg: add eax,ebx
;
@@NoReg: mov bl,eaIndex
or bl,bl
jz @@NoInd
dec bl
mov cl,bl
and ebx,127
and cl,128
or cl,cl
jz @@Ind16
mov ebx,[ea2DebugRegs+ebx*4]
mov ebx,[ebx]
jmp @@GotInd
;
@@Ind16: or bl,bl
jnz @@Ind16_1
mov ebx,DebugEBX
add ebx,DebugESI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,3+1
jmp @@GotInd
;
@@Ind16_1: cmp bl,1
jnz @@Ind16_2
mov ebx,DebugEBX
add ebx,DebugEDI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,3+1
jmp @@GotInd
;
@@Ind16_2: cmp bl,2
jnz @@Ind16_3
mov ebx,DebugEBP
add ebx,DebugESI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,2+1
jmp @@GotInd
;
@@Ind16_3: cmp bl,3
jnz @@Ind16_4
mov ebx,DebugEBP
add ebx,DebugEDI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,2+1
jmp @@GotInd
;
@@Ind16_4: cmp bl,4
jnz @@Ind16_5
mov ebx,DebugESI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,3+1
jmp @@GotInd
;
@@Ind16_5: cmp bl,5
jnz @@Ind16_6
mov ebx,DebugEDI
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,3+1
jmp @@GotInd
;
@@Ind16_6: cmp bl,6
jnz @@Ind16_7
mov ebx,DebugEBP
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,2+1
jmp @@GotInd
;
@@Ind16_7: cmp bl,7
jnz @@Ind16_8
mov ebx,DebugEBX
movzx ebx,bx
cmp eaSeg,0
jnz @@GotInd
mov dl,3+1
jmp @@GotInd
;
@@Ind16_8: xor ebx,ebx
;
@@GotInd: mov cl,eaScale
shl ebx,cl
add eax,ebx
@@NoInd: ;
movzx edx,dl ;get seg reg.
dec edx
mov edx,[ea2sDebugRegs+edx*4]
mov cx,w[edx]
;
ret
ea2Real endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1B proc near
mov eaMode,1
call get_modregrm
mov al,0
call out_ea
mov al,','
stosb
mov al,'1'
stosb
mov es:b[edi],0
ret
SHIFT1B endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1W proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,','
stosb
mov al,'1'
stosb
mov es:b[edi],0
ret
SHIFT1W endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1D proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,','
stosb
mov al,'1'
stosb
mov es:b[edi],0
ret
SHIFT1D endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1BIMB proc near
mov eaMode,1
call get_modregrm
mov al,0
call out_ea
mov al,','
stosb
mov al,fs:[esi]
inc esi
mov ecx,2
mov dx,0
call SymbolBin2Hex
mov es:b[edi],0
ret
SHIFT1BIMB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1WIMB proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,','
stosb
mov al,fs:[esi]
inc esi
mov ecx,2
mov dx,0
call SymbolBin2Hex
mov es:b[edi],0
ret
SHIFT1WIMB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFT1DIMB proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,','
stosb
mov al,fs:[esi]
inc esi
mov ecx,2
mov dx,0
call SymbolBin2Hex
mov es:b[edi],0
ret
SHIFT1DIMB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFTCLB proc near
mov eaMode,1
call get_modregrm
mov al,0
call out_ea
mov al,','
stosb
push esi
lea esi,T_CL
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
ret
SHIFTCLB endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFTCLW proc near
mov eaMode,2
call get_modregrm
mov al,1
call out_ea
mov al,','
stosb
push esi
lea esi,T_CL
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
ret
SHIFTCLW endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
SHIFTCLD proc near
mov eaMode,4
call get_modregrm
mov al,2
call out_ea
mov al,','
stosb
push esi
lea esi,T_CL
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
ret
SHIFTCLD endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
RMSEG proc near
mov eaMode,2
call get_modregrm
and bh,7
push bx
mov al,1
call out_ea
mov al,','
stosb
pop bx
push esi
movzx esi,bh
shl esi,2
add esi,offset T_SegRegs
mov esi,[esi]
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
ret
RMSEG endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
get_modregrm proc near
;
;Get mode,r/m,register.
;
mov al,fs:[esi]
inc esi
mov ch,al
mov bl,ch
mov bh,ch
mov cl,6
shr ch,cl ;ch = mod
and bl,7 ;bl = r/m
shr bh,1
shr bh,1
shr bh,1
and bh,7 ;bh = reg
ret
get_modregrm endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
outrm2 proc near
push eax
push ebx
push edx
call out_ea
mov al,','
stosb
pop edx
pop ebx
pop eax
push esi
movzx esi,bh
shl esi,2
add esi,edx
mov esi,[esi]
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
ret
outrm2 endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
outrm3 proc near
push eax
push ebx
push edx
push esi
movzx esi,bh
shl esi,2
add esi,edx
mov esi,[esi]
@@0: movsb
cmp b[esi-1],0
jnz @@0
dec edi
pop esi
mov al,','
stosb
pop edx
pop ebx
pop eax
call out_ea
ret
outrm3 endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
outrb2 proc near
;
;Print register number then address if any.
;
push esi
movzx esi,bh
shl esi,2
add esi,edx
mov esi,[esi]
@@0: movsb
cmp b[esi-1],0
jnz @@0
mov es:b[edi-1],','
mov es:b[edi],0
pop esi
call out_ea
ret
outrb2 endp
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
out_ea proc near
cmp al,2
jnz @@old
mov eax,offset T_DWordRegs
jmp outea1
;
@@old: or al,al
mov eax,offset T_ByteRegs
jz outea1
mov eax,offset T_WordRegs
outea1: ;
cmp SegOver_T,0
jz outea2
pushm eax,esi
mov esi,SegOver_T
@@2: movsb
cmp b[esi-1],0
jnz @@2
dec edi
mov al,':'
stosb
mov es:b[edi],0
popm eax,esi
outea2: ;
cmp ch,3 ;register,register?
jnz outea3
;
;register
;
mov eaReg,bl
inc eaReg
cmp eax,offset T_WordRegs
jz @@gotreg
cmp eax,offset T_DWordRegs
jnz @@GotReg
or eaReg,128
@@GotReg: push esi
movzx esi,bl
shl esi,2
add esi,eax
mov esi,[esi]
@@0: movsb
cmp b[esi-1],0
jnz @@0
pop esi
dec edi
jmp @@eaExit
outea3: ;
cmp PointType,0
jz @@NoPoint
push esi
mov esi,PointType
@@DoPoint: movsb
cmp b[esi-1],0
jnz @@DoPoint
dec edi
pop esi
@@NoPoint: ;
test In32Bit,2 ;check address formation size.
jz @@old16
;
or eaMode,128
mov es:b[edi],'['
inc edi
;
mov dx,cx
mov ax,bx
mov bl,100b ;initialise to NO index.
mov bh,100b
cmp al,100b ;escape to 2 byte?
jnz @@32_0
pushm ax,dx
call Get_ModRegRM
popm ax,dx
xchg bl,al
@@32_0: ;
cmp dh,00b ;mod 0?
jnz @@NotEa32
cmp al,101b
jnz @@NotEa32
jmp @@NoBase32 ;skip base register and put in 32 bit displacement.
;
@@NotEa32: push esi
movzx esi,al ;get the base register
mov eaReg,al
inc eaReg
or eaReg,128
shl esi,2
add esi,offset T_DWordRegs
mov esi,[esi]
@@32_3: movsb
cmp b[esi-1],0
jnz @@32_3
dec edi
pop esi
;
cmp dh,01b ;8 bit displacement?
jnz @@32_1
mov es:b[edi],'+'
inc edi
pushm eax,ebx,ecx,edx
movsx eax,fs:b[esi]
mov eaOffset,eax
inc esi
or eax,eax
jns @@sign0
neg eax
mov es:d[edi-1],'-'
@@sign0: mov ecx,2
mov dx,0
call Bin2Hex
mov es:b[edi],0
popm eax,ebx,ecx,edx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -