home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / APOG / ASM1.ZIP / 101KEY.ASM next >
Encoding:
Assembly Source File  |  1989-09-08  |  2.2 KB  |  72 lines

  1. comment |
  2.  This is a short memory-resident (TSR) program which lets DOS,
  3.  ANSI.SYS, and all of your programs use the entire 101-key 
  4.  keyboard.  However, see warnings about its use in the text.
  5.  Save as: 101KEY.ASM
  6.  Compile: MASM 101KEY;
  7.           LINK 101KEY;        (Ignore no-stack warning)
  8.       EXE2BIN 101KEY.EXE 101KEY.COM
  9.     |
  10.  
  11. cseg    segment
  12.     assume cs:cseg, ds:nothing
  13.         org    100h            ;.COM file format
  14. start:        jmp    begin
  15.  
  16. old16        equ     this dword        ;Storage for prior Int 16
  17. old16_off    dw    ?
  18. old16_seg    dw    ?
  19.  
  20. new16:        pushf                ;Save the flags
  21.         cmp    ah,1            ;Service 0 or 1?
  22.         ja    leave            ;No -- go
  23.         or    ah,10h            ;Change 0,1 to 10,11
  24. leave:        popf                ;Restore flags
  25.         jmp    cs:old16        ;Call original Int 16h
  26. TSR_END        equ    $
  27.  
  28. CR        equ    13
  29. LF        equ    10
  30. signon        db    'DOS, ANSI.SYS, and all of your programs now',CR,LF
  31.         db    'have access to all keys on your keyboard.$'
  32. nobios        db    '101/102-key keyboard and BIOS support are ',CR,LF
  33.         db    'required for this program.  TSR not installed.$'
  34. dos4        db    'This program is unnecessary with DOS 4.x',CR,LF
  35.         db    'TSR not installed.$'
  36. dos1        db    'You must have DOS 2.x or 3.x to use this program$'
  37.  
  38.     assume cs:cseg, ds:cseg
  39. begin:        mov    ax,40h            ;BIOS data segment
  40.         mov    es,ax            ;ES ==> BIOS data
  41.         test    byte ptr es:[96h],10h    ;101-key kb installed?
  42.         jnz    okay            ;Yes -- go
  43.         mov    dx,offset nobios    ;No -- report error
  44. error:        mov    ah,9            ;DOS print string
  45.         int    21h            ;Call DOS
  46.         int    20h            ;Return to DOS
  47. okay:        mov    ah,30h            ;Get DOS version
  48.         int    21h
  49.         cmp    al,2            ;At least 2.x?
  50.         jae    @F            ;Yes -- go
  51.         mov    dx,offset dos1        ;Else report error
  52.         jmp    error            ;  and leave
  53.   @@:        cmp    al,4            ;DOS 4?
  54.           jb    @F            ;No -- it's okay
  55.         mov    dx,offset dos4        ;Else report error
  56.         jmp    error            ;  and leave
  57.   @@:        mov    ax,3516h        ;Get Int 16h vector
  58.           int    21h            ;  from DOS
  59.         mov    [old16_off],bx        ;Save offset
  60.         mov    [old16_seg],es        ;  and segment
  61.         mov    dx,offset new16        ;DS:DX = new address
  62.         mov    ax,2516h        ;Set new Int 16 vector
  63.         int    21h            ;   with DOS
  64.         mov    dx,offset signon    ;Tell the world
  65.         mov    ah,9            ;   that everything's
  66.         int    21h            ;   okay.
  67.         mov    dx,offset TSR_END    ;Get address to keep
  68.         int    27h            ;Install TSR & exit
  69. cseg        ends
  70.         end    start
  71.  
  72.