Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TITLE Lab 3             (AddSub.asm)
  2.  
  3. ; This program blahs
  4. ; Name:Amanda Clark
  5. ; Date: Oct 13 2011
  6.  
  7. INCLUDE Irvine32.inc
  8.  
  9. .const
  10.  
  11. .data
  12. str1 BYTE "Enter a dividend ", 0Dh,0Ah,0
  13. str2 BYTE "enter a divisor: ",0
  14. str3 BYTE "Ends program"
  15. .code
  16.  
  17. main PROC
  18. mov edx, OFFSET str1       ; edx gets address of str1
  19. call WriteString           ; prints prompt to enter dividend
  20.  
  21. call ReadInt               ; reads int from library
  22.  
  23. mov ecx, eax   ; stores dividend in ecx
  24.  
  25.  
  26. mov edx, OFFSET str2       ; edx gets address of str2
  27. call WriteString           ; prints prompt to enter divisor
  28. call ReadInt               ; divisor is in eax
  29. mov ebp,0
  30.  
  31. beginwhile:
  32.      
  33.      sub ecx,eax
  34.      inc ebp
  35.      mov esi, 0
  36.      cmp esi, ecx
  37.      jae endwhile
  38. jmp beginwhile
  39.  
  40.  
  41. endwhile:
  42.     add ecx, eax
  43.     dec ebp
  44.  
  45. call    DumpRegs
  46.  
  47. exit
  48. main ENDP
  49. END main
Add Comment
Please, Sign In to add comment