Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. .model small
  2.  
  3. .data
  4. Mystr db "a"
  5. Str_Length dw 1
  6. Color db 00001010b
  7. Row db 0
  8. Col db 40
  9.  
  10. .stack 100h
  11.  
  12. .code
  13.  
  14. main:
  15.  
  16. call Initsegs
  17. endless:
  18. call GoDown
  19. call GoUp
  20. loop endless
  21.  
  22. ;===PROCS===
  23.  
  24. PROC Initsegs
  25. push ax
  26.  
  27. mov ax, @data
  28. mov ds, ax
  29. mov es, ax
  30.  
  31. pop ax
  32. RET
  33. ENDP Initsegs
  34.  
  35. PROC CheckKey
  36. push ax
  37.  
  38. mov ah, 01h
  39. int 16h
  40. cmp al, 'x'
  41. jz finish
  42. jnz continue
  43.  
  44. finish:
  45. call Exit
  46.  
  47. continue:
  48.  
  49. pop ax
  50. RET
  51. ENDP CheckKey
  52.  
  53.  
  54. PROC GoDown
  55. push cx
  56.  
  57. mov cx, 24
  58. redo:
  59. call PrintStr
  60. call Delay
  61. call ClearScreen
  62. call CheckKey
  63. inc Row
  64. loop redo
  65.  
  66. pop cx
  67. RET
  68. ENDP GoDown
  69.  
  70. PROC GoUp
  71. push cx
  72.  
  73. mov cx, 24
  74. redo2:
  75. call PrintStr
  76. call Delay
  77. call ClearScreen
  78. call CheckKey
  79. dec Row
  80. loop redo2
  81.  
  82. pop cx
  83. RET
  84. ENDP GoUp
  85.  
  86. PROC PrintStr
  87. push ax bx cx dx bp
  88.  
  89. mov ah, 13h
  90. mov al, 1
  91. mov bh, 0
  92. mov bl, Color
  93. mov cx, Str_Length
  94. mov dh, Row
  95. mov dl, Col
  96. mov bp, offset Mystr
  97. int 10h
  98.  
  99. pop bp dx cx bx ax
  100. RET
  101. ENDP PrintStr
  102.  
  103. PROC Delay
  104. push ax bx
  105.  
  106. mov bx, 08000h
  107. reload_ax:
  108. mov ax, 0fffh
  109. dec_ax:
  110. dec ax
  111. jnz dec_ax
  112. dec bx
  113. jnz reload_ax
  114.  
  115. pop bx ax
  116. RET
  117. ENDP Delay
  118.  
  119. PROC ClearScreen
  120. push ax bx cx dx
  121.  
  122. mov ah, 7h
  123. mov al, 0
  124. mov bh, 07h
  125. mov ch, 0
  126. mov cl, 0
  127. mov dh, 24d
  128. mov dl, 79d
  129. int 10h
  130.  
  131. pop dx cx bx ax
  132. RET
  133. ENDP ClearScreen
  134.  
  135. PROC Exit
  136. push ax
  137.  
  138. mov ah, 4ch
  139. int 21h
  140.  
  141. pop ax
  142. RET
  143. ENDP Exit
  144. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement