******************************************************************************
* tcs.i 21.4.1 (12.4.2000) - © 2000 Simone Bevilacqua
*
* public definitions
******************************************************************************



******************************************************************************
* TCSBase structure / TCSNAME macro

	rsreset
TCSBase	rs.b	$22	;LIB_SIZE=$22
tcsb_flgs	rs.b	1
tcsb_pad	rs.b	1
tcsb_SegLst	rs.l	1
tcsb_DOSBase	rs.l	1
tcsb_BFRPDIAdr	rs.l	1	;DI structure of display under Blitter-assisted FullRes pass
tcsb_BFRPStts	rs.b	1	;Blitter-assisted FullRes pass status:
			;2=VdoPln1 being converted;
			;1=VdoPln0 being converted;
			;0=not converting
TCSBase_SzOf	rs.b	0



	macro	TCSNAME
	dc.b	"tcs.library",0
	endm



******************************************************************************
* VideoModes definitions, bits and flags

TCS_VM_RGBW	=	0	;white mode
TCS_VM_RGBM	=	1	;modify mode
TCS_VM_RGBS	=	2	;strengthen mode
TCS_VM_RGBP	=	3	;pair mode
TCS_VM_RGB332	=	4	;332 mode
TCS_VM_RGBH	=	5	;hacked (332) mode
TCS_VM_last	=	5	;index of last mode

TCS_VMb_FPfld	=	24	;use as front playfield only
TCS_VMb_BltFRP	=	25	;enable Blitter-assisted FullRes
TCS_VMb_TriBuf	=	26	;enable triple buffering
TCS_VMb_DubBuf	=	27	;enable double buffering
TCS_VMb_FullRes	=	28	;enable 140ns pixels mode
TCS_VMb_MskPln	=	29	;enable MskPln
TCS_VMb_HScrl	=	30	;enable horizontal scrolling
TCS_VMb_chqr	=	31	;enable ChqrMode

TCS_VMf_FPfld	=	1<<TCS_VMb_FPfld
TCS_VMf_BltFRP	=	1<<TCS_VMb_BltFRP
TCS_VMf_TriBuf	=	1<<TCS_VMb_TriBuf
TCS_VMf_DubBuf	=	1<<TCS_VMb_DubBuf
TCS_VMf_FullRes	=	1<<TCS_VMb_FullRes
TCS_VMf_MskPln	=	1<<TCS_VMb_MskPln
TCS_VMf_HScrl	=	1<<TCS_VMb_HScrl
TCS_VMf_chqr	=	1<<TCS_VMb_chqr



******************************************************************************
* ClippingWindow structure

	rsreset
TCS_CW_btm	rs.w	1	;bottom side y coordinate
TCS_CW_top	rs.w	1	;top side y coordinate
TCS_CW_rt	rs.w	1	;right side x coordinate
TCS_CW_lf	rs.w	1	;left side x coordinate
TCS_CW_SzOf	rs.b	0



******************************************************************************
* GraphicContext bits, flags and structure

TCS_GCb_clp	=	0	;enable clipping
TCS_GCb_fill	=	1	;enable filling
TCS_GCb_eor	=	2	;enable exclusive-or drawing (STILL UNSUPPORTED)

TCS_GCf_clp	=	1<<TCS_GCb_clp
TCS_GCf_fill	=	1<<TCS_GCb_fill
TCS_GCf_eor	=	1<<TCS_GCb_eor

	rsreset
TCS_GC_flgs	rs.w	1	;drawing mode flags
TCS_GC_ClpWin	rs.b	TCS_CW_SzOf	;ClippingWindow structure
TCS_GC_SzOf	rs.b	0



******************************************************************************
* DisplayLimitations definitions

TCS_DL_MinX0	=	($18*2+17+16)*4	;minimum horizontal start
TCS_DL_MaxX1	=	($d8*2+17)*4	;maximum horizontal position
TCS_DL_MinY0	=	$1d	;minimum vertical start
TCS_DL_MaxY1	=	TCS_DL_MinY0+283	;maximum vertical position
TCS_DL_MinWd	=	128	;minimum display width in SHRES pixels
TCS_DL_MinHt	=	1	;minimum display height in pixels



******************************************************************************
* DisplayDeclaration structure

	rsreset
TCS_DD_VdoMode	rs.l	1	;display video mode
TCS_DD_UsrLst0	rs.l	1	;user copperlist0 address
TCS_DD_UsrLst1	rs.l	1	;user copperlist1 address
TCS_DD_DsplX0	rs.w	1	;coordinate of top-left pixel
TCS_DD_DsplY0	rs.w	1	;of display window (SHRES)
TCS_DD_DsplX1	rs.w	1	;coordinate of bottom-right pixel
TCS_DD_DsplY1	rs.w	1	;of display window (SHRES)
TCS_DD_ScrWd	rs.w	1	;screen width in TCS pixels
TCS_DD_ScrHt	rs.w	1	;screen height in lines
TCS_DD_brtns	rs.w	1	;start brightness
TCS_DD_GfxCtxt	rs.b	TCS_GC_SzOf	;GraphicContext structure
TCS_DD_SzOf	rs.b	0



******************************************************************************
* DisplayStatus bits and flags

TCS_DSb_shwn	=	0	;display currently shown
TCS_DSb_BPfld	=	1	;display used for back playfield
TCS_DSb_FPfld	=	2	;display used for front playfield
TCS_DSb_DXPfld	=	3	;Cross Playfield in Dual mode

TCS_DSf_shwn	=	1<<TCS_DSb_shwn
TCS_DSf_BPfld	=	1<<TCS_DSb_BPfld
TCS_DSf_FPfld	=	1<<TCS_DSb_FPfld
TCS_DSf_DXPfld	=	1<<TCS_DSb_DXPfld



******************************************************************************
* DisplayInfo structure

	rsreset
