Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. BUF_LEN EQU 41
  2. %include "io.mac"
  3. .STACK 100H
  4.  
  5. .DATA
  6. prompt1_msg db "Input a string: ",0
  7. prompt2_msg db "Input a number between 1 - 10: "
  8. output1_msg db "Here is the first ",0
  9. output2_msg db "characters of your string: ",0
  10.  
  11. .UDATA
  12. string resb BUF_LEN
  13.  
  14. .CODE
  15. .STARTUP
  16. PutStr prompt1_msg
  17. GetStr string,BUF_LEN
  18. mov EAX, string
  19. nwln
  20. PutStr prompt2_msg
  21. nwln
  22. GetInt BX
  23.  
  24.  
  25. PutStr output1_msg
  26. nwln
  27. PutStr output2_msg
  28. nwln
  29. PutInt BX
  30. push BX
  31. call print_string
  32.  
  33. done:
  34. .EXIT
  35.  
  36. .CODE
  37. print_string:
  38. pop ECX
  39. l1:
  40. PutCh [EAX]
  41. inc EAX
  42. loop l1
  43. ret 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement