[Reduction] #486-487: key_wait_bios and key_sense_bios

This commit is contained in:
nmlgc 2014-09-07 16:21:01 +02:00
parent 0d213f41b5
commit 3d05fb85c9
2 changed files with 62 additions and 24 deletions

View File

@ -0,0 +1,60 @@
; master library - PC-9801
;
; Description:
; PC-9801の KEY BIOS を用いて、キーバッファの先頭の値を取り出す
;
; Function/Procedures:
; unsigned key_wait_bios(void) ;
; unsigned key_sense_bios(void) ;
;
; Parameters:
; none
;
; Returns:
; 上位8bit:キーコード
; 下位8bit:キーデータ(キャラクタコード)
;
; key_wait_bios: キー入力が無ければ押されるまで待ち、バッファから
; 取り除く。
; key_sense_bios: キー入力が無ければ、0を返す。キー入力がある場合も
; バッファの更新は行わない。
;
; Binding Target:
; Microsoft-C / Turbo-C / Turbo Pascal
;
; Running Target:
; PC-9801
;
; Requiring Resources:
; CPU: 8086
;
; Notes:
;
;
; Assembly Language Note:
;
;
; Compiler/Assembler:
; TASM 3.0
; OPTASM 1.6
;
; Author:
; 恋塚昭彦
;
; Revision History:
; 93/ 8/17 Initial: keybios.asm/master.lib 0.21
func KEY_WAIT_BIOS ; key_wait_bios() {
mov AH,0
int 18h
ret
endfunc ; }
func KEY_SENSE_BIOS ; key_sense_bios() {
mov AH,1
int 18h
shr BH,1
sbb BX,BX
and AX,BX
ret
endfunc ; }

View File

@ -1907,29 +1907,7 @@ loc_129F:
locret_12A8:
retf
; ---------------------------------------------------------------------------
nop
mov ah, 0
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
retf
; ---------------------------------------------------------------------------
nop
; =============== S U B R O U T I N E =======================================
sub_12B0 proc far
mov ah, 1
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
shr bh, 1
sbb bx, bx
and ax, bx
retf
sub_12B0 endp
include libs/master.lib/keybios.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/egc.asm
include libs/master.lib/random.asm
@ -9074,7 +9052,7 @@ loc_B126:
inc di
loc_B135:
call sub_12B0
call key_sense_bios
or ax, ax
jz short loc_B126
push cs