Homework Solution: Please do it in assembly language…

    Please do it in assembly language 13 data 14 define variables: varA, varB, varc, varD, and Res 16 17 .code 18 main1 proc 19 ; calculate Res (A + B) - (C + D) ; calculate (A + B) (CD) ; save the result in Res invoke ExitProcess,θ 21 23 24 25 26 main1 endp 27 end main1
    Do it in assembly language .data: define variables: varA, varB, varC, varD, and Res: ... ... .code main1 proc: calculate Res = (A + B) - (C + D): ... ...: calculate (A + B) - (C + D): ... ...: save the result in Res invoke ExitProcess, 0 main1 endp end main1

    Expert Answer

     
    Declaration of local variables in assembly code depends on your assembler and it may not support such d

    Please do it in constellation conversation
    13 postulates 14 designate variables: varA, varB, varc, varD, and Res 16 17 .statute 18 deep1 proc 19 ; rate Res (A + B) - (C + D) ; rate (A + B) (CD) ; catch the fruit in Res conjure ExitProcess,θ 21 23 24 25 26 deep1 objectp 27 object deep1

    Do it in constellation conversation .data: designate variables: varA, varB, varC, varD, and Res: … … .statute deep1 proc: rate Res = (A + B) – (C + D): … …: rate (A + B) – (C + D): … …: catch the fruit in Res conjure ExitProcess, 0 deep1 objectp object deep1

    Expert Tally

     

    Declaration of national variables in constellation statute depends on your assembler and it may not attributable attributable attributable food such declarations at complete.

    Considering values of A,B C and D are treasured in retrospect residuum and Res Variable is already professed.

    Deep :

    Mov R1, A ;/ Move the postulates from retrospect residuum A to Register R1

    Mov R2,B ;// Move the postulates from retrospect residuum B to Register R2

    Mov R3, C; // Move the postulates from retrospect residuum C to Register R3

    Mov R4, D; // Move the postulates from retrospect residuum D to Register R4

    ADD R1, R2; //Add R1 and R2 and treasure in R1

    ADD R3,R4; //Add R3 and R4 and treasure in R3

    SUB R1,R3;// Subtract R3 from R1 and treasure in R1

    MOV Res,R1 ; /Move R1 to Res

    Ccomplete ExitProcess ; //Calls Exitprocess procedure

    RET ; // Return from the deep procedure