TCS_DI_mrk	rs.l	1	;safety keyword
TCS_DI_VdoMode	rs.l	1	;as "tuned" by InitPlns()
TCS_DI_MainLst	rs.l	1	;main copperlist address
TCS_DI_PalLst	rs.l	1	;normal palette copperlist address
TCS_DI_XPfldLst	rs.l	1	;Cross Playfield palette copperlist address
TCS_DI_BufLsts	rs.l	1	;buffering copperlists buffer address
TCS_DI_UsrLst0	rs.l	1	;user copperlist #0 address
TCS_DI_UsrLst1	rs.l	1	;user copperlist #1 address
TCS_DI_BufLstA	rs.l	1	;available copperlist address
TCS_DI_BufLstP	rs.l	1	;physic copperlist address
TCS_DI_BufLstR	rs.l	1	;ready copperlist address
TCS_DI_BufLstL	rs.l	1	;logic copperlist adrress
TCS_DI_VdoPln0A	rs.l	1	;plane useable for next rendering
TCS_DI_VdoPln0L	rs.l	1	;plane being used for rendering
TCS_DI_VdoPln0R	rs.l	1	;plane waiting to be displayed
TCS_DI_VdoPln0P	rs.l	1	;plane being displayed
TCS_DI_VdoPln1A	rs.l	1	;plane useable for next rendering
TCS_DI_VdoPln1L	rs.l	1	;plane being used for rendering
TCS_DI_VdoPln1R	rs.l	1	;plane waiting to be displayed
TCS_DI_VdoPln1P	rs.l	1	;plane being displayed
TCS_DI_SlcPln0	rs.l	1	;SlcPln0 address
TCS_DI_SlcPln1	rs.l	1	;SlcPln1 address
TCS_DI_MskPln	rs.l	1	;MskPln address
TCS_DI_PlnSz	rs.l	1	;size of a plane in bytes
TCS_DI_CSAdr	rs.l	1	;ChnkScr address
TCS_DI_CSSz	rs.l	1	;ChnkScr size in bytes
TCS_DI_BltFRBuf	rs.l	1	;Blitter-assisted FullRes pass buffer address
TCS_DI_OPfldDI	rs.l	1	;other playfield DI structure address
TCS_DI_BFRPVP0	rs.l	1	;VdoPlane0 adr for Blitter-assisted FullRes pass
TCS_DI_AmigaPal	rs.l	32	;32-bit Amiga actual palette buffer
TCS_DI_PlnWd	rs.w	1	;plane width in bytes
TCS_DI_PlnHt	rs.w	1	;plane height in pixels
TCS_DI_PlnMod	rs.w	1	;plane modulo in bytes
TCS_DI_CSWd	rs.w	1	;ChnkScr width in pixels/bytes
TCS_DI_CSHt	rs.w	1	;ChnkScr height in pixels
TCS_DI_CSMod	rs.w	1	;ChnkScr modulo in bytes
TCS_DI_DsplX0	rs.w	1	;coordinate of top-left corner of
TCS_DI_DsplY0	rs.w	1	;display window (as DIWSTRT+DIWHIGH)
TCS_DI_DsplX1	rs.w	1	;coordinate of bottom-right corner of
TCS_DI_DsplY1	rs.w	1	;display window (as DIWSTOP+DIWHIGH)
TCS_DI_DsplWd	rs.w	1	;display width in SHRES pixels
TCS_DI_DsplHt	rs.w	1	;display height in lines
TCS_DI_DsplBrtns	rs.w	1	;display current brightness
TCS_DI_ScrXPos	rs.w	1	;screen horizontal position
TCS_DI_ScrYPos	rs.w	1	;screen vertical position
TCS_DI_FPfldOpct	rs.w	1	;front playfield opacity
TCS_DI_GfxCtxt	rs.b	TCS_GC_SzOf	;GraphicContext structure
TCS_DI_TrnspCol	rs.b	1	;RGBx transparent color in Dual Cross Playfield
TCS_DI_DsplStts	rs.b	1	;display status flags
TCS_DI_SzOf	rs.b	0



******************************************************************************
* MainCopperList structure

	rsreset
TCS_MCL_DIWSTRT	rs.w	2
TCS_MCL_DIWSTOP	rs.w	2
TCS_MCL_DIWHIGH	rs.w	2
TCS_MCL_PushPC0	rs.w	4	;return address #0 to COP1LC
TCS_MCL_UsrLst0	rs.w	6	;gosub user coplst #0 or "fake" wait
TCS_MCL_RetAdr0	rs.b	0	;return address #0
TCS_MCL_DDFSTRT	rs.w	2
TCS_MCL_DDFSTOP	rs.w	2
TCS_MCL_BPLCON0	rs.w	2
TCS_MCL_BPLCON2	rs.w	2
TCS_MCL_BPLCON4	rs.w	2
TCS_MCL_BPL1MOD	rs.w	2
TCS_MCL_BPL2MOD	rs.w	2
TCS_MCL_SlcPln0	rs.w	4	;(BPL3PT)
TCS_MCL_SlcPln1	rs.w	4	;(BPL4PT)
TCS_MCL_MskPln	rs.w	4	;(BPL5PT)
TCS_MCL_PushPC1	rs.w	4	;return address #1 to COP1LC
TCS_MCL_PalLst	rs.w	6	;gosub palette copperlist
TCS_MCL_RetAdr1	rs.b	0	;return address #1
TCS_MCL_PushPC2	rs.w	4	;return address #2 to COP1LC
TCS_MCL_BufLst0	rs.w	6	;gosub this playfield buffering copperlist
TCS_MCL_RetAdr2	rs.b	0	;return address #2
TCS_MCL_PushPC3	rs.w	4	;return address #3 to COP1LC
TCS_MCL_BufLst1	rs.w	6	;gosub other playfield buffering copperlist
TCS_MCL_RetAdr3	rs.b	0	;return address #3
TCS_MCL_PushPC4	rs.w	4	;return address #4 to COP1LC
TCS_MCL_ChqrLst	rs.w	6	;gosub chequer copperlist
TCS_MCL_RetAdr4	rs.b	0	;return address #4
TCS_MCL_RestPC	rs.w	4	;start address to COP1LC
TCS_MCL_UsrLst1	rs.w	6	;gosub user coplst #1 or $fffffffe
TCS_MCL_SzOf	rs.b	0



