home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / AMISL083.ZIP / FASTMOUS.ASM < prev    next >
Assembly Source File  |  1992-04-19  |  4KB  |  132 lines

  1. ;-----------------------------------------------------------------------
  2. ; FASTMOUS.ASM    Public Domain 1992 Ralf Brown
  3. ;        You may do with this software whatever you want, but
  4. ;        common courtesy dictates that you not remove my name
  5. ;        from it.
  6. ;
  7. ; Convert slow (on some systems) hardware reset mouse call into a fast
  8. ; software reset call.    This is a demonstration program to show just
  9. ; how small a useful program can be made and still be fully compliant
  10. ; with the alternate multiplex interrupt specification v3.4.  FASTMOUS
  11. ; contains just 128 bytes of resident code and data.
  12. ;
  13. ; Version 0.80
  14. ; LastEdit: 4/19/92
  15. ;-----------------------------------------------------------------------
  16.  
  17. __TINY__ equ 1                ; using Tiny model
  18.     INCLUDE AMIS.MAC
  19.  
  20. ;-----------------------------------------------------------------------
  21. ;
  22. VERSION_NUM equ 0050h    ; v0.80
  23. VERSION_STR equ "0.80"
  24.  
  25. ;-----------------------------------------------------------------------
  26. ; Declare our segments in the order we want them in the executable.
  27. ;
  28. _TEXT    SEGMENT PUBLIC BYTE 'CODE'
  29. _TEXT    ENDS
  30. TSRcode@
  31. TSRcodeEnd@
  32.  
  33. ;-----------------------------------------------------------------------
  34. ; Put the resident code into its own segment so that all the offsets are
  35. ; proper for the new location after copying it into a UMB or down into
  36. ; the PSP.
  37. ;
  38. TSRcode@
  39. start_TSRcode label byte
  40.  
  41. ;-----------------------------------------------------------------------
  42. ; Declare the interrupt vectors hooked by the program, then set up the
  43. ; Alternate Multiplex Interrupt Spec handler
  44. ;
  45.     HOOKED_INTS 2Dh,33h        ; it isn't actually necessary to list 2Dh
  46.     ALTMPX    'Ralf B','FASTMOUS',VERSION_NUM
  47.  
  48. ;-----------------------------------------------------------------------
  49. ; Now the meat of the resident portion, the mouse interrupt handler.
  50. ; We can save one byte by specifying the hardware reset handler set up by
  51. ; the ALTMPX macro above
  52. ;
  53.     ISP_HEADER 33h,hw_reset_2Dh
  54.     or    ax,ax            ; hardware reset call?
  55.     jne    use_old_int33        ; skip if not
  56.     push    ds
  57.     mov    ds,ax                 ; DS <- 0000h
  58.     test    byte ptr ds:[417h],13h    ; shift or scroll lock pressed?
  59.     pop    ds
  60.     jnz    use_old_int33        ; skip if yes
  61.     mov    al,21h            ; do software reset instead
  62. use_old_int33:
  63.     jmp    ORIG_INT33h
  64.  
  65. resident_code_size equ offset $
  66.  
  67. TSRcodeEnd@
  68.  
  69. ;-----------------------------------------------------------------------
  70.  
  71. _TEXT SEGMENT 'CODE'
  72.     ASSUME cs:_TEXT,ds:_TEXT,es:_TEXT,ss:_TEXT
  73.     ORG 100h
  74.  
  75. FASTMOUSE:
  76.     DISPLAY_STRING banner
  77.     CHECK_DOS_VER 2,00
  78.     mov    bx,1000h        ; set memory block to 64K
  79.     mov    ah,4Ah
  80.     int    21h
  81.     mov    si,81h            ; SI -> command line
  82.     cld                ; ensure proper direction for string ops
  83. cmdline_loop:
  84.     lodsb
  85.     cmp    al,' '            ; skip blanks and tabs on commandline
  86.     je    cmdline_loop
  87.     cmp    al,9
  88.     je    cmdline_loop
  89.     and    al,0DFh            ; force to uppercase
  90.     cmp    al,'R'
  91.     je    removing
  92. installing:
  93.     ;
  94.     ; place any necessary pre-initialization here
  95.     ;
  96.     INSTALL_TSR <offset _TEXT:start_TSRcode>,RELBYTE,resident_code_size,BYTE,,BEST,TOPMEM,inst_notify,already_installed
  97.  
  98. removing:
  99.     UNINSTALL <offset _TEXT:start_TSRcode>,RELBYTE,cant_uninstall
  100.     push    cs
  101.     pop    ds
  102.     DISPLAY_STRING uninstalled_msg
  103.         mov     ax,4C00h
  104.     int    21h
  105.  
  106. cant_uninstall:
  107.     mov    dx,offset _TEXT:cant_remove_msg
  108.     jmp short exit_with_error
  109. already_installed:
  110.     mov    dx,offset _TEXT:already_inst_msg
  111. exit_with_error:
  112.     mov    ah,9
  113.     int    21h
  114.     mov    ax,4C01h
  115.     int    21h
  116.  
  117. inst_notify:
  118.     DISPLAY_STRING installed_msg
  119.     ret
  120.  
  121. banner     db 'FASTMOUS v',VERSION_STR,'  Public Domain 1992 Ralf Brown  '
  122.     db '[Type "FASTMOUS R" to remove]',13,10,"$"
  123. installed_msg     db "Installed.",13,10,"$"
  124. already_inst_msg db "Already installed.",13,10,"$"
  125. cant_remove_msg  db "Can't remove from memory.",13,10,"$"
  126. uninstalled_msg  db "Removed.",13,10,"$"
  127.  
  128. _TEXT ENDS
  129.  
  130.      end FASTMOUSE
  131.  
  132.