home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
KEYBOARD.ASM
/
NEXTKEY.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
678b
|
27 lines
;char next_key();
EXTRN _memory_model:byte
EXTRN _error_code:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _next_key
_next_key proc near
mov _error_code,2 ;2 = no keystroke in buffer
mov al,0FFh ;assume no keystroke
mov ah,1 ;BIOS func to chk buffer
int 16h ;chk for keystroke
jz L1 ;jump if buffer empty
mov _error_code,0 ;0 = not extended code
or al,al ;test for extended code
jnz L1 ;quit if ASCII code
inc _error_code ;1 = extended code
mov al,ah ;move extended code to AL
L1: cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_next_key ENDP
_TEXT ENDS
END