Execute the following program using
(a) Stack Architecture Instruction Set
(b) Accumulator Architecture Instruction Set
(c) General Purpose Register Instruction Set
(d) Using 0 address field
(e) Using 1 address field
(f) Using 2 address field
(g) Using 3 address field
F = R(C+D)-(RA+B)
include Irvine32.inc
.data
varA DWORD 4
varB DWORD 2
varC DWORD 5
varD DWORD 8
varR DWORD 2
AnsF DWORD 0
.code
main proc
xor EDX, EDX
mov EAX, varA
mov ECX, varR
mul ECX ; EAX = R*A = 8
add EAX, varB ; EAX = RA + B = 10
push EAX
mov ECX, varC
mov EDX, varD
add ECX, EDX ; ECX = C + D = 13
mov EAX, varR ; EAX = R = 2
mul ECX ; EAX = R(C + D) = 26
pop EBX ; EBX = (RA + B) = 10
sub EAX, EBX ; EAX = R(C + D) - (RA + B) = 26-10 = 16
mov AnsF, EAX
call WriteDec ; write value (eax)
invoke ExitProcess,0 ; Exit program
main endp
end main
Comments
Leave a comment