
;                  copper list example
;

bwobflag:	dc.w	0
execbase:	equ	4
dmacon:		equ	$dff096
oldopenlibary:	equ	-408


main:	move.l	execbase,a6
	lea	gfxname,a1
	move.l	#0,d0
	jsr	oldopenlibary(a6)
	tst	d0
	beq	error_no_libary
	move.l	d0,gfxbase
	move.l	d0,a0
	add.l	#$32,a0
	move.w	#$0080,dmacon
	move.l	(a0),oldcopper
	move.l	#newcopper,(a0)
	move.w	#$8080,dmacon
	jsr	startpos
	jsr	resetcols
	jsr	rrresud
	move.w	#$0020,$dff096
	jsr	resettext
	
	;move.l	$6c,store
	;lea	inter,a1
	;move.l	a1,$6c
	;move.w	#$0010,$dff09a
	;move.w	#$ffff,$dff088
	;move.w	#$8020,$dff09a
	;move.w	#$0403,$dff096

wait:	jsr	inter
	jsr	pause
	andi.b	#$40,$bfe001
	bne	wait
	;jsr 	start	
	move.l	gfxbase,a0
	add.l	#$32,a0
	move.w	#$8020,$dff096
	move.w	#$0080,dmacon
	move.l	oldcopper,(a0)
	move.w	#$8080,dmacon

error_no_libary:
	rts	

store:	dc.l	0,0,0,0

pause:	move.w	#$e000,d3
loop:	add.w	#1,d3
	bne	loop
	rts

inter:	jsr	moveit
	jsr	sine
	jsr	lights
	jsr	intcyc
	jsr	scrmove
	rts
	;move.l	store,a1
	;jmp	(a1)


vs1:	dc.w	0,0
vs2:	dc.w	0,0
vs3:	dc.w	0,0
vs4:	dc.w	0,0

lights:	cmp.w	#0,vs1
	beq	retli1
	move.w	vs1,vl1
retli1:	cmp.w	#0,vs2
	beq	retli2
	move.w	vs2,vl2
retli2:	cmp.w	#0,vs3
	beq	retli3
	move.w	vs3,vl3
retli3:	cmp.w	#0,vs4
	beq	retli4
	move.w	vs4,vl4
retli4:	rts	

gfxname:
	dc.b	"graphics.library",0
	even

scroll:	lea	$58000,a1
	move.l	chart,d1
	add.l	d1,a1
	lea	$59144,a2
	move.b	#$0,d1
loopy:	move.w	(a1),(a2)
	add.l	#48,a2
	add.l	#2,a1
	add.b	#1,d1
	cmp.b	#$20,d1	
	blt	loopy
	rts
chart:	dc.b	0,0
char:	dc.b	$1,$2,$c
	even

pauseflag:	dc.l	0,0
pausebit:	dc.l	0,0

pauser:	move.w	pausebit,d0
	sub.w	#1,d0
	cmp.w	#0,d0
	beq	unsetpause
	move.w	d0,pausebit
	rts

unsetpause:
	move.b	#0,pauseflag
	move.w	#0,pausebit
	bra	newchar

setpause:
	move.b	#$f,pauseflag
	move.w	#$0060,pausebit
	rts

scrspeed:	dc.w	$0022,0

moveit:	move.b	pauseflag,d0
	cmp.b	#$f,d0
	beq	pauser	
	move.w	scrspeed,d0
	move.w	scrpos,d1
	sub.w	d0,d1
	cmp.w	#$f1ef,d1
	bhi	resscr
	move.w	d1,scrpos
	rts

misschar:	
	move.b	#0,checkmoveflag
	rts

checkmoveflag:	dc.b	0,0,0,0

resscr:	move.b	checkmoveflag,d0
	cmp.b	#$f,d0
	beq	misschar

	move.w	#$00ff,scrpos
	lea	$59114,a2
	lea	$59116,a3
	move.w	#$0,d0
looppy:	move.w	(a3),(a2)
	add.l	#$2,a3
	add.l	#$2,a2
	add.w	#$1,d0
	cmp.w	#$180,d0
	blt	looppy
	jsr	scroll
	jsr	newchar
	rts

