Advertisement
Guest User

Assignement 3B

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