From eff96385b02fff5b8f0119f8f08187ca1444053e Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 20 Aug 2014 16:27:28 +0200 Subject: [PATCH] [Reduction] #82-89: PC-98 escape sequences I don't know anything about ANSI/VT100/??? escape sequences, but after some quick research, these sequences and their effect seem to be specific to the PC-98 (although they're implemented as part of DOS, of course). --- libs/master.lib/txesc.asm | 117 ++++++++++++++++++++++++++++++++++++++ th01_zunsoft.asm | 90 ++--------------------------- th02_op.asm | 95 ++----------------------------- th03_op.asm | 95 ++----------------------------- th04_op.asm | 95 ++----------------------------- th05_op.asm | 95 ++----------------------------- 6 files changed, 141 insertions(+), 446 deletions(-) create mode 100644 libs/master.lib/txesc.asm diff --git a/libs/master.lib/txesc.asm b/libs/master.lib/txesc.asm new file mode 100644 index 00000000..dbd78adb --- /dev/null +++ b/libs/master.lib/txesc.asm @@ -0,0 +1,117 @@ +; master library - PC-9801 +; +; Description: +; +; +; Function/Procedures: +; int text_height( void ) ; +; int text_systemline_shown( void ) ; +; void text_25line(void) ; +; void text_20line(void) ; +; void text_cursor_show(void) ; +; void text_cursor_hide(void) ; +; void text_systemline_hide(void) ; +; void text_systemline_show(void) ; +; +; Parameters: +; none +; +; Returns: +; +; +; 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: +; 92/11/19 Initial +; 93/ 2/ 4 on/off -> show/hideに名前変更 + +; テキスト画面の行数を得る +; ※ファンクションキー表示がされていると1だけ少ない値になる。 +func TEXT_HEIGHT + xor AX,AX + mov ES,AX + mov AL,ES:[0712h] + inc AX + ret + EVEN +endfunc + +; ファンクションキー表示状態を得る +func TEXT_SYSTEMLINE_SHOWN + xor AX,AX + mov ES,AX + mov AL,ES:[0711h] + ret + EVEN +endfunc + +func TEXT_25LINE + mov DX,'3l' + jmp short putcmd + EVEN +endfunc + +func TEXT_20LINE + mov DX,'3h' + jmp short putcmd + EVEN +endfunc + +func TEXT_CURSOR_HIDE + mov DX,'5h' + jmp short putcmd + EVEN +endfunc + +func TEXT_CURSOR_SHOW + mov DX,'5l' + jmp short putcmd + EVEN +endfunc + +func TEXT_SYSTEMLINE_HIDE + mov DX,'1h' + jmp short putcmd + EVEN +endfunc + +func TEXT_SYSTEMLINE_SHOW + mov DX,'1l' + jmp short putcmd + EVEN +endfunc + +; In: DH = first byte, DL = second byte +putcmd proc CALLMODEL + mov AL,27 ; ESC + int 29h + mov AL,'[' ; '[' + int 29h + mov AL,'>' ; '>' + int 29h + mov AL,DH + int 29h + mov AL,DL + int 29h + ret +putcmd endp diff --git a/th01_zunsoft.asm b/th01_zunsoft.asm index 53c12312..a31f1a90 100644 --- a/th01_zunsoft.asm +++ b/th01_zunsoft.asm @@ -18,6 +18,7 @@ DGROUP group seg000 include libs/BorlandC/RULES.ASI +include libs/master.lib/func.inc ; =========================================================================== @@ -62,8 +63,8 @@ sub_384 proc near call sub_1344 call sub_958 call sub_AB6 - call sub_8B8 - call sub_8AC + call text_systemline_hide + call text_cursor_hide call sub_155E call sub_367 call sub_87A @@ -738,90 +739,7 @@ sub_87A proc near retn sub_87A endp -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_88C proc near - xor ax, ax - mov es, ax - mov al, byte ptr es:loc_711+1 - inc ax - retn -sub_88C endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_896 proc near - xor ax, ax - mov es, ax - mov al, byte ptr es:loc_711 - retn -sub_896 endp - -; --------------------------------------------------------------------------- - nop - mov dx, 336Ch - jmp short loc_8C4 -; --------------------------------------------------------------------------- - nop - mov dx, 3368h - jmp short loc_8C4 -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_8AC proc near - mov dx, 3568h - jmp short loc_8C4 -sub_8AC endp - -; --------------------------------------------------------------------------- - nop - mov dx, 356Ch - jmp short loc_8C4 -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_8B8 proc near - mov dx, 3168h - jmp short loc_8C4 -; --------------------------------------------------------------------------- - nop - mov dx, 316Ch - jmp short loc_8C4 -; --------------------------------------------------------------------------- - nop - -loc_8C4: - mov al, 1Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 5Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 3Eh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dl - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - retn -sub_8B8 endp - -; --------------------------------------------------------------------------- +include libs/BorlandC/txesc.asm db 0 ; =============== S U B R O U T I N E ======================================= diff --git a/th02_op.asm b/th02_op.asm index 197c5203..fb41f2db 100644 --- a/th02_op.asm +++ b/th02_op.asm @@ -4591,92 +4591,7 @@ sub_2430 proc far retf sub_2430 endp -; --------------------------------------------------------------------------- - nop - xor ax, ax - mov es, ax - assume es:seg000 - mov al, es:byte_712 - inc ax - retf -; --------------------------------------------------------------------------- - xor ax, ax - mov es, ax - mov al, es:byte_711 - retf -; --------------------------------------------------------------------------- - nop - mov dx, 336Ch - jmp short loc_247A -; --------------------------------------------------------------------------- - nop - mov dx, 3368h - jmp short loc_247A -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2462 proc far - mov dx, 3568h - jmp short loc_247A -sub_2462 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2468 proc far - mov dx, 356Ch - jmp short loc_247A -sub_2468 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_246E proc far - mov dx, 3168h - jmp short loc_247A -sub_246E endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2474 proc far - mov dx, 316Ch - jmp short loc_247A -; --------------------------------------------------------------------------- - nop - -loc_247A: - mov al, 1Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 5Bh ; '[' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 3Eh ; '>' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dl - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - retf -sub_2474 endp - -; --------------------------------------------------------------------------- +include libs/BorlandC/txesc.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -21425,8 +21340,8 @@ sub_AB28 proc far push cs call near ptr sub_B019 call sub_1BC6 - call sub_2474 - call sub_2468 + call text_systemline_show + call text_cursor_show pop bp retf sub_AB28 endp @@ -22106,8 +22021,8 @@ loc_AFC4: out dx, al ; Interrupt Controller #2, 8259A call sub_2596 call sub_1BBA - call sub_246E - call sub_2462 + call text_systemline_hide + call text_cursor_hide call sub_71C mov byte_D8B2, 12h push ds diff --git a/th03_op.asm b/th03_op.asm index 2db270bc..6f243a48 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -4439,92 +4439,7 @@ sub_21F4 proc far retf sub_21F4 endp -; --------------------------------------------------------------------------- - nop - xor ax, ax - mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_712 - inc ax - retf -; --------------------------------------------------------------------------- - xor ax, ax - mov es, ax - mov al, byte ptr es:loc_70F+2 - retf -; --------------------------------------------------------------------------- - nop - mov dx, 336Ch - jmp short loc_223E -; --------------------------------------------------------------------------- - nop - mov dx, 3368h - jmp short loc_223E -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2226 proc far - mov dx, 3568h - jmp short loc_223E -sub_2226 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_222C proc far - mov dx, 356Ch - jmp short loc_223E -sub_222C endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2232 proc far - mov dx, 3168h - jmp short loc_223E -sub_2232 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2238 proc far - mov dx, 316Ch - jmp short loc_223E -; --------------------------------------------------------------------------- - nop - -loc_223E: - mov al, 1Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 5Bh ; '[' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 3Eh ; '>' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dl - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - retf -sub_2238 endp - -; --------------------------------------------------------------------------- +include libs/BorlandC/txesc.asm db 0 ; =============== S U B R O U T I N E ======================================= @@ -24397,8 +24312,8 @@ sub_BEB8 proc far push cs call near ptr sub_BFC2 call sub_1A2E - call sub_2238 - call sub_222C + call text_systemline_show + call text_cursor_show pop bp retf sub_BEB8 endp @@ -25192,8 +25107,8 @@ loc_C435: out dx, al ; Interrupt Controller #2, 8259A call sub_22CA call sub_1A22 - call sub_2232 - call sub_2226 + call text_systemline_hide + call text_cursor_hide call sub_708 call sub_2DB8 push large [bp+arg_0] diff --git a/th04_op.asm b/th04_op.asm index 7b558004..12e37241 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -4456,92 +4456,7 @@ sub_24EE proc far retf sub_24EE endp -; --------------------------------------------------------------------------- - nop - xor ax, ax - mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_711+1 - inc ax - retf -; --------------------------------------------------------------------------- - xor ax, ax - mov es, ax - mov al, byte ptr es:loc_711 - retf -; --------------------------------------------------------------------------- - nop - mov dx, 336Ch - jmp short loc_2538 -; --------------------------------------------------------------------------- - nop - mov dx, 3368h - jmp short loc_2538 -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2520 proc far - mov dx, 3568h - jmp short loc_2538 -sub_2520 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2526 proc far - mov dx, 356Ch - jmp short loc_2538 -sub_2526 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_252C proc far - mov dx, 3168h - jmp short loc_2538 -sub_252C endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2532 proc far - mov dx, 316Ch - jmp short loc_2538 -; --------------------------------------------------------------------------- - nop - -loc_2538: - mov al, 1Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 5Bh ; '[' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 3Eh ; '>' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dl - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - retf -sub_2532 endp - -; --------------------------------------------------------------------------- +include libs/BorlandC/txesc.asm db 0 dword_254E dd 0 @@ -27862,8 +27777,8 @@ sub_DDB1 proc far push cs call near ptr sub_E0AC call sub_1D6A - call sub_2532 - call sub_2526 + call text_systemline_show + call text_cursor_show pop bp retf sub_DDB1 endp @@ -28338,8 +28253,8 @@ loc_E109: mov word_F8FE, 2000h call sub_2552 call sub_1D5E - call sub_252C - call sub_2520 + call text_systemline_hide + call text_cursor_hide call sub_86E call sub_323A les bx, [bp+arg_0] diff --git a/th05_op.asm b/th05_op.asm index 782180c9..21cfb43c 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -3843,92 +3843,7 @@ sub_20FE proc far retf sub_20FE endp -; --------------------------------------------------------------------------- - nop - xor ax, ax - mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_710+2 - inc ax - retf -; --------------------------------------------------------------------------- - xor ax, ax - mov es, ax - mov al, byte ptr es:loc_710+1 - retf -; --------------------------------------------------------------------------- - nop - mov dx, 336Ch - jmp short loc_2148 -; --------------------------------------------------------------------------- - nop - mov dx, 3368h - jmp short loc_2148 -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2130 proc far - mov dx, 3568h - jmp short loc_2148 -sub_2130 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2136 proc far - mov dx, 356Ch - jmp short loc_2148 -sub_2136 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_213C proc far - mov dx, 3168h - jmp short loc_2148 -sub_213C endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_2142 proc far - mov dx, 316Ch - jmp short loc_2148 -; --------------------------------------------------------------------------- - nop - -loc_2148: - mov al, 1Bh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 5Bh ; '[' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, 3Eh ; '>' - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dh - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - mov al, dl - int 29h ; DOS 2+ internal - FAST PUTCHAR - ; AL = character to display - retf -sub_2142 endp - -; --------------------------------------------------------------------------- +include libs/BorlandC/txesc.asm db 0 dword_215E dd 0 @@ -26651,8 +26566,8 @@ sub_D41C proc far push cs call near ptr sub_D7EC call sub_197A - call sub_2142 - call sub_2136 + call text_systemline_show + call text_cursor_show pop bp retf sub_D41C endp @@ -28274,8 +28189,8 @@ loc_DF27: mov word_F566, 2000h call sub_2162 call sub_196E - call sub_213C - call sub_2130 + call text_systemline_hide + call text_cursor_hide call sub_84C call sub_2BAC les bx, [bp+arg_0]