mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 00:20:34 +00:00
- If we determine that the keyboard buffer is full, only call INT 16h,0 once without checking again whether the buffer is free afterwards
Fixes bug #4264 - Get rid of another procedure for getting a character, can be replaced with two instructions in the only place where this procedure was called See issue #4264 for more details. svn path=/trunk/; revision=40176
This commit is contained in:
parent
bd33ba7e48
commit
8403d77a18
1 changed files with 5 additions and 23 deletions
|
@ -898,41 +898,23 @@ kaboom:
|
||||||
sti
|
sti
|
||||||
mov si, err_bootfailed
|
mov si, err_bootfailed
|
||||||
call writestr
|
call writestr
|
||||||
call getchar
|
xor ax, ax ; Wait for keypress
|
||||||
|
int 16h
|
||||||
cli
|
cli
|
||||||
mov word [BIOS_magic], 0 ; Cold reboot
|
mov word [BIOS_magic], 0 ; Cold reboot
|
||||||
jmp 0F000h:0FFF0h ; Reset vector address
|
jmp 0F000h:0FFF0h ; Reset vector address
|
||||||
|
|
||||||
getchar:
|
|
||||||
.again:
|
|
||||||
mov ah, 1 ; Poll keyboard
|
|
||||||
int 16h
|
|
||||||
jz .again
|
|
||||||
.kbd:
|
|
||||||
xor ax, ax ; Get keyboard input
|
|
||||||
int 16h
|
|
||||||
.func_key:
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; pollchar_and_empty: check if we have an input character pending (ZF = 0) and empty the input buffer afterwards
|
; pollchar_and_empty: check if we have an input character pending (ZF = 0) and empty the input buffer afterwards
|
||||||
;
|
;
|
||||||
pollchar_and_empty:
|
pollchar_and_empty:
|
||||||
pushad
|
pushad
|
||||||
mov ah, 1 ; Poll keyboard
|
mov ah, 1 ; Did the user press a key?
|
||||||
int 16h
|
int 16h
|
||||||
jz .end
|
jz .end ; No, then we're done
|
||||||
.empty_buffer:
|
mov ah, 0 ; Otherwise empty the buffer by reading it
|
||||||
mov ah, 0 ; Read from keyboard
|
|
||||||
int 16h
|
int 16h
|
||||||
|
|
||||||
mov ah, 1 ; Poll keyboard again
|
|
||||||
int 16h
|
|
||||||
jz .buffer_emptied
|
|
||||||
jmp .empty_buffer
|
|
||||||
.buffer_emptied:
|
|
||||||
and ax, ax ; ZF = 0
|
|
||||||
.end:
|
.end:
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
Loading…
Reference in a new issue