Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : KEYBOARD.ASM

 
Output of file : KEYBOARD.ASM contained in archive : TASMSWAN.ZIP
%TITLE "Keyboard INPUT routines"

IDEAL
DOSSEG
MODEL small

CODESEG

PUBLIC KeyWaiting, GetCh

%NEWPAGE
;-----------------------------------------------------------------------
; KeyWaiting - checks if a key press is available
;-----------------------------------------------------------------------
; Input: none
; Output: zf = 0 : (JNZ) Character is waiting to be read
; zf = 1 : (JZ) No character is waiting
; Registers: none (flags only)
;-----------------------------------------------------------------------
PROC KeyWaiting
push ax
mov ah,1
int 16h
pop ax
ret
ENDP KeyWaiting
%NEWPAGE
;-----------------------------------------------------------------------
; GetCh - returns ASCII,control or function key value
;-----------------------------------------------------------------------
; Input: none
; Output: zf = 0 (ah = 1): (JNZ) al = ASCII character
; zf = 1 (ah = 0): (JZ) al = ASCII control or function
; Registers: ax
;-----------------------------------------------------------------------
PROC GetCh
xor ah,ah
int 16h
or al,al
jnz @@10
xchg ah,al
add al,32
jmp short @@20
@@10:
xor ah,ah
cmp al,32
jb @@20
inc ah
@@20:
or ah,ah
ret
ENDP GetCh

END


  3 Responses to “Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : KEYBOARD.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/