org $20000
load $20000
ExecBase = 4
OpenLib  = -30-522
Forbid = -132
Permit = -138

s:	movem.l d0-d7/a0-a6,-(a7)	;Save registers.
	move.l ExecBase,a6
	jsr Forbid(a6)			;Forbid multitasking.
	lea $dff000,a0
	move.w #$03ef,$96(a0)		;Disable all DMA's.
	move.w #$7fff,$9a(a0)		;Disable all interrupts.
	
	move.l #coplist,$80(a0)
	clr.w $88(a0)
	move.w #$8280,$96(a0)		;Enable Copper-DMA
	
	lea.l VERTB,a1
	move.l $6c,2(a1)		;Vector for level 3 interrupt.
	move.l #VertBlank,$6c
	move.w #$c020,$dff09a		;Enable Vert. Blank Interrupt.

	lea.l SOFT,a1
	move.l $64,2(a1)		;Vector for level 1 interrupt.
	move.l #SoftInt,$64
	move.w #$c004,$dff09a		;Enable Soft Interrupt

Mouse:	btst #10,$dff016		;Right mousebutton pressed ?
	bne Mouse

	lea.l VERTB,a1
	add.l #2,a1
	move.l (a1),$6c
	lea.l SOFT,a1
	add.l #2,a1
	move.l (a1),$64
	move.l ExecBase,a6
	move.l #GfxName,a1
	clr.l d0
	jsr OpenLib(a6)			;Get pointer of GFX-library
	move.l d0,a4
	lea $dff000,a0
	move.l 38(a4),$80(a0)		;Old Copper-List
	clr.w $88(a0)
	move.w #$83e0,$96(a0)		;Enable some DMA's.
	move.w #$000f,$96(a0)		;Disable sound-DMA
	move.w #$e06a,$9a(a0)		;Enable some interrupts
	jsr permit(a6)			;Permit Multi-Tasking
	movem.l (a7)+,d0-d7/a0-a6	;Get registers.
	rts

VertBlank:				;Interrupt that ALWAYS starts
	move.w #$0fff,$dff180		;at line 0 !!!
	jmp VERTB
VERTB:	jmp $00000000
	
SoftInt:move.w #$0004,$dff09c		;Interrupt that starts when
					;the user wants it to start.
	move.w #$0333,$dff180
	jmp SOFT
SOFT:	jmp $00000000

coplist:dc.w $009c,$8004	;Soft Interrupt required.
	dc.w $0096,$8360	;Enable Bitpl.-,Blitt.- and Sprite-DMA
	
	dc.w $0100,$0200	;BPLcon0
	dc.w $0102,$0000	;BPLcon1(scrollvalue...)
	dc.w $0104,$0000	;BPLcon2(priority...)
	dc.w $0108,$0000	;Modulo (odd planes)
	dc.w $010a,$0000	;Modulo (even planes)
	dc.w $008e,$2c81	;Window (start)
	dc.w $0090,$2cc1	;Window (stop)
	dc.w $0092,$0038	;Datafetch (start)
	dc.w $0094,$00d0	;Datafetch (stop)

planes:	dc.w $00e0,$0000,$00e2,$0000	;plane 0
	dc.w $00e4,$0000,$00e6,$0000	;plane 1
	dc.w $00e8,$0000,$00ea,$0000	;plane 2
	dc.w $00ec,$0000,$00ee,$0000	;plane 3
	dc.w $00f0,$0000,$00f2,$0000	;plane 4
	dc.w $00f4,$0000,$00f6,$0000	;plane 5

sprites:dc.w $0120,$0000,$0122,$0000	;sprite 0
	dc.w $0124,$0000,$0126,$0000	;sprite 1
	dc.w $0128,$0000,$012a,$0000	;sprite 2
	dc.w $012c,$0000,$012e,$0000	;sprite 3
	dc.w $0130,$0000,$0132,$0000	;sprite 4
	dc.w $0134,$0000,$0136,$0000	;sprite 5
	dc.w $0138,$0000,$013a,$0000	;sprite 6
	dc.w $013c,$0000,$013e,$0000	;sprite 7
	
colors:	dc.w $0180,$0000,$0182,$0000,$0184,$0000,$0186,$0000
	dc.w $0188,$0000,$018a,$0000,$018c,$0000,$018e,$0000
	dc.w $0190,$0000,$0192,$0000,$0194,$0000,$0196,$0000
	dc.w $0198,$0000,$019a,$0000,$019c,$0000,$019e,$0000
	dc.w $01a0,$0000,$01a2,$0000,$01a4,$0000,$01a6,$0000
	dc.w $01a8,$0000,$01aa,$0000,$01ac,$0000,$01ae,$0000
	dc.w $01b0,$0000,$01b2,$0000,$01b4,$0000,$01b6,$0000
	dc.w $01b8,$0000,$01ba,$0000,$01bc,$0000,$01be,$0000
	
	dc.w $ffff,$fffe
	
GfxName:dc.b "graphics.library",0
	even
