
; Display Example 8. -- Bitplane Modulo Tricks --

; 'Melting the screen'

		include		hardware.i
		include		HW_Macros.i
		include		HW_Start.i

; First, 'poke' address of bit planes into Copper list. Use a loop to do this

Main		COPBPLC		CopPlanes,bitplane,(320/8)*256,4

; Define address of Copper List

		STARTCOP	#MyCopper

; Enable bitplane and Copper DMA.

		move.w		#SETIT!DMAEN!COPEN!BPLEN,DMACON(a5)

; Initialise the counter, 199 lines!

		move.w		#199,counter

; Install a vetical blank interrupt and activate it

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

; Wait for user to press the left mouse button

mouse		btst		#6,CIAAPRA
		bne.s		mouse

; And exit.

		rts

;		****************************
;		* Vertical Blank Interrupt *
;		****************************

Level3		lea		$dff000,a5		hardware base

; if melt complete, clear modulo and exit interrupt!

		tst.w		counter
		bne.s		DoMelt

		move.w		#0,Melting+6
		move.w		#0,Melting+10
		bra.s		IntDone

; Else, melt a line

DoMelt		subq.w		#1,counter
		addq.b		#1,Melting

; Clear the interrupt request

IntDone		move.w		INTREQR(a5),d0
		and.w		#VERTB!COPER!BLIT,d0
		move.w		d0,INTREQ(a5)

		rte

counter		dc.w		0			melt count

;		***************************
;		*     CHIP Memory Data    *
;		***************************

;section		data custom,chip
		Section		Fish,DATA_C

MyCopper	CMOVE		DIWSTRT,$2c81		PAL -- 200 lines
		CMOVE		DIWSTOP,$2cc1
		CMOVE		DDFSTRT,$0038		LoRes
		CMOVE		DDFSTOP,$00d0
		CMOVE		BPL1MOD,$0000		No modulos
		CMOVE		BPL2MOD,$0000
		CMOVE		BPLCON0,$4200		4 bitplanes & colour
		CMOVE		BPLCON1,$0000		No scrolling
		CMOVE		BPLCON2,$0000		Ignore priority

CopPlanes	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

CopColours	CMOVE		COLOR00,$0000		The colours will be
		CMOVE		COLOR01,$0000		filled in by the
		CMOVE		COLOR02,$0000		program!
		CMOVE		COLOR03,$0000
		CMOVE		COLOR04,$0000
		CMOVE		COLOR05,$0000
		CMOVE		COLOR06,$0000
		CMOVE		COLOR07,$0000
		CMOVE		COLOR08,$0000
		CMOVE		COLOR09,$0000
		CMOVE		COLOR10,$0000
		CMOVE		COLOR11,$0000
		CMOVE		COLOR12,$0000
		CMOVE		COLOR13,$0000
		CMOVE		COLOR14,$0000
		CMOVE		COLOR15,$0000

Melting		CWAIT		0,44
		CMOVE		BPL1MOD,-40
		CMOVE		BPL2MOD,-40

		CEND					end of list

bitplane	incbin		'pic2.bm'

		end

		
