Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My code as is non functional but I need it to display all registers and flags. INCLUDE asmlib.inc . data registerNames BYTE EAX: ,

My code as is non functional but I need it to display all registers and flags. INCLUDE asmlib.inc
.data
registerNames BYTE "EAX: ",0, "EBX: ",0, "ECX:", 0, "EDX: ",0, "ESI: ",0, "EDI: ",0, "EBP: ",0, "ESP: ",0, "EIP: ",0, "EFL: ",0
eflags DWORD ?
.code
ShowFlag MACRO flagName, shiftCount
LOCAL flagStr, flagVal, L1
.data
flagStr BYTE " &flagName=",0
flagVal BYTE ?,0
.code
push eax
push edx
mov eax, eflags
mov flagVal, '1'
shr eax, shiftCount
jc L1
mov flagVal, '0'
L1:
mov edx, OFFSET flagStr
call writeString
mov edx, OFFSET flagVal
call writeString
pop edx
pop eax
ENDM
Tab MACRO
push eax
mov al,09h
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
mov edx, OFFSET registerNames
mov ecx, 8
dumpLoop:
mov eax, [esp + ecx *4]
invoke showRegister, edx, eax
add edx, 4
sub ecx, 1
jnz dumpLoop
pop eax
mov eflags, eax
push eax
invoke showRegister, edx, eax
ShowFlag CF,0
ShowFlag SF,7
ShowFlag ZF,6
ShowFlag OF,11
ShowFlag AF,4
ShowFlag PF,2
popfd
popad
ret
dumpRegisters ENDP
main PROC
call dumpRegisters
exit
main ENDP
END main I need this exact output: EAX: 5afafc EBX: 9db000 ECX: 5ebdec EDX: 5ebdec
ESI: 5ebdec EDI: 5ebdec EBP: 5afab0 ESP: 5afaa8
EIP: 763afa29 EFL: 246 CF=0 SF=0 ZF=1 OF=0 AF=0 PF=1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

5. Explain how to install a performance management program.

Answered: 1 week ago