Answer to Question #323443 in Assembler for amna

Question #323443

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)


1
Expert's answer
2022-04-07T04:03:51-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS