Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My EFL / eflags are not correct. Here is my code. How can I improve this to get them working? INCLUDE asmlib.inc . data EAXStr
My EFLeflags are not correct. Here is my code. How can I improve this to get them working? INCLUDE asmlib.inc
data
EAXStr BYTE "EAX:
EBXStr BYTE "EBX:
ECXStr BYTE "ECX:
EDXStr BYTE "EDX:
ESIStr BYTE "ESI:
EDIStr BYTE "EDI:
EBPStr BYTE "EBP:
ESPStr BYTE "ESP:
EIPStr BYTE "EIP:
EFLStr BYTE "EFL:
eflags DWORD
code
ShowFlag MACRO flagName, shiftCount
LOCAL flagStr, flagVal, L
data
flagStr BYTE &flagName
flagVal BYTE
code
push eax
push edx
mov eax, eflags
mov flagVal,
shr eax, shiftCount
jc L
mov flagVal,
L:
mov edx, OFFSET flagStr
call writeString
mov edx, OFFSET flagVal
call writeString
pop edx
pop eax
ENDM
Tab MACRO
push eax
mov alh
call writeChar
pop eax
ENDM
showRegister PROC regName:PTR BYTE, regValue:DWORD
pushad
mov edx, regName
call writeString
mov eax, regValue
call writeHex
Tab
popad
ret
showRegister ENDP
dumpRegisters PROC
pushad
pushfd
invoke showRegister, ADDR EAXStr, eax
invoke showRegister, ADDR EBXStr, ebx
invoke showRegister, ADDR ECXStr, ecx
invoke showRegister, ADDR EDXStr, edx
endl
invoke showRegister, ADDR ESIStr, esi
invoke showRegister, ADDR EDIStr, edi
invoke showRegister, ADDR EBPStr, ebp
mov eax, esp
add eax, h
invoke showRegister, ADDR ESPStr, eax
endl
mov eax, esp
invoke showRegister, ADDR EIPStr, eax
pop eax
mov eflags, eax
invoke showRegister, ADDR EFLStr, eax
ShowFlag CF
ShowFlag SF
ShowFlag ZF
ShowFlag OF
ShowFlag AF
ShowFlag PF
popad
ret
dumpRegisters ENDP
main PROC
pushfd
pop eflags
call dumpRegisters
exit
main ENDP
END main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started