
; ------------------------------------------------------------------
;
; Crackintro #2 from Ply-2/TRSi
;
; ------------------------------------------------------------------
;
; Crunched lenght is 3.5 Kilobytes (max. 4 KB)
;
; Include a Replayer if you want...
;
; Well, edit the text in line ...280 ff (up to l.300)
;
; For any questions call me or Ply-2
;
;
; Later, yours CONtROL/TRSi
;
; ------------------------------------------------------------------
;
;
;
	INCLUDE "df0:Ply2-intro2/inc/hardmacros.s"
	INCLUDE	"df0:Ply2-intro2/inc/copper+blittermacros.s"
	include	"df0:Ply2-intro2/inc/linemacros.s"
	section	"kl2",code_c
scrw	equ	1008
scrbw	equ	scrw/8
scrh	equ	256
tbw	equ	368/8
tth	equ	80
bth	equ	160
anf
	DEFPLN
	DEFBLIT
	INIT	cop0,inter,0
	SPROFF
	GENMULW	multab,0,scrbw,scrh
	bsr	drawlogo
	bsr	copylogo
	lea	toptxt,a0
	lea	tpage+20*3*tbw,a1
	bsr	drawtext
	lea	text,a0
	lea	bpage+12*3*tbw+2,a1
	bsr	drawtext
	WVBL
	move.w	#0,scrloff
	WVBL
	STARTC	#copper
	moveq	#110,d0
al
	WVBL
	dbf	d0,al
mainloop
	tst.w	scroll1
	beq.s	.out
	msloop	mainloop
.out
	move.w	#1,scrloff
	SETFADESTRUCT #rpal1,#2,fadst
	bsr	wfad
	SETFADESTRUCT #rpal2,#2,fadst
	bsr	wfad
	SETFADESTRUCT #xpal,#2,fadst	
	bsr	wfad
	bra.w	prgx

prgx
	EXIT
wfad	moveq	#31,d0
.lop	WVBL
	addq.w	#4,tscrl
	cmp.w	#73*4,tscrl
	bcs	.nbut
	move.w	#73*4,tscrl	

.nbut	dbf	d0,.lop
	rts
	
;; ******* TEXT MALEN *********
drawtext
.lin	
	move.l	a1,-(sp)
.llop	
	move.b	(a0)+,d0
	tst.b	d0
	beq.s	.linex
	lea	asctab,a2
	lea	font,a3
.srclp	
	tst.b	(a2)
	beq.s	.nfnd
	cmp.b	(a2)+,d0
	beq.s	.found
	addq.l	#1,a3
	bra.s	.srclp
.found
	move.l	a1,a2
	moveq	#7,d0
.ylop	move.b	(a3),d1
	move.b	d1,(a2)
	move.b	42(a3),d1
	move.b	d1,tbw(a2)
	move.b	2*42(a3),d1
	move.b	d1,2*tbw(a2)
	add.w	#3*42,a3
	add.w	#3*tbw,a2
	dbf	d0,.ylop
.nfnd	addq.l	#1,a1
	bra.s	.llop
.linex
	move.l	(sp)+,a1
	add.w	#tbw*3*15,a1
	cmp.b	#-1,(a0)
	bne.s	.lin
	rts
	
;; ******* LOGO KOPIEREN *****
copylogo
	WBLIT
	moveq	#15,d7
	SETADMOD scrbw,0
	BLITD	#scrbuf
	moveq	#0,d6
.loop
	move.w	d6,d5
	REGADJ	d5,%1001,%11110000,0
	BLITA	#logscr
	DOBLIT	scrbw/2,scrh/2
	WBLIT
	WBLIT
	addq.w	#1,d6
	dbf	d7,.loop	
	rts

;; ******* LOGO MALEN *****
drawlogo
	WBLIT
	flineinit scrw
	lea	vec+12,a0
	lea	multab,a3
.oloop	movem.w	(a0)+,d0/d1
	movem.w	d0/d1,-(sp)
.iloop
	movem.w	(a0)+,d2/d3
	cmp.w	#32768,d2
	beq.s	.eofl
	movem.w	d2/d3,-(sp)
	bsr	drawl
	movem.w	(sp)+,d0/d1
	bra.s	.iloop
