;****** Auto-Revision Header (do not edit) *******************************
;*
;* © Copyright by MMSoftware
;*
;* Filename         : Demo.s
;* Created on       : 01-Sep-93
;* Created by       : M.Meany
;* Current revision : V0.000
;*
;*
;* Purpose: Demo for ACCM PD Disk as submitted to Amiga Shopper
;*                                                    M.Meany (01-Sep-93)
;*          
;*
;* V0.000 : --- Initial release ---
;*
;*************************************************************************
REVISION        MACRO
                dc.b "0.000"
                ENDM
REVDATE         MACRO
                dc.b "01-Sep-93"
                ENDM

; Amiga Shopper demo

; Entire demo is in a single frame -- no double buffering at all, anywhere!

; Tested on WB3.0, WB2.04, WB1.3


		incdir		ACC31:Include/
		include		hardware.i
		include		HW_Macros.i
		include		HW_Start.i
		include		HW_Text.i
		include		HW_Sprites.i
		include		HW_Rotate.i
		include		HW_Input.i
		include		NT_Play.i

		dc.b		'$VER: Amiga Shopper Demo © M.Meany, v'
		REVISION
		dc.b		' ('
		REVDATE
		dc.b		' )',0
		even

; Define extension to sprite structure

spr_dX		=		spr_Ext
spr_dY		=		spr_dX+2

; Use macros to set up copper list for a 3 part playfield

Main		COPBPLC		CopPlanes1,bitplane2,(320/8)*50,3

		COPBPLC		CopPlanes2,bitplane2,(320/8)*256,4

		COPBPLC		CopPlanes3,bitplane3,(352/8)*33,4

; Initialise middle part of playfield for use with text routines

		FONTSCREEN	#bitplane2

; Turn off sprites

		lea		SprtBase,a0
		bsr		SpritesOff

; Start the Copper

		STARTCOP	#MyCopper
		
; Enable required DMA: Copper, Bitplane, Blitter, Sprite

	move.w	#SETIT!DMAEN!COPEN!BPLEN!BLTEN!BLTPRI!SPREN,DMACON(a5)
		
; Initialise the module ready for playing

		jsr		mt_init

; Install vertical blank interrupt handler and enable it.

		move.l		#NewLevel3,$6c		install
		
		move.w		#SETIT!INTEN!VERTB,INTENA(a5)

; Initialise star fields, interrupt wont catch up with us for some time yet!

		lea		Stars1,a2		a2->Sprite Struct
		lea		StarsXY,a3		a3->coord list
		
StarInitLoop	move.l		(a3)+,d0		get next coord pair
		beq.s		StarInit2		exit if end of table
		
		move.l		d0,(a2)			write into Sprite
		move.l		a2,a0
		bsr		SetSprPos
		addq.l		#8,spr_Data(a2)		bump Data pointer
		bra.s		StarInitLoop

StarInit2	move.l		#star1Data,spr_Data(a2)
		
		lea		Stars2,a2		a2->Sprite Struct
		lea		Stars1XY,a3		a3->coord list
		
StarInitLoop1	move.l		(a3)+,d0		get next coord pair
		beq.s		StarInitDone		exit if end of table
		
		move.l		d0,(a2)			write into Sprite
		move.l		a2,a0
		bsr		SetSprPos
		addq.l		#8,spr_Data(a2)		bump Data pointer
		bra.s		StarInitLoop1

; Position and activate sprite

StarInitDone	move.l		#star2Data,spr_Data(a2)


; Wait for user to press LMB

mouse		btst		#6,CIAAPRA
		bne.s		mouse

; Stop module playing

		jsr		mt_end

		rts

;		************************
;		* Vert Blank Interrupt *
;		************************


NewLevel3	lea		$dff000,a5		a5->hardware base

; See if next part yet, if so set vector

		bsr		CheckSwitch
		
; Call current routine handler

		move.l		CurrentRoutine,a0
		jsr		(a0)

; Do scrolling text last, its at the bottom of the display so we have lots of
;time to do rest of stuff before electron beam cathes us :-)

		bsr		ScrollText

; And clear the interrupt

;		move.w		#$00f0,COLOR00(a5)	Timing!

		move.w		#VERTB,INTREQ(a5)	clear request
		rte					back to user mode

;		****************************
;		* Switch Interrupt Routine *
;		****************************

; This code switches the routine called by interrupt handler allowing small
;code modules to run in sequence. A switch is generated by the scroll text
;routine.

CheckSwitch	tst.w		SwitchFlag
		beq.s		CSDone

		move.w		#0,SwitchFlag		clear the flag
		
; New part comming up, set vector to point to handler

		move.l		NextRoutine,a0
		move.l		(a0)+,CurrentRoutine	set vector
		tst.l		(a0)			end of jump table?
		bne.s		CSSet			nope, skip
;		lea		RoutineList,a0		reset pointer
		subq.l		#4,a0

CSSet		move.l		a0,NextRoutine

CSDone		rts

SwitchFlag	dc.w		0		set when switch required
CurrentRoutine	dc.l		L3None		ptr to current module
NextRoutine	dc.l		RoutineList	ptr into jump table

; The jump table that sequence of modules

RoutineList	dc.l		L3One		Display blue Copper bars
		dc.l		L3Two		Scroll Blue Bars
		dc.l		L3Three		Play music
		dc.l		L3Four		Show logo
		dc.l		L3Five		Advert text
		dc.l		L3Six		Wipe Screen
		dc.l		L3Seven		PacMan right
		dc.l		L3Eight		PacMan left
		dc.l		L3Nine		starfield
		dc.l		L3Ten		Vector Bobs
		dc.l		L3Six		Wipe Screen
		dc.l		L3Final		Just Text
		dc.l		L3Twelve	Controlled Vector Balls
		dc.l		L3Six		Wipe Screen
		dc.l		L3Final		Just text
		dc.l		L3Fifteen	3D vectors
		dc.l		L3Seventeen	Wipe Screen
		dc.l		L3Eighteen	next advert
		dc.l		L3Fourteen	Screen Magnification
		dc.l		L3Sixteen	Screen Flash
		
		dc.l		L3Final
		dc.l		0


; To start with, just set the blue bars at the bottom of the screen

;		***************************
;		*      Blue Bars Only     *
;		***************************

L3One		bsr		SetBlueBars
		rts

;		***************************
;		*   Scrolling Blue Bars   *
;		***************************

L3Two		bsr		ScrollBlue
		rts

;		***************************
;		*       Music Player      *
;		***************************

L3Three		jsr		mt_music
		lea		$dff000,a5		reset pointer
		bra.s		L3Two

;		***************************
;		*      Draw Main Logo     *
;		***************************

L3Four		bsr		ShowLogo
		bra.s		L3Three

;		***************************
;		*  Write Out Advert Text  *
;		***************************

L3Five		bsr		AdvertText
		bra.s		L3Three
		
;		***************************
;		*       Wipe Screen	  *
;		***************************

L3Six		bsr		ScreenWipe1
		bra.s		L3Three

;		***************************
;		*   PacMan to the right   *
;		***************************

L3Seven		bsr		SpriteRight
		bra.s		L3Three

;		***************************
;		*    PacMan to the Left   *
;		***************************

L3Eight		bsr		SpriteLeft
		bra.s		L3Three

;		***************************
;		*    Sprite Star Field	  *
;		***************************

L3Nine		bsr		MoveStars
		bra.s		L3Three
		
;		***************************
;		*   Rotating Vector Bobs  *
;		***************************

L3Ten		bsr		BlitBalls
		bsr		MoveStars
		move.w		#8,SW1Count
		move.w		#1,SW1Flag
		bra.s		L3Three

;		**********************************
;		*   User Controlled Vector Bobs  *
;		**********************************

L3Twelve	bsr		BlitBalls
		bsr		MoveStars
		bsr		MoveBalls
		move.w		#8,SW1Count
		move.w		#1,SW1Flag
		bra.s		L3Three

;		***************************
;		*  Expand Bpl1 into Bpl2  *
;		***************************

L3Fourteen	move.w		#-80,Reflect+2
		move.w		#-80,Reflect+6
		bsr		CopyBpls
		bsr		MoveStars
		bra		L3Three

L3Fifteen	move.w		#-80,Reflect+2
		move.w		#-80,Reflect+6
		bsr		VectorObject
		bsr		MoveStars
		move.w		#8,SW1Count
		move.w		#1,SW1Flag
		bra		L3Three

L3Sixteen	bsr		FlashScrn
		bsr		MoveStars
		bra		L3Three

L3Seventeen	move.w		#0,Reflect+2
		move.w		#0,Reflect+6
		move.l		#AdMsg2,TextPos
		bsr		ClearScreen
		bsr		MoveStars
		bra		L3Three

L3Eighteen	bsr		AdvertText
		bsr		MoveStars
		bra		L3Three


L3Final		bsr		MoveStars
		bra		L3Three

L3None		rts

*****************************************************************************
*		Scroll Text Routines And Variables			    *
*****************************************************************************

ScrollText	tst.w		ScrollPause
		beq.s		TextNotPaused
		subq.w		#1,ScrollPause
		bra.s		PauseOn

; See if we need to print another character yet ( 1 char every 16 VBI's )
		
TextNotPaused	subq.w		#1,ScrollCount
		bne.s		NoNewChar
		move.w		#8,ScrollCount

		bsr		DoChar			print next character
		tst.w		ScrollPause		was it a 'pause'?
		beq.s		NoNewChar		no, print it!
		move.w		#1,ScrollCount		else bump scrl count
		bra.s		PauseOn			and exit

NoNewChar	bsr		ScrollScreen		scroll the text

PauseOn		rts
		
ScrollCount	dc.w		8
ScrollPause	dc.w		0

;		******************************
;		* Scroll Screen Using Blitter*
;		******************************

ScrollScreen	move.l		#bitplane3,d7		address of bitplane

; Scrolling starts at end of last last line of the text area. The text area
;starts 0 lines down the display and is 32 lines high.

		add.l		#33*(352/8),d7
		subq.l		#2,d7			last word scroll area

		move.l		#32*(352/8),d6		size of bpl
		moveq.l		#3,d5			bpl counter

; Use blitter to scroll each line of the display

BWait		btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BWait

		move.l		d7,BLTAPTH(a5)		source
		move.l		d7,BLTDPTH(a5)		dest = source
		move.w		#0,BLTAMOD(a5)		no modulo
		move.w		#0,BLTDMOD(a5)
		move.w		#-1,BLTAFWM(a5)		no masking
		move.w		#$49f0,BLTCON0(a5)	A Scrl=2,use A,D, A=D
		move.w		#$0002,BLTCON1(a5)	B Scrl=0, Descending
		move.w		#32<<6!22,BLTSIZE(a5)	22 words by 32 lines

		add.l		d6,d7
		dbra		d5,BWait

		rts

;		*******************************
;		* Next Character Using Blitter*
;		*******************************

; Get next character from text message

DoChar		move.l		Cursor,a0		get next character
		moveq.l		#0,d0			from data.
		move.b		(a0)+,d0
		tst.b		(a0)			next a NULL?
		bne.s		NoWrap			no, keep going!
		lea		MessageEnd,a0		else stop!

NoWrap		move.l		a0,Cursor		save -> to next char

; Check if the current char is an embedded 'switch routine' character

		cmp.b		#1,d0			is it a switch code?
		bne.s		NotASwitch		no, so skip!
		not.w		SwitchFlag		else set switch flag
		bra.s		DoChar			and fetch next char

; Check if the current char is an embedded 'Pause Scroll' character

NotASwitch	cmp.b		#2,d0			is it a pause code?
		bne.s		NotAPause		no, so skip
		move.b		(a0)+,ScrollPause+1	else set pause
		move.l		a0,Cursor		update text pointer
		bra		CharSkip		and exit

; Check if current char is a space, if so adjust its ASCII code

NotAPause	cmp.b		#' ',d0			if a space correct it
		bne.s		NotSpace		since space after Z

		move.b		#'Z'+1,d0

; Convert ASCII code to a useable number: A=1, B=2, C=3, ... , Z=26,space=27

NotSpace	sub.b		#'A',d0
		moveq.l		#0,d1

; There are 10 characters per line, so determine which line the character is
;on

		cmp.b		#10,d0
		blt.s		GotNum
		sub.b		#10,d0
		move.l		#33*(320/8),d1		next row
		cmp.b		#10,d0
		blt.s		GotNum
		sub.b		#10,d0
		add.l		d1,d1			next row

; 4 bytes per character so determine offset from start of line, add to line
;offset and then add result to start of Font data. This is the address of the
;font data.

GotNum		and.l		#$f,d0
		asl.w		#2,d0			num * 4
		add.l		d1,d0
		add.l		#Font,d0		a0->char data

; Character is always printed off right side of display 140 lines down.

		move.l		#bitplane3,d1
		add.l		#(352/8)-4,d1
		moveq.l		#3,d2			bpl counter

; Blit the character

BWait1		btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BWait1

		move.l		d0,BLTAPTH(a5)		source = font
		move.l		d1,BLTDPTH(a5)		dest = screen
		move.w		#40-4,BLTAMOD(a5)	font modulo
		move.w		#44-4,BLTDMOD(a5)	screen modulo
		move.l		#-1,BLTAFWM(a5)		no masking
		move.w		#$09f0,BLTCON0(a5)	use AD, D=A
		move.w		#0,BLTCON1(a5)		normal mode
		move.w		#32<<6!2,BLTSIZE(a5)	32x32 pixels
		
		add.l		#(320/8)*99,d0		Font bpl size
		add.l		#(352/8)*33,d1		Screen bpl size
		dbra		d2,BWait1		for 4 planes
		
CharSkip	rts

Cursor		dc.l		Message

; The scroll text itself. Embedded '2's signal a pause, they are followed by
;the number of VBI's to pause for.

Message	dc.b		'AMIGANUTS PRESENTS THE ACC HARDWARE PROGRAMMING MANUAL'
	dc.b		' IN CO OPERATION WITH AMIGA SHOPPER    '
	dc.b		'THIS INTRO ATTEMPTS TO SHOW YOU SOME OF THE FEATURES COVERED IN THE MANUAL '
	DC.B		'     TO START WITH THERES '
	DC.B		'THE COPPER    LETS HAVE SOME BLUE BARS',1,2,200
	DC.B		' INTERRUPTS ARE COVERED AND YOU CAN '
	DC.B		'MODIFY COPPER LISTS FROM THESE    SO SCROLL EM',1,2,100 
	DC.B		'   REPLAYERS ALSO RUN FROM INTERRUPT SO '
	DC.B		'PLAY MUSIC',1,2,50
	DC.B		'     NOT A MEGA DEMO YET BUT WE ARE ON THE WAY    '
	DC.B		'THE MANUAL COVERS SPLIT DISPLAYS SO SHOW LOGO',1,2,50
	DC.B		'       MAY AS WELL POP IN AN ADD ',1,2,100
	dc.b		'   YEP  EVEN THE TEXT IS WRITTEN FROM INTERRUPT  '
	DC.B		'BASIC BLITTER TECHNIQUES ARE COVERED  CLEAR SCRN',1,2,25
	dc.b		' ANIMATING FOUR COLOUR SPRITES IS COVERED',1
	dc.b		'  PAC MAN IS IN TROUBLE  LUCKILY LARGE SIXTEEN COLOUR '
	dc.b		'SPRITES',1,' ARE COVERED   AND SPRITE STARFIELDS',1,2,50
	dc.b		'        '
	dc.b		' ANY ONE FOR VECTOR BALLS SPINNING ',1,2,255,2,255,2,255,1,2,16,' ',1
	dc.b		' TRY MOVING YOUR MOUSE   INPUT  ',1,2,255,2,255,2,255,2,255,1,2,16,' ',1
	dc.b		' AND JUST TO FINISH OFF THERES STANDARD LINES AND   VECTORS ',1,2,255,2,255,2,255,1,2,16
	dc.b		' ',1
	DC.B		'          NO SCROLLER IS COMPLETE WITHOUT A GREETS LIST '
	DC.B		'SO HERE GOES       MIKE CROSS  DAVE EDWARDS  PAUL KENT  '
	DC.B		'STEVE MARSHALL  DAVE SHAW  LEON SKELDON  BLAINE EVANS  '
	DC.B		'AFRO  PAUL CLASBY   HI PAUL ',2,50,' SEASOFT COMPUTING  '
	DC.B		'GUS CHANDLER  AND ALL AMIGA SHOPPER READERS        '
	DC.B		'WANT TO LEARN HOW TO DO ALL THIS AND LOADS MORE   '
	DC.B		'THEN ORDER YOUR COPY OF THE ACC HARDWARE PROGRAMMING ',1
	DC.B		'MANUAL FROM AMIGANUTS TODAY       ',1

MessageEnd	DC.B		'     HIT LEFT MOUSE BUTTON TO QUIT   THE END '
		DC.B		2,255,' ',0
		even

*****************************************************************************
*		Screen Flash Routine And Variables			    *
*****************************************************************************

FlashScrn	subq.w		#1,FlashCount
		bne.s		FlashDone
		move.w		#3,FlashCount

		lea		Flash,a0

		move.w		2(a0),d0
		not.w		d0
		and.w		#$fff,d0
		move.w		d0,2(a0)
		
FlashDone	rts
		
FlashCount	dc.w		3

;		********************************
;		*  Initialise Blue Copper Bars *
;		********************************

SetBlueBars	move.l		SBColour,a0
		tst.w		(a0)			all set yet?
		beq.s		SetBDone		yep, skip!

		move.l		SBCopper,a1		get pos in Cop list
		
		move.w		(a0)+,2(a1)
		addq.l		#8,a1			next position

		move.l		a0,SBColour
		move.l		a1,SBCopper

SetBDone	rts

SBColour	dc.l		BlueColours	position in colour table
SBCopper	dc.l		BlueBarsStart	position in Copper list

BlueColours	dc.w		3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,4,5,6,7,8,9,10
		dc.w		9,8,7,6,5,4,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,4
		dc.w		5,6,7,8,9,10,9,8,7,6,0

;		***************************
;		* Scroll Blue Copper Bars *
;		***************************

ScrollBlue	lea		BlueBarsStart,a0
		move.w		2(a0),d1
		
		moveq.l		#52,d0
SBLoop		move.w		10(a0),2(a0)
		addq.l		#8,a0
		dbra		d0,SBLoop
		
		move.w		d1,2(a0)
		rts

;		***************************
;		*   Display Logo At Top   *
;		***************************

ShowLogo	tst.w		LogoFlag
		bne.s		LogoOn
		
		COPBPLC		CopPlanes1,bitplane1,(320/8)*50,3

		not.w		LogoFlag

LogoOn		rts

LogoFlag	dc.w		0

;		***************************
;		* Write Advert For Manual *
;		***************************

AdvertText	move.l		TextPos,a0
		tst.b		(a0)
		beq.s		AddDone
		bsr		WriteText
		move.l		a0,TextPos
AddDone		rts

TextPos		dc.l		AdMsg

AdMsg		dc.b		FSINGLE			char printing
		dc.b		' ',$0a
		dc.b		FCOLOUR,3		colour 1
		dc.b		FCENTER			centralise
		dc.b		'Contents of ACCM Disks 1 to 3:',$0a
		dc.b		FCOLOUR,2		colour 1
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'Disk 1',$0a
		dc.b		FCOLOUR,1		colour 1
		dc.b		FCENTER			centralise
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'The Copper, Interrupts, Replayers',$0a
		dc.b		FCENTER			centralise
		dc.b		'Mouse, Joystick, Keyboard.',$0a
		dc.b		FCOLOUR,2		colour 1
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'Disk 2',$0a
		dc.b		FCOLOUR,1		colour 1
		dc.b		FCENTER			centralise
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'The Display, an indepth look!',$0a
		dc.b		FCOLOUR,2		colour 1
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'Disk 3',$0a
		dc.b		FCOLOUR,1		colour 1
		dc.b		FCENTER			centralise
		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'Sprites, Text Routines, Blitter Basics',$0a
		dc.b		FCENTER			centralise
		dc.b		'Blitter Scroll Texts',$0a
		dc.b		FCENTER			centralise
		dc.b		' ',$0a
		dc.b		FCOLOUR,4		colour 1
		dc.b		FCENTER			centralise
		dc.b		"It doesn't end there!",$0a
		dc.b		FCENTER			centralise
		dc.b		'Disk 4 is nearing completion and',$0a
		dc.b		FCENTER			centralise
		dc.b		'covers Vectors, Bobs and Synchronisation',$0a
		dc.b		FCENTER			centralise
		dc.b		FCOLOUR,5		colour 1
		dc.b		FCENTER			centralise
		dc.b		'Programming Made Easy by Amiganuts :-)',$0a
		
		dc.b		FEND
		dc.b		0
		even

AdMsg2		dc.b		FPOS,0,0
		dc.b		FSINGLE
		dc.b		' ',$0a
		dc.b		FCOLOUR,1		colour 4
		dc.b		FCENTER			centralise
		dc.b		'For any Techies or AMOS programmers',$0a
		dc.b		FCENTER			centralise
		dc.b		'still watching, this entire demo runs',$0a
		dc.b		FCENTER			centralise
		dc.b		'flicker free, in a single frame,',$0a
		dc.b		FCENTER			centralise
		dc.b		'without double-buffering the display.',$0a
		dc.b		FCOLOUR,5		colour 4
		dc.b		' ',$0a
		dc.b		'          Amiganuts PD Library',$0a
		dc.b		'          12 Hinkler Road',$0a
		dc.b		'          Southampton',$0a
		dc.b		'          Hants',$0a
		dc.b		'          SO2 6FT',$0a

		dc.b		' ',$0a
		dc.b		FCENTER			centralise
		dc.b		'Our latest PD catalogue disk can be',$0a
		dc.b		FCENTER			centralise
		dc.b		'obtained by sending 5Op to the above',$0a
		dc.b		FCENTER			centralise
		dc.b		'address. Source for this demo can be',$0a
		dc.b		FCENTER			centralise
		dc.b		'found on ACC disk 31. Enjoy :-)',$0a

		dc.b		FEND,0
		even

;		****************************
;		* Wipe Center Screen Clear *
;		****************************

ScreenWipe1	subq.w		#1,SW1Flag		clear every 4 frames
		bne.s		SW1Done
		move.w		#4,SW1Flag

SW1Loop		btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		SW1Loop

		moveq.l		#0,d1			get wipe counter
		move.w		SW1Count,d1
		beq.s		SW1Done			exit if screen clear
		subq.w		#1,SW1Count		else adjust counter
		move.w		#$eeee,d0		mask
		ror.w		d1,d0			shift mask for wipe
		move.w		d0,BLTBDAT(a5)		set blit mask		

; The Blitter B channel has not been enabled, so the Blitter will use the
;value written to BLTBDAT for the duration of the blit!

		move.l		#bitplane2,BLTAPTH(a5)	source = screen
		move.l		#bitplane2,BLTDPTH(a5)	dest = screen
		move.w		#0,BLTAMOD(a5)		modulo
		move.w		#0,BLTDMOD(a5)		modulo
		move.l		#-1,BLTAFWM(a5)		no masking
		move.w		#$09c0,BLTCON0(a5)	use AD, D=AB
		move.w		#0,BLTCON1(a5)		normal mode
		move.w		#20,BLTSIZE(a5)		1024x320 pixels

SW1Done		rts

SW1Count	dc.w		8
SW1Flag		dc.w		1

*****************************************************************************
*		Sprite Routines For Pac Man				    *
*****************************************************************************

;		***************************
;		*    Move sprites right	  *
;		***************************

SpriteRight	lea		Sprite2,a0
		cmp.w		#500,spr_X(a0)
		beq		NoSprRight

; Set sprites positions

		bsr		SetSprPos
		
		lea		Sprite1,a0
		bsr		SetSprPos

; Turn them on 

		SPRITEON	#0,#Sprite1
		SPRITEON	#2,#Sprite2

; Animate the sprites

		ANIMATESPRITE	#Sprite1
		ANIMATESPRITE	#Sprite2

; Move the sprites

		lea		Sprite1,a0
		move.w		spr_X(a0),d0
		add.w		spr_dX(a0),d0
		move.w		d0,spr_X(a0)
		
		lea		Sprite2,a0
		move.w		spr_X(a0),d0
		add.w		spr_dX(a0),d0
		move.w		d0,spr_X(a0)
		
NoSprRight	rts

;		***************************
;		*    Move sprites left	  *
;		***************************

; Position Sprite 4

SpriteLeft	lea		Sprite3,a0
		cmp.w		#52,spr_X(a0)
		beq		NoSpriteLeft
		bsr		SetSprPos

		lea		Sprite4,a0
		bsr		SetSprPos

; Must position Sprite 2 at same address and set attach bit. Since sprites
;are animated, we must obtain pointer to hardware sprite from Sprite struct

		lea		Sprite4,a0		a0->Sprite
		move.l		spr_Data(a0),a0		a0->hardware sprite
		move.l		(a0),d0			sprite control words
		bset.l		#7,d0			set attach bits
		lea		Sprite5,a0
		move.l		spr_Data(a0),a0
		move.l		d0,(a0)			copy to ODD sprite

; Position Sprite 3

		lea		Sprite6,a0
		lea		Sprite4,a1
		
		move.w		spr_X(a1),d0
		add.w		#16,d0
		move.w		d0,spr_X(a0)
		move.w		spr_Y(a1),spr_Y(a0)

		bsr		SetSprPos

; Must position Sprite 4 at same address and set attach bit. Since sprites
;are animated, we must obtain pointer to hardware sprite from Sprite struct

		lea		Sprite6,a0		a0->Sprite
		move.l		spr_Data(a0),a0		a0->hardware sprite
		move.l		(a0),d0			sprite control words
		bset.l		#7,d0			set attach bits
		lea		Sprite7,a0
		move.l		spr_Data(a0),a0
		move.l		d0,(a0)			copy to ODD sprite

; Turn Sprites on

		SPRITEON	#1,#Sprite3
		SPRITEON	#4,#Sprite4		Turn sprites on
		SPRITEON	#5,#Sprite5
		SPRITEON	#6,#Sprite6
		SPRITEON	#7,#Sprite7

; Animate the sprite

		ANIMATESPRITE	#Sprite3
		ANIMATESPRITE	#Sprite4
		ANIMATESPRITE	#Sprite5
		ANIMATESPRITE	#Sprite6
		ANIMATESPRITE	#Sprite7

; Move Sprite 4

		lea		Sprite4,a0
		move.w		spr_X(a0),d0
		add.w		spr_dX(a0),d0
		move.w		d0,spr_X(a0)
		cmp.w		#50,d0
		bgt.s		SprStillLeft
		move.w		#448,spr_X(a0)

; Move Sprite 3

SprStillLeft	lea		Sprite3,a0
		move.w		spr_X(a0),d0
		add.w		spr_dX(a0),d0
		move.w		d0,spr_X(a0)
		cmp.w		#50,d0
		bgt.s		NoSpriteLeft
		move.w		#448,spr_X(a0)

NoSpriteLeft	rts

;		***************************
;		*    Blank All Sprites	  *
;		***************************

; Entry		a0->SprBase for relevant Copper list

SpritesOff	move.l		#BlankSprite,d0		blank sprite
		moveq.l		#7,d1			sprite counter

_sprLoop	swap		d0			get high part of addr
		move.w		d0,2(a0)		into Copper list
		swap		d0			get low part of addr
		move.w		d0,6(a0)		into Copper list
		addq.l		#8,a0			bump Copper list ptr
		dbra		d1,_sprLoop
		
		rts

*****************************************************************************
*			Vector Ball Routines				    *
*****************************************************************************

BlitBalls	lea		BallPoints,a0
		lea		RotBallPoints,a1

		move.l		#bitplane2,d7		d7->bitplane
		add.l		#(320/8)*512,d7		d7->2nd plane
		move.l		a0,a2			keep safe
		move.l		a1,a3

		move.l		a1,a0

; a0->Points

		move.w		(a0)+,d5		point counter
		subq.w		#1,d5
		
		move.w		#500,d0
		move.w		OldBCX,d1
		move.w		#500,d2
		move.w		OldBCY,d3

LimitsLoop	move.w		(a0)+,d4
		add.w		d1,d4
		cmp.w		d4,d0
		blt.s		GetYLimit
		move.w		d4,d0		set min X

GetYLimit	move.w		(a0)+,d4
		add.w		d3,d4
		cmp.w		d4,d2
		blt.s		SkipZ
		move.w		d4,d2		set min Y

SkipZ		addq.l		#2,a0
		dbra		d5,LimitsLoop

; d0=x, d2=y in pixels

		moveq.l		#0,d4
		move.w		d0,d4		x
		asr.w		#4,d4		x/16
		asl.w		#1,d4		(x/16)*2
		move.w		d2,d5		y
		mulu		#40,d5
		add.w		d5,d4		x+40*y
		add.l		d7,d4		BLTDPTH
		
; d3.w = BLTSIZE, d4.l = Start address, d5.w = Modulo

; Clear the plane

BBobsWait1	btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BBobsWait1

		move.l		d4,BLTDPTH(a5)		D address
		move.w		#32,BLTDMOD(a5)		D modulo
		move.w		#$0100,BLTCON0(a5)	Use D: No Minterm 
		move.w		#0,BLTCON1(a5)		no special modes
		move.w		#48<<6!4,BLTSIZE(a5)	20 words by 255 lines

; And spin the points

		move.l		a2,a0			May Be In Wrong Place
		move.l		a3,a1			*
		jsr		RotatePoints		*

		move.l		a1,a0			*
		bsr		SortPoints		*

		move.l		a2,a0			*
		move.l		a3,a1			*

; Now blit bobs at position they were previously rotated to

		move.w		(a1)+,d6		point counter
		subq.w		#1,d6

; Not checking the blitter here as rotating and sorting bobs will take longer
;than the screen wipe Blitter routine!

BBobsWait1a	btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BBobsWait1a

		move.l		#$0024fffe,BLTCMOD(a5)	C & B Modulos
		move.l		#$fffe0024,BLTAMOD(a5)	A & D Modulos
		move.l		#$ffff0000,BLTAFWM(a5)	masks

		lea		Ball,a4
		lea		BallMask,a6
		
BBobsLoop	moveq.l		#0,d0
		moveq.l		#0,d1
		
; Get X,Y of next point

		move.w		(a1)+,d0		X
		add.w		BallCenterX,d0		center of screen = O
		
		move.w		(a1)+,d1		Y
		add.w		BallCenterY,d1		center of screen = O
		
		addq.l		#2,a1			skip Z

; Calculate start position and scroll value

		mulu		#40,d1
		ror.l		#4,d0
		asl.w		#1,d0
		add.w		d0,d1
		add.l		d7,d1			dest start address
		
		swap		d0
		move.w		d0,d2			copy scroll bits
		or.w		#$0fca,d0		minterm + usage

BBobsWait2	btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BBobsWait2

		move.l		a6,BLTAPTH(a5)		A address
		move.l		a4,BLTBPTH(a5)		B address
		move.l		d1,BLTCPTH(a5)		C address
		move.l		d1,BLTDPTH(a5)		D address
		move.w		d0,BLTCON0(a5)		Use A,B,C,D: D=AB+aC
		move.w		d2,BLTCON1(a5)		no special modes
		move.w		#9<<6!2,BLTSIZE(a5)	2 words by 9 lines

		dbra		d6,BBobsLoop		for all bobs

; Nowbump X,Y,Z angles

		lea		X_Angle,a0
		lea		X_AngleInc,a1
		jsr		RBumpAngle
		
BBobsDone	rts


; To sort points into ascending order

; Entry		a0->Points list that starts with counter

; Exit		list is sorted into ascending Z order

; Corrupt	none

SortPoints	movem.l		d0/d1/d5/d6/d7/a0/a1/a2,-(sp)

		move.w		(a0)+,d7	counter
		subq.w		#1,d7		dbra adjust

_SortPOuter	move.w		#$7fff,d5	set to maximum value

		move.l		a0,a2		working copies
		move.l		a0,a1
		move.l		d7,d6		copy point counter

_SortPInner	move.w		4(a1),d0	get z of next point
		cmp.w		d0,d5		compare with smallest so far
		blt.s		_SortPGt	skip if > smallest so far

		move.l		a1,a2		remember this pos in list
		move.w		d0,d5		set new smallest value

_SortPGt	addq.l		#6,a1		bump pos in points list
		dbra		d6,_SortPInner	and loop

		move.l		(a0)+,d0	swap 1st and smallest points
		move.w		(a0)+,d1	and bump pointer to 1st so it
		move.l		(a2),-6(a0)	points to next set of points
		move.w		4(a2),-2(a0)
		move.l		d0,(a2)
		move.w		d1,4(a2)

		dbra		d7,_SortPOuter	loop through again

		movem.l		(sp)+,d0/d1/d5/d6/d7/a0/a1/a2
		rts


MoveBalls	jsr		SeeMouse

		move.w		BallCenterX,OldBCX
		move.w		BallCenterY,OldBCY

		asr.w		#1,d0
		asr.w		#1,d1
		
		add.w		BallCenterX,d0
		bpl.s		BCXIsPlus
		move.w		#60,d0

BCXIsPlus	cmp.w		#30,d0
		bge.s		BCXUpper
		move.w		#30,d0

BCXUpper	cmp.w		#290,d0
		ble.s		BCDoY
		move.w		#290,d0

BCDoY		move.w		d0,BallCenterX
		add.w		BallCenterY,d1
		bpl.s		BCYIsPlus
		move.w		#60,d1

BCYIsPlus	cmp.w		#50,d1
		bge.s		BCYUpper
		move.w		#50,d1

BCYUpper	cmp.w		#220,d1
		ble.s		BCDoneY
		move.w		#220,d1

BCDoneY		move.w		d1,BallCenterY
		rts

BallCenterX	dc.w		160
BallCenterY	dc.w		100

OldBCX		dc.w		160
OldBCY		dc.w		100

BallPoints	dc.w		24		28 sets of points
		dc.w		-20,0,0
		dc.w		-10,0,0
		dc.w		0,0,0
		dc.w		10,0,0

		dc.w		-20,10,5
		dc.w		-10,10,5
		dc.w		0,10,5
		dc.w		10,10,5

		dc.w		-20,-10,5
		dc.w		-10,-10,5
		dc.w		0,-10,5
		dc.w		10,-10,5

;		dc.w		-20,0,10
;		dc.w		-10,0,10
;		dc.w		0,0,10
;		dc.w		10,0,10

		dc.w		-20,10,15
		dc.w		-10,10,15
		dc.w		0,10,15
		dc.w		10,10,15

		dc.w		-20,-10,15
		dc.w		-10,-10,15
		dc.w		0,-10,15
		dc.w		10,-10,15

		dc.w		-20,0,20
		dc.w		-10,0,20
		dc.w		0,0,20
		dc.w		10,0,20


RotBallPoints	dc.w		24
		dc.w		-20,0,0
		dc.w		-10,0,0
		dc.w		0,0,0
		dc.w		10,0,0

		dc.w		-20,10,5
		dc.w		-10,10,5
		dc.w		0,10,5
		dc.w		10,10,5

		dc.w		-20,-10,5
		dc.w		-10,-10,5
		dc.w		0,-10,5
		dc.w		10,-10,5

		dc.w		-20,0,10
		dc.w		-10,0,10
		dc.w		0,0,10
		dc.w		10,0,10

		dc.w		-20,10,15
		dc.w		-10,10,15
		dc.w		0,10,15
		dc.w		10,10,15

		dc.w		-20,-10,15
		dc.w		-10,-10,15
		dc.w		0,-10,15
		dc.w		10,-10,15

		dc.w		-20,0,20
		dc.w		-10,0,20
		dc.w		0,0,20
		dc.w		10,0,20

X_Angle		dc.w		0
Y_Angle		dc.w		0
Z_Angle		dc.w		0

X_AngleInc	dc.w		1,3,2

*****************************************************************************
*			3D Vector Object				    *
*****************************************************************************

; Add to ZDist if RMB pressed

VectorObject	lea		Object1,a0

		btst.b		#2,$dff016
		bne		_LMB
		addq.w		#8,obj_ZDist(a0)
		bra.s		_VBLD

_LMB		btst.b		#6,CIAAPRA
		bne.s		_VBLD
		subq.w		#8,obj_ZDist(a0)
				
; Clear the screen using the blitter

_VBLD		bsr		ClearScreen

		move.w		#$00f0,COLOR00(a5)	time 1 red

; Rotate and display the object

		lea		Object1,a0
		bsr		RotateObject

;		move.w		#$00f0,COLOR00(a5)	time 2 green

		lea		Object1,a0
		bsr		ClipObject

;		move.w		#$000f,COLOR00(a5)	time 3 blue

		lea		bitplane2+(320/8)*256,a0	bitplane
		lea		Object1,a1
		moveq.l		#40,d0
		bsr		DrawObject

;		move.w		#$0000,COLOR00(a5)	time 4 black

; Bump angle of rotation

		lea		X_Angle,a0
		lea		X_AngleInc,a1
		jsr		RBumpAngle

		rts

;		***********************************
;		*       Blit The Screen Clear	  *
;		***********************************

ClearScreen	PUSHALL

BlitWait	btst		#14,DMACONR(a5)		wait for Blitter
		bne.s		BlitWait

		move.l		#bitplane2+(320/8)*256,BLTDPTH(a5)	D address
		move.w		#0,BLTDMOD(a5)		D modulo
		move.w		#$0100,BLTCON0(a5)	Use D: No Minterm 
		move.w		#0,BLTCON1(a5)		no special modes
		move.w		#173<<6!20,BLTSIZE(a5)	20 words by 255 lines

		PULLALL
		rts

Object1		dc.w		160,78			origin
		dc.w		$40			distance from screen
		dc.w		4			4 surfaces
		dc.l		Object1Surfaces
		dc.l		Object1Points
		dc.l		Object1RotPts
		dc.l		Object1XY

Object1Surfaces	dc.w		4,2,0,1,2
		dc.w		4,0,2,3,0
		dc.w		4,3,1,0,3
		dc.w		4,3,2,1,3

Object1Points	dc.w		4			number of points
		dc.w		-30,-10,10			x1,y1,z1
		dc.w		60,0,60		x2,y2,z2
		dc.w		100,0,0			x3,y3,z3
		dc.w		40,40,60		x4,y4,z4

Object1RotPts	ds.w		1+4*3		space for rotated points

Object1XY	ds.w		4*2		space for final x,y points


*****************************************************************************
*			Sprite Starfield Routines			    *
*****************************************************************************

;		***************************
;		*   Move The Star Field   *
;		***************************

MoveStars	moveq.l		#1,d0
		
		SPRITEON	#0,#Stars1		Turn sprites on
		SPRITEON	#1,#Stars2		Turn sprites on

		lea		star1Data,a0
		moveq.l		#1,d0
		bsr		StarsRight
		lea		star2Data,a0
		moveq.l		#2,d0
		bsr		StarsRight

		rts

;		***************************
;		*  Scroll Sprites Right   *
;		***************************

; Entry		a0->1st Hardware Sprite
;		d0=pixels to scroll ie. Speed

; Corrupt	a0,d0,d1,d2,d3

StarsRight	move.l		d0,d3

StarsRLoop	move.l		(a0),d0			Save Control Words
		beq.s		StarsRDone		Exit if no more

; To scroll the stars right we must bump the x coordinate of the sprites

		move.l		d0,d2
		
		and.l		#$00ff0001,d0
		and.l		#$ff00fffe,d2
		move.w		d0,d1
		swap		d0
		asl.w		#1,d0
		or.w		d1,d0			d0=x
		add.w		d3,d0			bump x
		cmp.w		#448,d0
		ble.s		StarsRCont
		move.w		#128,d0

StarsRCont	move.w		d0,d1
		and.w		#1,d1
		asr.w		#1,d0
		swap		d0
		move.w		d1,d0
		or.l		d0,d2
		move.l		d2,(a0)

		addq.l		#8,a0			bump to next sprite
		
		bra.s		StarsRLoop

StarsRDone	rts


;		****************************
;		* Custom Sprite Structures *
;		****************************

Sprite1		dc.w		60
		dc.w		132
		dc.w		16
		dc.l		sprite1a
		dc.l		Sprite1Anim
		dc.w		0
		dc.w		1
		dc.w		2
		dc.w		0

Sprite1Anim	dc.w		4
		dc.w		2
		dc.l		sprite1a
		dc.l		sprite1b

Sprite2		dc.w		90
		dc.w		137
		dc.w		11
		dc.l		sprite2a
		dc.l		Sprite2Anim
		dc.w		0
		dc.w		1
		dc.w		2
		dc.w		0

Sprite2Anim	dc.w		4
		dc.w		2
		dc.l		sprite2a
		dc.l		sprite2b

Ix		equ		81

Sprite3		dc.w		Ix-30
		dc.w		132
		dc.w		16
		dc.l		sprite3a
		dc.l		Sprite3Anim
		dc.w		0
		dc.w		1
		dc.w		-2
		dc.w		0

Sprite3Anim	dc.w		4
		dc.w		2
		dc.l		sprite3a
		dc.l		sprite3b

; Sprite7 -> Sprite10 defines the large, 16 Colour PacMan


; Will use hardware sprites 4,5,6 and 7

Sprite4		dc.w		Ix		X
		dc.w		125		Y
		dc.w		23		height
		dc.l		sprite4a_11	address of initial data
		dc.l		Sprite4Anim	->Anim structure
		dc.w		0		current frame number
		dc.w		1		initial timer value
		dc.w		-2		dX -- our extension
		dc.w		0		dY -- our extension

Sprite4Anim	dc.w		4		animate after 4 VBLs
		dc.w		2		2 frames
		dc.l		sprite4a_11	address of 1st frame
		dc.l		sprite4b_11	address of 2nd frame


Sprite5		dc.w		Ix		X
		dc.w		125		Y
		dc.w		23		height
		dc.l		sprite4a_12	address of initial data
		dc.l		Sprite5Anim	->Anim structure
		dc.w		0		current frame number
		dc.w		1		initial timer value
		dc.w		-2		dX -- our extension
		dc.w		0		dY -- our extension

Sprite5Anim	dc.w		4		animate after 4 VBLs
		dc.w		2		2 frames
		dc.l		sprite4a_12	address of 1st frame
		dc.l		sprite4b_12	address of 2nd frame

Sprite6		dc.w		Ix+16		X
		dc.w		125		Y
		dc.w		23		height
		dc.l		sprite4a_21	address of initial data
		dc.l		Sprite6Anim	->Anim structure
		dc.w		0		current frame number
		dc.w		1		initial timer value
		dc.w		-2		dX -- our extension
		dc.w		0		dY -- our extension

Sprite6Anim	dc.w		4		animate after 4 VBLs
		dc.w		2		2 frames
		dc.l		sprite4a_21	address of 1st frame
		dc.l		sprite4b_21	address of 2nd frame

Sprite7		dc.w		Ix+16		X
		dc.w		125		Y
		dc.w		23		height
		dc.l		sprite4a_22	address of initial data
		dc.l		Sprite7Anim	->Anim structure
		dc.w		0		current frame number
		dc.w		1		initial timer value
		dc.w		-2		dX -- our extension
		dc.w		0		dY -- our extension

Sprite7Anim	dc.w		4		animate after 4 VBLs
		dc.w		2		2 frames
		dc.l		sprite4a_22	address of 1st frame
		dc.l		sprite4b_22	address of 2nd frame

Stars1		dc.w		128		X
		dc.w		44		Y
		dc.w		1		height
		dc.l		star1Data	address of initial data
		dc.l		0		->Animation Structure
		dc.w		0		current frame number
		dc.w		0		initial timer value

Stars2		dc.w		128		X
		dc.w		44		Y
		dc.w		1		height
		dc.l		star2Data	address of initial data
		dc.l		0		->Animation Structure
		dc.w		0		current frame number
		dc.w		0		initial timer value


StarsXY		dc.w		130,44
		dc.w		197,46
		dc.w		295,48
		dc.w		188,50
		dc.w		428,52
		dc.w		372,54
		dc.w		285,56
		dc.w		245,58
		dc.w		402,60
		dc.w		247,62 .
		dc.w		402,64
		dc.w		268,66
		dc.w		183,68
		dc.w		382,70
		dc.w		241,72
		dc.w		252,74
		dc.w		271,76
		dc.w		179,78
		dc.w		341,80
		dc.w		337,82 .
		dc.w		213,84
		dc.w		140,86
		dc.w		158,88
		dc.w		411,90
		dc.w		175,92
		dc.w		365,94
		dc.w		444,96
		dc.w		363,98
		dc.w		328,100
		dc.w		352,102 .
		dc.w		229,104
		dc.w		135,106
		dc.w		440,108
		dc.w		203,110
		dc.w		206,112
		dc.w		287,114
		dc.w		172,116
		dc.w		297,118
		dc.w		356,120
		dc.w		185,122 .
		dc.w		185,124
		dc.w		129,126
		dc.w		266,128
		dc.w		197,130
		dc.w		413,132
		dc.w		285,134
		dc.w		375,136
		dc.w		318,138
		dc.w		274,140
		dc.w		431,142 .
		dc.w		191,144
		dc.w		138,146
		dc.w		388,148
		dc.w		364,150
		dc.w		208,152
		dc.w		160,154
		dc.w		197,156
		dc.w		441,158
		dc.w		264,160
		dc.w		435,162 .
		dc.w		308,164
		dc.w		129,166
		dc.w		430,168
		dc.w		236,170
		dc.w		280,172
		dc.w		440,174
		dc.w		225,176
		dc.w		232,178
		dc.w		350,180
		dc.w		210,182
		dc.w		359,184
		dc.w		329,186
		dc.w		434,188
		dc.w		132,190
		dc.w		302,192
		dc.w		319,194
		dc.w		291,196
		dc.w		177,198
		dc.w		419,200
		dc.w		208,202
		dc.w		194,204
		dc.w		228,206
		dc.w		283,208
		dc.w		418,210
		dc.w		179,212
		dc.w		327,214
		dc.w		292,216
		dc.w		231,218
		dc.w		309,220
		dc.w		213,222
		dc.w		412,224
		dc.w		398,226
		dc.w		309,228
		dc.w		428,230
		dc.w		310,232
		dc.w		313,234
		dc.w		304,236
		dc.w		266,238
		dc.w		165,240
		dc.w		375,242
		dc.w		424,244
		dc.w		291,246
		dc.w		417,248
		dc.w		265,250
		dc.w		177,252
		dc.w		304,254
		dc.w		237,256
		dc.w		209,258
		dc.w		376,260
		dc.w		165,262
		dc.w		319,264
		dc.w		331,266
		dc.w		431,268
		dc.w		192,270
		dc.w		165,272
		dc.w		337,274
		dc.w		231,276
		dc.w		260,278
		dc.w		391,280
		dc.w		289,282
		dc.w		205,284
		dc.w		389,286
		dc.w		200,288
		dc.w		304,290
		dc.w		274,292
		dc.w		410,294
		dc.w		252,296
		dc.w		309,298
		dc.w		302,300

		dc.l		0
		
Stars1XY	dc.w		130,44
		dc.w		197,48
		dc.w		295,52
		dc.w		188,56
		dc.w		428,60
		dc.w		372,64
		dc.w		285,68
		dc.w		245,72
		dc.w		402,76
		dc.w		247,80
		dc.w		402,84
		dc.w		268,88
		dc.w		183,92
		dc.w		382,96
		dc.w		241,100
		dc.w		252,104
		dc.w		271,108
		dc.w		179,112
		dc.w		341,116
		dc.w		337,120
		dc.w		213,124
		dc.w		140,128
		dc.w		158,132
		dc.w		411,136
		dc.w		175,140
		dc.w		365,144
		dc.w		444,148
		dc.w		363,152
		dc.w		328,156
		dc.w		352,160
		dc.w		229,164
		dc.w		135,168
		dc.w		440,172
		dc.w		203,176
		dc.w		206,180
		dc.w		287,184
		dc.w		172,188
		dc.w		297,192
		dc.w		356,196
		dc.w		185,200
		dc.w		185,204
		dc.w		129,208
		dc.w		266,212
		dc.w		197,216
		dc.w		413,220
		dc.w		285,224
		dc.w		375,228
		dc.w		318,232
		dc.w		274,236
		dc.w		431,240
		dc.w		191,244
		dc.w		138,248
		dc.w		388,252
		dc.w		364,256
		dc.w		208,260
		dc.w		160,264
		dc.w		197,268
		dc.w		441,272
		dc.w		264,276
		dc.w		435,280
		dc.w		308,284
		dc.w		129,288
		dc.w		430,292
		dc.w		236,296
		dc.w		280,300		65 entries

		dc.l		0
		
;		***************************************
;		* Expand Bitplane 1 into Bitplane 2   *
;		***************************************

; Copies from src to dest 1 line each call and doubles the height

CopyBpls	tst.w		CopyBplsCount
		beq.s		CopyBplsDone
		
		move.l		CopyBplsSrc,a2
		move.l		CopyBplsDest,a3

		moveq.l		#2,d1

CopyBplsOuter	move.l		a2,a0
		move.l		a3,a1				
		moveq.l		#9,d0			a0 longs per line

CopyBplsInner	move.l		(a0)+,(a1)+
		move.l		-4(a0),36(a1)

		dbra		d0,CopyBplsInner

		lea		(320/8)*50(a2),a2
		lea		(320/8)*256(a3),a3
		dbra		d1,CopyBplsOuter

		add.l		#40,CopyBplsSrc
		add.l		#80,CopyBplsDest
		subq.w		#1,CopyBplsCount
		
CopyBplsDone	rts

CopyBplsSrc	dc.l		bitplane1
CopyBplsDest	dc.l		bitplane2+40
CopyBplsCount	dc.w		50


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

		section		fish,data_c

MyCopper	CMOVE		COLOR00,$0000		Black background

		CWAIT		0,20			build in a pause!

SprtBase	CMOVE		SPR0PTH,0		Sprite defs
		CMOVE		SPR0PTL,0
		CMOVE		SPR1PTH,0
		CMOVE		SPR1PTL,0
		CMOVE		SPR2PTH,0
		CMOVE		SPR2PTL,0
		CMOVE		SPR3PTH,0
		CMOVE		SPR3PTL,0
		CMOVE		SPR4PTH,0
		CMOVE		SPR4PTL,0
		CMOVE		SPR5PTH,0
		CMOVE		SPR5PTL,0
		CMOVE		SPR6PTH,0
		CMOVE		SPR6PTL,0
		CMOVE		SPR7PTH,0
		CMOVE		SPR7PTL,0
		
		CMOVE		DIWSTRT,$2c81		PAL -- 256 lines
		CMOVE		DIWSTOP,$2cc1
		CMOVE		DDFSTRT,$0038		LoRes
		CMOVE		DDFSTOP,$00d0

		CMOVE		BPL1MOD,$0000		no modulos
		CMOVE		BPL2MOD,$0000
		CMOVE		BPLCON0,$3200		1 bitplanes & colour
		CMOVE		BPLCON1,$0000		No scrolling
		CMOVE		BPLCON2,$0000		Ignore priority

CopPlanes1	CMOVE		BPL1PTH,0		Bit plane pointers
		CMOVE		BPL1PTL,0		filled in by the
		CMOVE		BPL2PTH,0		program!
		CMOVE		BPL2PTL,0
		CMOVE		BPL3PTH,0
		CMOVE		BPL3PTL,0
		ds.w		8*2			space for colours

; Colour table for sprites

		CMOVE		COLOR16,$0000
		CMOVE		COLOR17,$0e00
		CMOVE		COLOR18,$0f4a
		CMOVE		COLOR19,$0fff
		CMOVE		COLOR20,$0fff
		CMOVE		COLOR21,$0fe0
		CMOVE		COLOR22,$0e00
		CMOVE		COLOR23,$0620
		CMOVE		COLOR24,$0f60
		CMOVE		COLOR25,$0fa8
		CMOVE		COLOR26,$0555
		CMOVE		COLOR27,$00d0
		CMOVE		COLOR28,$0080
		CMOVE		COLOR29,$00cc
		CMOVE		COLOR30,$006f
		CMOVE		COLOR31,$000a
		
; Middle section of display

		CWAIT		0,94

		CMOVE		BPL1MOD,$0000		no modulos
		CMOVE		BPL2MOD,$0000
		CMOVE		BPLCON0,$4200		1 bitplanes & colour
		CMOVE		BPLCON1,$0000		No scrolling
		CMOVE		BPLCON2,$0000		Ignore priority

CopPlanes2	CMOVE		BPL1PTH,0		Bit plane pointers
		CMOVE		BPL1PTL,0		filled in by the
		CMOVE		BPL2PTH,0		program!
		CMOVE		BPL2PTL,0
		CMOVE		BPL3PTH,0
		CMOVE		BPL3PTL,0
		CMOVE		BPL4PTH,0
		CMOVE		BPL4PTL,0
		ds.w		16*2			space for colours

		CWAIT		0,95
Flash		CMOVE		COLOR00,$0000

		CWAIT		0,195
Reflect		CMOVE		BPL1MOD,$0000		reverse modulos
		CMOVE		BPL2MOD,$0000

		CWAIT		112,255			dummy wait
		CWAIT		0,11
		CMOVE		COLOR00,$0000


; Here the modulo, depth, scroll, Bpl pointers and colours of 1st playfield
;are displayed. The part of the display will start at line 44 as defined in
;DIWSTRT

		CWAIT		0,12

		CMOVE		BPL1MOD,$0004		no modulos
		CMOVE		BPL2MOD,$0004
		CMOVE		BPLCON0,$4200		1 bitplanes & colour
		CMOVE		BPLCON1,$0000		No scrolling
		CMOVE		BPLCON2,$0000		Ignore priority

CopPlanes3	CMOVE		BPL1PTH,0		Bit plane pointers
		CMOVE		BPL1PTL,0		filled in by the
		CMOVE		BPL2PTH,0		program!
		CMOVE		BPL2PTL,0
		CMOVE		BPL3PTH,0
		CMOVE		BPL3PTL,0
		CMOVE		BPL4PTH,0
		CMOVE		BPL4PTL,0
		ds.w		16*2			space for colours

		CWAIT		0,13
BlueBarsStart	CMOVE		COLOR00,$0000
		CWAIT		0,14
		CMOVE		COLOR00,$0000
		CWAIT		0,15
		CMOVE		COLOR00,$0000
		CWAIT		0,16
		CMOVE		COLOR00,$0000
		CWAIT		0,17
		CMOVE		COLOR00,$0000
		CWAIT		0,18
		CMOVE		COLOR00,$0000
		CWAIT		0,19
		CMOVE		COLOR00,$0000
		CWAIT		0,20
		CMOVE		COLOR00,$0000
		CWAIT		0,21
		CMOVE		COLOR00,$0000
		CWAIT		0,22
		CMOVE		COLOR00,$0000
		CWAIT		0,23
		CMOVE		COLOR00,$0000
		CWAIT		0,24
		CMOVE		COLOR00,$0000
		CWAIT		0,25
		CMOVE		COLOR00,$0000
		CWAIT		0,26
		CMOVE		COLOR00,$0000
		CWAIT		0,27
		CMOVE		COLOR00,$0000
		CWAIT		0,28
		CMOVE		COLOR00,$0000
		CWAIT		0,29
		CMOVE		COLOR00,$0000
		CWAIT		0,30
		CMOVE		COLOR00,$0000
		CWAIT		0,31
		CMOVE		COLOR00,$0000
		CWAIT		0,32
		CMOVE		COLOR00,$0000
		CWAIT		0,33
		CMOVE		COLOR00,$0000
		CWAIT		0,34
		CMOVE		COLOR00,$0000
		CWAIT		0,35
		CMOVE		COLOR00,$0000
		CWAIT		0,36
		CMOVE		COLOR00,$0000
		CWAIT		0,37
		CMOVE		COLOR00,$0000
		CWAIT		0,38
		CMOVE		COLOR00,$0000
		CWAIT		0,39
		CMOVE		COLOR00,$0000
		CWAIT		0,40
		CMOVE		COLOR00,$0000
		CWAIT		0,41
		CMOVE		COLOR00,$0000
		CWAIT		0,42
		CMOVE		COLOR00,$0000
		CWAIT		0,43
		CMOVE		COLOR00,$0000
		CWAIT		0,44
		CMOVE		COLOR00,$0000
		CWAIT		0,45
		CMOVE		COLOR00,$0000
		CWAIT		0,46
		CMOVE		COLOR00,$0000
		CWAIT		0,47
		CMOVE		COLOR00,$0000
		CWAIT		0,48
		CMOVE		COLOR00,$0000
		CWAIT		0,49
		CMOVE		COLOR00,$0000
		CWAIT		0,50
		CMOVE		COLOR00,$0000
		CWAIT		0,51
		CMOVE		COLOR00,$0000
		CWAIT		0,52
		CMOVE		COLOR00,$0000
		CWAIT		0,53
		CMOVE		COLOR00,$0000
		CWAIT		0,54
		CMOVE		COLOR00,$0000
		CWAIT		0,55
		CMOVE		COLOR00,$0000
		CWAIT		0,56
		CMOVE		COLOR00,$0000
		CWAIT		0,57
		CMOVE		COLOR00,$0000
		CWAIT		0,58
		CMOVE		COLOR00,$0000
		CWAIT		0,59
		CMOVE		COLOR00,$0000
		CWAIT		0,60
		CMOVE		COLOR00,$0000
		CWAIT		0,61
		CMOVE		COLOR00,$0000
		CWAIT		0,62
		CMOVE		COLOR00,$0000
		CWAIT		0,63
		CMOVE		COLOR00,$0000
		CWAIT		0,64
		CMOVE		COLOR00,$0000
		CWAIT		0,65
		CMOVE		COLOR00,$0000
		CWAIT		0,66
		CMOVE		COLOR00,$0000


		CEND

bitplane1	incbin		logo.bm

bitplane2	ds.b		(320/8)*256*4
		
	dc.w	$0000,$00B0,$004A,$0F00,$0C29,$0FE0,$0777,$0FEE
	dc.w	$0000,$0FFF,$0FEC,$0ED9,$0EC7,$0EB5,$0DA2,$0D90	Colour Data
	dc.w	$0C80,$0B70,$0A60,$0950,$0840,$0730,$0620,$0510

bitplane3	ds.b		(352/8)*33*4

	dc.w	$0000,$0FFF,$0FEC,$0ED9,$0EC7,$0EB5,$0DA2,$0D90	Colour Data
	dc.w	$0C80,$0B70,$0A60,$0950,$0840,$0730,$0620,$0510

Font		incbin		font.bm

BlankSprite	dc.w		0,0		non-exsistent sprite!

; Sprite defenitions created by DumpSprite, © M.Meany 1993.

; Width   = 16 pixels
; Height  = 16 lines
; Colours = 4

sprite1a

	dc.w	0,0
	dc.w	$07C0,$0000,$1830,$07C0,$2008,$1FF0,$4004,$3FF8
	dc.w	$8C62,$7FFC,$8842,$7BDC,$8C62,$7FFC,$8002,$7FFC
	dc.w	$8002,$7C04,$8002,$7E04,$8002,$7F0C,$98C4,$6738
	dc.w	$A528,$4210,$A528,$4210,$4210,$0000,$0000,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 16 lines
; Colours = 4

sprite1b

	dc.w	0,0
	dc.w	$07C0,$0000,$1830,$07C0,$2008,$1FF0,$4004,$3FF8
	dc.w	$8C62,$7FFC,$8842,$7BDC,$8C62,$7FFC,$8002,$7FFC
	dc.w	$8002,$7C04,$8002,$7E04,$8002,$7F0C,$8C62,$739C
	dc.w	$5294,$2108,$5294,$2108,$2108,$0000,$0000,$0000
	dc.l	0


; Width   = 16 pixels
; Height  = 11 lines
; Colours = 4

sprite2a

	dc.w	0,0
	dc.w	$1F00,$0000,$3F80,$0000,$7BC0,$0000,$FF80,$0000
	dc.w	$FE00,$0000,$FC00,$0000,$FE00,$0000,$FF80,$0000
	dc.w	$7FC0,$0000,$3F80,$0000,$1F00,$0000
	dc.l	0

; Width   = 15 pixels
; Height  = 11 lines
; Colours = 16

sprite2b

	dc.w	0,0
	dc.w	$1F00,$0000,$3F80,$0000,$7FC0,$0000,$FEE0,$0000
	dc.w	$FFE0,$0000,$FE00,$0000,$FFE0,$0000,$FFE0,$0000
	dc.w	$7FC0,$0000,$3F80,$0000,$1F00,$0000
	dc.l	0


; Width   = 16 pixels
; Height  = 16 lines
; Colours = 4

sprite3a

	dc.w	0,0
	dc.w	$07C0,$0000,$1830,$07C0,$2008,$1FF0,$4004,$3FF8
	dc.w	$8C62,$7FFC,$8422,$77BC,$8C62,$7FFC,$8002,$7FFC
	dc.w	$8002,$607C,$8002,$5FBC,$8002,$7FFC,$4632,$39CC
	dc.w	$294A,$1084,$294A,$1084,$1084,$0000,$0000,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 16 lines
; Colours = 4

sprite3b

	dc.w	0,0
	dc.w	$07C0,$0000,$1830,$07C0,$2008,$1FF0,$4004,$3FF8
	dc.w	$8C62,$7FFC,$8422,$77BC,$8C62,$7FFC,$8002,$7FFC
	dc.w	$8002,$607C,$8002,$5FBC,$8002,$7FFC,$8C62,$739C
	dc.w	$5294,$2108,$5294,$2108,$2108,$0000,$0000,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 23 lines
; Colours = 16

sprite4a_11

	dc.w	0,0
	dc.w	$00FE,$0000,$03FF,$0000,$063F,$0000,$1C1F,$0000
	dc.w	$1E3F,$0000,$3FFF,$0000,$3FFF,$0000,$7FFF,$0000
	dc.w	$7FFF,$0000,$1FFF,$2000,$07FF,$0800,$003F,$A0C0
	dc.w	$003F,$0480,$05FF,$0200,$26FF,$5900,$07FF,$7800
	dc.w	$5FFF,$2000,$3FFF,$0000,$3FFF,$0000,$1FFF,$0000
	dc.w	$07FF,$0000,$03FF,$0000,$00FE,$0000
	dc.l	0

sprite4a_12

	dc.w	0,0
	dc.w	$00FE,$0000,$03FF,$0000,$07FF,$0000,$1E7F,$0000
	dc.w	$1FFF,$0000,$3FFF,$0000,$3FFF,$0000,$7FFF,$0000
	dc.w	$7FFF,$0000,$7FFF,$0000,$9FFF,$0000,$A5FF,$0000
	dc.w	$A4FF,$0000,$57FF,$0000,$7FFF,$0000,$7FFF,$0000
	dc.w	$7FFF,$0000,$3FFF,$0000,$3FFF,$0000,$1FFF,$0000
	dc.w	$07FF,$0000,$03FF,$0000,$00FE,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 23 lines
; Colours = 16

sprite4a_21

	dc.w	0,0
	dc.w	$0000,$0000,$8000,$0000,$C000,$0000,$F000,$0000
	dc.w	$F000,$0000,$F800,$0000,$FC00,$0000,$FC00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FE00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FC00,$0000
	dc.w	$FC00,$0000,$F800,$0000,$F000,$0000,$F000,$0000
	dc.w	$C000,$0000,$8000,$0000,$0000,$0000
	dc.l	0

sprite4a_22

	dc.w	0,0
	dc.w	$0000,$0000,$8000,$0000,$C000,$0000,$F000,$0000
	dc.w	$F000,$0000,$F800,$0000,$FC00,$0000,$FC00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FE00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FC00,$0000
	dc.w	$FC00,$0000,$F800,$0000,$F000,$0000,$F000,$0000
	dc.w	$C000,$0000,$8000,$0000,$0000,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 23 lines
; Colours = 16

sprite4b_11

	dc.w	0,0
	dc.w	$00FE,$0000,$03FF,$0000,$063F,$0000,$1C1F,$0000
	dc.w	$1E3F,$0000,$3FFF,$0000,$3FFF,$0000,$03FF,$1000
	dc.w	$01FF,$0600,$00FF,$4900,$00FF,$0000,$003F,$0000
	dc.w	$003F,$00C0,$00FF,$0100,$00FF,$0000,$01FF,$0000
	dc.w	$02FF,$1900,$12FF,$2D00,$037F,$3C80,$0FFF,$1000
	dc.w	$07FF,$0000,$03FF,$0000,$00FE,$0000
	dc.l	0

sprite4b_12

	dc.w	0,0
	dc.w	$00FE,$0000,$03FF,$0000,$07FF,$0000,$1E7F,$0000
	dc.w	$1FFF,$0000,$3FFF,$0000,$3FFF,$0000,$37FF,$0000
	dc.w	$4FFF,$0000,$49FF,$0000,$00FF,$0000,$003F,$0000
	dc.w	$00FF,$0000,$01FF,$0000,$48FF,$0000,$49FF,$0000
	dc.w	$3FFF,$0000,$3FFF,$0000,$3FFF,$0000,$1FFF,$0000
	dc.w	$07FF,$0000,$03FF,$0000,$00FE,$0000
	dc.l	0

; Width   = 16 pixels
; Height  = 23 lines
; Colours = 16

sprite4b_21

	dc.w	0,0
	dc.w	$0000,$0000,$8000,$0000,$C000,$0000,$F000,$0000
	dc.w	$F000,$0000,$F800,$0000,$FC00,$0000,$FC00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FE00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FC00,$0000
	dc.w	$FC00,$0000,$F800,$0000,$F000,$0000,$F000,$0000
	dc.w	$C000,$0000,$8000,$0000,$0000,$0000
	dc.l	0

sprite4b_22

	dc.w	0,0
	dc.w	$0000,$0000,$8000,$0000,$C000,$0000,$F000,$0000
	dc.w	$F000,$0000,$F800,$0000,$FC00,$0000,$FC00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FE00,$0000
	dc.w	$FE00,$0000,$FE00,$0000,$FE00,$0000,$FC00,$0000
	dc.w	$FC00,$0000,$F800,$0000,$F000,$0000,$F000,$0000
	dc.w	$C000,$0000,$8000,$0000,$0000,$0000
	dc.l	0

; Sprite structures for the star fields

star1Data

	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		10 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		20 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		30 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		40 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		50 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		60 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		70 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		80 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		90 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		100 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		110 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		120 Sprites
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000
	dc.w	0,0
	dc.w	$8000,$0000		129 Sprites

	dc.l	0


star2Data

	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		10 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		20 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		30 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		40 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		50 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		60 Sprites
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000
	dc.w	0,0
	dc.w	$0000,$8000		65 Sprites

	dc.l	0


Ball		dc.w	$0000,$1C00,$3E00,$7F00,$7F00,$7F00,$3E00,$1C00,$0000

BallMask	dc.w	$1C00,$7F00,$7F00,$FF80,$FF80,$FF80,$7F00,$7F00,$1C00



mt_data		incbin		mod.music
