*******************************************************************************
* simple double buffering example
*******************************************************************************
* INFO	shows how to work with a HalfRes double buffered display
* NOTE	- experiment with the display definition parameters
*	- LMB to exit anytime
*******************************************************************************

	machine	68020

	include	INCLUDES:libraries/tcs.i
	include	INCLUDES:libraries/tcs_lib.i



*******************************************************************************
* custom display definitions
*******************************************************************************

DSPLWD	=	320	;our TCS display width and
DSPLHT	=	256	;height in 140 ns pixels
SCRWD	=	160	;TCS screen width and
SCRHT	=	256	;height in pixels
DSPLX0	=	$81*4	;display start
DSPLY0	=	$2c	;position (SHRES pixels)
DSPLX1	=	DSPLX0+DSPLWD*4	;display end
DSPLY1	=	DSPLY0+DSPLHT	;position (SHRES pixels)
DSPLBRTNS	=	256	;max brightness
GFXCTXT	=	0
CWBTM	=	0
CWTOP	=	0
CWRT	=	0
CWLF	=	0
VDOMODE	set	TCS_VM_RGBW | TCS_VMf_chqr | TCS_VMf_MskPln ;TCS display video mode
VDOMODE	set	VDOMODE | TCS_VMf_DubBuf



*******************************************************************************
* code start
*******************************************************************************

	include	/includes/shl_strtup.i



*******************************************************************************
* init
*******************************************************************************

_PrgInit	move.w	#0,ccr	;OK!
	rts



*******************************************************************************
* main
*******************************************************************************

_PrgMain	movea.l	DIAdr,a0	;our display
	moveq.l	#0,d0	;x0
	moveq.l	#0,d1	;y0
	move.w	#SCRWD-1,d2	;x1
	move.w	#SCRHT-1,d3	;y1
	move.b	#255,d4	;color
	CALLTCS	DrwFrm0	;mark screen with a rectangle

	btst.b	#5,$dff01f
	beq.s	_PrgMain	;if not VERTB...
	move.w	#$20,$dff09c	;clr VERTB

	CALLTCS	DubSwp	;swap screen buffers

	btst.b	#6,$bfe001
	bne.s	_PrgMain	;if not LMB...
	rts



*******************************************************************************
* cleanup
*******************************************************************************

_PrgClnUp	rts



*******************************************************************************
* data
*******************************************************************************

	include	/includes/dat.i
