Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. ; ------------------------------------------------------------
  2. ; Basic code for printing data in ASSM under MSVS or SASM
  3. ;
  4. ; R. M June 2016
  5. ; ------------------------------------------------------------
  6. ; Library for I/O and other purposes
  7. ; ----------------------------------
  8. include c:\asmio\asm32.inc
  9. includelib c:\asmio\asm32.lib
  10. includelib c:\asmio\user32.lib
  11. includelib c:\asmio\kernel32.lib
  12. ; ------------------------------------------------------------
  13. .const
  14. NULL = 0
  15. ; -----------------------------------
  16. .data ; Data section
  17.  
  18. message byte "Rich", NULL
  19. minput byte "Enter a number: ", NULL
  20. number dword ?
  21. ; -------------------------------------------------------------
  22. .code
  23. main proc
  24.  
  25. ; Simple string output
  26. ; --------------------
  27. mov edx, OFFSET message ; String must be in edx
  28. call WriteString ; Shows it on screen
  29. call crlf ; This is the endl in C++
  30. call crlf ; It will skip 2 lines
  31.  
  32. ; Simple Input/output
  33. ; ----------------------------
  34. mov edx, OFFSET minput ; String must be in edx
  35. call writeString ; Show it on screen
  36. call readInt ; Info is read into EAX
  37. mov number, eax ; Store number in var
  38. call writeInt ; Display again on screen
  39.  
  40. ; New code here..
  41.  
  42. call crlf
  43. call crlf
  44. call readInt ; Leave this here for now.
  45.  
  46. ret 0 ; Must return 0 in ASM
  47. main endp ; Ends the main procedure
  48. end main ; Ends the whole program
  49. ; --------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement