g_drawb.asm
bitfixer_bitfixer/dg/z88dk/libsrc/graphics/gray/g_drawb.asm
;
;       TI Gray Library Functions
;
;       Written by Stefano Bodrato - Mar 2001
;
;
;	$Id: g_drawb.asm,v 1.4 2015/01/19 01:32:49 pauloscustodio Exp $
;

;Usage: g_drawb(int tlx, int tly, int width, int height, int GrayLevel);


                PUBLIC    g_drawb

                EXTERN     drawbox
                EXTERN     plotpixel
                EXTERN     respixel
                EXTERN	graypage


.g_drawb
		ld	ix,0
		add	ix,sp
		ld	a,(ix+2)	;GrayLevel
		ld	b,(ix+4)	;H
		ld	c,(ix+6)	;W
		ld	l,(ix+8)	;y
		ld	h,(ix+10)	;x
		
		push	af
		xor	a
		call	graypage
		pop	af
                ld	ix,plotpixel
		rra
		jr	nc,set1
                ld	ix,respixel
.set1
		push	af
		push	hl
		push	bc
                call	drawbox
                pop	bc
		pop	hl
		pop	af

		push	af
		ld	a,1
		call	graypage
		pop	af

                ld	ix,plotpixel
		rra
		jr	nc,set2
                ld	ix,respixel
.set2
                jp	drawbox
