home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / TECLADO / TANDY.ZIP / TANDY.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-02-22  |  5.3 KB  |  162 lines

  1. COMMENT *
  2.  
  3.     By: Henry A. Groover
  4.     CSV: 70741,417
  5.  
  6.     This little TSR remaps the strange Tandy keyboard so
  7.     that decent normal programs that expect decent normal
  8.     BIOS codes (like MS Word, Norton Commander, etc.) get
  9.     what they want.  On an IBM-PC, when you press the grey
  10.     + key, a code of 4E2B hexadecimal becomes available to
  11.     our programs.  We can therefore have the grey plus key
  12.     look for 4E2B hex and distinguish that from the code 
  13.     produced by the regular + key.
  14.  
  15.     However, Tandy, in its infinite wisdom, has departed
  16.     grossly from the standard codes IBM has so carefully
  17.     maintained all the way from the most primitive PC to
  18.     the AT.  Shame on you, Tandy!  And the keyboard has a
  19.     lousy touch also, somewhere between the 'Chiclet' key-
  20.     board on the extinct PCjr and a Taiwanese off-brand
  21.     keyboard.
  22.  
  23.     This program, when compiled and included in your AUTOEXEC.BAT
  24.     file, will make your Tandy keyboard look just like an IBM
  25.     keyboard to anything except maybe some hardcore game programs
  26.     which don't follow the rules of compatible programming.
  27.  
  28.     To compile: (type in the semicolons!)
  29. MASM TANDY;
  30. LINK TANDY;
  31. EXE2BIN TANDY.EXE TANDY.COM
  32.     and you're done.
  33.  
  34.     If you don't have MASM or ASM, cut the following out into a file
  35.     named TEMP.TXT:
  36. -------- don't include this line -------
  37. 235  84 144   0   0   0   0 251
  38.  10 228 117  69 156  46 255  30
  39.   3   1  61  45  83 117   4 184
  40.  45  74 207  61  43  85 117   4
  41. 184  43  78 207  61  46  86 117
  42.   4 184  46  83 207  61 126  72
  43. 117   4 184 126  41 207  61  96
  44.  80 117   4 184  96  41 207  61
  45. 124  75 117   4 184 124  43 207
  46.  61  92  71 117   3 184  92  43
  47. 207  46 255  46   3   1 140 203
  48. 142 219 176  22 180  53 205  33
  49.  87 191   3   1 137  29 140  69
  50.   2  95 140 203 142 219 186   7
  51.   1 176  22 180  37 205  33 140
  52. 203 142 219 186  86   1 205  39
  53. -------- and don't include this line ---
  54.  
  55.     and type the following program into BASIC (everyone has BASIC):
  56. 10 OPEN "I",#1,"TEMP.TXT"
  57. 15 OPEN "O",#2,"TANDY.COM"
  58. 20 INPUT #1,B
  59. 30 PRINT #2,CHR$(B);
  60. 40 IF NOT EOF(1) THEN GOTO 20
  61. 50 CLOSE: END
  62. RUN
  63.  
  64.     and that's all.  The command
  65. TANDY
  66.     should be inserted into your AUTOEXEC.BAT file before any other TSR's
  67.     like SideKick, etc.
  68.  
  69. * ; end of comments
  70.  
  71. DOS_call                       equ     16H   ; kbd IO vector
  72. DOS_function                   equ     21H   ; DOS function
  73. DOS_replace_vector             equ     16H   ; 15H for debugging
  74. DOS_terminate_resident         equ     27H   ; Terminate, stayres
  75. get_vector                     equ     35H   ; Get vector function
  76. set_vector                     equ     25H   ; Set vector function
  77.  
  78. CSEG SEGMENT
  79.         assume        cs:cseg, ds:cseg
  80.         org           100H
  81.  
  82. ; jump over interceptor code to initialize
  83. start:
  84.         jmp            initialize
  85.  
  86. ; application begins here:
  87.  
  88. old_call               dd  ?   ; old keyboard vector
  89.  
  90. ; keyboard intercept routine
  91. call_interceptor              proc far
  92.        assume          cs:cseg,ds:cseg     ; default segments
  93.        sti                                 ; enable interrupts
  94.        or              ah,ah               ; Is AH = 0 (read request)?
  95.        jnz             ki2                 ; If not so, do special routine
  96.        pushf                               ; simulates INT call
  97.        assume          ds:nothing          ; Rather than rewrite keyboard
  98.        call            old_call            ; handler, we use it.
  99.     Cmp    ax, 532dh        ; replace bogus Tandy codes w/ normal; grey -
  100.     Jne    Not_esc            ; values
  101.     Mov    ax, 4a2dh
  102.     Iret                ; and we're done
  103. Not_esc:
  104.     Cmp    ax, 552bh        ; check for grey +
  105.     Jne    Del_dot
  106.     Mov    ax, 4e2bh        ; replace with proper value
  107.     Iret
  108. Del_dot:
  109.     Cmp    ax, 562eh
  110.     Jne    Tilde
  111.     Mov    ax, 532eh
  112.     Iret
  113. Tilde:
  114.     Cmp    ax, 487eh
  115.     Jne    back_accent
  116.     Mov    ax, 297eh
  117.     Iret
  118. Back_accent:
  119.     Cmp    ax, 5060h
  120.     Jne    Pipe
  121.     Mov    ax, 2960h
  122.     Iret
  123. Pipe:
  124.     Cmp    ax, 4b7ch
  125.     Jne    Backslash
  126.     Mov    ax, 2b7ch
  127.     Iret
  128. Backslash:
  129.     Cmp    ax, 475ch
  130.     Jne    ki1
  131.     Mov    ax, 2b5ch
  132. ki1:   iret                                ; interrupt return
  133. ki2:   assume          ds:nothing          ; for other than READ requests
  134.        jmp             old_call            ; turn off all assumptions
  135. call_interceptor   endp
  136. ; end of application code
  137. initialize:
  138.        mov             bx,cs               ; make DSEG = CSEG
  139.        mov             ds,bx               ;
  140.  
  141.        mov             al,DOS_call         ; get old vector
  142.        mov             ah,get_vector       ; getv func
  143.        int             DOS_function        ; call it
  144.        push            di
  145.        mov             di,offset old_call
  146.        mov             ds:[di],bx          ; old vector in ES:BX
  147.        mov             ds:[di+2],es
  148.        pop             di
  149.        mov             bx,cs               ; setting keyboard vector to ours
  150.        mov             ds,bx               ; seg:ofs in DS:DX
  151.        mov             dx,offset call_interceptor
  152.        mov             al,DOS_Replace_vector
  153.        mov             ah,set_vector       ; set new vector with DOS call
  154.        int             DOS_function        ;
  155.        mov             bx,cs               ; knock off initialize address
  156.        mov             ds,bx               ;
  157.        mov             dx,offset initialize; End program but leave handler
  158.        int             DOS_terminate_resident ; KEEP
  159.  
  160. CSEG ENDS
  161.      END START
  162.