
;                  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
	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,0
char:	dc.b	27*8,0,0

moveit:	move.w	scrpos,d1
	sub.w	#$0022,d1
	cmp.w	#$ffef,d1
	beq	resscr
	move.w	d1,scrpos
	rts

resscr:	move.w	#$00ff,scrpos
	lea	$59114,a2
	lea	$59116,a3
	move.w	#$0,d0
looppy:	move.b	(a3),(a2)
	add.l	#$1,a3
	add.l	#$1,a2
	add.w	#$1,d0
	cmp.w	#$300,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
	sub.b	#$61,d1
	mulu	#$20,d1
	move.b	d1,char
	add.l	#1,count
	cmp.b	#$ff,(a2)
	beq	resettext	
	rts

resettext:
	move.l	#0,count
	rts

text:	;dc.b	"                                                   "
	;dc.b	"                                                   "
	;dc.b	"                                                   "
	dc.b	"spark of xxx international presents his first demo "
	dc.b	"on the mighty amiga                                "
	dc.b	"this demo is written entirely in cbm sixty four bas"
	dc.b	"ic              how do you like it              "
	dc.b	"do you notice the wobble               yeah   thats"
	dc.b	" right     the middle x wobbles the other way      "
	dc.b	"                                                   "
	dc.b	"what do you thik of the offset bitplane scroller   "
	dc.b	"       dude init          here is an important mess"
	dc.b	"age to all demo and intro writters   "
	dc.b	"           the lights are back         so start all"
	dc.b	" them flashers now         the time is now three "
	dc.b	"fifty five am       and im fuckin tired so i will"
	dc.b	" now let my freind  "
	dc.b	"tezz have his chance at fame        " 
	dc.b	"          hi there this is tezz "
	dc.b	"i am not in xxx international but this is my chance"
	dc.b	" to put a few people in there place                "
	dc.b	"aaron from plymouth    if you ever think about "
	dc.b 	"giving fast a call again i will personaly castrate"
	dc.b	" you      all swappers beware of arron smith of "
	dc.b	"plymouth      right now for a special message to "
	dc.b	"lee demo creator ceco freeman  "
	dc.b    "      lee you are fat          "
	dc.b 	"i would like to give special thanks to j r     "
	dc.b	"         now for a message to my dad             "
	dc.b	" if you ever break my amiga again you will suffer "
	dc.b	"dearly   it has been sent back and i have not used "
	dc.b    "it for a week      oh shit now its time to go"       
	dc.b	"           so from tezz     good riddence"
	dc.b	"  now i will pass the text back to "
	dc.b    "the master of disaster            spark            "
	dc.b    "well     what more can one say        praise me my "
	dc.b	"slave              now lets get back to the real "
	dc.b	"world shall we          news flash     news flash "
	dc.b	"        the wildcats have joined   xxx internation"
	dc.b	"al      cougar alias turbo alias the postie alias"
	dc.b	" black adder  has changed his name back to       "
	dc.b	"  turbo       lynx has kept his name the same    "
	dc.b	"so from now on         the wildcats are extinct  "
	dc.b	"                          "
	dc.b	"   comming soon to a scroller "
	dc.b	"near you                 the greetings             "
	dc.b	"but not just yet                    or shall i     "
	dc.b	"                 yeah                no            "
	dc.b	"        ok then               here they are        "
	dc.b	"   in no particular order                 "
	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



scrmove:move.b	scrmovflag,d0
	cmp.b	#$f,d0
	beq	miss
	move.b	#$f,scrmovflag
	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
	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	$0100,$4000,$00e0,$0005,$00e2,$0000,$00e4,$0005
	dc.w	$00e6,$1f40,$00e8,$0005,$00ea,$3e80,$00ec,$0005
	dc.w	$00ee,$5dc0,$0092,$0038,$0094,$00d0,$008e,$1e01
	dc.w	$0102,$0000
	dc.w	$0180,$0000,$0182,$0ff0,$0184,$0ee0,$0186,$0dd0
	dc.w	$0188,$0cc0,$018a,$0bb0,$018c,$0aa0,$018e,$0990
	dc.w	$0190,$0880,$0192,$0770,$0194,$0660,$0196,$0550
	dc.w	$0198,$0440,$019a,$0330,$019c,$0220,$019e,$0110	
	dc.w	$0090,$31ff
	dc.w	$7f01,$fffe
	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
gb3:	dc.w	$8211,$fffe,$0180,$0222,$00e2,$8fff
gb4:	dc.w	$8311,$fffe,$0180,$0333,$00e2,$8fff
gb5:	dc.w	$8411,$fffe,$0180,$0444,$00e2,$8fff
gb6:	dc.w	$8511,$fffe,$0180,$0555,$00e2,$902d	
gb7:	dc.w	$8611,$fffe,$0180,$0666,$00e2,$902d
gb8:	dc.w	$8711,$fffe,$0180,$0777,$00e2,$902d
gb9:	dc.w	$8811,$fffe,$0180,$0888,$00e2,$902d
gba:	dc.w	$8911,$fffe,$0180,$0999,$00e2,$905b
gbb:	dc.w	$8a11,$fffe,$0180,$0aaa,$00e2,$905b
gbc:	dc.w	$8b11,$fffe,$0180,$0bbb,$00e2,$905b
gbd:	dc.w	$8c11,$fffe,$0180,$0ccc,$00e2,$905b
gbe:	dc.w	$8d11,$fffe,$0180,$0ddd,$00e2,$9089
gbf:	dc.w	$8e11,$fffe,$0180,$0eee,$00e2,$9089
gbg:	dc.w	$8f11,$fffe,$0180,$0fff,$00e2,$9089
gbh:	dc.w	$9011,$fffe,$0180,$0eee,$00e2,$9089
gbi:	dc.w	$9111,$fffe,$0180,$0ddd,$00e2,$9089
gbj:	dc.w	$9211,$fffe,$0180,$0ccc,$00e2,$9089
gbk:	dc.w	$9311,$fffe,$0180,$0bbb,$00e2,$90b7
gbl:	dc.w	$9411,$fffe,$0180,$0aaa,$00e2,$90b7
gbm:	dc.w	$9511,$fffe,$0180,$0999,$00e2,$90b7
gbn:	dc.w	$9611,$fffe,$0180,$0888,$00e2,$90b7
gbo:	dc.w	$9711,$fffe,$0180,$0777,$00e2,$90b7
gbp:	dc.w	$9811,$fffe,$0180,$0666,$00e2,$90e5
gbq:	dc.w	$9911,$fffe,$0180,$0555,$00e2,$90e5
gbr:	dc.w	$9a11,$fffe,$0180,$0444,$00e2,$90e5
gbs:	dc.w	$9b11,$fffe,$0180,$0333,$00e2,$90e5
gbt:	dc.w	$9c11,$fffe,$0180,$0222,$00e2,$9113
gbu:	dc.w	$9d11,$fffe,$0180,$0111,$00e2,$9113
gbv:	dc.w	$9e11,$fffe,$0180,$0000,$00e2,$9113
bp2:	dc.w	$9113,$fffe,$0100,$0000,$00e2,$9113
	
	dc.w	$da01,$fffe
	dc.w	$0100,$4000,$0102,$0000
	dc.w	$db01,$fffe,$0180,$0800
	dc.w	$dc01,$fffe,$0180,$0f00
	dc.w	$dd01,$fffe,$0180,$0800
	dc.w	$de01,$fffe,$0180,$0000,$018c,$0000
	dc.w	$00e0,$0006
	dc.w	$0092,$0038,$0094,$00d0,$0184,$0800
	dc.w	$00e4,$0005,$00e6,$a000
	dc.w	$00e8,$0005,$00ea,$bf40	
	dc.w	$00ec,$0005,$00ee,$de80
	dc.w	$dfa1,$fffe
	dc.w	$0184,$0fff,$0188,$0999,$018c,$0444
	dc.w	$0190
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
	

