mirror of https://github.com/nmlgc/ReC98.git
[Reduction] #427: grcg_trapezoid
This commit is contained in:
parent
c90b76bff9
commit
ce245eae9f
|
@ -0,0 +1,147 @@
|
|||
PAGE 98,120
|
||||
; koichan library - graphics - grcg - trapezoid - PC98V
|
||||
;
|
||||
; Function:
|
||||
; void far _pascal grcg_trapezoid( int y1, int x11, int x12, int y2, int x21, int x22 ) ;
|
||||
;
|
||||
; Description:
|
||||
; 台形塗りつぶし(青プレーンのみ)
|
||||
;
|
||||
; Parameters:
|
||||
; int y1 1つ目の水平線のy座標
|
||||
; int x11, x12 1つ目の水平線の両端のx座標
|
||||
; int y2 2つ目の水平線のy座標
|
||||
; int x21, x22 2つ目の水平線の両端のx座標
|
||||
;
|
||||
; Binding Target:
|
||||
; Microsoft-C / Turbo-C ( Small Model )
|
||||
;
|
||||
; Running Target:
|
||||
; NEC PC-9801 Normal mode
|
||||
;
|
||||
; Requiring Resources:
|
||||
; CPU: V30
|
||||
; GRAPHICS ACCELARATOR: GRAPHIC CHARGER
|
||||
;
|
||||
; Assembler:
|
||||
; TASM 3.0
|
||||
; OPTASM 1.6
|
||||
;
|
||||
; Notes:
|
||||
; ・グラフィック画面の青プレーンにのみ描画します。
|
||||
; ・色をつけるには、グラフィックチャージャーを利用してください。
|
||||
; ・クリッピングを行っています。
|
||||
; 左右方向は、grc_setclip()によるクリッピングに対応していますが、
|
||||
; 上下方向は、画面枠でクリップします。呼び出し側で対応して(ヒー)
|
||||
; y座標が上境界にかかっていると遅くなります。
|
||||
; (上境界との交点を計算せずに、上から順に調べているため)
|
||||
; ・位置関係は上下、左右とも自由ですが、ねじれている場合
|
||||
; ねじれた台形(2つの三角形が頂点で接している状態)を描画します。
|
||||
;
|
||||
; Author:
|
||||
; 恋塚昭彦
|
||||
;
|
||||
; Revision History:
|
||||
; 92/3/21 Initial
|
||||
; 92/3/29 bug fix, 台形に側辺の交差を認めるようにした
|
||||
; 92/4/2 少々加速
|
||||
; 92/4/18 三角形ルーチンから分離。クリッピング付加。
|
||||
; 92/4/19 少々加速
|
||||
; 92/5/7 自己書き換えにより加速
|
||||
; 92/5/20 任意クリッピングの横にだけ対応。:-)
|
||||
; 92/5/22 ↑これも自己書き換え〜
|
||||
; 92/6/6 bug fix
|
||||
; 92/6/13 bug fix
|
||||
; 92/6/16 TASM対応
|
||||
; 95/ 3/25 [M0.22k] BUGFIX ClipYT=0を仮定していた
|
||||
|
||||
;=========================================================================
|
||||
; void _pascal grcg_trapezoid( int y1, int x11, int x12, int y2, int x21, int x22 )
|
||||
|
||||
FUNC GRCG_TRAPEZOID
|
||||
push BP
|
||||
mov BP,SP
|
||||
push DI
|
||||
push SI
|
||||
mov ES,ClipYT_seg
|
||||
mov AX,ClipYT
|
||||
mov CX,ClipYH
|
||||
|
||||
; 引数
|
||||
@@y1 = (RETSIZE+6)*2
|
||||
@@x11 = (RETSIZE+5)*2
|
||||
@@x12 = (RETSIZE+4)*2
|
||||
@@y2 = (RETSIZE+3)*2
|
||||
@@x21 = (RETSIZE+2)*2
|
||||
@@x22 = (RETSIZE+1)*2
|
||||
|
||||
mov SI,[BP+@@y1]
|
||||
sub SI,AX
|
||||
js short @@Lno_draw
|
||||
mov DI,[BP+@@y2]
|
||||
sub DI,AX
|
||||
js short @@Lno_draw
|
||||
|
||||
cmp SI,DI
|
||||
jg short @@Lgyaku
|
||||
|
||||
or DI,DI
|
||||
js short @@Lno_draw
|
||||
cmp SI,CX
|
||||
jg short @@Lno_draw
|
||||
sub DI,CX ; if ( y2 >= Ymax )
|
||||
sbb AX,AX ; y2 = Ymax ;
|
||||
and DI,AX
|
||||
add DI,CX
|
||||
sub DI,SI ; DI = y2 - y1
|
||||
jl short @@Lno_draw
|
||||
|
||||
mov AX,[BP+@@x21]
|
||||
mov CX,DI ; y2-y1
|
||||
mov BX,offset trapez_a ;a
|
||||
mov DX,[BP+@@x11]
|
||||
call make_linework
|
||||
|
||||
mov AX,[BP+@@x22]
|
||||
mov CX,DI ; y2-y1
|
||||
mov BX,offset trapez_b ;b
|
||||
mov DX,[BP+@@x12]
|
||||
push offset @@Ldraw
|
||||
jmp make_linework
|
||||
|
||||
@@Lgyaku:
|
||||
xchg SI,DI ; y2<->y1
|
||||
|
||||
or DI,DI
|
||||
js short @@Lno_draw
|
||||
cmp SI,CX
|
||||
jg short @@Lno_draw
|
||||
sub DI,CX ; if ( y2 >= Ymax )
|
||||
sbb AX,AX ; y2 = Ymax ;
|
||||
and DI,AX
|
||||
add DI,CX
|
||||
|
||||
sub DI,SI ; DI = y2 - y1
|
||||
jl short @@Lno_draw
|
||||
|
||||
mov AX,[BP+@@x11]
|
||||
mov CX,DI ; y2-y1
|
||||
mov BX,offset trapez_a ;a
|
||||
mov DX,[BP+@@x21]
|
||||
call make_linework
|
||||
|
||||
mov AX,[BP+@@x12]
|
||||
mov CX,DI ; y2-y1
|
||||
mov BX,offset trapez_b ;b
|
||||
mov DX,[BP+@@x22]
|
||||
call make_linework
|
||||
@@Ldraw:
|
||||
imul SI,SI,80
|
||||
mov DX,DI
|
||||
call draw_trapezoid
|
||||
@@Lno_draw:
|
||||
pop SI
|
||||
pop DI
|
||||
leave
|
||||
ret 12
|
||||
ENDFUNC
|
|
@ -60,92 +60,7 @@ include libs/master.lib/grcg_setcolor.asm
|
|||
include libs/master.lib/grcg_settile_1line.asm
|
||||
include libs/master.lib/grcg_triangle.asm
|
||||
include libs/master.lib/grcg_vline.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_1120 proc far
|
||||
; sub_1905A+DAP ...
|
||||
|
||||
arg_0 = word ptr 6
|
||||
arg_2 = word ptr 8
|
||||
arg_4 = word ptr 0Ah
|
||||
arg_6 = word ptr 0Ch
|
||||
arg_8 = word ptr 0Eh
|
||||
arg_A = word ptr 10h
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push di
|
||||
push si
|
||||
mov es, ClipYT_seg
|
||||
mov ax, ClipYT
|
||||
mov cx, ClipYH
|
||||
mov si, [bp+arg_A]
|
||||
sub si, ax
|
||||
js short loc_11AF
|
||||
mov di, [bp+arg_4]
|
||||
sub di, ax
|
||||
js short loc_11AF
|
||||
cmp si, di
|
||||
jg short loc_1175
|
||||
or di, di
|
||||
js short loc_11AF
|
||||
cmp si, cx
|
||||
jg short loc_11AF
|
||||
sub di, cx
|
||||
sbb ax, ax
|
||||
and di, ax
|
||||
add di, cx
|
||||
sub di, si
|
||||
jl short loc_11AF
|
||||
mov ax, [bp+arg_2]
|
||||
mov cx, di
|
||||
mov bx, 118Ch
|
||||
mov dx, [bp+arg_8]
|
||||
call make_linework
|
||||
mov ax, [bp+arg_0]
|
||||
mov cx, di
|
||||
mov bx, 1194h
|
||||
mov dx, [bp+arg_6]
|
||||
push 11A7h
|
||||
jmp make_linework
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_1175:
|
||||
xchg si, di
|
||||
or di, di
|
||||
js short loc_11AF
|
||||
cmp si, cx
|
||||
jg short loc_11AF
|
||||
sub di, cx
|
||||
sbb ax, ax
|
||||
and di, ax
|
||||
add di, cx
|
||||
sub di, si
|
||||
jl short loc_11AF
|
||||
mov ax, [bp+arg_8]
|
||||
mov cx, di
|
||||
mov bx, 118Ch
|
||||
mov dx, [bp+arg_2]
|
||||
call make_linework
|
||||
mov ax, [bp+arg_6]
|
||||
mov cx, di
|
||||
mov bx, 1194h
|
||||
mov dx, [bp+arg_0]
|
||||
call make_linework
|
||||
imul si, 50h
|
||||
mov dx, di
|
||||
call draw_trapezoid
|
||||
|
||||
loc_11AF:
|
||||
pop si
|
||||
pop di
|
||||
leave
|
||||
retf 0Ch
|
||||
sub_1120 endp
|
||||
|
||||
include libs/master.lib/grcg_trapezoid.asm
|
||||
include libs/master.lib/gaiji_backup.asm
|
||||
include libs/master.lib/gaiji_entry_bfnt.asm
|
||||
include libs/master.lib/gaiji_putca.asm
|
||||
|
@ -34178,7 +34093,7 @@ loc_190CF:
|
|||
mov ax, [bp+var_8]
|
||||
add ax, 6
|
||||
push ax
|
||||
call sub_1120
|
||||
call grcg_trapezoid
|
||||
push large 0C0000Ah
|
||||
call grcg_setcolor
|
||||
push 8
|
||||
|
@ -34195,7 +34110,7 @@ loc_190CF:
|
|||
mov ax, [bp+var_8]
|
||||
add ax, 3
|
||||
push ax
|
||||
call sub_1120
|
||||
call grcg_trapezoid
|
||||
push large 0C0000Fh
|
||||
call grcg_setcolor
|
||||
push 8
|
||||
|
@ -34212,7 +34127,7 @@ loc_190CF:
|
|||
mov ax, [bp+var_8]
|
||||
inc ax
|
||||
push ax
|
||||
call sub_1120
|
||||
call grcg_trapezoid
|
||||
jmp loc_191FF
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -34247,7 +34162,7 @@ loc_19179:
|
|||
mov ax, [bp+var_8]
|
||||
add ax, di
|
||||
push ax
|
||||
call sub_1120
|
||||
call grcg_trapezoid
|
||||
mov ax, di
|
||||
cwd
|
||||
sub ax, dx
|
||||
|
@ -34269,7 +34184,7 @@ loc_19179:
|
|||
mov ax, [bp+var_8]
|
||||
add ax, di
|
||||
push ax
|
||||
call sub_1120
|
||||
call grcg_trapezoid
|
||||
|
||||
loc_191E4:
|
||||
push large 0C0000Fh
|
||||
|
|
Loading…
Reference in New Issue