Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1.  
  2. ; You may customize this and other start-up templates;
  3. ; The location of this template is c:\emu8086\inc\0_com_template.txt
  4.  
  5. org 100h
  6.  
  7. jmp print_menu
  8.  
  9. print_menu:
  10. call clear_screen
  11. mov ax, current_menu
  12. cmp ax, 1
  13. je print_menu_1
  14. cmp ax, 2
  15. je print_menu_2
  16. cmp ax, 3
  17. je print_menu_3
  18. input:
  19. mov dx, msg4
  20. mov ah, 9
  21. int 21h
  22. mov ah, 0
  23. int 16h
  24. cmp ah, 50h
  25. je up_pressed
  26. cmp ah, 48h
  27. je down_pressed
  28. cmp ah, 4dh
  29. je handle_buttonclick
  30. cmp ah, 4bh
  31. je exit
  32. jmp print_menu
  33.  
  34.  
  35. inc_menu:
  36. inc [current_menu]
  37. jmp print_menu
  38.  
  39.  
  40. dec_menu:
  41. dec [current_menu]
  42. jmp print_menu
  43.  
  44. up_pressed:
  45. jmp inc_menu
  46.  
  47. down_pressed:
  48. jmp dec_menu
  49.  
  50.  
  51. print_menu_1:
  52. mov dx, offset M1
  53. mov ah, 9
  54. int 21h
  55. jmp input
  56.  
  57. print_menu_2:
  58. mov dx, offset M2
  59. mov ah, 9
  60. int 21h
  61. jmp input
  62.  
  63. print_menu_3:
  64. mov dx, offset M3
  65. mov ah, 9
  66. int 21h
  67. jmp input
  68.  
  69. end:
  70. mov ah, 4ch
  71. mov al, 0
  72. int 21h
  73.  
  74. handle_buttonclick:
  75.  
  76. mov ax, [current_menu]
  77. cmp ax, 1
  78. je b1c
  79. cmp ax, 2
  80. je b2c
  81. cmp ax, 3
  82. je b3c
  83.  
  84. b1c:
  85. call clear_screen
  86. mov dx, msg1
  87. mov ah, 9
  88. int 21h
  89. mov ah, 0
  90. int 16h
  91. jmp print_menu
  92. b2c:
  93. call clear_screen
  94. mov dx, msg2
  95. mov ah, 9
  96. int 21h
  97. mov ah, 0
  98. int 16h
  99. jmp print_menu
  100.  
  101. b3c:
  102. call clear_screen
  103. mov dx, msg3
  104. mov ah, 9
  105. int 21h
  106. mov ah, 0
  107. int 16h
  108. jmp print_menu
  109.  
  110. exit:
  111. call clear_screen
  112. mov ah, 4ch
  113. mov al, 0
  114. int 21h
  115.  
  116. clear_screen proc near
  117. mov ah,0
  118. mov al,3
  119. int 10h
  120. ret
  121. clear_screen endp
  122.  
  123. msg3: db 'You clicked button 3.', 0ah, 0dh, 24h
  124. msg2: db 'you clicked button 2', 0ah, 0dh, 24h
  125. msg1: db 'you clicked button 3', 0ah, 0dh, 24h
  126. msg4: db ' ', 0ah, 0dh
  127. db 'MS DOS GUI Demo', 0ah, 0dh, 24h
  128.  
  129. apn db ?
  130.  
  131. current_menu dw 1
  132.  
  133. M1 dw ' ', 0ah, 0dh
  134. dw ' --------------- ', 0ah, 0dh
  135. dw ' | >Button 1 | ', 0ah, 0dh
  136. dw ' | | ', 0ah, 0dh
  137. dw ' | Button 2 | ', 0ah, 0dh
  138. dw ' | | ', 0ah, 0dh
  139. dw ' | Button 3 | ', 0ah, 0dh
  140. dw ' --------------- ', 0ah, 0dh
  141. dw '$', 0ah, 0dh
  142.  
  143. M2 dw ' ', 0ah, 0dh
  144. dw ' --------------- ', 0ah, 0dh
  145. dw ' | Button 1 | ', 0ah, 0dh
  146. dw ' | | ', 0ah, 0dh
  147. dw ' | >Button 2 | ', 0ah, 0dh
  148. dw ' | | ', 0ah, 0dh
  149. dw ' | Button 3 | ', 0ah, 0dh
  150. dw ' --------------- ', 0ah, 0dh
  151. dw '$', 0ah, 0dh
  152.  
  153. M3 dw ' ', 0ah, 0dh
  154. dw ' --------------- ', 0ah, 0dh
  155. dw ' | Button 1 | ', 0ah, 0dh
  156. dw ' | | ', 0ah, 0dh
  157. dw ' | Button 2 | ', 0ah, 0dh
  158. dw ' | | ', 0ah, 0dh
  159. dw ' | >Button 3 | ', 0ah, 0dh
  160. dw ' --------------- ', 0ah, 0dh
  161. dw '$', 0ah, 0dh
  162. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement