;colorgrid

rout			;when this is off, the routine-file will be
			;assembled, on=testing
			
;debug			;when this is on, colors in the background will
			;show how much time the routine needs.

;ntsctest		;when this is on, the routineplayer is in ntsc-mode

;ocs			;off=AGA,on=OCS testing not possible on OCS !

routinemode	equ	27008	;the routinemode !


; VideoTracker AGA developer source 25-12-93
; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
; wich makes low-resolution overscan a bit ugly.
; no "interactive" support anymore, it's only used by Kick 1.3 users.

; the first part of the source handles the things that are necessary to
; show the picture/copper and playing of the routine.
; the part between the "***" lines is the routine-source.
; at the bottom of the file, there are the necessary incbin-files who
; are needed to test the routine.
; these are saved with "save effect" in videotracker. they are raw
; data files which can be fonts,pictures,landscapes,vectorobjects
; etcetra.
; the incbin-files are put in the "variables" table, in the routine
; player-handler
; the place where it's done can be found by searching for "!!!"

	opt	a+	;devpac 3 optimize
	opt	o+

vew_wid	equ	48
vew_hgt	equ	290
win_hgt	equ	117
win_str	equ	$1a

		ifd	ocs
pic_wid		equ	4		;wide in bytes
pic_hgt		equ	6		;hoogte
pic_dpt		equ	8		;number planes
pic_ani		equ	10		;aantal effes (anim)
pic_vew		equ	12		;viewmode
pic_cycstr	equ	14		;cycle start (*4)
pic_cycend	equ	15		;cycle end (*4)
pic_cycspd	equ	16		;cycle speed (*4)
pic_cycadd	equ	17		;cycle add (*4)
pic_palnum	equ	30		;aantal kleuren
pic_pal		equ	32		;palette start
pic_palsiz	equ	256*2		;vaste palette size
pic_raw		equ	pic_pal+pic_palsiz	;palette start
		endc
		
		ifnd	ocs
pic_wid		equ	4		;wide in bytes
pic_hgt		equ	6		;hoogte
pic_dpt		equ	8		;number planes
pic_ani		equ	10		;aantal effes (anim)
pic_vew		equ	12		;viewmode
pic_cycstr	equ	14		;cycle start (*8)
pic_cycend	equ	15		;cycle end (*8)
pic_cycspd	equ	16		;cycle speed (*8)
pic_cycadd	equ	17		;cycle add (*8)
pic_widmod	equ	46		;animation-width modulo
pic_future	equ	50		;free future space
pic_palnum	equ	62		;aantal kleuren
pic_pal		equ	64		;palette start
pic_palsiz	equ	256*4		;vaste palette size (longwords)
pic_raw		equ	pic_pal+pic_palsiz	;palette start
		endc
		
var_len		equ	$300		;lengte vartabel

var__GfxBase	equ	$000		;graphics lib
var_pic1	equ	$004		;current picture
var_anispd1	equ	$008		;animspeed
var_anitel1	equ	$00c		;animcount
var_cprbck	equ	$010		;copperback
var_bck		equ	$014		;background
var_pic2	equ	$018		;current picture
var_ntsc	equ	$01c		;ntsc/pal frequence
var_lnd		equ	$020		;landscape
var_anilop1	equ	$024
var_rottrg	equ	$028		;effect trigger
var_txt1	equ	$040		;text
var_txt16	equ	15*4+var_txt1
var_vec1	equ	$080		;vectors
var_vec16	equ	15*4+var_vec1
var_fon1	equ	$0c0		;fonts
var_fon16	equ	15*4+var_fon1
var_cols1	equ	$100		;colorsets
var_cols16	equ	15*4+var_cols1
var_obj1	equ	$180		;objects
var_obj16	equ	15*4+var_obj1

	ifd	rout
	;videotracker routine-test

	incdir	"w:include/"
	include	"exec/types.i"
	include	"graphics/gfxbase.i"
	include	"lvo/graphics_lib.i"
	incdir	'videotracker:effect/'

	SECTION	1,CODE_C
tus
	lea	var,a0

;	move.l	#rotincobj,var_obj1(a0)	;incbinfile !!!
;	move.l	#rotincbck,var_bck(a0)	;incbinfile !!!
;	move.l	#rottube,var_vec1(a0)	;incbinfile !!!
;	move.l	#rotsrc,curpic1		;picture !!!
;	move.l	#rotsrc,curpal1		;palette !!!
;	move.l	#rotset,var_cols1(a0)	;colorset !!!

	bsr	paltabres

	move.l	($4).w,a6
	sub.l	a1,a1
	jsr	-$126(a6)		;findtask
	move.l	d0,curtsk
	move.l	d0,a0
	move.l	$b8(a0),tskpri

	lea	dosnam,a1		;doslib openen
	moveq.l	#0,d0
	move.l	(4).w,a6
	jsr	-408(a6)		;openlib
	move.l	d0,doslib

	bsr.s	label5			;videotracker opstarten
	
	move.l	curtsk,a0
	move.l	tskpri,$b8(a0)
	move.l	($4).w,a6
	jsr	-$84(a6)		;forbid

	move.l	doslib,a1
	move.l	(4).w,a6
	jsr	-414(a6)		;closelib

	moveq.l	#0,d0
	rts
	
label5
	move.l	(4).w,a6		;workbench gedoe

	move.b	530(a6),ntscmode	;50/60 hertz halen

	ifd	ntsctest
	move.b	#60,ntscmode		;60 hertz (ntsc)
	endc

	cmp.b	#50,ntscmode		;ntsc ?
	beq.s	str.ntsc
	move.l	#vew_hgt-56,hogscr	;set NTSC screen hight
str.ntsc

	lea	cprjmp,a2		;copjmp zetten !
	move.l	#cprbck-8,d0
	move.w	d0,6(a2)
	swap	d0
	move.w	d0,2(a2)

	lea	cprbck-8,a2		;copstr zetten !
	move.l	#cpr,d0
	move.w	d0,6(a2)
	swap	d0
	move.w	d0,2(a2)

	bsr	cprsprrem		;sprites legen

	lea	gfxnam,a1		;graphics lib openen
	move.l	(4).w,a6
	jsr	-408(a6)		;openlib
	move.l	d0,a6
	move.l	d0,gfxlib
	move.l	38(a6),oldcprlist

	bset	#1,$bfe001
	bsr	copbuf			;copper vullen

	bsr	sysoff

gadrun
	btst	#6,($bfe001).l
	bne	gadrun

scrend
scrend.play
	bsr	syson

	move.l	gfxlib,a1
	move.l	(4).w,a6
	jsr	-414(a6)		;closelib

scrend.qb
	moveq.l	#0,d0	
	rts
	
	;vertical blank interrupt, no blits.
	;handles counters,interlace,sprite
	;level 3

intvb
	bra.s	intvb.cnt
	dc.l	'VIDU'
	dc.l	'LOOP'
intvb.cnt
	movem.l	d0-d7/a0-a6,-(sp)
	lea	($dff000).l,a6

	move.w	$01e(a6),d0
	btst	#5,d0			;vblank ?
	bne.s	intvb.vb

	bra.s	intcop.end

intvb.vb
	bsr	grap
	bsr	palctr			;palette zetten
	bsr.s	copbuf			;copper vullen
	
intvb.end
	move.w	#$0020,$09c(a6)	;vb bit wissen
	movem.l	(sp)+,d0-d7/a0-a6	;multitask uit, shit !
	rte

intcop.end
	movem.l	(sp)+,d0-d7/a0-a6
	move.l	intvbold,-(sp)
	rts

	;transmission buffer empty routine, BLIT !
	;handles routines,animations
	
inttbe					;tbe interrupt
	movem.l	d0-d7/a0-a6,-(sp)
	lea	($dff000).l,a6

	move.w	$01e(a6),d0
	btst	#0,d0			;no tbe ?
	beq.s	intdskblk


	btst	#6,($bfe001).l		;muis ingedrukt ?
	beq.s	inttbe.cop
	btst	#2,($dff016).l
	beq.s	inttbe.cop

	ifd	debug
	move.w	#$700,$dff180
	endc
	
	bsr	rotply			;routineplayer BLIT !
	bsr.s	copbuf			;copper vullen

	ifd	debug
	move.w	#$070,$dff180
	endc
	
inttbe.cop

inttbe.end
	move.w	#$0001,$09c(a6)
	movem.l	(sp)+,d0-d7/a0-a6
	rte

intdskblk
	move.w	#$0001,$09c(a6)		;be sure for no tbe handling
	movem.l	(sp)+,d0-d7/a0-a6
	move.l	inttbeold,-(sp)
	rts


	;moves the copperbuffer to the copperlist
	;sort of double buffering
	
copbuf
	movem.l	d0-d7/a0-a6,-(sp)

	lea	($dff000).l,a6

copbuf.novb				;copperchange overslaan
	moveq.l	#0,d0
	move.b	$005(a6),d0
	lsl.w	#8,d0
	moveq.l	#0,d1
	move.b	$006(a6),d1
	add.w	d1,d0

	cmp.w	#$4,d0			;lower limit, all stations 100%
	blt	copbuf.novb

	cmp.b	#50,ntscmode
	beq.s	copbuf.pal
	cmp.w	#$133-72-8,d0		;ntsc grens
	bge	copbuf.novb
	bra.s	copbuf.cont
copbuf.pal
	cmp.w	#$133-8,d0		;pal grens
	bge	copbuf.novb
copbuf.cont

	lea	gra.s,a0		;buffer copieren
	lea	cprbuf,a1
copbuf_aga				;AGA stuff :)
	move.l	#(gra.ql)/4-1,d0
copbuf.a
	move.w	2(a0),2(a1)
	add.l	#4,a0
	add.l	#4,a1
	dbra	d0,copbuf.a

copbuf.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

	;goes back to the workbench
	
syson
	movem.l	d0-d7/a0-a6,-(sp)

	move.w	#$0001,$dff09a		;tbeint uit
	move.l	intvbold,($6c).w
	move.l	inttbeold,($64).w

	move.l	4,a6
	jsr	-138(a6)		;permit

	move.l	gfxlib,a6
	jsr	-462(a6)		;disownblitter

	move.l	wbview,a1
	move.l	gfxlib,a6
	jsr	_LVOLoadView(a6) 	; Fix view
	jsr	_LVOWaitTOF(a6)
	jsr	_LVOWaitTOF(a6)         ; wait for LoadView()