******************************************************************************
* BufferingCopperList structure

	rsreset
TCS_BCL_BPLCON1	rs.w	2	;(scrolling must affect only logical screens)
TCS_BCL_pln0	rs.w	4	;(BPL1PT: VdoPln0; BPL5PT or BPL6PT: FPfldPln0)
TCS_BCL_pln1	rs.w	4	;(BPL2PT: VdoPln1; BPL6PT or BPL7PT: FPfldPln1)
TCS_BCL_ret0	rs.w	2	;return to main copperlist
TCS_BCL_chqr	rs.b	0	;start of chequer copperlist
TCS_BCL_ret1	rs.w	2	;return to main copperlist
TCS_BCL_SzOf	rs.b	0



******************************************************************************
* CrossPlayfieldCopperList structure

TCS_D_PalCMNo	=	1+32	;number of COPMOVEs to BPLCON3 & COLORxx per chunk

	rsreset
TCS_XPCL_pal	rs.l	TCS_D_PalCMNo*8	;crossed-palette copperlist (8 chunks max)
TCS_XPCL_ret	rs.w	2	;return to main copperlist
TCS_XPCL_SzOf	rs.b	0



******************************************************************************
* PictureErrcodes definitions

TCS_PE_LOWMEM	=	0	;not enough memory
TCS_PE_IO	=	1	;I/O error
TCS_PE_BADIFF	=	2	;uncorrect IFF file
TCS_PE_BADILBM	=	3	;uncorrect ILBM file
TCS_PE_DSPL	=	4	;couldn't open TCS display
TCS_PE_OK	=	5	;anything >= is OK



******************************************************************************
* ILBMInfo structure

	rsreset
TCS_II_BufAdr	rs.l	1	;user specified buffer address
TCS_II_GfxAdr	rs.l	1	;chunky graphics address
TCS_II_PalAdr	rs.l	1	;raw 24-bit palette address
TCS_II_PalDiff	rs.l	1	;palette mismatch degree
TCS_II_wd	rs.w	1	;picture width in pixels
TCS_II_ht	rs.w	1	;picture height in pixels
TCS_II_PlnsNo	rs.b	1	;picture # of bitplanes
TCS_II_RGBxMode	rs.b	1	;one of TCS_VM_RGBx
TCS_II_SzOf	rs.b	0



******************************************************************************
* IFFHeader structure

TCS_D_FORM	=	"TCSH"	;TCS Header mark
TCS_D_BODY	=	"TCSB"	;TCS Body mark

	rsreset
TCS_IH_PicWd	rs.w	1	;picture width in pixels
TCS_IH_PicHt	rs.w	1	;picture height in pixels
TCS_IH_DsplX0	rs.w	1	;coordinate of top-left corner of
TCS_IH_DsplY0	rs.w	1	;display window (as DIWSTRT+DIWHIGH)
TCS_IH_DsplX1	rs.w	1	;coordinate of bottom-right corner of
TCS_IH_DsplY1	rs.w	1	;display window (as DIWSTOP+DIWHIGH)
TCS_IH_DsplWd	rs.w	1	;display width in SHRES pixels
TCS_IH_DsplHt	rs.w	1	;display height in lines
TCS_IH_VdoMode	rs.b	1	;display video mode
TCS_IH_pad	rs.b	1	