diff --git a/libs/master.lib/keybios.asm b/libs/master.lib/keybios.asm new file mode 100644 index 00000000..b0efeab2 --- /dev/null +++ b/libs/master.lib/keybios.asm @@ -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 ; } diff --git a/th01_op.asm b/th01_op.asm index 6c4d9888..bc9d7e51 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -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