diff options
Diffstat (limited to 'v4.0/src/MAPPER/CHARIN.ASM')
| -rw-r--r-- | v4.0/src/MAPPER/CHARIN.ASM | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/CHARIN.ASM b/v4.0/src/MAPPER/CHARIN.ASM new file mode 100644 index 0000000..384d05f --- /dev/null +++ b/v4.0/src/MAPPER/CHARIN.ASM | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | |||
| 2 | ; | ||
| 3 | page 80,132 | ||
| 4 | ;0 | ||
| 5 | title CP/DOS KbdCharIn mapper | ||
| 6 | ; | ||
| 7 | kbdxxx segment byte public 'kbd' | ||
| 8 | assume cs:kbdxxx,ds:nothing,es:nothing,ss:nothing | ||
| 9 | ; | ||
| 10 | ; ************************************************************************* * | ||
| 11 | ; * | ||
| 12 | ; * MODULE: kbdcharin | ||
| 13 | ; * | ||
| 14 | ; * FILE NAME: charin.asm | ||
| 15 | ; * | ||
| 16 | ; * CALLING SEQUENCE: | ||
| 17 | ; * | ||
| 18 | ; * push@ dword chardata ; buffer for data | ||
| 19 | ; * push word iowait ; Indicate if wait | ||
| 20 | ; * push word kbdhandle ; Keyboard Handle | ||
| 21 | ; * | ||
| 22 | ; * call kbdcharin | ||
| 23 | ; * | ||
| 24 | ; * | ||
| 25 | ; * MODULES CALLED: BIOS int 16h | ||
| 26 | ; * PC-DOS Int 21h, ah=2ch, get time | ||
| 27 | ; * | ||
| 28 | ; ************************************************************************* | ||
| 29 | |||
| 30 | public kbdcharin | ||
| 31 | .sall | ||
| 32 | .xlist | ||
| 33 | include kbd.inc | ||
| 34 | .list | ||
| 35 | extrn savedkbdinput:word | ||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | error_kbd_parameter equ 0002h | ||
| 40 | |||
| 41 | str struc | ||
| 42 | old_bp dw ? | ||
| 43 | return dd ? | ||
| 44 | handle dw ? ; keyboard handle | ||
| 45 | iowait dw ? ; indicate if wait for io | ||
| 46 | data dd ? ; data buffer pointer | ||
| 47 | str ends | ||
| 48 | |||
| 49 | |||
| 50 | kbdcharin proc far | ||
| 51 | |||
| 52 | Enter KbdCharIn ; save registers | ||
| 53 | lds si,[bp].data ; set up return data area | ||
| 54 | loopx: | ||
| 55 | mov ax,savedkbdinput | ||
| 56 | cmp ah,0 | ||
| 57 | je nosavedchar | ||
| 58 | |||
| 59 | mov savedkbdinput,0 | ||
| 60 | jmp avail | ||
| 61 | |||
| 62 | nosavedchar: | ||
| 63 | mov ah,0bh ; Check for ^C | ||
| 64 | int 021h | ||
| 65 | |||
| 66 | mov ah,06 | ||
| 67 | mov dl,-1 | ||
| 68 | int 021h | ||
| 69 | jnz avail | ||
| 70 | |||
| 71 | mov ax,[bp].iowait ; else, see if wait is desired | ||
| 72 | cmp ax,0 ; if so, | ||
| 73 | jz loopx ; keep trying | ||
| 74 | ; else... | ||
| 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 | ||
| 79 | ; end of block | ||
| 80 | |||
| 81 | avail: | ||
| 82 | cmp al,0 | ||
| 83 | je loopx | ||
| 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 | ||
| 87 | ; | ||
| 88 | shift: mov ah,02h ; Start of shift check block | ||
| 89 | int 16h ; | BIOS call to get shift state | ||
| 90 | |||
| 91 | sub ah,ah ; | | ||
| 92 | mov ds:[si].Shift_State,ax ; | put shift status into structure | ||
| 93 | |||
| 94 | mov ah,2ch ; start time stamping | ||
| 95 | int 21h ; | get current time of day | ||
| 96 | |||
| 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 | ||
| 101 | |||
| 102 | |||
| 103 | sub ax,ax ; set good return code | ||
| 104 | Mexit ; pop registers | ||
| 105 | |||
| 106 | ret size str - 6 ; return | ||
| 107 | |||
| 108 | kbdcharin endp | ||
| 109 | |||
| 110 | kbdxxx ends | ||
| 111 | |||
| 112 | end | ||