;	私製ライブラリ・グラフィック篇
;	(c) MATSUUCHI Ryosuke in Dec, 1992
;
;	gboxline.asm
;
;	1992. 8.17(Mon)
;	1992.12.28(Sun)

		public	gboxline,grboxline,_gboxline,_grboxline
		extrn	_ghline:near, _gvline:near
		
		include	grplib.inc



		assume	cs:cseg, ds:dseg



dseg segment dword 'DATA'
dseg ends



cseg segment dword 'CODE'

;---------------------------------------------------------------
;	_grboxline : 四角形の描画
;		in  EAX:x
;		    EBX:y
;		    ECX:xlen
;		    EDX:ylen
;		    Esi:col
;		    edi:logop
;---------------------------------------------------------------


_grboxline	proc near
		pushad
		add	ecx,eax			;ecx := x2
		dec	ecx
		xchg	ebx,ecx			;ebx←x2,ecx←y
		xchg	edx,esi			;edx←col
		xchg	esi,edi			;esi←logop edi←ylen
		call	_ghline
		cmp	edi,2
		jl	#0
			push	ecx		;y を 保存
			add	ecx,edi		;ecx ← y2
			dec	ecx
			call	_ghline
			pop	ecx		;ecx ← y1
			cmp	edi,3
			jl	#1
				add	edi,ecx		;edi ← y2-1
				dec	edi
				dec	edi
				inc	ecx		;ecx ← y1+1
				xchg	ebx,ecx		;ebx ← /y1/
				xchg	ecx,edi		;ecx ← /y2/ edi←/x2/
				call	_gvline
				xchg	eax,edi
				call	_gvline
			#1:
		#0:
		popad
		ret
_grboxline	endp



grboxline	proc near
		pushad
		pushfd
		mov	eax,[esp+36+4]
		mov	ebx,[esp+36+8]
		mov	ecx,[esp+36+12]
		mov	edx,[esp+36+16]
		mov	esi,[esp+36+20]
		mov	edi,[esp+36+24]
		call	_grboxline
		popfd
		popad
		ret
grboxline	endp



_gboxline	proc near
		push	ecx
		push	edx
		cmp	eax,ecx
		jle	#0
			xchg	eax,ecx
		#0:
		sub	ecx,eax
		inc	ecx
		cmp	ebx,edx
		jle	#1
			xchg	ebx,edx
		#1:
		sub	edx,ebx
		inc	edx
		call	_grboxline
		pop	edx
		pop	ecx
		ret
_gboxline	endp



gboxline	proc near
		pushad
		pushfd
		mov	eax,[esp+36+4]
		mov	ebx,[esp+36+8]
		mov	ecx,[esp+36+12]
		mov	edx,[esp+36+16]
		mov	esi,[esp+36+20]
		mov	edi,[esp+36+24]
		call	_gboxline
		popfd
		popad
		ret
gboxline	endp



cseg ends

end
