Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. PAGE 60,132
  2. TITLE asm (exe) MOV and ADD operation
  3.  
  4. .Model small
  5. .stack 64
  6. .data
  7.  
  8. msg db 13,10,13,10,13,10,13,10,10,10,10,10,9,9,' Input a single digit integer: $'
  9. numOne db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is ONE!$'
  10. numTwo db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is TWO!$'
  11. numThree db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is THREE!$'
  12. numFour db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is FOUR!$'
  13. numFive db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is FIVE!$'
  14. numSix db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is SIX!$'
  15. numSeven db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is SEVEN!$'
  16. numeight db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is EIGHT!$'
  17. numNine db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is NINE!$'
  18. numZero db 13,10,13,10,13,10,13,10,10,10,10,9,9,' The integer is Zero!$'
  19.  
  20. .code
  21.  
  22.  
  23. MAIN PROC FAR
  24.  
  25.  
  26. ;--------ClearSscreen
  27. mov ax,02
  28. mov bx,03
  29. int 10h
  30.  
  31. MOV AH,06H
  32. MOV AL,00H ;full screen
  33.  
  34.  
  35. ; cursor
  36. mov ax, 0600h
  37. int 10h
  38.  
  39. ;------------------------color--------------------
  40.  
  41. ;---grey
  42.  
  43. MOV BH,70h ; set color,
  44. MOV CX,0610h; (top,left)
  45. MOV DX,0a3bh ;(bottom,right)
  46. INT 10H
  47.  
  48. ;---red
  49.  
  50. MOV BH,4eh ; set color,
  51. MOV CX,0711h; (top,left)
  52. MOV DX,093ah ;(bottom,right)
  53. INT 10H
  54.  
  55.  
  56. ;---grey
  57.  
  58. MOV BH,70h ; set color,
  59. MOV CX,0d10h; (top,left)
  60. MOV DX,113bh ;(bottom,right)
  61. INT 10H
  62.  
  63. ;---yellow
  64.  
  65. MOV BH,42h ; set color,
  66. MOV CX,0e11h; (top,left)
  67. MOV DX,103ah ;(bottom,right)
  68. INT 10H
  69.  
  70. ;-------Read Input Number---------------
  71. MOV AX,@data
  72. mov DS,AX
  73.  
  74. lea dx,msg
  75. mov ah,9h
  76. int 21h
  77.  
  78. mov ah,1h
  79. int 21h
  80.  
  81.  
  82.  
  83.  
  84.  
  85. ;------------------------text---------------------
  86.  
  87. ; (if else)
  88.  
  89. cmp al,'1'
  90. je jmpOne
  91.  
  92. cmp al,'2'
  93. je jmpTwo
  94.  
  95. cmp al,'3'
  96. je jmpThree
  97.  
  98. cmp al,'4'
  99. je jmpFour
  100.  
  101. cmp al,'5'
  102. je jmpFive
  103.  
  104. cmp al,'6'
  105. je jmpSix
  106.  
  107. cmp al,'7'
  108. je jmpSeven
  109.  
  110. cmp al,'8'
  111. je jmpEight
  112.  
  113. cmp al,'9'
  114. je jmpNine
  115.  
  116. cmp al,'0'
  117. je jmpZero
  118.  
  119. jmp exit
  120.  
  121. ;------------Jump----------------
  122. jmpOne:
  123. mov ah,9
  124. lea dx,numOne
  125. int 21h
  126. jmp exit
  127. jmpTwo:
  128. mov ah,9
  129. lea dx,numTwo
  130. int 21h
  131. jmp exit
  132. jmpThree:
  133. mov ah,9
  134. lea dx,numThree
  135. int 21h
  136. jmp exit
  137. jmpFour:
  138. mov ah,9
  139. lea dx,numFour
  140. int 21h
  141. jmp exit
  142. jmpFive:
  143. mov ah,9
  144. lea dx,numFive
  145. int 21h
  146. jmp exit
  147. jmpSix:
  148. mov ah,9
  149. lea dx,numSix
  150. int 21h
  151. jmp exit
  152. jmpSeven:
  153. mov ah,9
  154. lea dx,numSeven
  155. int 21h
  156. jmp exit
  157. jmpEight:
  158. mov ah,9
  159. lea dx,numEight
  160. int 21h
  161. jmp exit
  162. jmpNine:
  163. mov ah,9
  164. lea dx,numNine
  165. int 21h
  166. jmp exit
  167.  
  168. jmpZero:
  169. mov ah,9
  170. lea dx,numZero
  171. int 21h
  172. jmp exit
  173.  
  174. ;---------Exit--------------------
  175.  
  176. exit:
  177. mov ah,4ch
  178. int 21h
  179.  
  180.  
  181. main ENDP
  182. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement