; Very Short and simple intro
; (C)1989 by Brian Postma
; J.v.Hartenstraat 51
; 7576 VX Oldenzaal (NL)
; Tel:05410-14763

start:	movem.l		d0-d7/a0-a6,-(a7)
	bsr		openstuff
	move.l		gfxbase,a0
	move.l		$32(a0),oldcop
	move.l		#newcop,$32(a0)
	bsr		text
	move.l		$6c,oldirq
	move.l		#newirq,$6c
wait:	tst.b		no
	beq		endwait
	btst		#6,$bfe001
	bne		wait
endwait:move.l		oldirq,$6c
	move.l		gfxbase,a0
	move.l		oldcop,$32(a0)
	bsr		closestuff
	movem.l		(a7)+,d0-d7/a0-a6
	move.w		#$f,$dff096
	rts

openstuff:
	move.l		4,a6
	jsr		-132(a6)	;Forbid
	lea		gfxname,a1
	jsr		-408(a6)
	move.l		d0,gfxbase
	lea		intname,a1
	jsr		-408(a6)
	move.l		d0,intbase

	move.l		intbase,a6
	lea		osargs,a0
	jsr		-198(a6)
	move.l		d0,screenbase
	beq		error
	add.l		#84,d0
	move.l		d0,rastport
	move.l		gfxbase,a6
	move.l		d0,a1
	clr.l		d0
	jsr		-234(a6)	;SetRast

	move.l		screenbase,a0
	move.l		192(a0),d0
	lea		pl,a0
	move.w		d0,6(a0)
	swap		d0
	move.w		d0,2(a0)
	rts

error:	move.l		(a7)+,d1
	movem.l		(a7)+,d0-d7/a0-a6
	rts

closestuff:
	move.l		intbase,a6
	move.l		screenbase,a0
	jsr		-66(a6)		;CloseScreen
	move.l		4,a6
	move.l		intbase,a1
	jsr		-414(a6)	;CloseLib
	move.l		4,a6
	move.l		gfxbase,a1
	jsr		-414(a6)
	jsr		-138(a6)	;Permit
	rts

text:	move.l		gfxbase,a6
	move.l		rastport,a1
	clr.l		d0
	jsr		-234(a6)	;SetRast
	move.l		stringpointer,a2
	tst.w		(a2)
	beq		notext
	move.l		gfxbase,a6
	move.l		rastport,a1
	move.w		(a2),36(a1)
	move.w		#y,38(a1)
	move.l		4(a2),a0
	clr.l		d0
	move.w		2(a2),d0
	jsr		-60(a6)			;Text

	addq.l		#8,stringpointer
	rts
notext:	clr.b		no
	rts

y = 8
stringpointer:	dc.l	strings

strings:
 dc.w	155,1
 dc.l	string1			;x,no. chars,pointer to string
 dc.w	104,12
 dc.l	string2
 dc.w	115,10
 dc.l	string3
 dc.w	149,3
 dc.l	string4
 dc.w	108,11
 dc.l	string5
 dc.w	0,0,0,0			;ending with 0

string1:dc.b	"A"
string2:dc.b	"BRIAN POSTMA"
string3:dc.b	"PRODUCTION"
string4:dc.b	"FOR"
string5:dc.b	"UGA IN 1989"
even
newirq:	movem.l		d0-d7/a0-a6,-(a7)
	bsr		doit
	movem.l		(a7)+,d0-d7/a0-a6
	dc.w		$4ef9
oldirq:	dc.l		0

count:	dc.w		64

doit:	subq.w		#1,count
	beq		yeah
	rts
yeah:	move.w		#3,count
	tst.b		yes
	beq		back
	cmpi.w		#$fff,col
	beq		okman
	add.w		#$111,col
	rts
okman:	move.w		#128,count
	clr.b		yes
	rts
back:	cmpi.w		#$000,col
	beq		okman2
	sub.w		#$111,col
	rts
okman2:	move.w		#64,count
	move.b		#1,yes
	bsr		text
	rts

newcop:	dc.w	$0120,0,$0122,0,$0096,$0020
	dc.w	$0180,0,$008e,$296a,$0090,$29fa
	dc.w	$0092,$0038,$0094,$00d0,$0102,0
	dc.w	$0108,0,$010a,0,$100,0
pl:	dc.w	$e0,0,$e2,0
	dc.w	$9001,$fffe,$0100,$1000,$0182
col:	dc.w	$0000,$a001,$fffe,$0100,$0000
	dc.w	$ffff,$fffe

oldcop:		dc.l	0
gfxbase:	dc.l	0
intbase:	dc.l	0
screenbase:	dc.l	0
rastport:	dc.l	0

osargs:		dc.w	0,0,320,16,1,1
		dc.w	0,15
		dc.l	textattr,0,0,0
textattr:	dc.l	fontname
		dc.w	9,0

gfxname:	dc.b	"graphics.library",0
intname:	dc.b	"intuition.library",0
fontname:	dc.b	"topaz.font",0
no:		dc.b	1
yes:		dc.b	1
end:
