


	;By The Art/EX4....................

SWIDTH		EQU	40
NUMPLANES	EQU	3-1

***************************************************
*** MACRO-Definition				***
***************************************************

WAITBLITT:	MACRO
		btst	#6,$02(a6)
.\@:		btst	#6,$02(a6)
		bne.s	.\@
		ENDM

***************************************************
*** ProgrammStart				***
***************************************************

Kill_OS:	move.l	(AbsExecBase).w,a6	; get execbase
		lea	Gfxlib(pc),a1		; point to graphics.library
		jsr	OldOpenLibrary(a6)	; open graphics library
		move.l 	d0,Gfxbase		; save gfxbase address
		jsr	Forbid(a6)		; () turn off multitasking
		lea	(_Custom).l,a6		; custom base address in a6
		move.w	dmaconr(a6),dmasav	; save dma
		move.w	intenar(a6),intsav	; save intena
		move.w	adkconr(a6),adksav	; save adkcon
		move.w	#$7fff,intena(a6)	; turn off intena

		move.l  #Copperlist,cop1lch(a6)	; install custom copperlist
		clr.w	copjmp1(a6)		; clear second copperlist
		move.w	#$c020,intena(a6)	; return INTENA:
		move.w  #$87c0,dmacon(a6)	; return DMA:Cop/Blit/Sprite


		bsr.w	get_planes
		bsr	Main


**********************************************************************
*	Restore OS
**********************************************************************



Help_OS:	lea	(_Custom).l,a6		; custom base address in a6
		move.l	GFXbase(pc),a1		; get gfxbase in a1
		move.l	SysCop1(a1),cop1lch(a6)	; restore old system copper
		move.w	dmasav,d0		; get saved dma value
		or.w	#$8000,d0
		move.w	d0,dmacon(a6)		; restore old dma
		move.w	adksav,d0		; get saved adkcon value
		or.w	#$8000,d0
		move.w	d0,adkcon(a6)		; restore old adkcon
		move.w	intsav,d0		; get saved intena value
		or.w	#$8000,d0
		move.w	d0,intena(a6)		; restore old interna
		move.l	(AbsExecBase).w,a6	; get execbase
		jsr	Permit(a6)		; permit multitasking
		move.l	GFXbase(pc),a1		; get gfxbase in a1
		jsr	CloseLibrary(a6)	; close gfx library
		moveq.l	#0,d0			; no cli return code
		rts

***************************************************
*** Main Loop					***
***************************************************

Main:		bsr.w	man_anim
		bsr.w	rollcols
		bsr.w	rollcols

		btst	#6,$bfe001
		bne.s	Main
		WAITBLITT
		rts


******************************************************************
printbigchar:	move.l	man_ptr,a2			;source gfx
		lea	buffPage+10,a0		;dest buffer (x8 size)
		moveq	#32-1,d2		;24 scanlines high
loop2:		move.w	(a2)+,d0
		moveq	#8,d5
nextscan:	moveq	#15,d1			;start at bit 0	
xloop:		btst	d1,d0
		beq.s	set1b
SetBit:		move.l	d1,d6
		moveq	#8,d4
yloop:		bset	d6,(a0)
		addq.l	#1,d6
		dbra	d4,yloop
set1b		tst.b	(a0)+
		subq.l	#1,d1			;next bit...
		bcc.s	xloop
		lea	40-16(a0),a0
		dbra	d5,nextscan
		dbra	d2,loop2
		rts


*********************************************************************
man_anim	bsr.w	getscreen
		move.l	#40,d0
		move.l	#255,d1
		lea	buffpage,a0
		bsr.w	Blitclear
drt		move.l	man_ptr,a0
		cmp.l	#-1,64(a0)
		bne.s	goman
		move.l	#test,man_ptr
		bra.w	drt
goman		bsr.w	printbigchar
		add.l	#64,man_ptr
		rts
***************************************************************
man_ptr		dc.l	test

Test:		incbin	work:prog/lsddemo/gfx/man.raw
		dc.l	-1


BlitClear:	lsr.w	#1,d0			; divide (width) by 2
		lsl.w	#6,d1			; multiply (height) by 64
		add.w	d1,d0			; add together to calc blitSize
		moveq	#0,d1			; erase d1

		lea	$dff000,a6		; hardware base in a6
		bsr.w	BlitReady
		move.l	a0,$54(a6)		; bltdpth source
		move.l	#$01000000,$40(a6)	; bltcon0
		move.l	d1,$64(a6)		; bltdmod
		move.w	d0,$58(a6)		; blit Size
		rts

blitready	
		btst	#14,$dff002
		bne.s	blitready
		rts
getscreen
		lea	mainpage+2,a1	;destin
		lea	buffpage,a0	;source	

		move.l	#256*1*64+40/2,d7	;size
		moveq	#0,d5		;modulo
		moveq	#0,d6
blit_it		move.w	d6,$dff060 		sour modulo
		move.w	d5,$dff066		dest modulo
		move.l	a0,$dff048		sourec
		move.l	a1,$dff054		destination
		move.w	#%0000001110101010,$dff040	do minterms
		move.w	d7,$dff058	size to blit
blitwait	btst	#14,$dff002		chk if blitter finished
		bne.s	blitwait			if not then wait
		rts				and return

******************************************************************
rollcols	lea	colst+6,a0
		lea	colst+14,a1
		moveq	#80,d0
		move.w	(a0),d1
docols		move.w	(a1),(a0)
		add.l	#8,a0
		add.l	#8,a1
		dbra	d0,docols
		move.w	d1,(a0)
		rts



get_planes	lea	planeptrs,a0	;get address of copper planes ptrs
		lea	planes,a1	;address of planes
		move.l	#3-1,d2		;number of planes -1

.loop		move.l	a1,d0		;store it in d0
		move.w	d0,6(a0)	;get low word
		swap	d0		;swap it round
		move.w	d0,2(a0)	;get high word
		add.l	#10240,a1	;add single plane size
		add.l	#8,a0		;add next copper plane ptr
		dbra	d2,.loop	;do all planes
		rts			;done!!!
			

***************************************************
*** Datas					***
***************************************************

Copperlist:	dc.l	$01200000,$01220000,$01240000,$01260000
		dc.l	$01280000,$012a0000,$012c0000,$012e0000
		dc.l	$01300000,$01320000,$01340000,$01360000
		dc.l	$01380000,$013a0000,$013c0000,$013e0000

		dc.l	$008e2c81,$00902bc1,$00920038,$009400d0
		dc.l	$01020000,$01040000,$01080000,$010a0000
		dc.l	$01000200,$01060000,$01fc0000

PlanePtrs:	dc.l	$00e00000,$00e20000,$00e40000,$00e60000
		dc.l	$00e80000,$00ea0000
		dc.l	$01009200

		dc.l	$01800000,$01820333,$01840555,$01860777
		dc.l	$01880999,$018a0bbb,$018c0ddd,$018e0fff


		dc	$ab01,$fffe,$108,-200,$10a,-200
		dc	$180,$002,$182,$004,$100,$9200
		dc	$184,$003,$186,$004

		dc	$188,$001,$18a,$001,$18c,$001,$18e,$842
		dc	$190,$006,$192,$006,$194,$006,$196,$006
		dc	$198,$006,$19a,$006,$19c,$006,$19e,$003

colst		dc	$ac01,$fffe,$102,$000f
		dc	$ad01,$fffe,$102,$000f
		dc	$ae01,$fffe,$102,$000f
		dc	$af01,$fffe,$102,$000f
		dc	$b001,$fffe,$102,$000f
		dc	$b101,$fffe,$102,$000f
		dc	$b201,$fffe,$102,$001e
		dc	$b301,$fffe,$102,$001e
		dc	$b401,$fffe,$102,$001e
		dc	$b501,$fffe,$102,$001e
		dc	$b601,$fffe,$102,$001e
		dc	$b701,$fffe,$102,$002d
		dc	$b801,$fffe,$102,$002d
		dc	$b901,$fffe,$102,$002d
		dc	$ba01,$fffe,$102,$002d
		dc	$bb01,$fffe,$102,$003c
		dc	$bc01,$fffe,$102,$003c
		dc	$bd01,$fffe,$102,$003c
		dc	$be01,$fffe,$102,$004b
		dc	$bf01,$fffe,$102,$004b
		dc	$c001,$fffe,$102,$005a
		dc	$c101,$fffe,$102,$0069
		dc	$c201,$fffe,$102,$0078
		dc	$c301,$fffe,$102,$0087
		dc	$c401,$fffe,$102,$0096
		dc	$c501,$fffe,$102,$0096
		dc	$c601,$fffe,$102,$00a5
		dc	$c701,$fffe,$102,$00a5
		dc	$c801,$fffe,$102,$00a5
		dc	$c901,$fffe,$102,$00b4
		dc	$ca01,$fffe,$102,$00b4
		dc	$cb01,$fffe,$102,$00b4
		dc	$cc01,$fffe,$102,$00b4
		dc	$cd01,$fffe,$102,$00c3
		dc	$ce01,$fffe,$102,$00c3
		dc	$cf01,$fffe,$102,$00c3
		dc	$d001,$fffe,$102,$00c3
		dc	$d101,$fffe,$102,$00c3
		dc	$d201,$fffe,$102,$00d2
		dc	$d301,$fffe,$102,$00d2
		dc	$d401,$fffe,$102,$00d2
		dc	$d501,$fffe,$102,$00d2
		dc	$d601,$fffe,$102,$00d2
		dc	$d701,$fffe,$102,$00d2
		dc	$d801,$fffe,$102,$00e1
		dc	$d901,$fffe,$102,$00e1
		dc	$da01,$fffe,$102,$00e1
		dc	$db01,$fffe,$102,$00e1
		dc	$dc01,$fffe,$102,$00e1
		dc	$dd01,$fffe,$102,$00e1
		dc	$de01,$fffe,$102,$00e1
		dc	$df01,$fffe,$102,$00f0
		dc	$e001,$fffe,$102,$00f0
		dc	$e101,$fffe,$102,$00f0
		dc	$e201,$fffe,$102,$00f0
		dc	$e301,$fffe,$102,$00f0
		dc	$e401,$fffe,$102,$00f0
		dc	$e501,$fffe,$102,$00f0
		dc	$e601,$fffe,$102,$00f0
		dc	$e701,$fffe,$102,$00e1
		dc	$e801,$fffe,$102,$00e1
		dc	$e901,$fffe,$102,$00e1
		dc	$ea01,$fffe,$102,$00e1
		dc	$eb01,$fffe,$102,$00e1
		dc	$ec01,$fffe,$102,$00e1
		dc	$ed01,$fffe,$102,$00d2
		dc	$ee01,$fffe,$102,$00d2
		dc	$ef01,$fffe,$102,$00d2
		dc	$f001,$fffe,$102,$00d2
		dc	$f101,$fffe,$102,$00c3
		dc	$f201,$fffe,$102,$00c3
		dc	$f301,$fffe,$102,$00c3
		dc	$f401,$fffe,$102,$00b4
		dc	$f501,$fffe,$102,$00b4
		dc	$f601,$fffe,$102,$00a5
		dc	$f701,$fffe,$102,$0096
		dc	$f801,$fffe,$102,$0087
		dc	$f901,$fffe,$102,$0078
		dc	$fa01,$fffe,$102,$0069
		dc	$fb01,$fffe,$102,$005a
		dc	$fc01,$fffe,$102,$004b
		dc	$fd01,$fffe,$102,$003c
		dc	$fe01,$fffe,$102,$003c
		dc	$ff01,$fffe,$102,$003c,$100,$0200



		dc.l	-2


dmasav:		dc.w	0
adksav:		dc.w	0
intsav:		dc.w	0
GFXlib:		dc.b	"graphics.library"
		even
GFXBase:	ds.l	2
		even

		section	b,bss_c
planes
mainpage	ds.b	40*256*3


buffpage	ds.b	10240
Level3Vector	equ $6c
SysCop1		equ $26
_ciaa:		equ $bfe001
_ciab:		equ $bfd000
left		equ 6

_custom:	equ $dff000
bltddat:	equ $000
dmaconr:	equ $002
vposr:		equ $004
vhposr:		equ $006
dskdatr:	equ $008
joy0dat:	equ $00a
joy1dat:	equ $00c
clxdat:		equ $00e
adkconr:	equ $010
pot0dat:	equ $012
pot1dat:	equ $014
potgor:		equ $016
serdatr:	equ $018
dskbytr:	equ $01a
intenar:	equ $01c
intreqr:	equ $01e
dskpth:		equ $020
dskptl:		equ $022
dsklen:		equ $024
dskdat:		equ $026
refptr:		equ $028
vposw:		equ $02a
vhposw:		equ $02c
copcon:		equ $02e
serdat:		equ $030
serper:		equ $032
potgo:		equ $034
joytest:	equ $036
strequ:		equ $038
strvbl:		equ $03a
strhor:		equ $03c
strlong:	equ $03e
bltcon0:	equ $040
bltcon1:	equ $042
bltafwm:	equ $044
bltalwm:	equ $046
bltcpth:	equ $048
bltcptl:	equ $04a
bltbpth:	equ $04c
bltbptl:	equ $04e
bltapth:	equ $050
bltaptl:	equ $052
bltdpth:	equ $054
bltdptl:	equ $056
bltsize:	equ $058
bltcmod:	equ $060
bltbmod:	equ $062
bltamod:	equ $064
bltdmod:	equ $066
bltcdat:	equ $070
bltbdat:	equ $072
bltadat:	equ $074
dsksync:	equ $07e
cop1lch:	equ $080
cop1lcl:	equ $082
cop2lch:	equ $084
cop2lcl:	equ $086
copjmp1:	equ $088
copjmp2:	equ $08a
copins:		equ $08c
diwstrt:	equ $08e
diwstop:	equ $090
ddfstrt:	equ $092
ddfstop:	equ $094
dmacon:		equ $096
clxcon:		equ $098
intena:		equ $09a
intreq:		equ $09c
adkcon:		equ $09e
aud0pth:	equ $0a0
aud0ptl:	equ $0a2
aud0len:	equ $0a4
aud0per:	equ $0a6
aud0vol:	equ $0a8
aud0dat:	equ $0aa
aud1pth:	equ $0b0
aud1ptl:	equ $0b2
aud1len:	equ $0b4
aud1per:	equ $0b6
aud1vol:	equ $0b8
aud1dat:	equ $0ba
aud2pth:	equ $0c0
aud2ptl:	equ $0c2
aud2len:	equ $0c4
aud2per:	equ $0c6
aud2vol:	equ $0c8
aud2dat:	equ $0ca
aud3pth:	equ $0d0
aud3ptl:	equ $0d2
aud3len:	equ $0d4
aud3per:	equ $0d6
aud3vol:	equ $0d8
aud3dat:	equ $0da
bpl1pth:	equ $0e0
bpl1ptl:	equ $0e2
bpl2pth:	equ $0e4
bpl2ptl:	equ $0e6
bpl3pth:	equ $0e8
bpl3ptl:	equ $0ea
bpl4pth:	equ $0ec
bpl4ptl:	equ $0ee
bpl5pth:	equ $0f0
bpl5ptl:	equ $0f2
bpl6pth:	equ $0f4
bpl6ptl:	equ $0f6
bplcon0:	equ $100
bplcon1:	equ $102
bplcon2:	equ $104
bpl1mod:	equ $108
bpl2mod:	equ $10a
bpl1dat:	equ $110
bpl2dat:	equ $112
bpl3dat:	equ $114
bpl4dat:	equ $116
bpl5dat:	equ $118
bpl6dat:	equ $11a
spr0pth:	equ $120
spr0ptl:	equ $122
spr1pth:	equ $124
spr1ptl:	equ $126
spr2pth:	equ $128
spr2ptl:	equ $12a
spr3pth:	equ $12c
spr3ptl:	equ $12e
spr4pth:	equ $130
spr4ptl:	equ $132
spr5pth:	equ $134
spr5ptl:	equ $136
spr6pth:	equ $138
spr6ptl:	equ $13a
spr7pth:	equ $13c
spr7ptl:	equ $13e
spr0pos:	equ $140
spr0ctl:	equ $142
spr0data:	equ $144
spr0datb:	equ $146
spr1pos:	equ $148
spr1ctl:	equ $14a
spr1data:	equ $14c
spr1datb:	equ $14e
spr2pos:	equ $150
spr2ctl:	equ $152
spr2data:	equ $154
spr2datb:	equ $156
spr3pos:	equ $158
spr3ctl:	equ $15a
spr3data:	equ $15c
spr3datb:	equ $15e
spr4pos:	equ $160
spr4ctl:	equ $162
spr4data:	equ $164
spr4datb:	equ $166
spr5pos:	equ $168
spr5ctl:	equ $16a
spr5data:	equ $16c
spr5datb:	equ $16e
spr6pos:	equ $170
spr6ctl:	equ $172
spr6data:	equ $174
spr6datb:	equ $176
spr7pos:	equ $178
spr7ctl:	equ $17a
spr7data:	equ $17c
spr7datb:	equ $17e
color00:	equ $180
color01:	equ $182
color02:	equ $184
color03:	equ $186
color04:	equ $188
color05:	equ $18a
color06:	equ $18c
color07:	equ $18e
color08:	equ $190
color09:	equ $192
color10:	equ $194
color11:	equ $196
color12:	equ $198
color13:	equ $19a
color14:	equ $19c
color15:	equ $19e
color16:	equ $1a0
color17:	equ $1a2
color18:	equ $1a4
color19:	equ $1a6
color20:	equ $1a8
color21:	equ $1aa
color22:	equ $1ac
color23:	equ $1ae
color24:	equ $1b0
color25:	equ $1b2
color26:	equ $1b4
color27:	equ $1b6
color28:	equ $1b8
color29:	equ $1ba
color30:	equ $1bc
color31:	equ $1be
open:		equ -30
close:		equ -36
read:		equ -42
write:		equ -48
input:		equ -54
output:		equ -60
seek:		equ -66
deletefile:	equ -72
rename:		equ -78
lock:		equ -84
unlock:		equ -90
duplock:	equ -96
examine:	equ -102
exnext:		equ -108
info:		equ -114
createdir:	equ -120
currentdir:	equ -126
ioErr:		equ -132
CreateProc:	equ -138
exit:		equ -144
loadseg:	equ -150
unloadseg:	equ -156
getpacket:	equ -162
queupacket:	equ -168
deviceproc:	equ -174
setcomment:	equ -180
setprotection:	equ -186
datestamp:	equ -192
delay:		equ -198
waitforchar:	equ -204
parentdir:	equ -210
IsInteractive:	equ -216
Execute:	equ -222

AbsExecBase:	equ 4
forbid		equ -132
permit		equ -138
allocmem:	equ -198
freemem:	equ -210
getmsg:		equ -372
replymsg:	equ -378
waitport:	equ -384
closelibrary:	equ -414
opendevice:	equ -444
closedevice:	equ -450
doio:		equ -456
oldopenlibrary	equ -408
openlibrary:	equ -552

