From 366ba7a85f28875f0706c32e853da3a71dd9d50a Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 28 Aug 2014 05:48:32 +0200 Subject: [PATCH] [Reduction] #247: grcg_pset --- libs/master.lib/grcg_pset.asm | 79 +++++++++++++++++++++++++++++++++++ th01_reiiden.asm | 41 +----------------- th01_reiiden_2.inc | 2 +- th01_zunsoft.asm | 44 ++----------------- th02_main.asm | 50 ++-------------------- th03_op.asm | 42 +------------------ th04_main.asm | 45 +------------------- th05_main.asm | 43 +------------------ th05_maine.asm | 43 +------------------ 9 files changed, 96 insertions(+), 293 deletions(-) create mode 100644 libs/master.lib/grcg_pset.asm diff --git a/libs/master.lib/grcg_pset.asm b/libs/master.lib/grcg_pset.asm new file mode 100644 index 00000000..6ecfd325 --- /dev/null +++ b/libs/master.lib/grcg_pset.asm @@ -0,0 +1,79 @@ +PAGE 98,120 +; graphics - grcg - pset - PC98V +; +; DESCRIPTION: +; 点の描画 +; +; FUNCTION: +; void far _pascal grcg_pset( int x, int y ) + +; PARAMETERS: +; int x,y 点の座標 +; +; BINDING TARGET: +; Microsoft-C / Turbo-C +; +; RUNNING TARGET: +; NEC PC-9801 Normal mode +; +; REQUIRING RESOURCES: +; CPU: V30 +; GRAPHICS ACCELARATOR: GRAPHIC CHARGER +; +; COMPILER/ASSEMBLER: +; TASM 3.0 +; OPTASM 1.6 +; +; NOTES: +; ・グラフィック画面の青プレーンにのみ描画します。 +; ・色をつけるには、グラフィックチャージャーを利用してください。 +; ・grc_setclip()によるクリッピングに対応しています。 +; +; AUTHOR: +; 恋塚昭彦 +; +; 関連関数: +; grc_setclip() +; +; HISTORY: +; 92/6/12 Initial +; 92/7/16 bugfix(^^; + +func GRCG_PSET + mov BX,BP ; save BP + mov BP,SP + + ; parameters + @@x = (RETSIZE+1)*2 + @@y = (RETSIZE+0)*2 + + mov CX,[BP+@@x] + mov DX,[BP+@@y] + + mov BP,BX ; restore BP + + cmp CX,ClipXL + jl short @@RETURN + cmp CX,ClipXR + jg short @@RETURN + sub DX,ClipYT + jl short @@RETURN + cmp DX,ClipYH + jg short @@RETURN + + mov AX,DX + shl AX,2 + add DX,AX + add DX,ClipYT_seg + mov ES,DX + + mov BX,CX + shr BX,3 + and CL,7 + mov AL,80h + shr AL,CL + + mov ES:[BX],AL +@@RETURN: + ret 4 +endfunc diff --git a/th01_reiiden.asm b/th01_reiiden.asm index de678289..68005bdf 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -2762,46 +2762,7 @@ sub_140E endp include libs/master.lib/dos_ropen.asm include libs/master.lib/grcg_setcolor.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_146A proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_14AA - cmp cx, ClipXR - jg short locret_14AA - sub dx, ClipYT - jl short locret_14AA - cmp dx, ClipYH - jg short locret_14AA - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - assume es:nothing - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_14AA: - retf 4 -sub_146A endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/egc.asm ; =============== S U B R O U T I N E ======================================= diff --git a/th01_reiiden_2.inc b/th01_reiiden_2.inc index fd2cab0c..bcabcdff 100644 --- a/th01_reiiden_2.inc +++ b/th01_reiiden_2.inc @@ -13748,7 +13748,7 @@ loc_2261D: mov ax, [bx+589Dh] sar ax, 4 push ax - call sub_146A + call grcg_pset loc_22652: inc [bp+var_1] diff --git a/th01_zunsoft.asm b/th01_zunsoft.asm index e95b87d9..758ffcbb 100644 --- a/th01_zunsoft.asm +++ b/th01_zunsoft.asm @@ -346,7 +346,7 @@ loc_5C8: mov bx, si shl bx, 2 push word ptr [bx+288Ah] - call sub_14E4 + call grcg_pset lea ax, [bp+var_2] push ax lea ax, [bp+var_4] @@ -1173,45 +1173,7 @@ sub_139C endp include libs/master.lib/grcg_hline.asm include libs/master.lib/grcg_setcolor.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_14E4 proc near - -arg_0 = word ptr 2 -arg_2 = word ptr 4 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_1524 - cmp cx, ClipXR - jg short locret_1524 - sub dx, ClipYT - jl short locret_1524 - cmp dx, ClipYH - jg short locret_1524 - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h - shr al, cl - mov es:[bx], al - -locret_1524: - retn 4 -sub_14E4 endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/egc.asm ; =============== S U B R O U T I N E ======================================= @@ -1299,7 +1261,7 @@ loc_15FF: loc_160A: push [bp+arg_4] push [bp+arg_2] - call sub_14E4 + call grcg_pset pop di pop si leave diff --git a/th02_main.asm b/th02_main.asm index bb57c0d6..177eedcf 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -566,8 +566,7 @@ loc_C9B: loc_CA6: push [bp+arg_4] push [bp+arg_2] - push cs - call near ptr sub_123A + call grcg_pset pop di pop si leave @@ -1343,47 +1342,7 @@ loc_122E: retf 8 sub_109C endp -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_123A proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_127A - cmp cx, ClipXR - jg short locret_127A - sub dx, ClipYT - jl short locret_127A - cmp dx, ClipYH - jg short locret_127A - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_127A: - retf 4 -sub_123A endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/grcg_setcolor.asm include libs/master.lib/grcg_vline.asm @@ -5336,8 +5295,7 @@ loc_4253: cmp byte ptr [si+0Eh], 0 jnz short loc_4264 nop - push cs - call near ptr sub_123A + call grcg_pset jmp short loc_4270 ; --------------------------------------------------------------------------- @@ -29605,7 +29563,7 @@ loc_11013: loc_11095: push [bp+var_2] push si - call sub_123A + call grcg_pset inc di mov al, [bp+var_3] add al, 4 diff --git a/th03_op.asm b/th03_op.asm index b1c328a5..97997f1c 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -775,45 +775,7 @@ loc_E62: retf 6 sub_C6A endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_E82 proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_EC2 - cmp cx, ClipXR - jg short locret_EC2 - sub dx, ClipYT - jl short locret_EC2 - cmp dx, ClipYH - jg short locret_EC2 - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_EC2: - retf 4 -sub_E82 endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/grcg_setcolor.asm ; =============== S U B R O U T I N E ======================================= @@ -17702,7 +17664,7 @@ loc_B6CF: mov [bp+var_4], ax push [bp+var_2] push ax - call sub_E82 + call grcg_pset inc [bp+var_6] loc_B73B: diff --git a/th04_main.asm b/th04_main.asm index 949c210f..c096aad3 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -617,8 +617,7 @@ loc_11C7: loc_11D2: push [bp+arg_4] push [bp+arg_2] - push cs - call near ptr sub_1700 + call grcg_pset pop di pop si leave @@ -1246,47 +1245,7 @@ loc_16F4: retf 8 sub_1562 endp -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_1700 proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_1740 - cmp cx, ClipXR - jg short locret_1740 - sub dx, ClipYT - jl short locret_1740 - cmp dx, ClipYH - jg short locret_1740 - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_1740: - retf 4 -sub_1700 endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/grcg_setcolor.asm include libs/master.lib/grcg_vline.asm diff --git a/th05_main.asm b/th05_main.asm index da694867..aaa50d58 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -397,8 +397,7 @@ loc_1089: loc_1094: push [bp+arg_4] push [bp+arg_2] - push cs - call near ptr sub_1A44 + call grcg_pset pop di pop si leave @@ -1651,45 +1650,7 @@ loc_1A28: retf 6 sub_18B4 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_1A44 proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_1A84 - cmp cx, ClipXR - jg short locret_1A84 - sub dx, ClipYT - jl short locret_1A84 - cmp dx, ClipYH - jg short locret_1A84 - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_1A84: - retf 4 -sub_1A44 endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/grcg_setcolor.asm include libs/master.lib/grcg_vline.asm diff --git a/th05_maine.asm b/th05_maine.asm index d6cdc155..2a67ab75 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -608,8 +608,7 @@ loc_DB1: loc_DBC: push [bp+arg_4] push [bp+arg_2] - push cs - call near ptr sub_EE4 + call grcg_pset pop di pop si leave @@ -702,45 +701,7 @@ loc_E58: sub_DCC endp include libs/master.lib/grcg_hline.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EE4 proc far - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - mov bx, bp - mov bp, sp - mov cx, [bp+arg_2] - mov dx, [bp+arg_0] - mov bp, bx - cmp cx, ClipXL - jl short locret_F24 - cmp cx, ClipXR - jg short locret_F24 - sub dx, ClipYT - jl short locret_F24 - cmp dx, ClipYH - jg short locret_F24 - mov ax, dx - shl ax, 2 - add dx, ax - add dx, ClipYT_seg - mov es, dx - mov bx, cx - shr bx, 3 - and cl, 7 - mov al, 80h ; '' - shr al, cl - mov es:[bx], al - -locret_F24: - retf 4 -sub_EE4 endp - +include libs/master.lib/grcg_pset.asm include libs/master.lib/grcg_setcolor.asm include libs/master.lib/grcg_vline.asm