syson.ras
	cmp.b	#$c0,$dff006		;prevent copperjump
	bne	syson.ras

	move.l	gfxlib,a6
	move.l	gb_copinit(a6),$dff080	 ; Kick it into life

	movem.l	(sp)+,d0-d7/a0-a6
	rts
	
	;goes back to the gadgetscreen
	
sysoff
	movem.l	d0-d7/a0-a6,-(sp)
 	
	move.l	gfxlib,a6
	move.l	gb_ActiView(a6),wbview	;current view
	sub.l	a1,a1			; clear a1
	jsr 	_LVOLoadView(a6) 	; Flush View to nothing
	jsr	_LVOWaitTOF(a6) 	; Wait once
	jsr	_LVOWaitTOF(a6) 	; Wait again.

	move.l	gfxlib,a6
	jsr	-456(a6)		;ownblitter

	move.l	4,a6
	jsr	-132(a6)		;forbid
		
	move.l	($6c).w,intvbold
	move.l	#intvb,($6c).w
	move.l	($64).w,inttbeold
	move.l	#inttbe,($64).w
	move.w	#$8001,$dff09a		;tbeint aan
	bsr	gracpr			;reset copper
	bsr	copbuf			;copy copper
	move.l	#cpr,$dff080

	movem.l	(sp)+,d0-d7/a0-a6
	rts
	
cprsprrem
	movem.l	d0-d7/a0-a6,-(sp)
	lea	cprspr,a0
	move.l	#sprdat,d0
	move.w	#7,d1
cprsprrem.a
	move.w	d0,3*2(a0)
	swap	d0
	move.w	d0,1*2(a0)
	swap	d0
	add.l	#8,a0
	dbra	d1,cprsprrem.a
	movem.l	(sp)+,d0-d7/a0-a6
	rts

varset					;variablen neerzetten
	movem.l	d0-d7/a0-a6,-(sp)
	move.l	#var,a0

	move.l	#cprbck,var_cprbck(a0)
	move.l	gfxlib,var__GfxBase(a0)
	move.b	ntscmode,var_ntsc(a0)

	move.l	curpic1,var_pic1(a0)	;variabel
	move.l	curpic2,var_pic2(a0)	;variabel
	move.w	anispd1,var_anispd1(a0)
	move.w	anitel1,var_anitel1(a0)
	move.b	anilop1,var_anilop1(a0)
	move.l	#rottrg,var_rottrg(a0)
	movem.l	(sp)+,d0-d7/a0-a6
	rts
	
	;this routine handles all videotracker-routines

rotply	
	movem.l	d0-d7/a0-a6,-(sp)

	moveq.l	#0,d0

	lea	currot1,a2		;routine 1
	move.w	rotinf1,d0		;routine info
	bsr.s	rotplyr

rotply.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

	;this routine handles 1 routine, BLIT !
	
rotplyr
	movem.l	d0-d7/a1-a6,-(sp)

	move.l	#rot,(a2)		;routinestart address

;	move.b	#50,ntscmode		;ntsc/pal hz
	clr.l	curpic2			;background picture
	move.w	#1,anispd1		;animationspeed
	clr.w	anitel1			;animation position

	lea	var,a0			;communication-table

	move.b	#0,anilop1		;animloop off/on !!!
	move.w	#32,anispd1		;animdelay !!!
	move.l	#routinemode,d0		;routinemode !!!

	sub.l	a0,a0			;picture info legen

	tst.l	(a2)			;is er een routine ?
	beq	rotplyr.end		;interlace handling

	move.l	intdel,d2		;delay
	move.l	inttel,d1		;teller
	cmp.w	d2,d1
	blt	rotplyr.end
	clr.l	inttel
				
	bsr	varset			;variabelen updaten

	move.l	(a2),a1			;routine halen
	move.l	#var,a0			;variablen tabel

	movem.l	d3-d7/a1-a6,-(sp)
	moveq.l	#0,d1			;vars wissen
	moveq.l	#0,d2
	moveq.l	#0,d3
	moveq.l	#0,d4
	moveq.l	#0,d5
	moveq.l	#0,d6
	moveq.l	#0,d7
	sub.l	a2,a2
	sub.l	a3,a3
	sub.l	a4,a4
	sub.l	a5,a5

	jsr	4(a1)			;routine afwerken
	movem.l	(sp)+,d3-d7/a1-a6

	;Routine:
	;
	;Input:
	;a0=variabelentabel
	;d0=routinemode
	;
	;Output:
	;a0=picture
	;d1=copperlist
	;d2=interruptdelay		(NOT used till now)
	
	move.w	#$0020,$dff09a		;vb off !

	move.l	d2,intdel		;delay

	lea	cprjmp,a3
	move.l	#cprbck-8,d0

	cmp.l	(a2),a1			;routine ondertussen gewipt ?
	bne.s	rotplyr.nocop
	tst.l	d1			;copperlist ?
	beq.s	rotplyr.nocop
	move.l	d1,d0
rotplyr.nocop
	move.w	d0,6(a3)
	swap	d0
	move.w	d0,2(a3)

	cmp.l	#0,a0			;picture ?
	beq.s	rotplyr.endvb

	move.l	a0,curpic1		;current picture (cycle)
	move.l	a0,curpal1		;current palette

	tst.b	rotdpl			;plane is geleverd
	beq.s	rotplyr.set
	clr.b	rotdpl
	clr.l	cycdel1			;cycle info wissen
	clr.l	4+cycdel1
	clr.l	curfrm1			;curfrm1, altijd planes zetten
rotplyr.set
	clr.b	dplctr
	bsr.s	grap
	bsr	grac			;colorset
rotplyr.endvb
	move.w	#$8020,$dff09a
rotplyr.end
	movem.l	(sp)+,d0-d7/a1-a6
	rts

	;removes possible routine-coppers
	
gracpr
	movem.l	d0-d7/a0-a6,-(sp)
	lea	cprjmp,a3
	move.l	#cprbck-8,d0		;copperlist resetten
	move.w	d0,6(a3)
	swap	d0
	move.w	d0,2(a3)
	movem.l	(sp)+,d0-d7/a0-a6
	rts

grap					;d7=anim
	movem.l	d0-d7/a0-a6,-(sp)

	clr.l	d7

	tst.l	curpic1			;current picture ?
	beq	grap.end

	move.l	curpic1,a2		;normal pic halen

	lea	gracprscr,a1		;window neerzetten
	move.l	hogscr,d1

	move.w	pic_hgt(a2),d3		;pic hoogte
	move.w	pic_vew(a2),d5
	btst	#2,d5			;interlace ?
	beq.s	grap.nohi4
	lsr.w	#1,d3			;/2
grap.nohi4
	cmp.w	d3,d1
	bge.s	grap.hog
	move.w	d1,d3
grap.hog
	sub.w	d3,d1
	lsr.w	#1,d1
	add.w	#win_str,d1
	move.w	d1,d2
	add.w	d3,d2

	move.b	d1,2(a1)		;y start
	move.b	d2,6(a1)		;y end

	move.w	pic_wid(a2),d4		;pic breedte in bytes
	lsl.l	#3,d4

	move.l	#vew_wid*8,d0
	move.l	#0,d1
	move.l	#$61,d6

	cmp.w	#40,pic_wid(a2)		;overscan ?
	ble.s	grap.noov1
	move.l	#$41,d6
grap.noov1

	move.w	pic_vew(a2),d5
	btst	#15,d5			;hires ?
	beq.s	grap.nohi2

	move.l	#(vew_wid)*8*2,d0
	move.l	#1,d1
	move.l	#$61,d6

	cmp.w	#80,pic_wid(a2)		;overscan ?
	ble.s	grap.nohi2
	move.l	#(vew_wid)*8*2,d0
	move.l	#$51,d6

	bra.s	grap.noshi2
grap.nohi2	
	btst	#6,d5			;super hires ?
	beq.s	grap.noshi2

	move.l	#(vew_wid)*8*4,d0
	move.l	#2,d1
	move.l	#$61,d6

	cmp.w	#80*2,pic_wid(a2)	;overscan ?
	ble.s	grap.noshi2
	move.l	#(vew_wid)*8*4,d0
	move.l	#$51,d6

grap.noshi2	

	clr.w	d5
	cmp.w	d0,d4			;breeder dan scherm ?
	ble.s	grap.c
	move.w	d4,d5
	move.w	d0,d4
	sub.w	d0,d5			;modulo
	lsr.w	#3,d5			;/8
grap.c
	lsr.w	d1,d0
	lsr.w	d1,d4

	move.w	d0,d2
	sub.w	d4,d2
	lsr.w	#1,d2			;/2

	add.w	d6,d2
	move.b	d2,3(a1)		;x start
	move.w	d2,d3			;d3 bewaren !

	add.w	d4,d2			;d4 bewaren !
	move.b	d2,7(a1)		;x end
	
	move.w	pic_vew(a2),d6
	btst	#15,d6			;hires ?
	beq.s	grap.nohi5	
	add.l	d4,d4			;*2
	bra.s	grap.noshi5
grap.nohi5
	btst	#6,d6			;super hires ?
	beq.s	grap.noshi5	
	add.l	d4,d4			;*4
	add.l	d4,d4
grap.noshi5

	move.l	d7,-(sp)
	move.w	pic_vew(a2),d6
	move.l	#17,d0
	move.l	#4,d1			;ecs 1
	move.l	#3,d7

	btst	#15,d6			;hires ?
	beq.s	grap.nohi3	
	move.l	#17,d0			;ecs 9
	move.l	#4,d1			;ecs 2
	move.l	#2,d7
	bra.s	grap.noshi3
grap.nohi3
	btst	#6,d6			;super hires ?
	beq.s	grap.noshi3	
	move.l	#17,d0			;ecs 9
	move.l	#4,d1			;ecs 2
	move.l	#1,d7
grap.noshi3
	sub.w	d0,d3
	lsr.w	#1,d3
	move.w	d3,10(a1)		;ddfstrt
	
	move.w	d4,d2			;pic breedte in pixels
	lsr.w	#4,d2			;/16
	sub.w	d1,d2			;-1

	lsl.w	d7,d2			;*8
	add.w	d2,d3
	move.w	d3,14(a1)		;ddfstop
	move.l	(sp)+,d7
	
	lea	pic_raw(a2),a0

	moveq.l	#0,d2
	move.w	pic_dpt(a2),d2
	sub.l	#1,d2
	muls	pic_wid(a2),d2
	add.w	d2,d5

	move.w	pic_vew(a2),d2		;viewmode add
	btst	#2,d2
	beq.s	grap.nolace4

	moveq.l	#0,d2
	move.w	pic_dpt(a2),d2
	muls	pic_wid(a2),d2
	add.w	d2,d5			;interlace gedoe