count:	dc.l	0,0
newchar:
	lea	count,a1
	lea	text,a2
	add.l	(a1),a2
	move.b	(a2),d1
	move.b	d1,shortbit
	move.w	shortstore,d1
	sub.w	#$31,d1
	mulu	#$20,d1
	move.w	d1,char
	add.l	#1,count
	cmp.b	#$ff,(a2)
	beq	resettext	
	cmp.b	#$ee,(a2)	
	beq	setpause
	cmp.b	#$d1,(a2)
	beq	scrspeed1
	cmp.b	#$d2,(a2)
	beq	scrspeed2
	cmp.b	#$d3,(a2)
	beq	scrspeed3
	cmp.b	#$d4,(a2)
	beq	scrspeed4
	cmp.b	#$d5,(a2)
	beq	scrspeed5
	cmp.b	#$c0,(a2)
	beq	upon
	cmp.b	#$c1,(a2)
	beq	upoff

	rts
upon:	move.b	#$0,stopflag
	move.b	#$f,checkmoveflag
	rts

upoff:	move.b	#$f,stopflag
	move.b	#$f,checkmoveflag
	rts


scrspeed1:
	move.w	#$0011,scrspeed
	move.b	#$f,checkmoveflag
	rts
scrspeed2:
	move.w	#$0022,scrspeed
	move.b	#$f,checkmoveflag
	rts
scrspeed3:
	move.w	#$0044,scrspeed
	move.b	#$f,checkmoveflag
	rts
scrspeed4:
	move.w	#$0088,scrspeed
	move.b	#$f,checkmoveflag
	rts
scrspeed5:
	move.w	#$01ff,scrspeed
	move.b	#$f,checkmoveflag
	rts


shortstore:	dc.b	0
shortbit:	dc.b	0,0,0

resettext:
	move.l	#0,count
	rts
	
text:	DC.B	$D5,`              FAST SCROLL`,$5B,$5B,$5B,`   `,$EE
	dc.b	`             SPARK          `,$c1,$EE,$ee,$ee,$c0
	DC.B	`                 OF XXX INTERNATIONAL   `,$EE
	DC.B	$D4,`           HIMEDIUM SCROLL `,$5B,$5B,$5B,`  `,$EE
	dc.b	`             SPARK          `,$EE
	DC.B	`                 OF XXX INTERNATIONAL   `,$EE
	DC.B	$D3,`          LOWMEDIUM SCROLL `,$5B,$5B,$5B,`  `,$EE
	dc.b	`             SPARK          `,$EE
	DC.B	`                 OF XXX INTERNATIONAL   `,$EE
	DC.B	$D2,`              SLOW SCROLL `,$5B,$5B,$5B,`  `,$EE
	dc.b	`             SPARK          `,$EE
	DC.B	`                 OF XXX INTERNATIONAL   `,$EE
	DC.B	$D1,`             SLOWER SCROLL `,$5B,$5B,$5B,`  `,$EE
	dc.b	`             SPARK          `,$EE
	DC.B	`                 OF XXX INTERNATIONAL   `,$EE


	DC.B	$FF
	dc.b	`     greetings go to                   `
	dc.b	`channel fourteen       british bulldogs    sex dwarf`
	dc.b	`         `
	dc.b	`soft killer crew      scanner of crisis internation`
	dc.b	`al       special message to nero of crisis      `
	dc.b	`  why the fuck did you rip off our st scroller you`
	dc.b	` asshole        and no you `
	dc.b 	`cannt fucking keep it        right now back to the`
	dc.b	` greetings          greetings cont           `
	dc.b	`steve of the mission           red baron        `
	dc.b	`tristar        axxess and dma     the sinners      `
	dc.b	`sca      random access      the movers      the bit`
	dc.b	`stoppers       deltaforce       digitech     hqc    `
	dc.b	`  blizzard         def jam       antitrax      doc  `
	dc.b    `   the champs      alphawave     phr crew     tcc   `
	dc.b    `   vortex      tbr      mcp    the knight hawks     `
	dc.b    `  rob the bop hubbard      the outrunners      phs  `
	dc.b	`   ccs     the computer brains     megaforce        `
	dc.b	`the visitors    fairlight     northern lights       `
	dc.b    `the risky business boys     disaster area     danish`
	dc.b	` gold     the light circle     bitkillersoft     the`
	dc.b    ` limit crew     skyline     the stupid name team    `
	dc.b	`silver ghosts     the a team     lazer     irata    `
	dc.b	` alpha flight     the new age     unit a     tcc    `
	dc.b    ` gigaflops    cpu     the commodore guys    the play`
	dc.b	`boys     goffy crackings     tba     ccw team     `
	dc.b	`enterprise     bca     cfr     bfbs     ibb `
	dc.b    `        sorry if i missed anyone                    `
	dc.b	`ok        me thinks that will do for this demo    `
	dc.b	`look out for future xxx international productions`
	dc.b	`         xxx international           we deal with`
	dc.b	` the best       we dont mess with the rest  `
	dc.b	`        now its time for the rap            `
	dc.b	`yo party people in the place to be        `
	dc.b	`this is what you booted your amiga to see `
	dc.b	`                  bye from spark            `
	dc.b	`for now            `	      
	dc.b	$ff,0,0,0,0
	even

