home *** CD-ROM | disk | FTP | other *** search
/ BBS 1 / BBS#1.iso / for-dos / vmouse.ha / VMOUSE.ASM next >
Encoding:
Assembly Source File  |  1993-02-09  |  10.4 KB  |  484 lines

  1. ;                        VMOUSE ver 0.1
  2. ;
  3. ;      ¥Γa »poúpa¼¼a íδ½a ¡a»¿ca¡a »o ¼oΓ¿óa¼ ¿ºóecΓ¡oúo »a¬eΓa NU.
  4. ;  Haτa½ ∩ φΓπ »poúpa¼¼π úoña  ñóa ¡aºañ, oñ¡a¬o, ¬aªñδ⌐ paº  ío½ee
  5. ;  cpoτ¡δe ¿ ¡eoΓ½oª¡δe ñe½a »pepδóa½¿ paíoΓπ.  Åoxoªe, τΓo ∩ oτe¡∞
  6. ;  ¡e c¬opo ¡a⌐ñπ ópe¼∩ ñoóecΓ¿ VMOUSE ño ñe⌐cΓó¿Γe½∞¡o  »p¿½¿τ¡oúo
  7. ;  ó¿ña. ÅoφΓo¼π ∩ peΦ¿½ óδ»πcΓ¿Γ∞ VMOUSE ¬a¬ Multiware product.
  8. ;      Bc∩¬¿⌐ ªe½aεΘ¿⌐ ¼oªeΓ  ¬a¬ e¼π πúoñ¡o  »epeñe½δóaΓ∞ ¿cxoñ¡δ⌐
  9. ;  Γe¬cΓ  »poúpa¼¼δ  ¿  ¿¼eeΓ  »paóo  ño»o½¡¿Γ∞  c»¿co¬  coaóΓopoó.
  10. ;  Åpoúpa¼¼a  ¼oªeΓ  pac»pocΓpa¡∩Γ∞c∩  Γo½∞¬o  ó¼ecΓe c ee ¿cxoñ¡δ¼
  11. ;  Γe¬cΓo¼ ¿ ¡e ¼oªeΓ íδΓ∞ ¿c»o½∞ºoóa¡a ó ¬o¼¼epτec¬¿x µe½∩x.
  12. ;
  13. ;  Version 0.1 - Vladimir Volynsky
  14. ;  Version 0.2 -                   <──────  Cεña Bδ ¼oªeΓe ó»¿caΓ∞ cóoe ¿¼∩.
  15. ;  Version 0.3 -
  16. ;   ....
  17. ;
  18. ;  VMOUSE φΓo  ¡e ¼δΦ¿¡δ⌐  ñpa⌐óep, a  ¡aóec¬a ¡añ  ¼δΦ¿¡δ¼ ñpa⌐óepo¼.
  19. ;  Åπc¬aΓ∞ ee c½eñπeΓ _»oc½e_ oíδτ¡oúo ¼δΦ¿¡oúo ñpa⌐óepa. O¡a ºa¼e¡∩eΓ
  20. ;  cΓa¡ñapΓ¡δ⌐ ¼δΦ¿¡δ⌐ ¬πpcop ó Γe¬cΓoóo⌐ ¼oñe ¡a cΓpe½¬π »o Γ¿»π Γoúo,
  21. ;  ¬oΓopδ⌐ Bδ  ó¿ñe½¿ ó  Norton Utility.   Op¿e¡Γ¿poóa¡a o¡a  ¡a  VGA,
  22. ;  oñ¡a¬o,  ¡op¼a½∞¡o  paíoΓaeΓ  ¿  ¡a  EGA,  ec½¿ ºaúpπªe¡δ VGA Σo¡Γδ
  23. ;  (¡a»p¿¼ep, »poúpa¼¼o⌐ VGAGA).
  24. ;
  25.  
  26. MY_CHAR        equ    0DBh    ;0DCh    ;0DBh    ;0D3h
  27. MY_CHAR1    equ    008h    ;0B2h    ;0F1h
  28. MY_CHAR2    equ    0DEh    ;00Ah    ;0DFh    ;0D1h
  29. MY_CHAR3    equ    00Ah    ;0DEh    ;0F2h
  30.  
  31. ATT_MASK    equ    077h
  32.  
  33. .286
  34.  
  35. code        segment    byte public
  36.         assume    cs:code, ds:code
  37.         org    0A0h
  38. _cx        dw    ?
  39. _dx        dw    ?
  40. _x        dw    ?
  41. _di        dw    ?
  42. _si        dw    ?
  43. _xx        dw    ?
  44. _xxx        dw    ?
  45. _y        dw    ?
  46. _yy        dw    ?
  47. _yyy        dw    ?
  48. char_address    dw    ?
  49. char_att    db    ?
  50. char_att1    db    ?
  51. char_att2    db    ?
  52. char_att3    db    ?
  53. h_mask        dw    ?
  54. cur_mask    dw    ?
  55. flag        db    ?
  56. video_base    dw    ?
  57.  
  58.         org    100h
  59. start:        jmp    init
  60. ;──────────────────────────────────────────────────────────────────────────
  61. int33:        cmp    ax,0000h
  62.         jnz    no_stop_drv
  63. turn_off_all:    mov    cs:h_mask,0
  64. turn_off_my:    mov    cs:flag,0
  65.         call    restore
  66. temp:        jmp    int33_old
  67. no_stop_drv:    cmp    ax,0002h
  68.         jz    turn_off_my
  69.         cmp    ax,0021h
  70.         jz    turn_off_all
  71.         cmp    ax,0001h
  72.         jz    init_drv
  73.         cmp    ax,000Ch
  74.         jz    new_drv
  75. int33_old:
  76.         db    0EAh        ; jmp int33
  77. int33_off    dw    0
  78. int33_seg    dw    0
  79. iret33:        retf    2
  80. new_drv:    mov    cs:h_mask,cx
  81.         mov    cs:h_off,dx
  82.         mov    cs:h_seg,es
  83.         jmp    int33_old
  84.  
  85. init_drv:       push    ds
  86.         push    es
  87.         push    ax
  88.         push    bx
  89.         push    cx
  90.         push    dx
  91.         push    si
  92.         push    di
  93.         push    bp
  94.         mov    ax,000Ch
  95.         mov    cx,007Fh
  96.         mov    dx,offset handler
  97.         push    cs
  98.         pop    es
  99.         pushf
  100.         call    cs: dword ptr offset int33_off
  101.                cmp    cs:flag,1
  102.         jz    no_save
  103.         call    save
  104.         call    set_char_font
  105. no_save:           mov    cs:flag,1
  106.         pop    bp
  107.         pop    di
  108.         pop    si
  109.         pop    dx
  110.         pop    cx
  111.         pop    bx
  112.         pop    ax
  113.         pop    es
  114.         pop    ds
  115.         iret
  116. ;──────────────────────────────────────────────────────────────────────────
  117. handler:    cmp    cs:flag,0
  118.         jnz    si0
  119. kbd_emulation:    cmp    bl,1
  120.         jnz    no_left
  121.         mov    cx,1C0Bh        ; CR
  122.         jmp    short int16_5
  123. no_left:    cmp    bl,2
  124.         jnz    no_rigth
  125.         mov    cx,5200h        ; Ins Key
  126.         jmp    short int16_5
  127. no_rigth:    cmp    bl,4
  128.         jnz    no_middle
  129.         mov    cx,5300h        ; Del Key
  130.         jmp    short int16_5
  131. no_middle:    shr    cx,1
  132.         shr    cx,1
  133.         shr    cx,1
  134.         cmp    cx,cs:_xx
  135.         mov    cs:_xx,cx
  136.         jz    cx00
  137.         ja    cx_plus0
  138. cx_minus0:    mov    cx,4B00h        ; Left arror
  139.         jmp    short int16_5
  140. cx_plus0:       mov    cx,4D00h        ; Right arror
  141. int16_5:    mov    ah,5
  142.         int    16h
  143. cx00:        shr    dx,1
  144.         shr    dx,1
  145.         shr    dx,1
  146.         cmp    dx,cs:_yy
  147.         mov    cs:_yy,dx
  148.         jz    dx00
  149.         ja    dx_plus0
  150. dx_minus0:    mov    cx,4800h        ; Up arror
  151.         jmp    short int16_5_dx
  152. dx_plus0:       mov    cx,5000h        ; Down arror
  153. int16_5_dx:    mov    ah,5
  154.         int    16h
  155. dx00:        retf
  156. ;-------------------------------------------
  157. si0:        call    restore
  158.         test    cs:h_mask,ax
  159.         jz    ignore_h
  160.         push    ax
  161.         push    bx
  162.         push    cx
  163.         push    dx
  164.         db    09Ah        ; call handler
  165. h_off        dw    0
  166. h_seg        dw    0
  167.         pop    dx
  168.         pop    cx
  169.         pop    bx
  170.         pop    ax
  171. ignore_h:    shr    cx,1
  172.         shr    cx,1
  173.         shr    cx,1
  174.         cmp    cx,cs:_xx
  175.         jz    cx0
  176.         ja    cx_plus
  177. cx_minus:    mov    cs:_si,si
  178.         mov    cs:_xxx,7
  179. cx0:        cmp    cx,0
  180.         jz    cx_plus
  181. no_cx_plus:    cmp    cx,79
  182.         jnz    cx_no_big
  183. cx_plus:    mov    cs:_xxx,0
  184.         mov    cs:_si,si
  185. cx_no_big:    mov    ax,si
  186.         sub    si,cs:_si
  187.         add    si,cs:_xxx
  188.         and    si,7h
  189.         mov    cs:_xxx,si
  190.         mov    cs:_si,ax
  191.         mov    cs:_xx,cx
  192.         shr    dx,1
  193.         shr    dx,1
  194.         shr    dx,1
  195.         cmp    dx,cs:_yy
  196.         jz    dx0
  197.         ja    dx_plus
  198. dx_minus:    mov    cs:_di,di
  199.         mov    cs:_yyy,00Fh
  200. dx0:        cmp    dx,0
  201.         jz    dx_plus
  202.         cmp    dx,24
  203.         jnz    dx_no_big
  204. dx_plus:    mov    cs:_di,di
  205.         mov    cs:_yyy,4
  206. dx_no_big:    mov    ax,di
  207.         sub    di,cs:_di
  208.         add    di,cs:_yyy
  209.         and    di,01Fh
  210.         mov    cs:_yyy,di
  211.         mov    cs:_di,ax
  212.         mov    cs:_yy,dx
  213.         call    save
  214.         call    set_char_font
  215.         sti
  216. oks:        retf
  217. ;──────────────────────────────────────────────────────────────────────────
  218. set_char_font:    cli
  219.         push    ds
  220.         push    si
  221.         push    bx
  222.         push    ds
  223.         xor    ax,ax
  224.         mov    ds,ax
  225.         cmp    ds: byte ptr [485h],10h        ;scan lines / char
  226.         jz    standart
  227.         mov    cs:cur_mask,offset cursor_mask    ; ???_8
  228.         mov    cs:cur_msk,offset cursor_msk    ; ???
  229.         jmp    short ok_cur
  230. standart:    mov    cs:cur_mask,offset cursor_mask
  231.         mov    cs:cur_msk,offset cursor_msk
  232. ok_cur:         pop    ds
  233. open_font:    mov    dx,3C4h        ; sequencer
  234.         mov    ax,0402h
  235.         out    dx,ax
  236.         mov    ax,0704h
  237.         out    dx,ax
  238.         mov    dl,0CEh        ; graph
  239.         mov    ax,0005h
  240.         out    dx,ax
  241.         mov    ax,0406h
  242.         out    dx,ax
  243.         mov    ax,0204h
  244.         out    dx,ax
  245.         push    si
  246.             mov     ax,0A000h
  247.             mov     es,ax
  248.         mov    ds,ax
  249.         mov     di,MY_CHAR*20h
  250.         mov    al,cs:char_att
  251.         call    convert1
  252. f_cikl:         push    cx
  253.         lodsb
  254.         mov    ah,cs:[bx]
  255.         mov    cx,cs:_xxx
  256.         shr    ah,cl
  257.         or    al,ah
  258.         mov    ah,cs:[bp]
  259.         shr    ah,cl
  260.         call    convert3
  261.         pop    cx
  262.             loop    f_cikl
  263.         pop    si
  264.         push    si
  265.         mov     di,MY_CHAR1*20h
  266.         mov    al,cs:char_att1
  267.         call    convert1
  268. f_cikl1:    push    cx
  269.         lodsb
  270.         mov    ah,cs:[bx]
  271.         mov    cx,8
  272.         sub    cx,cs:_xxx
  273.         shl    ah,cl
  274.         or    al,ah
  275.         mov    ah,cs:[bp]
  276.         shl    ah,cl
  277.         call    convert3
  278.         pop    cx
  279.             loop    f_cikl1
  280.         pop    si
  281.         push    si
  282.         mov     di,MY_CHAR2*20h
  283.         mov    al,cs:char_att2
  284.         call    convert2
  285. f_cikl2:    push    cx
  286.         lodsb
  287.         mov    ah,cs:[bx]
  288.         mov    cx,cs:_xxx
  289.         shr    ah,cl
  290.         or    al,ah
  291.         mov    ah,cs:[bp]
  292.         shr    ah,cl
  293.         call    convert3
  294.         pop    cx
  295.             loop    f_cikl2
  296.         pop    si
  297.         mov     di,MY_CHAR3*20h
  298.         mov    al,cs:char_att3
  299.         call    convert2
  300. f_cikl3:    push    cx
  301.         lodsb
  302.         mov    ah,cs:[bx]
  303.         mov    cx,8
  304.         sub    cx,cs:_xxx
  305.         shl    ah,cl
  306.         or    al,ah
  307.         mov    ah,cs:[bp]
  308.         shl    ah,cl
  309.         call    convert3
  310.         pop    cx
  311.             loop    f_cikl3
  312. close_font:    mov    dx,3C4h        ; sequencer
  313.         mov    ax,0302h
  314.         out    dx,ax
  315.         mov    al,04h
  316.         out    dx,ax
  317.         mov    dl,0CEh        ; graph
  318.         mov    ax,1005h
  319.         out    dx,ax
  320.         mov    ax,0E06h
  321.         out    dx,ax
  322.         mov    ax,0004h
  323.         out    dx,ax
  324.         pop    bx
  325.         pop    si
  326.         pop    ds
  327.         ret
  328. ;──────────────────────────────────────────────────────────────────────────
  329. convert3:    inc    bx
  330.         inc    bp
  331.         not    ah
  332.         and    al,ah
  333.         stosb
  334.         ret
  335. ;──────────────────────────────────────────────────────────────────────────
  336. convert2:    call    convert1
  337.         add    bx,16
  338.         add    bp,16
  339.         ret
  340. ;──────────────────────────────────────────────────────────────────────────
  341. convert1:    mov    ah,0
  342.         mov    cl,5
  343.         shl    ax,cl
  344.         mov     si,ax
  345.         mov     cx,20h
  346.         mov    bx,cs:cur_mask
  347.         sub    bx,cs:_yyy
  348.         mov    bp,cs:cur_msk
  349.         sub    bp,cs:_yyy
  350.         ret
  351. ;──────────────────────────────────────────────────────────────────────────
  352. save:        cli
  353.         cld
  354.         mov    ax,cs:_yy
  355.         mov    cx,cs:_xx
  356.         xor    dx,dx
  357.         mov    bx,80*2
  358.         mul    bx
  359.         shl    cx,1
  360.         add    ax,cx
  361.         mov    si,ax
  362.         mov    ax,cs:video_base
  363.             mov    ds,ax
  364.         mov    bl,ds:[si]                      ; save char & attrib
  365.         mov    cs:char_att,bl
  366.         mov    cs:char_address,si
  367.         mov        ds: byte ptr [si],MY_CHAR
  368.         mov    bl,ds:[si+2]
  369.         mov    cs:char_att1,bl
  370.         mov        ds: byte ptr [si+2],MY_CHAR1
  371.         mov    bl,ds:[si+80*2]
  372.         mov    cs:char_att2,bl
  373.         mov        ds: byte ptr [si+80*2],MY_CHAR2
  374.         mov    bl,ds:[si+80*2+2]
  375.         mov    cs:char_att3,bl
  376.         mov        ds: byte ptr [si+80*2+2],MY_CHAR3
  377.         ret
  378. ;──────────────────────────────────────────────────────────────────────────
  379. restore:    cli
  380.         push    ds
  381.         push    ax
  382.         push    bx
  383.         mov    ax,cs:video_base
  384.             mov    ds,ax
  385.         mov    bx,cs:char_address        ; restore char & attrib
  386.         cmp    ds:byte ptr [bx],MY_CHAR
  387.         jnz    rest1
  388.         mov    al,cs:char_att
  389.         mov    ds:[bx],al
  390. rest1:        cmp    ds:byte ptr [bx+2],MY_CHAR1
  391.         jnz    rest2
  392.         mov    al,cs:char_att1
  393.         mov    ds:[bx+2],al
  394. rest2:        cmp    ds:byte ptr [bx+80*2],MY_CHAR2
  395.         jnz    rest3
  396.         mov    al,cs:char_att2
  397.         mov    ds:[bx+80*2],al
  398. rest3:        cmp    ds:byte ptr [bx+80*2+2],MY_CHAR3
  399.         jnz    rest4
  400.         mov    al,cs:char_att3
  401.         mov    ds:[bx+80*2+2],al
  402. rest4:        pop    bx
  403.         pop    ax
  404.         pop    ds
  405.         ret
  406. ;──────────────────────────────────────────────────────────────────────────
  407. cur_msk        dw    0
  408.         db    060h,090h,088h,084h,082h,081h,080h,082h
  409.         db    092h,069h,069h,006h,000h,000h,000h,000h
  410.         db    000h,000h,000h,000h,000h,000h,000h,000h
  411.         db    000h,000h,000h,000h,000h,000h,000h,000h
  412. cursor_msk    db    060h,090h,088h,084h,082h,081h,080h,082h
  413.         db    092h,069h,069h,006h,000h,000h,000h,000h
  414.         db    000h,000h,000h,000h,000h,000h,000h,000h
  415.         db    000h,000h,000h,000h,000h,000h,000h    ;,000h
  416.  
  417.         db    000h,060h,070h,078h,07Ch,07Eh,07Fh,07Ch
  418.         db    06Ch,006h,006h,000h,000h,000h,000h,000h
  419.         db    000h,000h,000h,000h,000h,000h,000h,000h
  420.         db    000h,000h,000h,000h,000h,000h,000h,000h
  421. cursor_mask    db    000h,060h,070h,078h,07Ch,07Eh,07Fh,07Ch
  422.         db    06Ch,006h,006h,000h,000h,000h,000h,000h
  423.         db    000h,000h,000h,000h,000h,000h,000h,000h
  424.         db    000h,000h,000h,000h,000h,000h,000h,000h
  425. db 0,0
  426. ;──────────────────────────────────────────────────────────────────────────
  427. init:        mov    ah,9
  428.         mov    dx,offset copy_mess
  429.         int    21h
  430.         mov    cx,(100h-90h)/2
  431.         mov    di,90h
  432.         xor    ax,ax
  433.     rep    stosw
  434.         mov    flag,1
  435.         mov    video_base,0B800h
  436.         mov    ax,0021h
  437.         int    33h            ; Enable mouse cursor
  438.         mov    ax,0000h
  439.         int    33h            ; Enable mouse cursor
  440.         mov    ax,0004h
  441.         xor    cx,cx
  442.         xor    dx,dx
  443.         int    33h            ; Set pointer
  444.         mov    ax,0002h
  445.         int    33h            ; Enable mouse cursor
  446. ;        mov    ax,000Fh
  447. ;        mov    cx,0
  448. ;        mov    dx,1
  449. ;        int    33h            ; Enable mouse cursor
  450.         mov    ax,0008h
  451.         mov    cx,0
  452.         mov    dx,0C7h
  453.         int    33h            ; Enable mouse cursor
  454.         mov    ax,000Ch
  455.         mov    cx,0001h
  456.         mov    dx,offset handler
  457.         int    33h
  458.         xor    ax,ax
  459.         mov    ds,ax
  460.         les    ax,ds:[33h*4]
  461.         mov    cs:int33_off,ax
  462.         mov    cs:int33_seg,es
  463.         mov    ds: word ptr [33h*4],offset int33
  464.         mov    ds: word ptr [33h*4+2],cs
  465.         mov    dx,offset init
  466.         int    27h
  467. ms_cikl:    mov    ax,0003h
  468.         int    33h
  469.         test    bx,1
  470.         jz    ms_cikl
  471. done:        mov    ax,0002h
  472.         int    33h            ; Hide mouse cursor
  473.         mov    ax,000Ch
  474.         mov    cx,0000h
  475.         mov    dx,offset handler
  476.         int    33h
  477.         int    20h
  478. ;──────────────────────────────────────────────────────────────────────────
  479. copy_mess    db    "VMOUSE Multiware Ver 0.1. V.V.Volynsky,...",13,10,'$'
  480. ;                                           ^
  481. ;                                                                │
  482. ;                            Cóoe ¿¼∩ Bδ ¼oªeΓe ó»¿caΓ∞ cεña ────┘
  483. code        ends
  484.         end    start