.eofl	move.w	d3,d6
	movem.w	(sp)+,d2/d3
	bsr	drawl
	tst.w	d6
	beq.s	.oloop
	PROCOFF
	WBLIT
	FIXADJ 0,%1001,%11110000,5
	setadmod 0,0
	move.l	#-1,bltafwm(a6)
	BLITA	#logscr+scrbw*scrh-2
	BLITD	#logscr+scrbw*scrh-2
	DOBLIT	scrbw/2,scrh
	rts

drawl	add.w	d0,d0
	add.w	d2,d2
	add.w	#352,d0
	add.w	#352,d2
	fline	#logscr
inter
	IRQIN
	lea	$dff000,a6

	move.l	#tpage,bpl1pth(a6)
	move.l	#tpage+tbw,bpl2pth(a6)
	move.l	#tpage+2*tbw,bpl3pth(a6)
	sub.w	#1,tscrl
	bpl.s	.nto
	move.w	#0,tscrl
.nto
	move.w	tscrl,d0
	lsr.w	#2,d0
	add.w	#25,d0
	move.b	d0,tyscrl
	

	lea	scroll1,a0
	bsr	calcs
	move.w	d1,lc2+6
	swap	d1
	move.w	d1,lc2+2

	move.w	d2,lc1+6
	swap	d2
	move.w	d2,lc1+2

	lea	scroll2,a0
	bsr	calcs
	move.w	d1,lc3+6
	swap	d1
	move.w	d1,lc3+2

	move.w	d2,lc4+6
	swap	d2
	move.w	d2,lc4+2

	lea	scroll3,a0
	bsr	calcs
	move.w	d1,lc5+6
	swap	d1
	move.w	d1,lc5+2

	move.l	#bpage,d1
	move.w	d1,bc1+6
	swap	d1
	move.w	d1,bc1+2
	move.l	#bpage+tbw,d1
	move.w	d1,bc2+6
	swap	d1
	move.w	d1,bc2+2
	move.l	#bpage+2*tbw,d1
	move.w	d1,bc3+6
	swap	d1
	move.w	d1,bc3+2

;	move.l	#fpage,bpl1pth(a6)
;	move.l	#fpage+scrbw*scrh/2,bpl3pth(a6)
;	move.l	#fpage+scrbw*scrh,bpl5pth(a6)
	
	subq.w	#1,bfco
	bne.s	.nfls

	lea	bcl+4,a0
	moveq	#6,d0
.bcll	move.w	#$fff,2(a0)
	addq.l	#4,a0
	dbf	d0,.bcll	
.nfls

	tst.w	bfco
	bpl.s	.nfad
	lea	fadst,a1
	lea	bcl,a2
	bsr	cf
.nfad
	IRQOUT
bfco	dc.w	100
fadst	fadestruct bpal,8,2

calcs
	move.w	(a0),d0
	add.w	2(a0),d0
	tst.w	scrloff
	bne.s	.scro
	cmp.w	#scrw,d0
	bcs.s	.nsr
.scro	moveq	#0,d0
.nsr	move.w	d0,(a0)
	bsr	.c2
	move.l	d1,d2
	move.w	#scrw,d0
	sub.w	(a0),d0
.c2	moveq	#0,d1
	move.w	d0,d1
	lsr.w	#4,d1
	add.w	d1,d1
	add.l	#scrbuf,d1
	not.w	d0
	and.w	#$f,d0
	mulu	#scrbw*scrh/2,d0
	add.l	d0,d1
	rts
cf	cfadeirq
scrloff	dc.w	1
scroll1	dc.w	0,1
scroll2	dc.w	0,2
scroll3	dc.w	0,3

tscrl	dc.w	73*4

vec	incbin	"df0:Ply2-intro2/raw/trsibig.vob"

asctab	dc.b	"ABCDEFGHIJKLMNOPQRSTUVWXYZ,!.:-1234567890*",0

toptxt
	dc.b	"    *TRISTAR AND RED SECTOR INCOOPERATED* ",0
	dc.b	"                 IRGENDWAS",0
	dc.b	"         CRACKED BY WASISCHNISCH",0,-1
;		"                                             "

text	dc.b	"IRGENDWIE IST DA WAS MIT DEM DESIGN IN DIE",0
	DC.B	"HOSEN GEGANGEN... NAJA, SPARIGES INTRO FUER",0
	DC.B	"SPARIGE KILOBYTES...",0
	dc.b	"                                   ",0
	dc.b	-1
	EVEN
cop0	copmode	0,0,0,0,0
	dc.w	$180,0
	dc.l	-2

bpal	dc.w	$000,$0F0,$0C0,$0A0,$080,$060,$040,$020
rpal1	dc.w	$000,$FF,$Cc,$aA,$88,$66,$44,$22
rpal2	dc.w	$000,$F,$C,$A,$8,$6,$4,$2

copper	copmode	0,0,0,0,0
	copddf	97,0,368,300
	copwin	113,0,344,300
	dc.w	$102,$ff
	dc.w	$180,$000,$182,$F00,$184,$D00,$186,$B00
	dc.w	$188,$A00,$18a,$800,$18c,$700,$18e,$520
tyscrl	WAIT	0,98
	copmode	3,0,0,0,0

	WAIT	0,99
	copmode	0,0,0,0,0
lc1	coppln	1,0
lc2	coppln	2,0
lc3	coppln	3,0
lc4	coppln	4,0
lc5	coppln	5,0
	dc.w	$180,$000,$182,$0f2,$184,$004,$186,$9f4
	dc.w	$188,$004,$18a,$0f4,$18c,$008,$18e,$9f8
	dc.w	$190,$004,$192,$0f4,$194,$008,$196,$9f8
	dc.w	$198,$008,$19a,$0f8,$19c,$00c,$19e,$9fc

	dc.w	$1a0,$004,$1a2,$0f4,$1a4,$008,$1a6,$9f8
	dc.w	$1a8,$008,$1aa,$0f8,$1ac,$00c,$1ae,$9fc
	dc.w	$1b0,$008,$1b2,$0f8,$1b4,$00c,$1b6,$9fc
	dc.w	$1b8,$00c,$1ba,$0fc,$1bc,$00f,$1be,$9ff

	copemod	scrbw-46
	copomod	scrbw-46
	WAIT	0,100
	copmode	5,0,0,0,0
	WAIT	0,100+127
	copmode 0,0,0,0,0

bcl	dc.w	$180,$000,$182,$000,$184,$000,$186,$000
	dc.w	$188,$000,$18a,$000,$18c,$000,$18e,$000


bc1	coppln	1,0
bc2	coppln	2,0
bc3	coppln	3,0
	copemod	2*tbw
	copomod	2*tbw
	dc.w	$102,$77
	WAIT	0,101+128
	copmode	3,0,0,0,0	

	WAIT	20,198
	dc.w	$180,$fff
	WAIT	20,199
	dc.w	$180,0
	wait	446,255
	Wait	20,43
	dc.w	$180,$1
	Wait	20,44
	dc.w	$180,$2
	Wait	20,45
	dc.w	$180,$3
	Wait	20,46
	dc.w	$180,$4
	Wait	20,47
	dc.w	$180,$5
	Wait	20,48
	dc.w	$180,$6
	Wait	20,49
	dc.w	$180,$7
	Wait	20,50
	dc.w	$180,$8
	Wait	20,51
	dc.w	$180,$9
	Wait	20,52
	dc.w	$180,$a
	Wait	20,53
	dc.w	$180,$b
	Wait	20,54
	dc.w	$180,$c
	dc.l	-2
font	incbin	"df0:Ply2-intro2/raw/nice.font"
ende	
	printt	"Soviel is schon wech:"
	printv	ende-anf
	section	"Würg",bss_c
multab	ds.w	scrh
xpal	ds.w	8
logscr	ds.w	scrbw*(scrh+1)/2
	ds.w	scrbw*scrh/2

tpage	ds.w	tbw*tth*3/2
bpage	ds.w	tbw*bth*3/2

scrbuf	ds.w	scrh/4*scrbw*16
	ds.w	scrbw
scre
	ds.w	1000
