diff --git a/libs/BorlandC/kbhit.asm b/libs/BorlandC/kbhit.asm new file mode 100644 index 00000000..3105858e --- /dev/null +++ b/libs/BorlandC/kbhit.asm @@ -0,0 +1,20 @@ +; int kbhit(void) +public _kbhit +_kbhit proc DIST + push si + push di + cmp _cFlag, 0 + jz short @@do + mov ax, 1 + jmp short @@ret + +@@do: + mov ah, 0Bh + int 21h + cbw + +@@ret: + pop di + pop si + ret +_kbhit endp diff --git a/libs/BorlandC/kbhit[data].asm b/libs/BorlandC/kbhit[data].asm new file mode 100644 index 00000000..30d3609a --- /dev/null +++ b/libs/BorlandC/kbhit[data].asm @@ -0,0 +1,2 @@ +_cFlag db 0 +_cChar db 0 diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 90f92c34..a00c26c4 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -20,7 +20,7 @@ _cx dw ? _dx dw ? _si dw ? _di dw ? -_cflag dw ? +_cflags dw ? _flags dw ? WORDREGS ends @@ -13513,34 +13513,7 @@ loc_B142: retn sub_B11B endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -; int kbhit(void) -_kbhit proc far - push si - push di - cmp byte_36A7E, 0 - jz short loc_B153 - mov ax, 1 - jmp short loc_B158 -; --------------------------------------------------------------------------- - -loc_B153: - mov ah, 0Bh - int 21h ; DOS - CHECK STANDARD INPUT STATUS - ; Return: AL = FFh if character available - ; 00h if no character - cbw - -loc_B158: - pop di - pop si - retf -_kbhit endp - +include libs/BorlandC/kbhit.asm ; =============== S U B R O U T I N E ======================================= @@ -48574,7 +48547,7 @@ include libs/BorlandC/strings[data].asm word_36A78 dw 952h word_36A7A dw 0 word_36A7C dw 0 -byte_36A7E db 0 +include libs/BorlandC/kbhit[data].asm dd 0 dd 0 dd 0 @@ -48592,7 +48565,6 @@ byte_36A7E db 0 dd 0 dd 0 db 0 - db 0 db 8 db 8 db 8 diff --git a/th03_op.asm b/th03_op.asm index 7c99d770..9acda286 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -4812,10 +4812,10 @@ include libs/BorlandC/strings.asm sub_952E proc far push si push di - cmp byte_E82A, 0 + cmp _cFlag, 0 jz short loc_9541 - mov byte_E82A, 0 - mov al, byte_E82B + mov _cFlag, 0 + mov al, _cChar jmp short loc_9546 ; --------------------------------------------------------------------------- @@ -4830,34 +4830,7 @@ loc_9546: retf sub_952E endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -; int kbhit(void) -_kbhit proc far - push si - push di - cmp byte_E82A, 0 - jz short loc_9559 - mov ax, 1 - jmp short loc_955E -; --------------------------------------------------------------------------- - -loc_9559: - mov ah, 0Bh - int 21h ; DOS - CHECK STANDARD INPUT STATUS - ; Return: AL = FFh if character available - ; 00h if no character - cbw - -loc_955E: - pop di - pop si - retf -_kbhit endp - +include libs/BorlandC/kbhit.asm ; =============== S U B R O U T I N E ======================================= @@ -12606,8 +12579,7 @@ include libs/BorlandC/sysnerr[data].asm include libs/BorlandC/xx[data].asm include libs/BorlandC/setenvp[data].asm include libs/BorlandC/strings[data].asm -byte_E82A db 0 -byte_E82B db 0 +include libs/BorlandC/kbhit[data].asm db 0 db 0 db 0 diff --git a/th04_op.asm b/th04_op.asm index c1e6cb5c..43ea6bd4 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -4861,10 +4861,10 @@ include libs/BorlandC/strings.asm sub_A3B2 proc far push si push di - cmp byte_10D56, 0 + cmp _cFlag, 0 jz short loc_A3C5 - mov byte_10D56, 0 - mov al, byte_10D57 + mov _cFlag, 0 + mov al, _cChar jmp short loc_A3CA ; --------------------------------------------------------------------------- @@ -4879,34 +4879,7 @@ loc_A3CA: retf sub_A3B2 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -; int kbhit(void) -_kbhit proc far - push si - push di - cmp byte_10D56, 0 - jz short loc_A3DD - mov ax, 1 - jmp short loc_A3E2 -; --------------------------------------------------------------------------- - -loc_A3DD: - mov ah, 0Bh - int 21h ; DOS - CHECK STANDARD INPUT STATUS - ; Return: AL = FFh if character available - ; 00h if no character - cbw - -loc_A3E2: - pop di - pop si - retf -_kbhit endp - +include libs/BorlandC/kbhit.asm ; =============== S U B R O U T I N E ======================================= @@ -14287,8 +14260,7 @@ include libs/BorlandC/sysnerr[data].asm include libs/BorlandC/xx[data].asm include libs/BorlandC/setenvp[data].asm include libs/BorlandC/strings[data].asm -byte_10D56 db 0 -byte_10D57 db 0 +include libs/BorlandC/kbhit[data].asm aPath db 'PATH',0 db '/\',0 db 0 diff --git a/th05_op.asm b/th05_op.asm index 88bd2cd5..3ca86397 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -4608,10 +4608,10 @@ include libs/BorlandC/strings.asm sub_A002 proc far push si push di - cmp byte_11D7E, 0 + cmp _cFlag, 0 jz short loc_A015 - mov byte_11D7E, 0 - mov al, byte_11D7F + mov _cFlag, 0 + mov al, _cChar jmp short loc_A01A ; --------------------------------------------------------------------------- @@ -4626,34 +4626,7 @@ loc_A01A: retf sub_A002 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function - -; int kbhit(void) -_kbhit proc far - push si - push di - cmp byte_11D7E, 0 - jz short loc_A02D - mov ax, 1 - jmp short loc_A032 -; --------------------------------------------------------------------------- - -loc_A02D: - mov ah, 0Bh - int 21h ; DOS - CHECK STANDARD INPUT STATUS - ; Return: AL = FFh if character available - ; 00h if no character - cbw - -loc_A032: - pop di - pop si - retf -_kbhit endp - +include libs/BorlandC/kbhit.asm ; =============== S U B R O U T I N E ======================================= @@ -14918,8 +14891,7 @@ include libs/BorlandC/sysnerr[data].asm include libs/BorlandC/xx[data].asm include libs/BorlandC/setenvp[data].asm include libs/BorlandC/strings[data].asm -byte_11D7E db 0 -byte_11D7F db 0 +include libs/BorlandC/kbhit[data].asm aPATH db 'PATH',0 asc_11D85 db '/\',0 db 0