COMMENT $
Copyright (C) Magna Carta Software, Inc. 1987-1990. All Rights Reserved.
BIOS_KBD -- Assembly language interface to BIOS keyboard INT 16H
Note: Emulates all of the features of bioskey() in the Turbo C and
_bios_keybrd() in MSC 5.0+ compiler libraries but additionally adds support
for Enhanced Keyboard functions.
File invocation syntax:
POWER C: MASM bkey /DM_I86xM=1
else: MASM bkey /DM_I86xM=1 /DMSC
Where 'x' is one of: S C M L
Compatibility: MSC 5.0+/QC, POWER C v2.0+, TURBO C, WATCOM C
First version 11-08-87. Last update 06-07-91.
$
.LALL
.LIST
INCLUDE cmacros.mac
DEFSEG BKEY _DATA
CSEG SEGMENT
;BIOS_KBD -- BIOS keyboard service.
;Returns: EOF -- no key ready
; scan code in high byte, char code in low byte
;Calls INT 16H, (including enhanced keyboard services).
;Nukes: AX, BX
;
START_PROC bios_kbd <_SHORT func>
pushf
mov ah, func
int 016h
pushf
cmp BYTE PTR func, 1 ;is it service 1 (key ready)?
je testzflag
cmp BYTE PTR func, 11h ;is it service 11 (enhanced service 1)
je testzflag
popf
jmp SHORT is1
testzflag:
popf
jnz is1 ;ZF=1 => no char ready
mov ax,0FFFFh
is1:
popf
END_PROC bios_kbd
IFDEF DEBUG
main PROC
call bios_kbd
ret
main ENDP
ENDIF
CSEG ENDS
END