bp1count:	dc.l	0

startpos:	lea	btable,a0
		move.l	a0,bp1count
		rts

sine:	lea	gb1,a0
	lea	bp1count,a1
	jsr	updown
	rts


updown:	move.l	(a1),a2
	cmp.w	#$ffff,(a2)	
	beq	resud
	move.w	(a2),d0
	add.w	d0,gb1
	lea	gb2,a3
	lea	gbu,a4
loopp:	add.w	d0,(a3)
	add.l	#12,a3
	cmp.l	a4,a3
	bls	loopp
	add.l	#2,(a1)
	rts

resud:	lea	btable,a2
	move.l	a2,(a1)
	move.w	#$8111,(a0)
	rts

btable:	dc.w	0,0,0,0,256,0,256,0,256,256,256,256,512,256
	dc.w	512,256,512,512
	dc.w	512,512,768,512,768,512,768,512,768,768
	dc.w	768,768	
	
	dc.w	-$300,-$300,-$300,-$300,-$200,-$300,-$200,-$300
	dc.w	-$200,-$300
	dc.w	-$200,-$200,-$200,-$200,-$100,-$200,-$100,-$200
	dc.w	-$100,-$100
	dc.w	-$100,-$100
	dc.w	0,-$100,0,-$100,0,0
	
	dc.w	$ffff


scrmovflag:	dc.l	0,0

uppauseflag:	dc.l	0,0,0,0
stopflag:	dc.b	0,0,0,0

checkstopflag:
	move.b	stopflag,d0
	cmp.b	#$f,d0
	beq	ender
	bra	renter
ender:	rts

scrmove:move.b	scrmovflag,d0
	cmp.b	#$f,d0
	beq	miss
	move.b	#$f,scrmovflag
	move.w	uppauseflag,d0
	cmp.w	#$17,d0
	beq	checkstopflag
renter:	add.w	#1,uppauseflag	

	lea	bp1,a3
	cmp.w	#$9500,(a3)
	bgt	rrresud	
	lea	bp2,a4
lloopp:	add.w	#48,(a3)
	add.l	#12,a3
	cmp.l	a4,a3
	bls	lloopp
	add.l	#2,(a1)
	rts

miss:	move.b	#0,scrmovflag
	rts

rrresud:
	lea	bp1,a2
	move.w	#$8c67,d1
	lea	postable,a1
back:	add.w	(a1),d1
	move.w	d1,(a2)
	add.l	#12,a2
	add.l	#2,a1
	cmp.w	#$ffff,(a1)
	bne	back
	move.w	#0,uppauseflag
	rts
postable:	
	dc.w	0,96,96,48,48,48,0,48,0,0,48,0,0,48,0,0
	dc.w	0,0,48,0,0,48,0,0,48,0,48,48,48,96,96,$ffff