grap.nolace4

	lea	gracprbpl,a4		;iffpln neerzetten
	lea	gracprpln,a0		;iffpln neerzetten
	moveq.l	#0,d2
	move.w	pic_dpt(a2),d2		;plnnummer 1 halen
	move.l	#8,d6			;copper step !

	tst.l	curpic2			;2de picture ?
	bne.s	grap.pic2
grap.nopic2
	move.w	d5,34(a1)		;modulo oneven zetten
	bra	grap.nodpl
grap.pic2
	move.l	curpic2,a3		;oneven plane
	move.l	curpic2+4,a6		;oneven plane
	move.l	currot2,a5		;oneven plane
	clr.l	curpic2			;mischien niet goed
	clr.l	curpic2+4		;mischien niet goed
	clr.l	curpal2			;mischien niet goed
	clr.l	currot2			;mischien niet goed

	cmp.l	curpic1,a3		;picture hetzelfde ?
	beq.s	grap.nopic2
	
	cmp.l	#0,currot1		;routine ?	
	beq.s	grap.norot
	cmp.l	currot1,a5		;routine hetzelfde ?
	beq.s	grap.nopic2
grap.norot
	cmp.b	#4,d2			;> 16 kleuren ? (AGA)
	bgt	grap.nopic2

	move.w	pic_dpt(a3),d3		;plnnummer 2 halen
	cmp.b	d2,d3			;gelijke plnummers ?
	bne.s	grap.nopic2
	move.w	pic_vew(a2),d1
	cmp.w	pic_vew(a3),d1		;view gelijk ?
	bne.s	grap.nopic2

	move.w	pic_vew(a2),d1		;groter dan view test
	btst	#6,d1			;super hires ?
	beq.s	grap.nohi2a
	move.l	#vew_wid*4,d1
	bra.s	grap.nohi2b
grap.nohi2a
	btst	#15,d1			;hires ?
	beq.s	grap.noshi2a
	move.l	#vew_wid*2,d1
	bra.s	grap.nohi2b
grap.noshi2a
	move.l	#vew_wid,d1
grap.nohi2b
	cmp.w	pic_wid(a2),d1		;breder dan view ?
	bgt.s	grap.small
	cmp.w	pic_wid(a3),d1		;breder dan view ?
	bgt.s	grap.small

	move.w	pic_vew(a2),d1
	btst	#2,d1
	beq.s	grap.nolace8a
	move.l	hogscr,d1
	add.l	d1,d1
	bra.s	grap.nolace8b
grap.nolace8a
	move.l	hogscr,d1
grap.nolace8b
	cmp.w	pic_hgt(a2),d1		;hoger dan view ?
	bgt.s	grap.small
	cmp.w	pic_hgt(a3),d1		;hoger dan view ?
	bgt.s	grap.small
	bra.s	grap.big

grap.small
	move.w	pic_hgt(a2),d1		;wid+hgt<vew
	cmp.w	pic_hgt(a3),d1		;hoogte gelijk ?
	bne	grap.nopic2
	move.w	pic_wid(a2),d1
	cmp.w	pic_wid(a3),d1		;breedte gelijk ?
	bne	grap.nopic2

grap.big
	move.l	a3,curpic2		;toch wel goed !
	move.l	a6,curpic2+4
	move.l	a3,curpal2
	move.l	a5,currot2

	tst.b	dplctr			;dual playfield al gezet ?
	beq	grap.nocop

	move.w	30(a1),34(a1)		;modulo copieren

	move.w	2(a4),d1		;bplcon0
	btst	#10,d1			;al dual playfield ?
	beq.s	grap.ta

	move.w	2(a0),10(a0)		;plane 0>1 copieren
	move.w	6(a0),14(a0)

	move.w	18(a0),26(a0)		;plane 2>3 copieren
	move.w	22(a0),30(a0)

	move.w	34(a0),42(a0)		;plane 4>5 copieren
	move.w	38(a0),46(a0)

	move.w	50(a0),58(a0)		;plane 6>7 copieren
	move.w	54(a0),62(a0)

	bra.s	grap.tb
grap.ta
	move.w	24(a0),58(a0)		;plane 3>7 copieren
	move.w	28(a0),62(a0)

	move.w	18(a0),42(a0)		;plane 2>5 copieren
	move.w	22(a0),46(a0)

	move.w	10(a0),26(a0)		;plane 1>3 copieren
	move.w	14(a0),30(a0)

	move.w	2(a0),10(a0)		;plane 0>1 copieren
	move.w	6(a0),14(a0)

grap.tb
	move.l	#palette,a3		;palette copieren

	move.w	#16-1,d1
grap.pal
	move.l	(a3)+,60(a3)
	dbra	d1,grap.pal

grap.nocop
	add.w	d3,d2			;aantal bitplanes
	cmp.w	#8,d2			;8 bitplanes ?
	blt	grap.no8planes2
	move.w	#%10000,d2		;only bit 4
	bra	grap.8planes2
grap.no8planes2
	lsl.w	#8,d2
	lsl.w	#4,d2
grap.8planes2
	or.w	#$400,d2		;dual playfield aan
	move.w	d2,2(a4)		;bplcon0

	movem.l	d0-d7/a0-a6,-(sp)

	move.l	curpic,a2		;animpic ?
	move.l	curfrm,d7
	cmp.l	#0,a2
	bne.s	grap.noanipic

	move.l	curpic2,a2		;normal pic ?
	move.l	curfrm2,d7
	cmp.l	#0,a2
	beq.s	grap.nodplpic

grap.noanipic
	add.l	d6,a0
	add.w	d6,d6
	bsr.s	grappln			;a2,d6,d7,d0
grap.nodplpic
	movem.l	(sp)+,d0-d7/a0-a6
	add.w	d6,d6
	bra.s	grap.nodpla


grap.nodpl				;geen dual playfield
	cmp.w	#8,d2			;8 bitplanes ?
	blt	grap.no8planes
	move.w	#%10000,d2		;only bit 4
	bra	grap.8planes
grap.no8planes
	lsl.w	#8,d2
	lsl.w	#4,d2
grap.8planes
	move.w	d2,2(a4)		;bplcon0

grap.nodpla
	move.w	d5,30(a1)		;modulo even

	moveq.l	#0,d3
	add.w	pic_vew(a2),d3		;viewmode add
	moveq.l	#0,d2
	move.w	2(a4),d2
	or.l	d3,d2

	ifd	gui
	tst.b	genlck
	bne	grap.genset
	endc

	or.l	#$100,d2		;genlock off ($302)

	ifd	gui
	bra	grap.gencont
grap.genset
	or.l	#$102,d2		;genlock on ($302)
grap.gencont
	endc
	
	move.w	d2,2(a4)
	
	bsr.s	grappln			;a2,d6,d7,d0

grap.end
	
	movem.l	(sp)+,d0-d7/a0-a6
	rts
		

	;sets on of the 2 possible pictures to the copper
	;handles interlace

	;d7=framenummer
	;d6=copperliststap
	;d0=raw planes positie
	;a2=current picture
grappln					;planes invullen 
	movem.l	d0-d7/a0-a6,-(sp)

	lea	pic_raw(a2),a1
	move.l	a1,d0			;raw planes
	
	moveq.l	#0,d2			;x*y
	move.w	pic_wid(a2),d2
	lsr.l	#1,d2			;/2
	moveq.l	#0,d3
	move.w	pic_hgt(a2),d3
	muls	d3,d2
	
	move.l	d2,d4
	add.l	d2,d2

	move.w	pic_dpt(a2),d3
	muls	d3,d4			;hele picture size
	muls	d7,d4			;frame*size d7 !!!

	add.l	d4,d4

	add.l	d4,d0

	move.l	#vew_wid,d5		;max x view
	move.l	hogscr,d4		;max y view
	move.w	pic_vew(a2),d1		;viewmode add
	btst	#2,d1
	beq.s	grappln.nolace
	add.l	d4,d4			;max y view
grappln.nolace
	btst	#15,d1			;hires ?
	beq.s	grappln.nohi
	move.l	#vew_wid*2,d5		;max x view
	bra.s	grappln.noshi
grappln.nohi
	btst	#6,d1			;super hires ?
	beq.s	grappln.noshi
	move.l	#vew_wid*4,d5		;max x view
grappln.noshi

	moveq.l	#0,d3			;scherm centreren
	move.w	pic_wid(a2),d3		;pic breedte in bytes
	cmp.w	d5,d3			;breder dan scherm ?
	ble.s	grappln.qa
	sub.w	d5,d3			;-scherm breedte
	lsr.w	#2,d3			;/4

	add.l	d3,d3

	add.l	d3,d0
grappln.qa
	move.w	pic_hgt(a2),d3		;pic hoogte in bytes
	cmp.w	d4,d3			;hoger dan scherm ?
	ble.s	grappln.qb
	sub.w	d4,d3			;-scherm breedte
	lsr.w	#1,d3			;/2
	moveq.l	#0,d5
	move.w	pic_wid(a2),d5		;pic breedte in bytes
	muls	pic_dpt(a2),d5
	muls	d5,d3
	add.l	d3,d0
grappln.qb
	moveq.l	#0,d2
	move.w	pic_wid(a2),d2

	move.w	pic_vew(a2),d5		;interlace flipping ?
	btst	#2,d5
	beq.s	grappln.nolac7b

	move.w	$04(a6),d5		;even/oneven ?
	btst	#15,d5
	beq.s	grappln.nolac7b
	
	moveq.l	#0,d3
	move.w	pic_wid(a2),d3
	muls	pic_dpt(a2),d3
	add.l	d3,d0
grappln.nolac7b

	move.w	pic_dpt(a2),d1		;plnnummer 1 halen
	tst.w	d1			;0 planes ?
	beq	grappln.end
	sub.w	#1,d1
