Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. clr     equ     110b
  3.  
  4. DATA    SEGMENT USE16
  5. dvalue      db  30 dup('0',0Fh)
  6. len     dw  20             
  7. row     dw  10             
  8. col     dw  30             
  9. valadd      db  8              
  10. cont        db  0ffh               
  11. DATA    ENDS
  12.  
  13.  
  14. ASSUME  CS: CODE, DS: DATA
  15. CODE    SEGMENT USE16
  16. @@entry:
  17. mov     ax, data
  18. mov     ds, ax
  19. mov     ax, 0b800h
  20. mov     es, ax
  21. call    mouse_init
  22. mov     al, 02h
  23. mov     ah, 00h
  24. int     10h
  25. mov     ax, 1
  26. int     33h    
  27.  
  28. @write:                            
  29. cli                    
  30. lea     si, dvalue
  31.  
  32. mov     al, byte ptr row       
  33. mov     ah, 0
  34. imul    ax, (80*2)
  35. add     ax, col
  36. add     ax, col            
  37. mov     di, ax
  38. mov     cx, len
  39.    
  40. @l_write:
  41. mov     bx, cx
  42. shl     bx, 1
  43. mov     ah, ds:[si+bx] 
  44. mov     es:[di+bx], ah
  45. loop    @l_write
  46. sti
  47.  
  48. @9:                                
  49. mov     si, len
  50. shl     si, 1
  51. sub     si, 2              
  52. mov     ah ,0              
  53.                                                
  54. mov     al, dvalue[si]
  55. add     al, [valadd]
  56. aaa                    
  57.                                                
  58. or      al, 30h            
  59. mov     dvalue[si], al
  60.  
  61. @10:
  62. dec     si
  63. dec     si
  64. mov     al, ah
  65. mov     ah, 0
  66. add     al, dvalue[si]         
  67. aaa
  68. or      al, 30h
  69. mov     dvalue[si], al
  70.                        
  71. cmp     si, 0
  72. jg      @10
  73.  
  74. mov     al, [cont]         
  75. cmp     al, 0ffh
  76. je      @write
  77. jmp     exit
  78.  
  79. exit:      
  80. call    mouse_deinit
  81. mov     ax, 4c00h
  82. int     21h
  83.  
  84. mouse_init  proc
  85. push    ax
  86. push    cx
  87. push    dx
  88.                        
  89. xor     ax, ax
  90. int     33h
  91. test    ax, ax
  92. jz      @mi_endp
  93.                        
  94. mov     ax, 0ch                            
  95. mov     cx, 1010b          
  96.                                                    
  97. push    es                 
  98. push    cs
  99. pop     es                 
  100.                                                    
  101. lea     dx, prmaus                                 
  102. int     33h    
  103.                            
  104. pop     es
  105.  
  106. @mi_endp:      
  107. pop     dx
  108. pop     cx
  109. pop     ax
  110. ret
  111. mouse_init  endp
  112.  
  113. mouse_deinit proc
  114. push    ax
  115. push    cx
  116. push    dx
  117.                    
  118. xor     cx, cx             
  119. mov     ax, 0ch                    
  120. int     33h
  121.  
  122. pop     dx
  123. pop     cx
  124. pop     ax
  125. ret
  126. mouse_deinit endp
  127.                                                    
  128. prmaus  proc    far
  129.                                                
  130. push    ds    
  131. push    es
  132. pusha
  133.                                                
  134. push    0b800h             
  135. pop     es
  136. push    data
  137. pop     ds
  138.                                            
  139. test    bx, 01b
  140. jz      @exit_r
  141.  
  142. mov     ax,3
  143. int     33h
  144. shr     cx,3
  145. shr     dx,3
  146. mov     si, dx
  147. imul    si, 80
  148. add     si, cx
  149. shl     si, 1
  150. mov     byte ptr es:[si+1], clr
  151.  
  152.  
  153. @exit_r:
  154. test    ax, 1000b
  155. jz      @l
  156.  
  157. mov     byte ptr[cont], 0
  158. @l:
  159. popa
  160. pop     es
  161. pop     ds
  162. ret
  163. prmaus  endp
  164. CODE    ENDS
  165. END @@entry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement