]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/CHARIN.ASM
5 title CP
/DOS KbdCharIn mapper
7 kbdxxx
segment byte public 'kbd'
8 assume
cs:kbdxxx
,ds:nothing
,es:nothing
,ss:nothing
10 ; ************************************************************************* *
14 ; * FILE NAME: charin.asm
18 ; * push@ dword chardata ; buffer for data
19 ; * push word iowait ; Indicate if wait
20 ; * push word kbdhandle ; Keyboard Handle
25 ; * MODULES CALLED: BIOS int 16h
26 ; * PC-DOS Int 21h, ah=2ch, get time
28 ; *************************************************************************
35 extrn savedkbdinput
:word
39 error_kbd_parameter equ
0002h
44 handle dw ?
; keyboard handle
45 iowait dw ?
; indicate if wait for io
46 data dd ?
; data buffer pointer
52 Enter KbdCharIn
; save registers
53 lds si,[bp].data ; set up return data area
63 mov ah,0bh ; Check for ^C
71 mov ax,[bp].iowait
; else, see if wait is desired
73 jz loopx
; keep trying
75 mov ds:[si].Char_Code
,0 ; | zero out scan and char codes
76 mov ds:[si].Scan_Code
,0 ; | zero out scan and char codes
77 mov ds:[si].Status
,0 ; | 0 for status
78 jmp short shift
; | go to get shift status
84 mov ds:[si].Scan_Code
,0 ; |
85 mov ds:[si].Char_Code
,al ; | move char&scan code into structure
86 mov ds:[si].Status
,1 ; | 1 for status
88 shift: mov ah,02h ; Start of shift check block
89 int 16h
; | BIOS call to get shift state
92 mov ds:[si].Shift_State
,ax ; | put shift status into structure
94 mov ah,2
ch ; start time stamping
95 int 21h
; | get current time of day
97 mov byte ptr ds:[si].Time
+0,ch ; | put hours into structure
98 mov byte ptr ds:[si].Time
+1,cl ; | put minutes into structure
99 mov byte ptr ds:[si].Time
+2,dh ; | put seconds into structure
100 mov byte ptr cs:[si].Time
+3,dl ; | put hundreds into structure
103 sub ax,ax ; set good return code
104 Mexit
; pop registers
106 ret size
str - 6 ; return