grappln.a
	move.w	d0,3*2(a0)
	swap	d0
	move.w	d0,1*2(a0)
	swap	d0
	add.l	d6,a0			;d6=copper step !
	add.l	d2,d0
	dbra	d1,grappln.a

	cmp.w	#8,pic_dpt(a2)		;8 planes ?
	bne	grappln.noham8
	btst	#3,pic_vew(a2)		;ham ?
	beq	grappln.noham8

	move.w	-14(a0),d0		;get 6
	move.w	-10(a0),d1
	move.w	-6(a0),d2		;get 7
	move.w	-2(a0),d3
	move.w	-18(a0),-2(a0)		;5>7
	move.w	-22(a0),-6(a0)		;5>7
	move.w	-26(a0),-10(a0)		;4>6
	move.w	-30(a0),-14(a0)		;4>6
	move.w	-34(a0),-18(a0)		;3>5
	move.w	-38(a0),-22(a0)		;3>5
	move.w	-42(a0),-26(a0)		;2>4
	move.w	-46(a0),-30(a0)		;2>4
	move.w	-50(a0),-34(a0)		;1>3
	move.w	-54(a0),-38(a0)		;1>3
	move.w	-58(a0),-42(a0)		;0>2
	move.w	-62(a0),-46(a0)		;0>2
	move.w	d0,-62(a0)		;6>0
	move.w	d1,-58(a0)		;6>0
	move.w	d2,-54(a0)		;7>1
	move.w	d3,-50(a0)		;7>1
grappln.noham8

grappln.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

	;sets palettes to palette-buffer
	
grac
	movem.l	d0-d7/a0-a6,-(sp)

	lea	curpal1,a3		;palette 1
	move.l	#palette,a1
	bsr.s	gracfrm

	lea	curpal2,a3		;palette 2 (dpl)
	move.l	#16*4+palette,a1
	bsr.s	gracfrm
	
	bsr	palctr			;palette-buffer to copper
grac.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts
		
	;moves palette from picture to palette-buffer

gracfrm
	movem.l	d0-d7/a0-a6,-(sp)
	tst.l	(a3)			;palette aanwezig ?
	beq.s	gracfrm.end

	move.l	(a3),a2			;current palette
	
	cmp.l	#'PALE',(a2)		;palette ?
	bne.s	gracfrm.pict
	lea	6(a2),a0		;palette
	move.w	4(a2),d0		;aantal kleuren
	bra.s	gracfrm.col
gracfrm.pict
	cmp.l	#'ANIM',(a2)		;animatie ?
	bne.s	gracfrm.noanim

	moveq.l	#0,d1
	move.w	pic_ani(a2),d1
	bclr	#7,d1			;behandelbit weghalen

	moveq.l	#0,d3
	move.w	pic_wid(a2),d3
	lsr.w	#1,d3			;/2
	muls	pic_hgt(a2),d3
	muls	pic_dpt(a2),d3

	add.l	d3,d3

	add.l	#pic_raw,d3
	move.l	d3,d5

	btst	#0,d1
	bne.s	gracfrm.buf2
	moveq.l	#0,d5
gracfrm.buf2
	add.l	d5,a2
gracfrm.noanim
	lea	pic_pal(a2),a0		;palette
	move.w	pic_palnum(a2),d0

	tst.w	d0			;0 planes ?
	beq.s	gracfrm.end
gracfrm.col
gracfrm.fa
	move.l	(a0)+,(a1)+
	dbra	d0,gracfrm.fa
gracfrm.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts
	
	;handles colorcycling in the palette-buffer

palcycctr
	movem.l	d0-d7/a0-a6,-(sp)

	move.l	curpic1,a2		;current raw
	cmp.l	#0,a2
	beq.s	palcycctr.qb
	lea	cycdel1,a3		;cycle delays
	move.l	#paltab,a4
	bsr	palcyc
palcycctr.qb
	move.l	curpic2,a2		;current raw
	cmp.l	#0,a2
	beq.s	palcycctr.c
	lea	cycdel2,a3		;cycle delays
	move.l	#16*2+paltab,a4
	bsr	palcyc
palcycctr.c
	movem.l	(sp)+,d0-d7/a0-a6
	rts
	
	;copies palette-buffer to copper

palctr
	movem.l	d0-d7/a0-a6,-(sp)

	lea	gracprcol,a1		;AGA
	move.l	#palette,a0
	move.l	#paltab,a2
	move.w	#8-1,d6
palctr.e
	move.w	#32-1,d7
palctr.d
	move.w	(a2)+,d0			;get cycle-position
	move.w	(a0,d0),6(a1)			;high RGB bits
	move.w	2(a0,d0),((32+1)*4)+6(a1)	;low RGB bits
	add.l	#4,a1
	dbra	d7,palctr.d
	add.l	#((32+2)*4),a1
	dbra	d6,palctr.e
palctr.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

	;reset palette tabel, for proper color cycling

paltabres
	movem.l	d0-d7/a0-a6,-(sp)
	lea	paltab,a0
	clr.l	d0
	move.w	#256-1,d1
paltabres.a
	move.w	d0,(a0)+
	add.w	#4,d0			;aga color words, high RGB + low RGB
	dbra	d1,paltabres.a
paltabres.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

	;colorcyclinghandling of a palette

palcyc
	movem.l	d0-d7/a0-a6,-(sp)
	move.w	#4-1,d7			;4 cycles
palcyc.d
	tst.w	(a3)+			;delay klaar ?
	bne.s	palcyc.c
	
	moveq.l	#0,d1
	move.b	pic_cycstr(a2),d1	;start color
	lsl.b	#1,d1		;*2

	moveq.l	#0,d2
	move.b	pic_cycend(a2),d2	;end color
	lsl.b	#1,d2		;*2

	moveq.l	#0,d3
	move.b	pic_cycadd(a2),d3	;richting

	move.l	a4,a0			;palette pointer
	move.l	a0,a1
	add.l	d1,a0			;startcolor
	add.l	d2,a1			;endcolor
	
	cmp.b	#1,d3			;omhoog
	beq.s	palcyc.up	
	cmp.b	#3,d3			;omlaag
	beq.s	palcyc.down
	bra.s	palcyc.i

palcyc.up				;kleuren copieren
	move.w	(a1),d4			;laatst color bewaren
palcyc.f				;kleuren copieren
	cmp.l	a0,a1
	beq.s	palcyc.fa
	move.w	-(a1),2(a1)
	bra.s	palcyc.f
palcyc.fa
	move.w	d4,(a1)
	bra.s	palcyc.g	
	
palcyc.down
	move.w	(a0),d4			;laatst color bewaren
palcyc.h				;kleuren copieren
	cmp.l	a0,a1
	beq.s	palcyc.ha
	move.w	2(a0),(a0)+
	bra.s	palcyc.h
palcyc.ha
	move.w	d4,(a1)

palcyc.g
	move.b	pic_cycspd(a2),-1(a3)	;delay zetten
	bra.s	palcyc.i
palcyc.c
	sub.w	#1,-2(a3)		;cycle delay aftellen
palcyc.i
	add.l	#4,a2			;next cycle info
	dbra	d7,palcyc.d

palcyc.qb
	movem.l	(sp)+,d0-d7/a0-a6
	rts



;	SECTION	variabelen,DATA_c

	cnop	0,2
curtsk		dc.l	0
tskpri		dc.l	0
duplok		dc.l	0
inttel		dc.l	0
intdel		dc.l	0

form		dc.l	0
ifffil		dc.l	0
intvbold	dc.l	0
inttbeold	dc.l	0
patpos		dc.l	0
gfxlib		dc.l	0
doslib		dc.l	0
wbview  	dc.l	0
mt_data		dc.l	0
memvid		dc.l	0
oldcprlist	dc.l	0
hogscr		dc.l	vew_hgt

inspos		dc.l	-1
anispd1		dc.w	1	;nooit op 0 !
anispd2		dc.w	1

		cnop	0,2
varclr.s			;start wissen
oldrot		dc.l	0
curpic		dc.l	0
curfrm		dc.l	0
cycdel1		ds.w	4
cycdel2		ds.w	4

rotinf1		dc.w	0
rotinf2		dc.w	0

effspd		dc.w	0
efflop		dc.b	0
anilop1		dc.b	0
anilop2		dc.b	0
anipal1		dc.b	0
anipal2		dc.b	0
rotdpl		dc.b	1
rottrg		dc.b	0
dplctr		dc.b	0
		cnop	0,2

insdat		ds.l	4
inspri		dc.l	0
instel		dc.w	0

cureff		dc.l	0
efftel		dc.w	0

curpal1		dc.l	0
curpal2		dc.l	0
currot1		dc.l	0
currot2		dc.l	0
curpic1		dc.l	0
curpic2		dc.l	0
anitel1		dc.w	0
anitel2		dc.w	0
curfrm1		dc.l	0
curfrm2		dc.l	0
oldfrm1		dc.l	0
oldfrm2		dc.l	0

varclr.e
		dc.l	0			;wisruimte
	
varclr.ql	equ	varclr.e-varclr.s	;wislengte
	
ntscmode	dc.b	0
end		dc.b	0

pronam	dc.b	'VideoTracker',0
	cnop	0,2
dosnam	dc.b	'dos.library',0
	cnop	0,4
gfxnam	dc.b	'graphics.library',0
	cnop	0,4
	
	cnop	0,4
gra.s			;copperlist edit buffer
gracprscr
	dc.w	$8e,$3381,$90,$81c1,$92,$003c,$94,$00d0
gracprbpl
	dc.w	$100,$0000,$102,$0000,$104,$0020
	dc.w	$108,$0000,$10a,$0000,$1fc,$0003
gracprpln
	dc.w	$e0,$0000,$e2,$0000	;1
	dc.w	$e4,$0000,$e6,$0000	;2
	dc.w	$e8,$0000,$ea,$0000	;3
	dc.w	$ec,$0000,$ee,$0000	;4
	dc.w	$f0,$0000,$f2,$0000	;5
	dc.w	$f4,$0000,$f6,$0000	;6
	dc.w	$f8,$0000,$fa,$0000	;7
	dc.w	$fc,$0000,$fe,$0000	;8
gracprcol
	dc.w	$106,$0000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$0200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$2000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$2200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$4000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$4200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$6000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$6200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$8000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$8200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$a000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$a200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$c000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$c200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$e000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$e200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$1000

cprjmp
	dc.w	$080,0,$082,0
gra.e
gra.ql	equ	gra.e-gra.s		;block lengte

cpr					;real copperlist
	dc.w	$0001,$fffe
	dc.w	$09c,$8001		;tbeint
cprspr
	dc.w	$120,$0000,$122,$0000
	dc.w	$124,$0000,$126,$0000
	dc.w	$128,$0000,$12a,$0000
	dc.w	$12c,$0000,$12e,$0000
	dc.w	$130,$0000,$132,$0000
	dc.w	$134,$0000,$136,$0000
	dc.w	$138,$0000,$13a,$0000
	dc.w	$13c,$0000,$13e,$0000

