! Code draws an "8" in the center of the gx device,
! via combination of rectangles and color change.
!
	.include "gx.h"

	.text
	set	GX_BUFFER, %r1

	! open the device
	st	%r0, [%r1 + GX_CMD]

	! draw and fill rectangle at center
	set	135, %r3
	set	80, %r4
	set	240, %r5
	set	360, %r6

	st	%r3, [%r1+GX_FILL_X]
	st	%r4, [%r1+GX_FILL_Y]
	st	%r5, [%r1+GX_FILL_W]
	st	%r6, [%r1+GX_FILL_H]

	mov	GX_FILL, %r2
	st	%r2, [%r1+GX_CMD]

	! change drawing color to white
	set	1, %r8
	mov	GX_COLOR, %r2
	st	%r2, [%r1+GX_CMD]

	! draw and fill smaller rectangle at center top
	set	205, %r3
	set	130, %r4
	set	100, %r5

	st	%r3, [%r1+GX_FILL_X]
	st	%r4, [%r1+GX_FILL_Y]
	st	%r5, [%r1+GX_FILL_W]
	st	%r5, [%r1+GX_FILL_H]

	mov	GX_FILL, %r2
	st	%r2, [%r1+GX_CMD]
	
	! blit the previous rectangle to center bottom
	set	290, %r7

	st	%r3, [%r1+GX_BLIT_X1]
	st	%r4, [%r1+GX_BLIT_Y1]
	st	%r5, [%r1+GX_BLIT_W]
	st	%r5, [%r1+GX_BLIT_H]
	st	%r3, [%r1+GX_BLIT_X2]
	st	%r7, [%r1+GX_BLIT_Y2]
	
	mov	GX_BLIT, %r2
	st	%r2, [%r1+GX_CMD]
	
end:
	ta	0