home *** CD-ROM | disk | FTP | other *** search
- page 58,132
-
- ; gkbd.asm
- ; contains: ggetkey()
- ;
- ;
- ifndef _LCODE
- include model.h
- endif
- include prologue.h
- name kbd
-
- ;;
- ; Copyright (C)1984-1990 Greenleaf Software Inc. All Rights Reserved.
- ;
- ;; MODIFICATIONS:
- ;
- ;;;
-
- ;==>-- Translation tables for getkey()
- ;
- dseg kbd
- ; 0, ALTESC, 0, CTRL2, then nulls up to 13 (decimal)
- trans db 0,0fbh,0,0fch,0,0,0,0,0,0,0,0,0,0
-
- ;==>-- ALTBS,REVTAB Alt-Q, W, E, R, T, Y, U, I, O, P (14-25)
-
- db 0deh,08Fh,0D1h,0D7h,0C5h,0D2h,0D4h,0D9h,0D5h,0C9h,0CFh,0D0h
-
- ;==>-- ALTLFBRAK,ALTRTBRAK,ALTCR (26..28, and pad to 29
-
- db 0fdh,0feh,0c0h,0
-
- ;==>-- Alt-A, S, D, F, G, H, J, K, L, (30-38)
- db 0C1h,0D3h,0C4h,0C6h,0C7h,0C8h,0CAh,0CBh,0CCh
-
- ;==>-- ALTSEMI, 0, ALTACCE, 0 (39-40-41-42)
-
- db 0dfh,0,0f8h,0
-
- ;==>-- Alt-Z X C V B N M (43-49) + pads to 58
- db 0DAh,0D8h,0C3h,0D6h,0C2h,0CEh,0CDh,0,0,0,0,0,0,0,0,0
-
- ;==>-- unshifted F1..F10 (59-68) + pads to 70
- db 080h,081h,082h,083h,084h,085h,086h,087h,088h,089h,0,0
-
-
-
- ;==>-- HOME, CURUP, PGUP, 0,CURLF,CENTERKEY,CURRT,ALTGREYPLUS
- ; 71 72 73 74 75, 76 77 78
- db 08Ah,08Dh,09Ah,0,08Bh,0f9h,09Bh,0fah
-
- ;==>-- ENDKEY,CURDN,PGDN,INSERT,DELETE
- ; 79 80 81 82 83
- db 08Ch,08Eh,09Ch,09Dh,09Eh
-
- ;==>-- SF1..SF10 (84-93)
- db 090h,091h,092h,093h,094h,095h,096h,097h,098h,099h
-
- ;==>-- CF1..CF10 (94-103)
- db 0A0h,0A1h,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h
-
- ;==>-- AF1..AF10 (104-113)
- db 0E0h,0E1h,0E2h,0E3h,0E4h,0E5h,0E6h,0E7h,0E8h,0E9h
-
- ;==>-- CTRLPRTSC, CTRLCURLF, CTRLCURRT, CTRLEND, CTRLPGDN, CTRLHOME
- ; 114 115 116 117 118 119
- db 0AEh ,0ABh,0BBh,0ACh,0BCh,0AAh
-
- ;==>-- Alt 1,2,3,4,5,6,7,8,9,0
- ; 120..129
- db 0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0B0h
-
- ;==>-- Alt--, Alt-=, CTRLPGUP
- ; 130 131 132
- db 0BDh,0BEh,0BAh
-
- ;==>-- F11,F12,SF11,SF12,CF11,CF12,AF11,AF12, nulls to 147
- ; 133 .. 140, nulls to 147
- db 0f0h,0f1h,0f2h,0f3h,0f4h,0f5h,0f6h,0f7h,0,0,0,0,0,0,0
-
- ;==>-- CTRLTAB,CTRLSLASH,CTRLASTER, ALTHOME,ALTCURUP,nulls to 158
- ; 148 149 150 151 152, nulls for 153..158
- db 0ech,0edh,0eeh,0efh,0bfh,0,0,0,0,0,0
-
- ;==>-- ALTENDKEY, ALTCURDN, ALTPGDN, ALTINSERT, ALTDELETE, ALTENTER
- ; 159 164
- db 09fh,0adh,0afh,0dbh,0dch,0ddh
-
- ;==>-- ALTTAB,ALTKEY45
- ; 165 166
- db 0eah,0ebh,0,0
-
- kstfunc db 1 ;keyboard status function #
- sstfunc db 2 ;shift status function #
- kinfunc db 0 ;input function #
-
- trapptr dw offset trfunc
-
- endds
-
- pseg getkey
-
- bchkv db 0ffh ;keeps track of last breakchk() value
- ;SET. When 0FFH it means vector has
- ;not yet been re-directed. If
- ;it == 0 then don't abort, if == 1
- ;abort.
-
- ;==>-- unsigned ggetkey(void)
- ;
- ;; ARGUMENTS:
- ; (none)
- ;
- ;; DESCRIPTION:
- ; Get keyboard code without echo.
- ;
- ;; SIDE EFFECTS:
- ; none
- ;
- ;; RETURNS:
- ; 8-bit standard ASCII code (0x00-0x7f) or predefined extended code
- ; per gibmkeys.h
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;
- ;; MODIFICATIONS:
- ;
- ; DK 14-Jan-1989 16:47:07
- ; Added codes in conversion tables for IBM 101/102 Key, Extended
- ; Function key set.
- ;
- ;;;
- cproc ggetkey
- call [trapptr]
- mov ah,kinfunc
- int 16h ;rom bios keyboard input
- or ax,ax ;is it Ctrl-Break ?
- jz short gtkyex ;if so return ax=0 for control break
- ;
- ; A few special cases for Enhanced Keyboard only.
- ;
- cmp ax,2800h
- jz adde0 ; these get 0e000h added to them
- cmp ax,2b00h
- jz adde0
- cmp ax,3300h
- jz adde0
- cmp ax,3400h
- jz adde0
- cmp ax,3500h
- jz adde0
- cmp ax,3700h
- jz adde0
- cmp ax,4a00h
- jz adde0
- cmp ax,9900h
- jz adde0
- cmp ax,9b00h
- jz adde0
- cmp ax,8d00h
- jz adde0
- cmp ax,8e00h
- jz adde0
- cmp ax,8f00h
- jz adde0
- cmp ax,9000h
- jz adde0
- cmp ax,9100h
- jz adde0
- cmp ax,9200h
- jz adde0
- cmp ax,9300h
- jz adde0
- cmp ax,9d00h
- jz adde0
-
- cmp al,0e0h
- jz adde0 ; and these just get AH=0e0h
-
- or al,al ;is it extended ?
- jz xltkey ;translate it if so
- xor ah,ah ;else return character in AL, clear AH
- jmp short gtkyex
- xltkey: mov al,ah
- lea bx,trans
- ifdef AZTEC
- xlat [bx]
- else
- xlat
- endif
- xor ah,ah
- ; xchg ah,al ;return extended code in AH, AL==0
- jmp short gtkyex
-
- ;
- ; Come here to add 0xe000 to codes in AL
- ;
- adde0: xchg ah,al
- mov ah,0e0h ; return 0xe0xx
-
- gtkyex:
- call doschk
- cproce
-
- ;==>-- doschk is a procedure used only by functions in this file
- ; it makes a dos call to give dos an oppurtunity to terminate
- ; the current program.
- ;
- doschk proc near
- cmp byte ptr cs:bchkv,0
- je doscex
- push ax
- mov ah,0bh ;check keyboard status via DOS
- int 21h ;this gives dos an oppurtunity to exit
- pop ax
- doscex: ret
- doschk endp
-
-
- enkbck proc near
- push ds
- mov ax,40h
- mov ds,ax
- mov bx,96h
- mov bl,[bx]
- pop ds
- xor ax,ax ;assume not installed
- and bl,10h
- jz enot
- inc ax
- enot: ret
- enkbck endp
-
- trfunc proc near
- mov trapptr,offset trfret
- call enkbck
- or ax,ax ;if enhanced kbd not installed skip
- jz trfret
- mov ah,10h
- or kstfunc,ah
- or sstfunc,ah
- or kinfunc,ah
- trfret: ret
- trfunc endp
- endps
- end
-