diff --git a/libs/master.lib/text_boxfilla.asm b/libs/master.lib/text_boxfilla.asm new file mode 100644 index 00000000..716ea59e --- /dev/null +++ b/libs/master.lib/text_boxfilla.asm @@ -0,0 +1,95 @@ +; master library - PC98 +; +; Description: +; テキスト画面の長方形範囲を指定属性で埋める +; +; Function/Procedures: +; void text_boxfilla( unsigned x1, unsigned y1, unsigned x2, unsigned y2, +; unsigned atrb ) ; +; +; Parameters: +; unsigned x1 左端の横座標( 0 〜 79 ) +; unsigned y1 上端の縦座標( 0 〜 24 ) +; unsigned x2 右端の横座標( 0 〜 79 ) +; unsigned y2 下端の縦座標( 0 〜 24 ) +; unsigned atrb 属性 +; +; Returns: +; none +; +; Binding Target: +; Microsoft-C / Turbo-C / Turbo Pascal +; +; Running Target: +; PC-9801 +; +; Requiring Resources: +; CPU: 8086 +; +; Notes: +; x1 <= x2 かつ y1 <= y2でなければならない。 +; +; Compiler/Assembler: +; TASM 3.0 +; OPTASM 1.6 +; +; Author: +; 恋塚昭彦 +; +; Revision History: +; 92/11/15 Initial + +func TEXT_BOXFILLA + push DI + pushf + CLI + add SP,(2+retsize)*2 + ; パラメータ領域の先頭( flags,DI,retadr ) + + pop AX ; color + pop DX ; y2 + pop BX ; x2 + pop CX ; Y1 + + mov DI,CX + shl DI,1 + shl DI,1 + add DI,CX + shl DI,1 + add DI,TextVramSeg + add DI,200h + mov ES,DI ; これで ESに (0,y1)のテキスト属性セグメントが入った + + pop DI ; X1 + + sub SP,(5+2+retsize)*2 + ; (5(パラメータの数)+1(リターンアドレス)+2(DI,flags))*2 + popf + + sub BX,DI ; BX = X2 - X1 + 1 + inc BX ; + + sub DX,CX + mov CX,DX + shl DX,1 + shl DX,1 + add DX,CX + shl DX,1 + shl DX,1 + shl DX,1 + shl DX,1 + add DI,DX + shl DI,1 ; これで DI には(x1,y2)のoffsetが入った。 + + lea DX,[BX+80] + shl DX,1 ; 毎回の減少分 + + EVEN +@@SLOOP: mov CX,BX + rep stosw ; 一行分の書き込み + sub DI,DX ; 下の行に移動 + jnb short @@SLOOP + + pop DI + ret 10 +endfunc diff --git a/th02_main.asm b/th02_main.asm index 82a2c5e9..5dc50b5b 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -1477,56 +1477,7 @@ include libs/master.lib/random.asm include libs/master.lib/rottbl.asm include libs/master.lib/smem_release.asm include libs/master.lib/smem_wget.asm - -; =============== S U B R O U T I N E ======================================= - - -sub_25DA proc far - push di - pushf - cli - add sp, 8 - pop ax - pop dx - pop bx - pop cx - mov di, cx - shl di, 1 - shl di, 1 - add di, cx - shl di, 1 - add di, TextVramSeg - add di, 200h - mov es, di - pop di - sub sp, 12h - popf - sub bx, di - inc bx - sub dx, cx - mov cx, dx - shl dx, 1 - shl dx, 1 - add dx, cx - shl dx, 1 - shl dx, 1 - shl dx, 1 - shl dx, 1 - add di, dx - shl di, 1 - lea dx, [bx+50h] - shl dx, 1 - nop - -loc_261C: - mov cx, bx - rep stosw - sub di, dx - jnb short loc_261C - pop di - retf 0Ah -sub_25DA endp - +include libs/master.lib/text_boxfilla.asm include libs/BorlandC/text_clear.asm include libs/master.lib/text_fillca.asm @@ -8198,7 +8149,7 @@ loc_B8B5: push large 40001h push large 330017h push 5 - call sub_25DA + call text_boxfilla push 30h ; '0' ; n push ds push offset unk_1F4AD ; src diff --git a/th03_main.asm b/th03_main.asm index 01047fe7..3722fc06 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -1551,56 +1551,7 @@ loc_1F83: retn sub_1F78 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_1F8C proc far - push di - pushf - cli - add sp, 8 - pop ax - pop dx - pop bx - pop cx - mov di, cx - shl di, 1 - shl di, 1 - add di, cx - shl di, 1 - add di, TextVramSeg - add di, 200h - mov es, di - pop di - sub sp, 12h - popf - sub bx, di - inc bx - sub dx, cx - mov cx, dx - shl dx, 1 - shl dx, 1 - add dx, cx - shl dx, 1 - shl dx, 1 - shl dx, 1 - shl dx, 1 - add di, dx - shl di, 1 - lea dx, [bx+50h] - shl dx, 1 - nop - -loc_1FCE: - mov cx, bx - rep stosw - sub di, dx - jnb short loc_1FCE - pop di - retf 0Ah -sub_1F8C endp - +include libs/master.lib/text_boxfilla.asm include libs/BorlandC/text_clear.asm include libs/master.lib/text_fillca.asm @@ -8406,11 +8357,11 @@ sub_B8F7 proc far push large 20001h push large 250018h push 0E1h ; '' - call sub_1F8C + call text_boxfilla push large 2A0001h push large 4D0018h push 0E1h ; '' - call sub_1F8C + call text_boxfilla pop bp retf sub_B8F7 endp diff --git a/th05_main.asm b/th05_main.asm index aee09b59..a7531387 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -1586,60 +1586,7 @@ loc_249F: retn sub_2494 endp - -; =============== S U B R O U T I N E ======================================= - - -sub_24A8 proc far - push di - pushf - cli - add sp, 8 - pop ax - pop dx - pop bx - pop cx - mov di, cx - shl di, 1 - shl di, 1 - add di, cx - shl di, 1 - add di, TextVramSeg - add di, 200h - mov es, di - pop di - sub sp, 12h - popf - sub bx, di - inc bx - sub dx, cx - mov cx, dx - shl dx, 1 - shl dx, 1 - add dx, cx - shl dx, 1 - shl dx, 1 - shl dx, 1 - shl dx, 1 - add di, dx - shl di, 1 - lea dx, [bx+50h] - shl dx, 1 - nop - -loc_24EA: - mov cx, bx - rep stosw - -loc_24EE: - sub di, dx - jnb short loc_24EA - pop di - -locret_24F3: - retf 0Ah -sub_24A8 endp - +include libs/master.lib/text_boxfilla.asm include libs/BorlandC/text_clear.asm include libs/master.lib/text_fillca.asm @@ -15222,11 +15169,11 @@ loc_F1F2: push large 140014h push large 320017h push 21h ; '!' - call sub_24A8 + call text_boxfilla push large 6000Ch push large 24000Fh push 21h ; '!' - call sub_24A8 + call text_boxfilla push word_2C934 push word_2C936 call sub_EF74