intcyc:	
	lea	fintc,a0
	lea	sintc,a1
	lea	lintc,a2
rep:	move.w	(a1),(a0)
	add.l	#8,a0
	add.l	#8,a1
	cmp.l	a0,a2
	bgt	rep
	bra	getcol
	

coladdstore:	dc.l	0,0,0

getcol:	move.l	coladdstore,a0
	cmp.w	#$ffff,(a0)
	beq	resetcols
	move.w	(a0),lintc
	add.l	#2,coladdstore
	rts
resetcols:
	lea	coltable,a0
	move.l	a0,coladdstore
	rts
	
coltable:	
	dc.w	$0880,$0990,$0aa0,$0bb0,$0cc0,$0dd0,$0ee0,$0ff0
	dc.w	$0fe0,$0fd0,$0fc0,$0fb0,$0fa0,$0f90,$0f80,$0f70
	dc.w	$0f60,$0f50,$0f40,$0f30,$0f20,$0f10,$0f00,$0f01
	dc.w	$0f01,$0f02,$0f03,$0f04,$0f05,$0f06,$0f07,$0f08
	dc.w	$0f09,$0f0a,$0f0b,$0f0c,$0f0d,$0f0e,$0f0f,$0e0f
	dc.w	$0d0f,$0c0f,$0b0f,$0a0f,$090f,$080f,$081f,$072e
	dc.w	$063d,$054c,$045b,$036a,$0279,$0188,$0098,$00a8
	dc.w	$00b8,$00c8,$00d8,$00e8,$00f8,$01e7,$02d6,$03c5
	dc.w	$04b4,$05a3,$0692,$0781,$0770
	dc.w	$ffff


gfxbase:

	dc.l	0

oldcopper:

	dc.l	0

newcopper:

	dc.w	$1001,$fffe
	dc.w	$0180,$0000,$0182,$0070	
	dc.w	$0090,$31ff
	dc.w	$7f01,$fffe
	dc.w	$0100,$1000,$00e0,$0005
	dc.w	$0092,$0028,$0094,$00f8
	dc.w	$0102
scrpos:	dc.w	$00ff
gb1:	dc.w	$8001,$fffe
	
	dc.w	$0180,$0000,$00e2
bp1:	dc.w	$8fff
gb2:	dc.w	$8111,$fffe,$0180,$0111,$00e2,$8fff
	dc.w	$8211,$fffe,$0180,$0222,$00e2,$8fff
	dc.w	$8311,$fffe,$0180,$0333,$00e2,$8fff
	dc.w	$8411,$fffe,$0180,$0444,$00e2,$8fff
	dc.w	$8511,$fffe,$0180,$0555,$00e2,$902d	
	dc.w	$8611,$fffe,$0180,$0666,$00e2,$902d
	dc.w	$8711,$fffe,$0180,$0777,$00e2,$902d
	dc.w	$8811,$fffe,$0180,$0888,$00e2,$902d
	dc.w	$8911,$fffe,$0180,$0999,$00e2,$905b
	dc.w	$8a11,$fffe,$0180,$0aaa,$00e2,$905b
	dc.w	$8b11,$fffe,$0180,$0bbb,$00e2,$905b
	dc.w	$8c11,$fffe,$0180,$0ccc,$00e2,$905b
	dc.w	$8d11,$fffe,$0180,$0ddd,$00e2,$9089
	dc.w	$8e11,$fffe,$0180,$0eee,$00e2,$9089
	dc.w	$8f11,$fffe,$0180,$0fff,$00e2,$9089
	dc.w	$9011,$fffe,$0180,$0eee,$00e2,$9089
	dc.w	$9111,$fffe,$0180,$0ddd,$00e2,$9089
	dc.w	$9211,$fffe,$0180,$0ccc,$00e2,$9089
	dc.w	$9311,$fffe,$0180,$0bbb,$00e2,$90b7
	dc.w	$9411,$fffe,$0180,$0aaa,$00e2,$90b7
	dc.w	$9511,$fffe,$0180,$0999,$00e2,$90b7
	dc.w	$9611,$fffe,$0180,$0888,$00e2,$90b7
	dc.w	$9711,$fffe,$0180,$0777,$00e2,$90b7
	dc.w	$9811,$fffe,$0180,$0666,$00e2,$90e5
	dc.w	$9911,$fffe,$0180,$0555,$00e2,$90e5
	dc.w	$9a11,$fffe,$0180,$0444,$00e2,$90e5
	dc.w	$9b11,$fffe,$0180,$0333,$00e2,$90e5
	dc.w	$9c11,$fffe,$0180,$0222,$00e2,$9113
GBU:	dc.w	$9d11,$fffe,$0180,$0111,$00e2,$9113
	dc.w	$9e11,$fffe,$0180,$0000,$00e2,$9113
bp2:	dc.w	$9113,$fffe,$0100,$0000,$00e2,$9113
	
	dc.w	$CC01,$fffe,$0180,$0800
	dc.w	$CD01,$fffe,$0180,$0f00
	dc.w	$CE01,$fffe,$0180,$0800
	dc.w	$CF01,$fffe,$0180,$0000
vl1:	dc.w	$0f00,$0194
vl2:	dc.w	$00f0,$0198
vl3:	dc.w	$000b,$019c
vl4:	dc.w	$00ff	


pal:	dc.w	$ffdf,$fffe,$0021,$fffe

international:
	dc.w	$1401,$fffe
	dc.w	$0180,$0000,$0182,$0000,$0100,$1000
	dc.w	$1501,$fffe,$00e0,$0006,$00e2,$8000
	dc.w	$1601,$fffe,$0182,
fintc:	dc.w	$0000
	dc.w	$1701,$fffe,$0182,
sintc:	dc.w	$0000
	dc.w	$1801,$fffe,$0182,$0
	dc.w	$1901,$fffe,$0182,$0
	dc.w	$1a01,$fffe,$0182,$0
	dc.w	$1b01,$fffe,$0182,$0
	dc.w	$1c01,$fffe,$0182,$0
	dc.w	$1d01,$fffe,$0182,$0
	dc.w	$1e01,$fffe,$0182,$0
	dc.w	$1f01,$fffe,$0182,$0
	dc.w	$2001,$fffe,$0182,$0
	dc.w	$2101,$fffe,$0182,$0
	dc.w	$2201,$fffe,$0182,$0
	dc.w	$2301,$fffe,$0182,$0
	dc.w	$2401,$fffe,$0182,$0
	dc.w	$2501,$fffe,$0182,$0
	dc.w	$2601,$fffe,$0182,$0
	dc.w	$2701,$fffe,$0182,$0
	dc.w	$2801,$fffe,$0182,$0
	dc.w	$2901,$fffe,$0182,$0
	dc.w	$2a01,$fffe,$0182,$0
	dc.w	$2b01,$fffe,$0182,$0
	dc.w	$2c01,$fffe,$0182,$0
	dc.w	$2d01,$fffe,$0182,$0
	dc.w	$2e01,$fffe,$0182,$0
	dc.w	$2f01,$fffe,$0182,$0
	dc.w	$3001,$fffe,$0182,$0
	dc.w	$3101,$fffe,$0182,$0
	dc.w	$3201,$fffe,$0182,$0
	dc.w	$3301,$fffe,$0182,$0
	dc.w	$3401,$fffe,$0182,$0
	dc.w	$3501,$fffe,$0182,$0
	dc.w	$3601,$fffe,$0182,$0
	dc.w	$3701,$fffe,$0182,$0
	dc.w	$3801,$fffe,$0182,$0
	dc.w	$3901,$fffe,$0182,$0
	dc.w	$3a01,$fffe,$0182,$0
	dc.w	$3b01,$fffe,$0182,$0
	dc.w	$3c01,$fffe,$0182,$0
	dc.w	$3d01,$fffe,$0182,
lintc:	dc.w	$0000

end:	dc.w	$ffff,$fffe
	