cprbuf
	dc.w	$8e,$3381,$90,$81c1,$92,$003c,$94,$00d0
	dc.w	$100,$9000,$102,$0000,$104,$0020
	dc.w	$108,$0000,$10a,$0000,$1fc,$0003

	dc.w	$e0,$0000,$e2,$0000	;0
	dc.w	$e4,$0000,$e6,$0000	;1
	dc.w	$e8,$0000,$ea,$0000	;2
	dc.w	$ec,$0000,$ee,$0000	;3
	dc.w	$f0,$0000,$f2,$0000	;4
	dc.w	$f4,$0000,$f6,$0000	;5
	dc.w	$f8,$0000,$fa,$0000	;6
	dc.w	$fc,$0000,$fe,$0000	;7

	dc.w	$106,$0000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$0200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$2000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$2200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$4000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$4200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$6000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$6200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$8000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$8200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
 	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$a000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$a200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$c000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$c200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$e000
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
	dc.w	$106,$e200
	dc.w	$180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
	dc.w	$190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
	dc.w	$1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
	dc.w	$1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0

	dc.w	$106,$1000

	dc.w	$080,0,$082,0
cprbuf.e

	dc.w	$088,$0000		;copjmp2
	dc.w	$080,0,$082,0		;moet achter cprbck blijven !
cprbck
sprdat
	dc.w	$ffff,$fffe

palette		ds.l	256		;palette 24-bits, far out !
paltab		ds.w	256		;palette cycle-tabel

	cnop	0,2
var	ds.b	$300	;variabelen voor routines

	
;	SECTION	10,CODE_C
		endc

; this is the routine-source
;**********************************************************************

;	Input:
;	a0=variabelen tabel
;	d0=routinfo

;	Output:
;	a0=picture
;	d1=copperlist

	SECTION	3,CODE
	cnop	0,8
rot
rotp
	ifd	ocs
	dc.l	'ROTO'
	endc
	ifnd	ocs
	dc.l	'ROTA'
	endc
	movem.l	d2-d7/a1-a6,-(sp)

	lea	($dff000).l,a6	;hardware
	lea	rot,a5		;prog base
	ifd	rout
	move.l	#rotc,a2
	endc
	move.l	a2,rotchp-rot(a5)
	
	bclr	#15,d0		;bit weghalen
	
	move.l	d0,d1
	divs	#4096,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolfil-rot(a5)	;fillup data
	muls	#4096,d1
	sub.l	d1,d0

	move.l	d0,d1
	divs	#2048,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolrot3-rot(a5)	;routinenummer 3
	muls	#2048,d1
	sub.l	d1,d0
	move.l	d0,d1
	divs	#256,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolnum3-rot(a5)	;kleurnummer 3
	muls	#256,d1
	sub.l	d1,d0

	move.l	d0,d1
	divs	#128,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolrot2-rot(a5)	;routinenummer 2
	muls	#128,d1
	sub.l	d1,d0
	move.l	d0,d1
	divs	#16,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolnum2-rot(a5)	;kleurnummer 2
	muls	#16,d1
	sub.l	d1,d0

	move.l	d0,d1
	divs	#8,d1
	and.l	#$ffff,d1
	move.l	d1,rotcolrot1-rot(a5)	;routinenummer 1
	muls	#8,d1
	sub.l	d1,d0
	move.l	d0,rotcolnum1-rot(a5)	;kleurnummer 1

	bsr	rotfil			;copper vullen

	move.l	var_cprbck(a0),d1
	sub.l	#8,d1

	move.l	rotchp-rot(a5),a1
	add.l	#rot.cop1-rotc,a1	;copperjump adres zetten
	add.l	rot.buf-rot(a5),a1	;double buffer
	move.w	d1,6(a1)
	swap	d1
	move.w	d1,2(a1)

	move.l	rotchp-rot(a5),a1
	add.l	#rot.cop1-rotc,a1	;splitscreen zetten
	add.l	rot.buf-rot(a5),a1	;double buffer
	move.l	a1,a2
	add.l	#rot.cprbck1ntsc-rot.cop1,a2
	move.l	a1,a3
	add.l	#rot.cprend1ntsc-rot.cop1,a3
	move.l	a1,a4
	add.l	#rot.cprbck1-rot.cop1,a4

	cmp.b	#50,var_ntsc(a0)	;ntsc/pal frequence
	bne	rot.ntsc

	move.l	#$8b29fffe,(a2)	;reset ntsc split
	move.l	#$fb29fffe,(a3)	;reset ntsc end
	add.l	#rot.cprbck1-rot.cop1,a1
	move.l	#$c329fffe,d0
	bra	rot.split
rot.ntsc
	move.l	#$c329fffe,(a4)	;reset pal split
	move.l	#$00880000,(a3)	;set ntsc end
	add.l	#rot.cprbck1ntsc-rot.cop1,a1
	move.l	#$8b29fffe,d0

rot.split
	move.l	#$00880000,(a1)	;set break
	move.l	var_cprbck(a0),a2
	cmp.b	#$ff,(a2)		;menu uit ?
	bne	rot.a
	move.l	d0,(a1)
rot.a

	move.l	rotcolrot1-rot(a5),d7
	move.l	rotcolnum1-rot(a5),d6
	move.l	#0,d4
	bsr	rotset
	
	move.l	rotcolrot2-rot(a5),d7
	move.l	rotcolnum2-rot(a5),d6
	move.l	#4,d4
	bsr	rotset
	
	move.l	rotcolrot3-rot(a5),d7
	move.l	rotcolnum3-rot(a5),d6
	move.l	#8,d4
	bsr	rotset
	

	sub.l	a0,a0		;geen pic

	ifd	rout
	move.l	#rotpic,a0	;testpicture !!!
	endc

	move.l	rotchp-rot(a5),a1
	add.l	#rot.cop1-rotc,a1
	add.l	rot.buf-rot(a5),a1	;double buffer
	move.l	a1,d1
	eor.l	#rot.cop2-rot.cop1,rot.buf-rot(a5)	;buffer swap
	movem.l	(sp)+,d2-d7/a1-a6
	rts

rotset
	movem.l	d0-d7/a0-a6,-(sp)
	tst.b	d7			;welke routine ?
	bne	rotset.bb
	bsr	rotbig
	bra	rotset.end
rotset.bb
	cmp.b	#1,d7
	bne	rotset.c
	bsr	rotcol
	bra	rotset.end
rotset.c
rotset.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

rotcol
	movem.l	d0-d7/a0-a6,-(sp)
	lea	rot.ctab,a0		;kleureninfo
	muls	#5*2,d6
	add.l	d6,a0
	
	move.l	rotchp-rot(a5),a1
	add.l	#rot.copcol1-rotc,a1		;copperlist
	add.l	rot.buf-rot(a5),a1	;double buffer
	add.l	d4,a1			;coppos

	cmp.w	#$102,4(a1)		;zichtbaar ?
	beq	rotcol.end

	move.w	(a0),d0
	move.w	2(a0),d1
	move.w	4(a0),d2

	move.w	#16-1,d3
rotcol.a
	move.w	d0,d5
	move.w	#16-1,d7
rotcol.c
	move.w	d0,6(a1)
	move.w	d0,196+6(a1)
	move.w	d0,2*196+6(a1)
	move.w	d0,3*196+6(a1)
	move.w	d0,4*196+6(a1)
	move.w	d0,5*196+6(a1)
	move.w	d0,6*196+6(a1)
	move.w	d0,7*196+6(a1)
	move.w	d0,8*196+6(a1)
	move.w	d0,9*196+6(a1)
	move.w	d0,10*196+6(a1)
	move.w	d0,11*196+6(a1)
	move.w	d0,12*196+6(a1)
	move.w	d0,13*196+6(a1)
	move.w	d0,14*196+6(a1)
	move.w	d0,15*196+6(a1)
	move.w	d0,16*196+6(a1)
	add.w	d1,d0
	lea	12(a1),a1
	dbra	d7,rotcol.c

	add.l	#(17*(12*16+4)-(12*16)),a1
	move.w	d5,d0
	add.w	d2,d0
	dbra	d3,rotcol.a

	move.w	(a0),d0
	move.w	6(a0),d1
	add.w	d1,d0
	move.w	d0,(a0)

	add.w	#1,8(a0)
	cmp.w	#15,8(a0)
	bne	rotcol.f
	clr.w	8(a0)
	neg.w	6(a0)
rotcol.f
rotcol.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

rotbig
	movem.l	d0-d7/a0-a6,-(sp)
	lea	rot.ctab2,a0		;kleureninfo
	muls	#4*5,d6
	add.l	d6,a0
	
	move.l	rotchp-rot(a5),a1
	add.l	#rot.copcol1-rotc,a1
	add.l	rot.buf-rot(a5),a1	;double buffer
	add.l	d4,a1			;coppos

	cmp.w	#$102,4(a1)		;zichtbaar ?
	beq	rotbig.end
	
	move.l	(a0)+,a2		;colortabel
	add.l	a5,a2
	
	move.l	(a2)+,d6		;breedte in words
	
	move.l	(a0)+,a3		;x movtab
	add.l	a5,a3

	move.l	(a0),d0			;x pos halen
	cmp.w	#-1,(a3,d0)		;einde ?
	bne	rotbig.g
	clr.l	d0
rotbig.g
	clr.l	d1
	move.w	(a3,d0),d1
	add.l	d1,d1			;*2
	add.l	d1,a2			;+x
	add.l	#2,d0
	move.l	d0,(a0)+		;x pos zettem
	
	move.l	(a0)+,a3		;y movtab
	add.l	a5,a3

	move.l	(a0),d0			;y pos halen
	cmp.w	#-1,(a3,d0)		;einde ?
	bne	rotbig.ga
	clr.l	d0
rotbig.ga
	clr.l	d1
	move.w	(a3,d0),d1
	add.l	d1,d1			;*2
	muls	d6,d1			;*breedte in words
	add.l	d1,a2			;+y
	add.l	#2,d0
	move.l	d0,(a0)+		;y pos zettem
	
	add.l	d6,d6			;*2
	sub.l	#16*2,d6		;breedte>modulo

	move.w	#16-1,d3
rotbig.a
	move.w	#16-1,d7
rotbig.c
	move.w	(a2)+,d0
	move.w	d0,6(a1)
	move.w	d0,196+6(a1)
	move.w	d0,2*196+6(a1)
	move.w	d0,3*196+6(a1)
	move.w	d0,4*196+6(a1)
	move.w	d0,5*196+6(a1)
	move.w	d0,6*196+6(a1)
	move.w	d0,7*196+6(a1)
	move.w	d0,8*196+6(a1)
	move.w	d0,9*196+6(a1)
	move.w	d0,10*196+6(a1)
	move.w	d0,11*196+6(a1)
	move.w	d0,12*196+6(a1)
	move.w	d0,13*196+6(a1)
	move.w	d0,14*196+6(a1)
	move.w	d0,15*196+6(a1)
	move.w	d0,16*196+6(a1)
	lea	12(a1),a1
	dbra	d7,rotbig.c

	add.l	#(17*(12*16+4)-(12*16)),a1
	add.l	d6,a2			;modulo
	dbra	d3,rotbig.a

rotbig.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

rotfil
	movem.l	d0-d7/a0-a6,-(sp)
	move.l	rotchp-rot(a5),a1
	add.l	#rot.copcol1-rotc,a1		;copperlist
	add.l	rot.buf-rot(a5),a1	;double buffer

	lea	rotfiltab,a2		;fillup data halen
	move.l	rotcolfil-rot(a5),d0	;fillup nummer halen
	muls	#3*4,d0
	add.l	d0,a2
	
	move.w	(a2),d0
	cmp.w	4(a1),d0		;al gedaan ?
	bne	rotfil.f
	move.w	4(a2),d0
	cmp.w	8(a1),d0
	bne	rotfil.f
	move.w	8(a2),d0
	cmp.w	12(a1),d0
	beq	rotfil.end

rotfil.f
	move.w	#$23,d6
	move.w	#16-1,d3
rotfil.a
	move.w	#17-1,d7
rotfil.c
	move.l	#$0029fffe,(a1)+
	move.b	d6,-4(a1)
	move.w	#16-1,d0
rotfil.d
	move.l	(a2),(a1)
	move.l	4(a2),4(a1)
	move.l	8(a2),8(a1)
	lea	12(a1),a1
	dbra	d0,rotfil.d
	add.w	#1,d6
	dbra	d7,rotfil.c
	dbra	d3,rotfil.a
rotfil.end
	movem.l	(sp)+,d0-d7/a0-a6
	rts

rotchp			dc.l	0
rot.buf			dc.l	0

rotcolfil		dc.l	0
rotcolnum1		dc.l	0
rotcolnum2		dc.l	0
rotcolnum3		dc.l	0
rotcolrot1		dc.l	0
rotcolrot2		dc.l	0
rotcolrot3		dc.l	0


rotfiltab
	ifd	ocs
	dc.l	$01800000,$01020000,$01020000	;copper fillupdata
	dc.l	$01820000,$01020000,$01020000
	dc.l	$01920000,$01020000,$01020000
	dc.l	$01800000,$01820000,$01020000
	dc.l	$01800000,$01920000,$01020000
	dc.l	$01820000,$01920000,$01020000
	dc.l	$01800000,$01820000,$01920000
	dc.l	$01020000,$01020000,$01020000
	endc
	ifnd	ocs
	dc.l	$01800000,$01020000,$01020000	;copper fillupdata
	dc.l	$01820000,$01020000,$01020000
	dc.l	$01a20000,$01020000,$01020000
	dc.l	$01800000,$01820000,$01020000
	dc.l	$01800000,$01a20000,$01020000
	dc.l	$01820000,$01a20000,$01020000
	dc.l	$01800000,$01820000,$01a20000
	dc.l	$01020000,$01020000,$01020000
	endc
	
	;	str  x+   y+   str+
rot.ctab
	dc.w	$000,$100,$010,$001,0	;6 moving 256 grids
	dc.w	$000,$010,$001,$100,0
	dc.w	$000,$001,$100,$010,0
	dc.w	$000,$100,$001,$010,0
	dc.w	$000,$010,$100,$001,0
	dc.w	$000,$001,$010,$100,0

	dc.w	$00f,$100,$010,$000,0	;6 light grids
	dc.w	$f00,$010,$001,$000,0
	dc.w	$0f0,$001,$100,$000,0
	dc.w	$0f0,$100,$001,$000,0
	dc.w	$00f,$010,$100,$000,0
	dc.w	$f00,$001,$010,$000,0

	;	color	sinx	p siny	  p
rot.ctab2
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0
	dc.l	rotcoltab.a-rot,rotsintab.a-rot,0,rotsintab.bb-rot,0

rotsintab.a
       dc.w       24,24,25,25,26,26,26,27,27,28,28,28
       dc.w       29,29,30,30,30,31,31,31,32,32,33,33
       dc.w       33,34,34,34,35,35,36,36,36,37,37,37
       dc.w       38,38,38,38,39,39,39,40,40,40,41,41
       dc.w       41,41,42,42,42,42,43,43,43,43,44,44
       dc.w       44,44,44,44,45,45,45,45,45,45,46,46
       dc.w       46,46,46,46,46,46,46,47,47,47,47,47
       dc.w       47,47,47,47,47,47,47,47,47,47,47,47
       dc.w       47,47,47,47,47,47,46,46,46,46,46,46
       dc.w       46,46,46,45,45,45,45,45,45,44,44,44
       dc.w       44,44,44,43,43,43,43,42,42,42,42,41
       dc.w       41,41,41,40,40,40,39,39,39,38,38,38
       dc.w       38,37,37,37,36,36,36,35,35,34,34,34
       dc.w       33,33,33,32,32,31,31,31,30,30,30,29
       dc.w       29,28,28,28,27,27,26,26,26,25,25,24
       dc.w       24,24,23,23,22,22,22,21,21,20,20,20
       dc.w       19,19,18,18,18,17,17,17,16,16,15,15
       dc.w       15,14,14,14,13,13,13,12,12,11,11,11
       dc.w       10,10,10,10,9,9,9,8,8,8,7,7
       dc.w       7,7,6,6,6,6,5,5,5,5,4,4
       dc.w       4,4,4,4,3,3,3,3,3,3,2,2
       dc.w       2,2,2,2,2,2,2,1,1,1,1,1
       dc.w       1,1,1,1,1,1,1,1,1,1,1,1
       dc.w       1,1,1,1,1,1,2,2,2,2,2,2
       dc.w       2,2,2,3,3,3,3,3,3,4,4,4
       dc.w       4,4,4,5,5,5,5,6,6,6,6,7
       dc.w       7,7,7,8,8,8,9,9,9,10,10,10
       dc.w       10,11,11,11,12,12,12,13,13,14,14,14
       dc.w       15,15,15,16,16,17,17,17,18,18,18,19
       dc.w       19,20,20,20,21,21,22,22,22,23,23,24
       dc.w       24
	dc.w	-1

rotsintab.bb
       dc.w       7,7,7,8,8,8,8,8,8,9,9,9
       dc.w       9,9,9,10,10,10,10,10,10,11,11,11
       dc.w       11,11,11,11,12,12,12,12,12,12,12,13
       dc.w       13,13,13,13,13,13,13,13,14,14,14,14
       dc.w       14,14,14,14,14,14,14,14,15,15,15,15
       dc.w       15,15,15,15,15,15,15,15,15,15,15,15
       dc.w       15,15,15,15,15,15,15,15,15,15,15,15
       dc.w       15,15,15,15,15,14,14,14,14,14,14,14
       dc.w       14,14,14,14,14,13,13,13,13,13,13,13
       dc.w       13,13,12,12,12,12,12,12,12,11,11,11
       dc.w       11,11,11,11,10,10,10,10,10,10,9,9
       dc.w       9,9,9,9,8,8,8,8,8,8,7,7
       dc.w       7,7,7,6,6,6,6,6,6,5,5,5
       dc.w       5,5,5,4,4,4,4,4,4,3,3,3
       dc.w       3,3,3,3,2,2,2,2,2,2,2,1
       dc.w       1,1,1,1,1,1,1,1,0,0,0,0
       dc.w       0,0,0,0,0,0,0,0,0,0,0,0
       dc.w       0,0,0,0,0,0,0,0,0,0,0,0
       dc.w       0,0,0,0,0,0,0,0,0,0,0,0
       dc.w       0,0,0,0,0,0,0,0,0,0,0,0
       dc.w       0,0,0,0,0,1,1,1,1,1,1,1
       dc.w       1,1,2,2,2,2,2,2,2,3,3,3
       dc.w       3,3,3,3,4,4,4,4,4,4,5,5
       dc.w       5,5,5,5,6,6,6,6,6,6,7,7
       dc.w       7
	dc.w	-1

rotcoltab.a
	dc.l	64	;breedte in words

	dc.w	$000,$001,$002,$003,$004,$005,$006,$007,$008,$009,$00a,$00b,$00c,$00d,$00e,$00f
	dc.w	$00f,$01f,$02f,$03f,$04f,$05f,$06f,$07f,$08f,$09f,$0af,$0bf,$0cf,$0df,$0ef,$0ff
	dc.w	$0ff,$0fe,$0fd,$0fc,$0fb,$0fa,$0f9,$0f8,$0f7,$0f6,$0f5,$0f4,$0f3,$0f2,$0f1,$0f0
	dc.w	$0f0,$0e0,$0d0,$0c0,$0b0,$0a0,$090,$080,$070,$060,$050,$040,$030,$020,$010,$000

	dc.w	$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$10a,$10b,$10c,$10d,$10e,$10f
	dc.w	$10f,$11f,$12f,$13f,$14f,$15f,$16f,$17f,$18f,$19f,$1af,$1bf,$1cf,$1df,$1ef,$1ff
	dc.w	$1ff,$1fe,$1fd,$1fc,$1fb,$1fa,$1f9,$1f8,$1f7,$1f6,$1f5,$1f4,$1f3,$1f2,$1f1,$1f0
	dc.w	$1f0,$1e0,$1d0,$1c0,$1b0,$1a0,$190,$180,$170,$160,$150,$140,$130,$120,$110,$100

	dc.w	$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$20a,$20b,$20c,$20d,$20e,$20f
	dc.w	$20f,$21f,$22f,$23f,$24f,$25f,$26f,$27f,$28f,$29f,$2af,$2bf,$2cf,$2df,$2ef,$2ff
	dc.w	$2ff,$2fe,$2fd,$2fc,$2fb,$2fa,$2f9,$2f8,$2f7,$2f6,$2f5,$2f4,$2f3,$2f2,$2f1,$2f0
	dc.w	$2f0,$2e0,$2d0,$2c0,$2b0,$2a0,$290,$280,$270,$260,$250,$240,$230,$220,$210,$200

	dc.w	$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$30a,$30b,$30c,$30d,$30e,$30f
	dc.w	$30f,$31f,$32f,$33f,$34f,$35f,$36f,$37f,$38f,$39f,$3af,$3bf,$3cf,$3df,$3ef,$3ff
	dc.w	$3ff,$3fe,$3fd,$3fc,$3fb,$3fa,$3f9,$3f8,$3f7,$3f6,$3f5,$3f4,$3f3,$3f2,$3f1,$3f0
	dc.w	$3f0,$3e0,$3d0,$3c0,$3b0,$3a0,$390,$380,$370,$360,$350,$340,$330,$320,$310,$300

	dc.w	$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$40a,$40b,$40c,$40d,$40e,$40f
	dc.w	$40f,$41f,$42f,$43f,$44f,$45f,$46f,$47f,$48f,$49f,$4af,$4bf,$4cf,$4df,$4ef,$4ff
	dc.w	$4ff,$4fe,$4fd,$4fc,$4fb,$4fa,$4f9,$4f8,$4f7,$4f6,$4f5,$4f4,$4f3,$4f2,$4f1,$4f0
	dc.w	$4f0,$4e0,$4d0,$4c0,$4b0,$4a0,$490,$480,$470,$460,$450,$440,$430,$420,$410,$400

	dc.w	$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$50a,$50b,$50c,$50d,$50e,$50f
	dc.w	$50f,$51f,$52f,$53f,$54f,$55f,$56f,$57f,$58f,$59f,$5af,$5bf,$5cf,$5df,$5ef,$5ff
	dc.w	$5ff,$5fe,$5fd,$5fc,$5fb,$5fa,$5f9,$5f8,$5f7,$5f6,$5f5,$5f4,$5f3,$5f2,$5f1,$5f0
	dc.w	$5f0,$5e0,$5d0,$5c0,$5b0,$5a0,$590,$580,$570,$560,$550,$540,$530,$520,$510,$500

	dc.w	$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$60a,$60b,$60c,$60d,$60e,$60f
	dc.w	$60f,$61f,$62f,$63f,$64f,$65f,$66f,$67f,$68f,$69f,$6af,$6bf,$6cf,$6df,$6ef,$6ff
	dc.w	$6ff,$6fe,$6fd,$6fc,$6fb,$6fa,$6f9,$6f8,$6f7,$6f6,$6f5,$6f4,$6f3,$6f2,$6f1,$6f0
	dc.w	$6f0,$6e0,$6d0,$6c0,$6b0,$6a0,$690,$680,$670,$660,$650,$640,$630,$620,$610,$600

	dc.w	$700,$701,$702,$703,$704,$705,$706,$707,$708,$709,$70a,$70b,$70c,$70d,$70e,$70f
	dc.w	$70f,$71f,$72f,$73f,$74f,$75f,$76f,$77f,$78f,$79f,$7af,$7bf,$7cf,$7df,$7ef,$7ff
	dc.w	$7ff,$7fe,$7fd,$7fc,$7fb,$7fa,$7f9,$7f8,$7f7,$7f6,$7f5,$7f4,$7f3,$7f2,$7f1,$7f0
	dc.w	$7f0,$7e0,$7d0,$7c0,$7b0,$7a0,$790,$780,$770,$760,$750,$740,$730,$720,$710,$700

	dc.w	$800,$801,$802,$803,$804,$805,$806,$807,$808,$809,$80a,$80b,$80c,$80d,$80e,$80f
	dc.w	$80f,$81f,$82f,$83f,$84f,$85f,$86f,$87f,$88f,$89f,$8af,$8bf,$8cf,$8df,$8ef,$8ff
	dc.w	$8ff,$8fe,$8fd,$8fc,$8fb,$8fa,$8f9,$8f8,$8f7,$8f6,$8f5,$8f4,$8f3,$8f2,$8f1,$8f0
	dc.w	$8f0,$8e0,$8d0,$8c0,$8b0,$8a0,$890,$880,$870,$860,$850,$840,$830,$820,$810,$800

	dc.w	$900,$901,$902,$903,$904,$905,$906,$907,$908,$909,$90a,$90b,$90c,$90d,$90e,$90f
	dc.w	$90f,$91f,$92f,$93f,$94f,$95f,$96f,$97f,$98f,$99f,$9af,$9bf,$9cf,$9df,$9ef,$9ff
	dc.w	$9ff,$9fe,$9fd,$9fc,$9fb,$9fa,$9f9,$9f8,$9f7,$9f6,$9f5,$9f4,$9f3,$9f2,$9f1,$9f0
	dc.w	$9f0,$9e0,$9d0,$9c0,$9b0,$9a0,$990,$980,$970,$960,$950,$940,$930,$920,$910,$900

	dc.w	$a00,$a01,$a02,$a03,$a04,$a05,$a06,$a07,$a08,$a09,$a0a,$a0b,$a0c,$a0d,$a0e,$a0f
	dc.w	$a0f,$a1f,$a2f,$a3f,$a4f,$a5f,$a6f,$a7f,$a8f,$a9f,$aaf,$abf,$acf,$adf,$aef,$aff
	dc.w	$aff,$afe,$afd,$afc,$afb,$afa,$af9,$af8,$af7,$af6,$af5,$af4,$af3,$af2,$af1,$af0
	dc.w	$af0,$ae0,$ad0,$ac0,$ab0,$aa0,$a90,$a80,$a70,$a60,$a50,$a40,$a30,$a20,$a10,$a00

	dc.w	$b00,$b01,$b02,$b03,$b04,$b05,$b06,$b07,$b08,$b09,$b0a,$b0b,$b0c,$b0d,$b0e,$b0f
	dc.w	$b0f,$b1f,$b2f,$b3f,$b4f,$b5f,$b6f,$b7f,$b8f,$b9f,$baf,$bbf,$bcf,$bdf,$bef,$bff
	dc.w	$bff,$bfe,$bfd,$bfc,$bfb,$bfa,$bf9,$bf8,$bf7,$bf6,$bf5,$bf4,$bf3,$bf2,$bf1,$bf0
	dc.w	$bf0,$be0,$bd0,$bc0,$bb0,$ba0,$b90,$b80,$b70,$b60,$b50,$b40,$b30,$b20,$b10,$b00

	dc.w	$c00,$c01,$c02,$c03,$c04,$c05,$c06,$c07,$c08,$c09,$c0a,$c0b,$c0c,$c0d,$c0e,$c0f
	dc.w	$c0f,$c1f,$c2f,$c3f,$c4f,$c5f,$c6f,$c7f,$c8f,$c9f,$caf,$cbf,$ccf,$cdf,$cef,$cff
	dc.w	$cff,$cfe,$cfd,$cfc,$cfb,$cfa,$cf9,$cf8,$cf7,$cf6,$cf5,$cf4,$cf3,$cf2,$cf1,$cf0
	dc.w	$cf0,$ce0,$cd0,$cc0,$cb0,$ca0,$c90,$c80,$c70,$c60,$c50,$c40,$c30,$c20,$c10,$c00

	dc.w	$d00,$d01,$d02,$d03,$d04,$d05,$d06,$d07,$d08,$d09,$d0a,$d0b,$d0c,$d0d,$d0e,$d0f
	dc.w	$d0f,$d1f,$d2f,$d3f,$d4f,$d5f,$d6f,$d7f,$d8f,$d9f,$daf,$dbf,$dcf,$ddf,$def,$dff
	dc.w	$dff,$dfe,$dfd,$dfc,$dfb,$dfa,$df9,$df8,$df7,$df6,$df5,$df4,$df3,$df2,$df1,$df0
	dc.w	$df0,$de0,$dd0,$dc0,$db0,$da0,$d90,$d80,$d70,$d60,$d50,$d40,$d30,$d20,$d10,$d00

	dc.w	$e00,$e01,$e02,$e03,$e04,$e05,$e06,$e07,$e08,$e09,$e0a,$e0b,$e0c,$e0d,$e0e,$e0f
	dc.w	$e0f,$e1f,$e2f,$e3f,$e4f,$e5f,$e6f,$e7f,$e8f,$e9f,$eaf,$ebf,$ecf,$edf,$eef,$eff
	dc.w	$eff,$efe,$efd,$efc,$efb,$efa,$ef9,$ef8,$ef7,$ef6,$ef5,$ef4,$ef3,$ef2,$ef1,$ef0
	dc.w	$ef0,$ee0,$ed0,$ec0,$eb0,$ea0,$e90,$e80,$e70,$e60,$e50,$e40,$e30,$e20,$e10,$e00

	dc.w	$f00,$f01,$f02,$f03,$f04,$f05,$f06,$f07,$f08,$f09,$f0a,$f0b,$f0c,$f0d,$f0e,$f0f
	dc.w	$f0f,$f1f,$f2f,$f3f,$f4f,$f5f,$f6f,$f7f,$f8f,$f9f,$faf,$fbf,$fcf,$fdf,$fef,$fff
	dc.w	$fff,$ffe,$ffd,$ffc,$ffb,$ffa,$ff9,$ff8,$ff7,$ff6,$ff5,$ff4,$ff3,$ff2,$ff1,$ff0
	dc.w	$ff0,$fe0,$fd0,$fc0,$fb0,$fa0,$f90,$f80,$f70,$f60,$f50,$f40,$f30,$f20,$f10,$f00

	dc.w	$e00,$e01,$e02,$e03,$e04,$e05,$e06,$e07,$e08,$e09,$e0a,$e0b,$e0c,$e0d,$e0e,$e0f
	dc.w	$e0f,$e1f,$e2f,$e3f,$e4f,$e5f,$e6f,$e7f,$e8f,$e9f,$eaf,$ebf,$ecf,$edf,$eef,$eff
	dc.w	$eff,$efe,$efd,$efc,$efb,$efa,$ef9,$ef8,$ef7,$ef6,$ef5,$ef4,$ef3,$ef2,$ef1,$ef0
	dc.w	$ef0,$ee0,$ed0,$ec0,$eb0,$ea0,$e90,$e80,$e70,$e60,$e50,$e40,$e30,$e20,$e10,$e00

	dc.w	$d00,$d01,$d02,$d03,$d04,$d05,$d06,$d07,$d08,$d09,$d0a,$d0b,$d0c,$d0d,$d0e,$d0f
	dc.w	$d0f,$d1f,$d2f,$d3f,$d4f,$d5f,$d6f,$d7f,$d8f,$d9f,$daf,$dbf,$dcf,$ddf,$def,$dff
	dc.w	$dff,$dfe,$dfd,$dfc,$dfb,$dfa,$df9,$df8,$df7,$df6,$df5,$df4,$df3,$df2,$df1,$df0
	dc.w	$df0,$de0,$dd0,$dc0,$db0,$da0,$d90,$d80,$d70,$d60,$d50,$d40,$d30,$d20,$d10,$d00

	dc.w	$c00,$c01,$c02,$c03,$c04,$c05,$c06,$c07,$c08,$c09,$c0a,$c0b,$c0c,$c0d,$c0e,$c0f
	dc.w	$c0f,$c1f,$c2f,$c3f,$c4f,$c5f,$c6f,$c7f,$c8f,$c9f,$caf,$cbf,$ccf,$cdf,$cef,$cff
	dc.w	$cff,$cfe,$cfd,$cfc,$cfb,$cfa,$cf9,$cf8,$cf7,$cf6,$cf5,$cf4,$cf3,$cf2,$cf1,$cf0
	dc.w	$cf0,$ce0,$cd0,$cc0,$cb0,$ca0,$c90,$c80,$c70,$c60,$c50,$c40,$c30,$c20,$c10,$c00

	dc.w	$b00,$b01,$b02,$b03,$b04,$b05,$b06,$b07,$b08,$b09,$b0a,$b0b,$b0c,$b0d,$b0e,$b0f
	dc.w	$b0f,$b1f,$b2f,$b3f,$b4f,$b5f,$b6f,$b7f,$b8f,$b9f,$baf,$bbf,$bcf,$bdf,$bef,$bff
	dc.w	$bff,$bfe,$bfd,$bfc,$bfb,$bfa,$bf9,$bf8,$bf7,$bf6,$bf5,$bf4,$bf3,$bf2,$bf1,$bf0
	dc.w	$bf0,$be0,$bd0,$bc0,$bb0,$ba0,$b90,$b80,$b70,$b60,$b50,$b40,$b30,$b20,$b10,$b00

	dc.w	$a00,$a01,$a02,$a03,$a04,$a05,$a06,$a07,$a08,$a09,$a0a,$a0b,$a0c,$a0d,$a0e,$a0f
	dc.w	$a0f,$a1f,$a2f,$a3f,$a4f,$a5f,$a6f,$a7f,$a8f,$a9f,$aaf,$abf,$acf,$adf,$aef,$aff
	dc.w	$aff,$afe,$afd,$afc,$afb,$afa,$af9,$af8,$af7,$af6,$af5,$af4,$af3,$af2,$af1,$af0
	dc.w	$af0,$ae0,$ad0,$ac0,$ab0,$aa0,$a90,$a80,$a70,$a60,$a50,$a40,$a30,$a20,$a10,$a00

	dc.w	$900,$901,$902,$903,$904,$905,$906,$907,$908,$909,$90a,$90b,$90c,$90d,$90e,$90f
	dc.w	$90f,$91f,$92f,$93f,$94f,$95f,$96f,$97f,$98f,$99f,$9af,$9bf,$9cf,$9df,$9ef,$9ff
	dc.w	$9ff,$9fe,$9fd,$9fc,$9fb,$9fa,$9f9,$9f8,$9f7,$9f6,$9f5,$9f4,$9f3,$9f2,$9f1,$9f0
	dc.w	$9f0,$9e0,$9d0,$9c0,$9b0,$9a0,$990,$980,$970,$960,$950,$940,$930,$920,$910,$900

	dc.w	$800,$801,$802,$803,$804,$805,$806,$807,$808,$809,$80a,$80b,$80c,$80d,$80e,$80f
	dc.w	$80f,$81f,$82f,$83f,$84f,$85f,$86f,$87f,$88f,$89f,$8af,$8bf,$8cf,$8df,$8ef,$8ff
	dc.w	$8ff,$8fe,$8fd,$8fc,$8fb,$8fa,$8f9,$8f8,$8f7,$8f6,$8f5,$8f4,$8f3,$8f2,$8f1,$8f0
	dc.w	$8f0,$8e0,$8d0,$8c0,$8b0,$8a0,$890,$880,$870,$860,$850,$840,$830,$820,$810,$800

	dc.w	$700,$701,$702,$703,$704,$705,$706,$707,$708,$709,$70a,$70b,$70c,$70d,$70e,$70f
	dc.w	$70f,$71f,$72f,$73f,$74f,$75f,$76f,$77f,$78f,$79f,$7af,$7bf,$7cf,$7df,$7ef,$7ff
	dc.w	$7ff,$7fe,$7fd,$7fc,$7fb,$7fa,$7f9,$7f8,$7f7,$7f6,$7f5,$7f4,$7f3,$7f2,$7f1,$7f0
	dc.w	$7f0,$7e0,$7d0,$7c0,$7b0,$7a0,$790,$780,$770,$760,$750,$740,$730,$720,$710,$700

	dc.w	$600,$601,$602,$603,$604,$605,$606,$607,$608,$609,$60a,$60b,$60c,$60d,$60e,$60f
	dc.w	$60f,$61f,$62f,$63f,$64f,$65f,$66f,$67f,$68f,$69f,$6af,$6bf,$6cf,$6df,$6ef,$6ff
	dc.w	$6ff,$6fe,$6fd,$6fc,$6fb,$6fa,$6f9,$6f8,$6f7,$6f6,$6f5,$6f4,$6f3,$6f2,$6f1,$6f0
	dc.w	$6f0,$6e0,$6d0,$6c0,$6b0,$6a0,$690,$680,$670,$660,$650,$640,$630,$620,$610,$600

	dc.w	$500,$501,$502,$503,$504,$505,$506,$507,$508,$509,$50a,$50b,$50c,$50d,$50e,$50f
	dc.w	$50f,$51f,$52f,$53f,$54f,$55f,$56f,$57f,$58f,$59f,$5af,$5bf,$5cf,$5df,$5ef,$5ff
	dc.w	$5ff,$5fe,$5fd,$5fc,$5fb,$5fa,$5f9,$5f8,$5f7,$5f6,$5f5,$5f4,$5f3,$5f2,$5f1,$5f0
	dc.w	$5f0,$5e0,$5d0,$5c0,$5b0,$5a0,$590,$580,$570,$560,$550,$540,$530,$520,$510,$500

	dc.w	$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$40a,$40b,$40c,$40d,$40e,$40f
	dc.w	$40f,$41f,$42f,$43f,$44f,$45f,$46f,$47f,$48f,$49f,$4af,$4bf,$4cf,$4df,$4ef,$4ff
	dc.w	$4ff,$4fe,$4fd,$4fc,$4fb,$4fa,$4f9,$4f8,$4f7,$4f6,$4f5,$4f4,$4f3,$4f2,$4f1,$4f0
	dc.w	$4f0,$4e0,$4d0,$4c0,$4b0,$4a0,$490,$480,$470,$460,$450,$440,$430,$420,$410,$400

	dc.w	$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$30a,$30b,$30c,$30d,$30e,$30f
	dc.w	$30f,$31f,$32f,$33f,$34f,$35f,$36f,$37f,$38f,$39f,$3af,$3bf,$3cf,$3df,$3ef,$3ff
	dc.w	$3ff,$3fe,$3fd,$3fc,$3fb,$3fa,$3f9,$3f8,$3f7,$3f6,$3f5,$3f4,$3f3,$3f2,$3f1,$3f0
	dc.w	$3f0,$3e0,$3d0,$3c0,$3b0,$3a0,$390,$380,$370,$360,$350,$340,$330,$320,$310,$300

	dc.w	$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$20a,$20b,$20c,$20d,$20e,$20f
	dc.w	$20f,$21f,$22f,$23f,$24f,$25f,$26f,$27f,$28f,$29f,$2af,$2bf,$2cf,$2df,$2ef,$2ff
	dc.w	$2ff,$2fe,$2fd,$2fc,$2fb,$2fa,$2f9,$2f8,$2f7,$2f6,$2f5,$2f4,$2f3,$2f2,$2f1,$2f0
	dc.w	$2f0,$2e0,$2d0,$2c0,$2b0,$2a0,$290,$280,$270,$260,$250,$240,$230,$220,$210,$200

	dc.w	$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$10a,$10b,$10c,$10d,$10e,$10f
	dc.w	$10f,$11f,$12f,$13f,$14f,$15f,$16f,$17f,$18f,$19f,$1af,$1bf,$1cf,$1df,$1ef,$1ff
	dc.w	$1ff,$1fe,$1fd,$1fc,$1fb,$1fa,$1f9,$1f8,$1f7,$1f6,$1f5,$1f4,$1f3,$1f2,$1f1,$1f0
	dc.w	$1f0,$1e0,$1d0,$1c0,$1b0,$1a0,$190,$180,$170,$160,$150,$140,$130,$120,$110,$100

	dc.w	$000,$001,$002,$003,$004,$005,$006,$007,$008,$009,$00a,$00b,$00c,$00d,$00e,$00f
	dc.w	$00f,$01f,$02f,$03f,$04f,$05f,$06f,$07f,$08f,$09f,$0af,$0bf,$0cf,$0df,$0ef,$0ff
	dc.w	$0ff,$0fe,$0fd,$0fc,$0fb,$0fa,$0f9,$0f8,$0f7,$0f6,$0f5,$0f4,$0f3,$0f2,$0f1,$0f0
	dc.w	$0f0,$0e0,$0d0,$0c0,$0b0,$0a0,$090,$080,$070,$060,$050,$040,$030,$020,$010,$000

