Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TITLE ADD 4 32-Bit Integer Variables ;Title of assignment
- COMMENT ! ;Block comment
- ;Simerpal Whala
- ;Assignment 3A
- ;Program adds 4 32-bit variables together
- ;9/22/19
- ;Complete
- !
- INCLUDE Irvine32.inc ;INCLUDE directive is used to obtain definitions and information from Irvine32.inc text file
- .data ;data area which is used to define variables
- num1 DWORD 10 ;Creates "num1" variable which is type DWORD which is a 32-bit un-signed integer. The variable holds 10.
- num2 DWORD 20 ;Creates "num2" variable with type DWORD holding 20
- num3 DWORD 30 ;Creates "num3" variable with type DWORD holding 30
- num4 DWORD 40 ;Creates "num4" variable with type DWORD holding 40
- sum DWORD 0 ;Creates "sum" variable with type DWORD holding 0 because it will be used later to hold the sum of all values.
- .code ;Code area which contains executable instructions
- main PROC ;Establishes the Entry point for the program
- MOV eax, num1 ;Moves num1(10) into the registry
- ADD eax, num2 ;Adds num2(20) to the eax registry which has 10 in it right now. (10 + 20)
- ADD eax, num3 ;Adds num3(30) to the eax registry which has 30 in it right now. (30 + 30)
- ADD eax, num4 ;Adds num4(40) to the eax registry which was 60 in it right now. (60 + 40)
- MOV sum, eax ;Moves eax registry contents to
- CALL dumpRegs ;Displays registers
- EXIT ;Stops the program and returns control to the operating system
- main ENDP ;ENDP directive marks end of procedures
- END main ;END Directive marks end of program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement