mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-21 12:54:30 +02:00
Some duplicate code merging and scancode-0xe0 related fixes.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@606 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
7bc5f8b31e
commit
1b2a421f44
@ -41,7 +41,7 @@ ConTable db 0Ah
|
|||||||
dw _IOCommandError
|
dw _IOCommandError
|
||||||
dw ConRead
|
dw ConRead
|
||||||
dw CommonNdRdExit
|
dw CommonNdRdExit
|
||||||
dw ConInStat
|
dw CommonNdRdExit
|
||||||
dw ConInpFlush
|
dw ConInpFlush
|
||||||
dw ConWrite
|
dw ConWrite
|
||||||
dw ConWrite
|
dw ConWrite
|
||||||
@ -106,25 +106,15 @@ ConRead2:
|
|||||||
jmp _IOExit
|
jmp _IOExit
|
||||||
|
|
||||||
|
|
||||||
checkkey:
|
|
||||||
mov ah,1
|
|
||||||
add ah,[cs:kbdType]
|
|
||||||
int 16h ; Get status, if zf=0 al=char
|
|
||||||
jz keydone ; Jump if no char available
|
|
||||||
checke0: cmp al,0xe0 ; must check for 0xe0 scan code
|
|
||||||
jne .ret
|
|
||||||
cmp ax,0x00e0 ; check for Greek alpha
|
|
||||||
je .ret
|
|
||||||
mov al,0
|
|
||||||
.ret: retn
|
|
||||||
|
|
||||||
readkey:
|
readkey:
|
||||||
mov ah,[cs:kbdType]
|
mov ah,[cs:kbdType]
|
||||||
int 16h
|
int 16h
|
||||||
jmp short checke0
|
checke0: cmp al,0xe0 ; must check for 0xe0 scan code
|
||||||
|
jne .ret
|
||||||
keydone: pop cx
|
or ah,ah ; check for Greek alpha
|
||||||
jmp _IODone
|
jz .ret
|
||||||
|
mov al,0 ; otherwise destroy the 0xe0
|
||||||
|
.ret: retn
|
||||||
|
|
||||||
;
|
;
|
||||||
; Name:
|
; Name:
|
||||||
@ -162,13 +152,27 @@ KbdRd1:
|
|||||||
KbdRdRtn:
|
KbdRdRtn:
|
||||||
retn
|
retn
|
||||||
|
|
||||||
|
;
|
||||||
|
; Name:
|
||||||
|
; ConInStat
|
||||||
|
;
|
||||||
|
; Function:
|
||||||
|
; Checks the keyboard input buffer.
|
||||||
|
;
|
||||||
|
; Description:
|
||||||
|
; Calls int 16 (get status). Sets Busy-Flag in status field. Destroys ax.
|
||||||
|
;
|
||||||
global CommonNdRdExit
|
global CommonNdRdExit
|
||||||
CommonNdRdExit: ; *** tell if key waiting and return its ASCII if yes
|
CommonNdRdExit: ; *** tell if key waiting and return its ASCII if yes
|
||||||
mov al,[cs:uScanCode] ; Test for last scan code
|
mov al,[cs:uScanCode] ; Test for last scan code
|
||||||
; now AL is set if previous key was extended,
|
; now AL is set if previous key was extended,
|
||||||
or al,al ; Was it zero ?
|
or al,al ; Was it zero ?
|
||||||
jnz ConNdRd2 ; Jump if there's a char waiting
|
jnz ConNdRd2 ; Jump if there's a char waiting
|
||||||
call checkkey
|
mov ah,1
|
||||||
|
add ah,[cs:kbdType]
|
||||||
|
int 16h ; Get status, if zf=0 al=char
|
||||||
|
jz ConNdRd4 ; Jump if no char available
|
||||||
|
call checke0 ; check for e0 scancode
|
||||||
or ax,ax ; Zero ?
|
or ax,ax ; Zero ?
|
||||||
jnz ConNdRd1 ; Jump if not zero
|
jnz ConNdRd1 ; Jump if not zero
|
||||||
call readkey
|
call readkey
|
||||||
@ -183,6 +187,8 @@ ConNdRd1:
|
|||||||
|
|
||||||
ConNdRd2:
|
ConNdRd2:
|
||||||
lds bx,[cs:_ReqPktPtr] ; Set the status
|
lds bx,[cs:_ReqPktPtr] ; Set the status
|
||||||
|
cmp byte[bx+2],6 ; input status call?
|
||||||
|
je ConNdRd3
|
||||||
mov [bx+0Dh],al ; return the ASCII of that key
|
mov [bx+0Dh],al ; return the ASCII of that key
|
||||||
|
|
||||||
ConNdRd3:
|
ConNdRd3:
|
||||||
@ -263,42 +269,3 @@ _int29_handler:
|
|||||||
pop si
|
pop si
|
||||||
pop ax
|
pop ax
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
; Name:
|
|
||||||
; ConInStat
|
|
||||||
;
|
|
||||||
; Function:
|
|
||||||
; Checks the keybord input buffer.
|
|
||||||
;
|
|
||||||
; Description:
|
|
||||||
; Calls int 16 (get status). Sets Busy-Flag in status field. Destroys ax.
|
|
||||||
;
|
|
||||||
global ConInStat
|
|
||||||
ConInStat:
|
|
||||||
mov ah,0 ; just in case ...
|
|
||||||
mov al,[cs:uScanCode] ; Test for last scan code
|
|
||||||
or al,al ; Was it zero ?
|
|
||||||
jnz ConCharReady ; Jump if there's a char waiting
|
|
||||||
; return previously cached ext char if any
|
|
||||||
call checkkey
|
|
||||||
or ax,ax ; Zero ?
|
|
||||||
jnz ConIS1 ; Jump if not zero
|
|
||||||
; if non-zero key waiting, take it
|
|
||||||
call readkey
|
|
||||||
jmp short ConInStat
|
|
||||||
; if zero key was waiting, fetch 2nd part etc. (???)
|
|
||||||
|
|
||||||
ConIS1:
|
|
||||||
cmp ax,CTL_PRT_SCREEN ; Was ctl+prntscrn key pressed?
|
|
||||||
jne ConIS2 ; Jump if not
|
|
||||||
mov al,CTL_P
|
|
||||||
ConIS2:
|
|
||||||
lds bx,[cs:_ReqPktPtr] ; Set the status
|
|
||||||
mov [bx+0Dh],al ; return the ASCII of the key
|
|
||||||
ConCharReady:
|
|
||||||
jmp _IOExit ; key ready (busy=0)
|
|
||||||
ConNoChar:
|
|
||||||
jmp _IODone ; no key ready (busy=1)
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user