1.Using the AddTwo program from Section 3.2 as a reference, write a program that calculates the following expression, using registers: A = (A + B) − (C + D). Assign integer values to the EAX, EBX, ECX, and EDX registers. Note: you can hard code integer literal onto the registers, e.g. mov eax,55 ; AddTwo.asm - adds two 32-bit integers. ; Chapter 3 example .386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword .code main proc mov eax,5 add eax,6 invoke ExitProcess,0 main endp end main 2. Listing File for AddTwoSum Generate a listing file for AddTwoSum.asm(in 3.4.3 of the text) and write a description of the machine code bytes generated for each instruction. You can write your descriptions directly over the .lst file. You might have to guess at some of the meanings of the byte values. Submit the .lst file with your description over it. TITLE Add and Subtract, Version 2 (AddSub2.asm) ; This program adds and subtracts 32-bit integers ; and stores the sum in a variable. INCLUDE Irvine32.inc .data val1 dword 10000h val2 dword 40000h val3 dword 20000h finalVal dword ? .code main PROC mov eax,val1 ; start with 10000h add eax,val2 ; add 40000h sub eax,val3 ; subtract 20000h mov finalVal,eax ; store the result (30000h) call DumpRegs ; display the registers exit main ENDP END main
IN asmly language please Pretty please with successful build screen shot and output
1.Using the AddTwo
Note: you can hard code integer literal onto the registers, e.g. mov eax,55
; AddTwo.asm - adds two 32-bit integers.
; Chapter 3 example
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.code
main proc
mov eax,5
add eax,6
invoke ExitProcess,0
main endp
end main
2. Listing File for AddTwoSum
Generate a listing file for AddTwoSum.asm(in 3.4.3 of the text) and write a description of the machine code bytes generated for each instruction. You can write your descriptions directly over the .lst file. You might have to guess at some of the meanings of the byte values.
Submit the .lst file with your description over it.
TITLE Add and Subtract, Version 2 (AddSub2.asm)
; This program adds and subtracts 32-bit integers
; and stores the sum in a variable.
INCLUDE Irvine32.inc
.data
val1 dword 10000h
val2 dword 40000h
val3 dword 20000h
finalVal dword ?
.code
main PROC
mov eax,val1 ; start with 10000h
add eax,val2 ; add 40000h
sub eax,val3 ; subtract 20000h
mov finalVal,eax ; store the result (30000h)
call DumpRegs ; display the registers
exit
main ENDP
END main
Trending now
This is a popular solution!
Step by step
Solved in 4 steps