rotp.e

	SECTION	4,CODE_C
	cnop	0,8
rotc
	ifd	ocs
	dc.l	'ROTO'
	endc
	ifnd	ocs
	dc.l	'ROTA'
	endc
	rts
	cnop	0,8

rot.cop1
	dc.w	$080,$0000,$082,$0000
rot.copcol1
	ds.b	104*(12*16+4)
rot.cprbck1ntsc
	ds.b	56*(12*16+4)
rot.cprbck1
	ds.b	56*(12*16+4)
rot.cprend1ntsc
	ds.b	56*(12*16+4)
rot.cprend1
	dc.w	$0088,$0000

rot.cop2
	dc.w	$080,$0000,$082,$0000
rot.copcol2
	ds.b	104*(12*16+4)
rot.cprbck2ntsc
	ds.b	56*(12*16+4)
rot.cprbck2
	ds.b	56*(12*16+4)
rot.cprend2ntsc
	ds.b	56*(12*16+4)
rot.cprend2
	dc.w	$0088,$0000

rotc.e
rot.e

;**********************************************************************

;and here are the incbin-files....

		ifd	rout
		cnop	0,8
rotpic
		ifd	ocs
		incbin	'w:effect/triangle_l4.pic'
		endc
		ifnd	ocs
;		incbin	'w:effectaga/triangle_l4.pic'
		endc
		endc
		
