From 3e7fa3a3d1cf7576a5f0d6c54d7e5045ad5456ac Mon Sep 17 00:00:00 2001 From: nmlgc Date: Tue, 9 Sep 2014 05:54:40 +0200 Subject: [PATCH] [Reduction] #500: over_put_8 --- libs/master.lib/over_put_8.asm | 165 +++++++++++++++++++++++++++++++++ th02_maine.asm | 119 +----------------------- 2 files changed, 167 insertions(+), 117 deletions(-) create mode 100644 libs/master.lib/over_put_8.asm diff --git a/libs/master.lib/over_put_8.asm b/libs/master.lib/over_put_8.asm new file mode 100644 index 00000000..ea2fe43a --- /dev/null +++ b/libs/master.lib/over_put_8.asm @@ -0,0 +1,165 @@ +; superimpose & master library module +; +; Description: +; 透明処理を行わないパターン表示[横8dot単位] +; +; Functions/Procedures: +; void over_put_8( int x, int y, int num ) ; +; +; Parameters: +; x,y 左上端の座標 +; num パターン番号 +; +; Returns: +; none +; +; Binding Target: +; Microsoft-C / Turbo-C / Turbo Pascal +; +; Running Target: +; PC-9801 +; +; Requiring Resources: +; CPU: 8086 +; +; Notes: +; 横座標は8の倍数に切り捨てられる。 +; +; Compiler/Assembler: +; TASM 3.0 +; OPTASM 1.6 +; +; Author: +; Kazumi(奥田 仁) +; 恋塚(恋塚昭彦) +; +; Revision History: +; +;$Id: overput8.asm 0.04 92/05/29 20:08:09 Kazumi Rel $ +; +; 93/ 3/20 Initial: master.lib <- super.lib 0.22b +; 93/ 5/ 4 [M0.16] +; + +func OVER_PUT_8 + push BP + mov BP,SP + push DS + push SI + push DI + + @@x = (RETSIZE+3)*2 + @@y = (RETSIZE+2)*2 + @@num = (RETSIZE+1)*2 + + mov BX,[BP+@@num] + shl BX,1 ;integer size & near pointer + mov CX,[BP+@@x] + mov BP,[BP+@@y] + + mov AX,BP ;-+ + shl AX,2 ; | + add BP,AX ; |DI=y*80 + shl BP,4 ;-+ + shr CX,3 ;CX=x/8 + add BP,CX ;GVRAM offset address + + mov DX,super_patsize[BX] ;pattern size (1-8) + mov DS,super_patdata[BX] ;BX+2 -> BX + + mov AL,DH ; skip mask pattern + mul DL + mov SI,AX + + mov BX,80 + sub BL,DH + mov AL,DH + xor AH,AH + mov CX,0a800h + call OVERPUT8_DISP + mov CX,0b000h + call OVERPUT8_DISP + mov CX,0b800h + call OVERPUT8_DISP + mov CX,0e000h + call OVERPUT8_DISP + + pop DI + pop SI + pop DS + pop BP + ret 6 +endfunc + +; +; 表示 +; +; IN: +; BP +; CX +; DL +; AX +; DS:SI +; BX +OVERPUT8_DISP proc near + mov ES,CX + + mov DH,DL + mov DI,BP + test DI,1 + jnz short @@ODD_ADDRESS + shr AX,1 + jb short @@EAOS + + EVEN +@@EAES: + mov CX,AX + rep movsw + add DI,BX + dec DH + jnz short @@EAES + shl AX,1 + ret + + EVEN +@@EAOS: + mov CX,AX + rep movsw + movsb + lea DI,[DI+BX] + dec DH + jnz short @@EAOS + rcl AX,1 + ret + + EVEN +@@ODD_ADDRESS: + shr AX,1 + jb short @@OAOS + + EVEN +@@OAES: + dec AX +@@OAES_L: + mov CX,AX + movsb + rep movsw + movsb + add DI,BX + dec DH + jnz short @@OAES_L + inc AX + shl AX,1 + ret + + EVEN +@@OAOS: + mov CX,AX + movsb + rep movsw + lea DI,[DI+BX] + dec DH + jnz short @@OAOS + rcl AX,1 + ret +OVERPUT8_DISP endp diff --git a/th02_maine.asm b/th02_maine.asm index d0527d01..b5984cbd 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -272,122 +272,7 @@ include libs/master.lib/graph_pi_free.asm include libs/master.lib/graph_pi_load_pack.asm include libs/master.lib/graph_pack_put_8.asm include libs/master.lib/key_sense.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_1B86 proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push ds - push si - push di - mov bx, [bp+arg_0] - shl bx, 1 - mov cx, [bp+arg_4] - mov bp, [bp+arg_2] - mov ax, bp - shl ax, 2 - add bp, ax - shl bp, 4 - shr cx, 3 - add bp, cx - mov dx, [bx+2512h] - mov ds, word ptr [bx+2112h] - mov al, dh - mul dl - mov si, ax - mov bx, 50h ; 'P' - sub bl, dh - mov al, dh - xor ah, ah - mov cx, 0A800h - call sub_1BDC - mov cx, 0B000h - call sub_1BDC - mov cx, 0B800h - call sub_1BDC - mov cx, 0E000h - call sub_1BDC - pop di - pop si - pop ds - pop bp - retf 6 -sub_1B86 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_1BDC proc near - mov es, cx - assume es:nothing - mov dh, dl - mov di, bp - test di, 1 - jnz short loc_1C08 - shr ax, 1 - jb short loc_1BFA - -loc_1BEC: - mov cx, ax - rep movsw - add di, bx - dec dh - jnz short loc_1BEC - shl ax, 1 - retn -; --------------------------------------------------------------------------- - nop - -loc_1BFA: - mov cx, ax - rep movsw - movsb - lea di, [bx+di] - dec dh - jnz short loc_1BFA - rcl ax, 1 - retn -; --------------------------------------------------------------------------- - -loc_1C08: - shr ax, 1 - jb short loc_1C1E - dec ax - -loc_1C0D: - mov cx, ax - movsb - rep movsw - movsb - add di, bx - dec dh - jnz short loc_1C0D - inc ax - shl ax, 1 - retn -; --------------------------------------------------------------------------- - nop - -loc_1C1E: - mov cx, ax - movsb - rep movsw - lea di, [bx+di] - dec dh - jnz short loc_1C1E - rcl ax, 1 - retn -sub_1BDC endp - +include libs/master.lib/over_put_8.asm include libs/master.lib/palette_show.asm include libs/master.lib/pfclose.asm include libs/master.lib/pfgetc.asm @@ -3252,7 +3137,7 @@ loc_A887: push si push [bp+arg_2] push di - call sub_1B86 + call over_put_8 inc [bp+var_2] inc di add si, 10h