; Makes a file whoes pathname is given by label filename and which contains
; all data between labels data and dataend

OpenLibrary	=-552
CloseLibrary	=-414
Write	=-48
Open    =-30
Close   =-36
Oldfile	=1005
Newfile	=1006
	move.l	4,a6
	lea	dosname,a1	; Open Dos library
	moveq.l	#0,d0		; Any version
	jsr	OpenLibrary(a6)
	move.l	d0,dosbase	; Store its base
	move.l	d0,a6
	move.l	#filename,d1	; d1 = filename
	move.l	#Newfile,d2	; d2 = type
	jsr	Open(a6)
	move.l	d0,handle	; Save handle
	beq.s	quit	
	move.l	d0,d1		; d1 = handle
	move.l	#data,d2	; d2 = data to write
	move.l	#datalen+1,d3	; d3 = length
	jsr	Write(a6)
	move.l	handle,d1
	jsr	Close(a6)
	move.l	4,a6
	move.l	dosbase,a1	; Close dos library
	jmp	CloseLibrary(a6)

quit	rts

dosbase	dc.l	0
handle	dc.l	0
dosname	dc.b	'dos.library',0
filename
	dc.b	'source:treebeard/Viewer_eg',0

	even

data

	dc.b	'source:treebeard/gfx/My_Logo',0	; Picture 1's filename
	dc.b	'source:treebeard/gfx/Amiga_Logo',0	; Picture 2's filename
	dc.b	0			; End of picture list
	even				; Word numbers follow
	dc.l	page1-data		; Offset of page 1
	dc.l	page2-data		; Offset of page 2
	dc.l	0			; End of page list

; Page 1

page1	dc.b	1		; Use picture 1
	dc.b	28,0		; X pos and Y pos
	dc.b	24,48		; Width and Height
	dc.b	1		; No of bitplanes -1

	dc.b	2		; Use picture 2
	dc.b	32,27		; X pos and Y pos
	dc.b	18,32		; Width and height
	dc.b	1		; No of bitplanes -1

	dc.b	0		; End of pictures for page 1 - start of text

	dc.b	31,35,7,17,1,'VIEWER 1.0'
	dc.b	31,35,9,17,2,'Written by'
	dc.b	31,22,11,'Treebeard of the Dragon Masters 1991'
	dc.b	10,10,17,0
	dc.b	9,'Hi Leon!  Sorry about forgetting those files, but here '
	dc.b	'is the complete set.  There is a new doc (the last '
	dc.b	'one was really naf!)  I am still working on an editor (but '
	dc.b	"I've not really done much).  You were saying you will use "
	dc.b	"the Hi-res version, but I've included the 6x8 low-res one "
	dc.b	'because I think it is worth looking at.  As before, the '
	dc.b	"example file won't work on it properly, since the logos and "
	dc.b	'layout are both for hi-res screens.',10,10
	dc.b	17,2,9,'Use the left and right arrows to view the pages '
	dc.b	'and space-bar also moves onto next page.  Use the Left '
	dc.b	"Mouse Button to quit.  There's only 2 pages here because "
	dc.b	"I ain't got much to say.",10,10
	dc.b	17,3,"Well that's all for now.  Hope you like it!",10,10
	dc.b	17,1,30,20,'Treebeard 10.10.91',0

; Page 2

page2	dc.b	0		; No pictures
	dc.b	31,0,10,17,1,'Condition codes used in the text are:',10,10
	dc.b	17,2,'31 x y   Positions text at (x,y) where x and y are in characters',10
	dc.b	'30 x',30,10,'Changes x position of text',10
	dc.b	'17 c',30,10,'Changes text to colour c',10
	dc.b	'10',30,10,'Carriage return',0
	dc.b	'9',30,10,'Tab',0       

datalen	=	*-data
