;** Program for receiving FAX pictures **
;
; *********** Copyright (c) Martyn Bannister 1992 **************
;

MoveScreen 	equ	-162
WritePixel	equ	-324
ViewPortAddress	equ	-300
SetRGB4		equ	-288
SetWindowTitles	equ	-276
GetMsg		equ	-372
ReplyMsg	equ	-378
Wait		equ	-318
DisplayBeep	equ	-96
BltClear	equ	-300
OpenScreen	equ	-198
CloseScreen	equ	-66
OpenWindow	equ	-204
CloseWindow	equ	-72
CloseLibrary	equ	-414
OpenLib		equ	-408
ExecBase	equ	 4
Open		equ	-30
Close		equ	-36
Write		equ	-48
Disable		equ	-120
Enable		equ	-126
Forbid		equ	-132
Permit		equ	-138

wid		equ	 640
high		equ	 512
vkey		equ	 $200000
qkey		equ	 113
gkey		equ	 103
skey		equ	 115
key1		equ	 49
key2		equ	 50
key3		equ	 51
key4		equ	 52
esckey		equ	 27
ctr		equ      128

par		equ	 $bfe101
mouse		equ	 $bfe001
keybuff		equ	 $bfec01

custom		equ	$dff000
ciaa		equ	$bfe001
ciaicr		equ	$0d00
ciaddrb		equ	$0300

run:
	bsr	openint		;open Intuition
	beq	end0		;if cannot open Intuition
	
	bsr	opengra		;open graphics library
	beq	endg		;if cannot open graphics lib

	bsr	scropen		;open screen
	beq	endi		;if cannot open screen
	
	bsr	initcia		;set up CIAB for ACK interrupts
	
	bsr	winopen		;open window
	beq	ends		;if cannot open window
	
	bsr	getrast		;get the window rastport
	
	bsr	setcolours	;set the colours up

donothing:
	bsr	lookmsg		;wait for a key to be pressed

	move.l	esctoggle,d0	;get escape key
	bne	ende		;exit if its been pressed

	move.l	gotoggle,d0	;get "go" key
	beq	donothing	;receive if pressed, otherwise wait again

	move.l  #0,gotoggle	;reset go toggle
	
	bsr	receive		;only if the go key pressed
	
	bra	donothing	;do it all again

ende:				;END THE PROGRAM TIDILY 
	bsr	winclose	;close window
	bsr	resetcia	;reset the parallel port
ends:
	bsr	scrclose	;close screen
endi:
	bsr	closegra	;close graphics library	
endg:
	bsr	closeint	;close intuition library
end0:

	rts			;return to CLI

;-------------------------------

receive:

	move.l	#0,stoptoggle	

	move.l	ExecBase,a6	;stop all other tasks apart from interrupts
	jsr	Forbid(a6)

;calculate width of screen
	move.l	#wid,d0		;width in d0
	divu	#8,d0		;divide by 8 (= no of bytes)
	move.l	d0,wbytes	;and store it

; calculate end of screen
	move.l	#0,d0		;clear d0
	move.w	screenhigh,d0	;get screen height
	divu	#8,d0		;divide by 8 (= no of bytes)
	mulu	#wid,d0		;multiply by width
	move.l	d0,sbytes	;and store it

;clear the screen
	move.l	bithd,a5	;get bitplane 0 address in a5
	move.l	a5,a1		;start of bitplane in a1
	move.l	sbytes,d0	;number of bytes in d0
	move.l	#0,d1		;flags = 0
	move.l	grabase,a6
	jsr	BltClear(a6)	;clear this area

	bsr	waiting		;wait for synchronising signal

	move.l	stoptoggle,d0	;get "stop waiting" toggle
	bne	gonow		;do not synchronise if not 0

	bsr	synching	;otherwise wait through the synch signal

gonow:
	move.l	#0,stoptoggle	;cancel mouse button	
	move.l	#0,d6		;set up screen counter
yloop:
	move.l	#0,d5		;set up line counter
xloop:
	move.l	#8,d7		;set up bit counter
bloop:
	bsr	getpar		;wait for ACK

	sub.l	#1,d7		;next bit

	bsr	write_pixel	;write one pixel

	cmp.l	#0,d7		;end of byte? - go back if not
	bne	bloop

;do the above until the end of each byte
				;then :-

	add.l	#1,a5		;add 1 to the byte counter
	add.l	#1,d5		;add 1 to line counter
	add.l	#1,d6		;add 1 to screen counter
	cmp.l	wbytes,d5	;end of wbytes? i.e. end of the line?
	bne	xloop		;loop if not

xend:
	bsr	mousebutton	;see if mouse button is being pressed
	bsr	keypress	;see if left A (51) or right A (49) pressed
	move.l	stoptoggle,d0	;get stop toggle
	bne	permitagain	;go back and wait for key if not 0

	bsr	rows		;more rows to go?
	beq	screentest	;go and do it again if not

	sub.l	wbytes,d5	;subtract line length from line counter
	sub.l	wbytes,d6	;subtract line length from screen counter
	sub.l	wbytes,a5	;subtract line length from the address
	bra	yloop		;go and do it again

screentest:
	cmp.l	sbytes,d6	;end of screen?
	bne	yloop		;loop if not

permitagain:
	move.l	#0,stoptoggle	;reset stop toggle	
	move.l	ExecBase,a6
	jsr	Permit(a6)	;start other tasks again

rep:				;TIDY UP ANY MESSAGES
	move.l	windowhd,a0	;pointer to window in a0
	move.l	86(a0),a0	;userport pointer in a0
	move.l	ExecBase,a6
	jsr 	GetMsg(a6)	;look to see if there is a message
	tst.l	d0		;check 0 for zero (MANDATORY!!!!)
	beq	goon		;nothing there so continue
	move.l	d0,a1		;else move message pointer to a1
	move.l	ExecBase,a6
	jsr 	ReplyMsg(a6)	;reply to the message
	bra	rep
goon:
	rts			;return

;------------------------------------------------------------

mousebutton:	
	move.l	#0,d0
	move.b	mouse,d0
	btst.b	#6,d0
	bne	mouseend
	move.l	#255,stoptoggle
mouseend:
	rts

keypress:	
	move.l	#0,d0
	move.b	keybuff,d0
	cmp.l	#51,d0
	bne	keycont
	move.l	centre,d0
	cmp.l	#11,d0
	blt	keycont
	sub.l	#1,d0
	move.l	d0,centre
	bra	keyend
keycont:
	cmp.l	#49,d0
	bne	keyend
	move.l	centre,d0
	cmp.l	#254,d0
	bgt	keyend
	add.l	#1,d0
	move.l	d0,centre
keyend:
	rts

;-------------------------------

initcia:				;INITIALISE CIAB
	lea	custom,a3		;bottom of custom chips in a3
	lea	ciaa,a4			;ciaa address in a4
	move.b	#%10010000,ciaicr(a4)	;set FLAG interrupt bit
	move.b	#%00000000,ciaddrb(a4)	;switch parallel port to input
	rts				;return to main program

;-------------------------------

resetcia:				;RESET CIAB
	lea	custom,a3		;bottom of custom chips in a3
	lea	ciaa,a4			;ciaa address in a4
	move.b	#%00010000,ciaicr(a4)	;reset FLAG interrupt bit
	move.b	#%00000001,ciaddrb(a4)	;switch parallel port to input
	rts				;return to main program

;-------------------------------

opendos:				;INTIALISE AND OPEN DOS
	move.l	ExecBase,a6		;Exec base address in a6
	lea	DosName,a1		;Name of Dos Library
	jsr	OpenLib(a6)		;Open the library
	move.l	d0,dosbase		;save the dos base address
	rts				;return to main prog

closedos:				;CLOSE DOS
	move.l	ExecBase,a6		;Exec base address in a6
	move.l	dosbase,a1		;previously saved dos base in a1
	jsr	CloseLibrary(a6) 	;Close the library
	rts				;return to main prog

openint:				;INTIALISE AND OPEN INTUITION
	move.l	ExecBase,a6		;Exec base address in a6
	lea	IntName,a1		;Name of Intuition Library
	jsr	OpenLib(a6)		;Open the library
	move.l	d0,intbase		;save the Intuition base address
	rts				;return to main prog

closeint:				;CLOSE INTUITION
	move.l	ExecBase,a6		;Exec base address in a6
	move.l	intbase,a1		;previously saved Intuition base in a1
	jsr	CloseLibrary(a6)	 ;Close the library
	rts				;return to main prog
	
opengra:				;OPEN THE GRAPHICS LIBRARY
	move.l	ExecBase,a6		;Exec base address in a6
	lea	GraName,a1		;Name of the Graphics library
	jsr	OpenLib(a6)		;Open the library
	move.l	d0,grabase		;save the graphics base address
	rts				;return to main prog
	
closegra:				;CLOSE THE GRAPHICS LIBRARY
	move.l	ExecBase,a6		;Exec base address in a6
	move.l	grabase,a1		;previously saved base in a1
	jsr	CloseLibrary(a6) 	;Close the library
	rts				;return to main prog

scropen:				;OPEN A SCREEN
	move.l	intbase,a6		;previously saved base in a6
	lea	screen_defs,a0		;pointer to table in a0
	jsr	OpenScreen(a6)		;call the open screen function
	move.l	d0,screenhd		;save screen pointer
	move.l	d0,a5			;put the screen handlein a5
	move.l	$c0(a5),d0		;move bitplane handle to d0
	move.l	d0,bithd		;and store it
	rts				;return to main prog

scrclose:				;CLOSE THE SCREEN
	move.l	intbase,a6		;previously saved base in a6
	move.l	screenhd,a0		;previously saved screen ptr in a0
	jsr	CloseScreen(a6)		;call the close screen function
	rts				;return to main prog

winopen:				;OPEN THE WINDOW
	move.l	intbase,a6		;previously saved base in a6
	lea	window_defs,a0		;pointer to window definition
	jsr	OpenWindow(a6)		;call open window function
	move.l	d0,windowhd		;save the pointer to the window
	rts				;return to main prog

winclose:				;CLOSE THE WINDOW
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	jsr	CloseWindow(a6)		;call the close window function
	rts				;return to main prog

getrast:				;GET THE WINDOW RASTPORT
	move.l	windowhd,a0		;window pointer in a0
	move.l	50(a0),a0		;get the LONG at byte 50 in a0
	move.l	a0,rastport		;save the rastport
	rts				;return to main prog

setcolours:				;SET UP black AND white	
					;first get the viewport address
	move.l	intbase,a6		;previously saved intuition base in a6
	move.l	windowhd,a0		;pointer to the window in a0
	jsr	ViewPortAddress(a6)	;get the viewport address
	move.l	d0,viewhd		;and save it

	move.l	grabase,a6		;graphics library base
	move.l	viewhd,a0		;viewport address
	move.l  #0,d0			;color register 0
	move.l	#0,d1			;use 0 as a red value
	move.l	#0,d2			;use 0 as a green value
	move.l	#0,d3			;use 0 as a blue value
	jsr 	SetRGB4(a6)		;set the colour register to black

	move.l	grabase,a6		;graphics library base
	move.l	viewhd,a0		;viewport address
	move.l	#1,d0			;color register 1
	move.l	#15,d1			;use 15 as a red value
	move.l	#15,d2			;use 15 as a green value
	move.l	#15,d3			;use 15 as a blue value
	jsr 	SetRGB4(a6)		;set the colour register to white

	rts				;return to main prog

;-------------------------------

waiting:
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#waittitle,a1		;pointer to title in a1
	move.l	#waittitle,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function
waiton:
	move.l	#wid,d5			;read 1 line from parallel port
	move.l	#0,d6			;one colour counter
	move.l	#0,d7			;the other colour counter

lineloop:

	bsr	getpar			;wait for ACK

	move.l	#0,d2			;clear d2
	move.b	par,d2			;get value from parallel port in d2
	move.l	centre,d0
	cmp.l	d0,d2			;compare to ctr (= 1900Hz)

	bge	w1			;if greater than (lower freq!) then goto w1
	add.l	#1,d6			;less than (high freq) so add 1 to d6 (white)
	bra	w2			;and continue
w1:
	add.l	#1,d7			;greater than so add 1 to d7 (black)
w2:
	dbra	d5,lineloop		;go back if line not finished

	bsr	mousebutton		;see if mouse button is being pressed

	move.l	stoptoggle,d0		;get stop toggle
	bne	waitend			;continue if not zero - esc key pressed

	cmp.l	#550,d7			;more than 550 black pixels?
	bls	waiton			;no so continue waiting

	cmp.l	#28,d6			;more than 31 white pixels?
	bls	waiton			;no so continue waiting

waitend:
	rts				;return to main program

;-------------------------------

synching:
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#syntitle,a1		;pointer to title in a1
	move.l	#syntitle,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

					;  we want to count 47 lines

	bsr	synon			;find the white band

	move.l	#wid,d5			;width of screen in d5
	mulu	#47,d5			;multiply by 47

aloop:

	bsr	getpar
	bsr	write_pixel
	dbra	d5,aloop		;go back if not end of wait

	bsr	synon			;find the white band

	rts				;return

;------------------------------

synon:					;we want to synchronise to the signal
	move.l	#10,d5			;read 10 white pixels from parallel port
	move.l	#0,d6			;one colour counter
	move.l	#0,d7			;the other colour counter
synloop:

	bsr	getpar

	move.l	#0,d2			;clear d2
	move.b	par,d2			;get value from parallel port in d2
	cmp.l	#94,d2			;compare to 94(= 1900Hz)

	bge	s1			;if greater than (lower freq!) then goto s1
	add.l	#1,d6			;less than (high freq) so add 1 to d6 (white)
	bra	s2			;and continue
s1:
	add.l	#1,d7			;greater than so add 1 to d7 (black)
s2:
	dbra	d5,synloop		;go back if not end of 10 pixels

	cmp.l	#8,d6			;8 out of 10 pixels were white?
	bls	synon			;go back and try again if not

					; should be in the middle of the white band

synend:
	rts				;synchro signal received

;-------------------------------

getpar:
	move.l	ExecBase,a6
	jsr	Disable(a6)

busy_wait:
	btst.b	#4,ciaicr(a4)		;wait for ACK to go low
	beq.s	busy_wait

	move.l	ExecBase,a6
	jsr	Enable(a6)

	rts				;return

;-------------------------------

write_pixel:				;WRITE ONE PIXEL

	move.l	#0,d2			;clear d2
	move.b	par,d2			;get value from parallel port in d2
	move.l	centre,d0
	cmp.l	d0,d2			;compare to ctr (= 1900Hz)

					;the colours below are for USB!!!!
					;reverse for LSB!!!!

	bge	c5			;if greater than (lower freq!) then goto c5
	move.l	under,d0		;less than so move low colour to d0
	bra	c6			;and continue
c5:
	move.l	over,d0			;greater than so move high colour to d0
c6:
	cmp.l	#2,d0			;do we want to write a 2?
	beq	nowrite			;jump if not

	bset	d7,(a5)			;set a bit i.e. write a 2
	bra	writeend		;and exit
nowrite:				;otherwise
	bclr	d7,(a5)			;clear a bit
writeend:
	rts				;return to main prog

;-------------------------------

rows:	
	move.l	rowstogo,d0		;how many rows to go?
	cmp.l	#0,d0
	beq	rowsend			;if it was zero then return
	move.l	morerows,d0		;how many more to go really?
	cmp.l	#0,d0
	beq	initrows		;initialise morerows and exit if zero
	sub	#1,d0			;wasn't zero so subtract 1
	move.l	d0,morerows		;replace in morerows
	move.l	#1,d0			;don't return with 0 in d0
	bra	rowsend			;and return
initrows:
	move.l	rowstogo,d0		;initialise morerows
	move.l	d0,morerows
	move.l	#0,d0			;return with zero
rowsend:
	rts

;-------------------------------

save:					;SAVE THE SCREEN AS A FILE
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#savetitle,a1		;pointer to title in a1
	move.l	#savetitle,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	bsr	opendos			;open the dos library
	beq	dosend			;end if fail
	move.l	#1006,d2		;open new file
	move.l	dosbase,a6		;dosbase in a6
	move.l	#filename,d1		;with filename
	jsr	Open(a6)		;open it
	beq	fileend			;exit if it didn`t work
	move.l	d0,filehd		;store pointer

writelarge:
	move.l	#0,d0			;clear d0
	move.w	screenhigh,d0		;get the screen height
	cmp.l	#256,d0			;is it small?
	beq	writesmall		;write small if it is
					;else write it large
	move.l	filehd,d1		;file pointer in d1
	move.l	#large,d2		;start of screen size in d2
	move.l	#4,d3			;no of bytes in d3
	move.l	dosbase,a6		;dosbase in a6
	
	jsr	Write(a6)		;write it

	bra	writescreen		;and continue

writesmall:
	move.l	filehd,d1		;file pointer in d1
	move.l	#small,d2		;start of screen size in d2
	move.l	#4,d3			;no of bytes in d3
	move.l	dosbase,a6		;dosbase in a6
	
	jsr	Write(a6)		;write it

writescreen:
	move.l	filehd,d1		;file pointer in d1
	move.l	bithd,d2		;start of bitplane in d2
	move.l	sbytes,d3		;no of bytes in screen in d3
	move.l	dosbase,a6		;dosbase in a6
	
	jsr	Write(a6)		;write it

	move.l	dosbase,a6		;dosbase again
	move.l	filehd,d1		;and filename
	jsr	Close(a6)		;close it
fileend:
	bsr	closedos		;close the library
dosend:
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#savedtitle,a1		;pointer to title in a1
	move.l	#savedtitle,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	rts				;and go back

;------------------------------

lookmsg:
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#winname,a1		;pointer to title in a1
	move.l	#winname,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

lookmore:
	move.l	windowhd,a0		;pointer to window in a0
	move.l	86(a0),a0		;userport pointer in a0
	move.l	ExecBase,a6
	jsr 	GetMsg(a6)		;look to see if there is a message
	tst.l	d0			;test d0 for zero (MANDATORY!!!)
	beq	lookmore		;nothing there so do it again
	move.l	d0,a1			;move message pointer to a1
	move.l	20(a1),d3		;move event to d3
	clr.l	d4			;clear out d4
	move.w	24(a1),d4		;put the key value in d4

	move.l	ExecBase,a6
	jsr 	ReplyMsg(a6)		;reply to the message

	cmp.l	#vkey,d3		;was it vanilla key?
	bne	lookmsg			;if not then wait again

	cmp	#esckey,d4		;was it the escape key?
	bne	nxt1			;if not then try the next
	move.l	#255,esctoggle		;it was so set esctoggle
	bra	msgend			;and exit
nxt1:
	cmp	#gkey,d4		;was it the go key?
	bne	nxt2			;if not then try the next
	move.l	#255,gotoggle		;it was so set gotoggle
	bra 	msgend			;and exit
nxt2:	
	cmp	#skey,d4		;was it the save key?
	bne	nxt3			;if not then try the next
	bsr	save			;it was so save
	bra 	lookmore		;and wait again
nxt3:
	cmp	#key1,d4		;was it the 1 line key?
	bne	nxt4			;if not then try the next
	move.l	#0,rowstogo		;it was so set up 1 line 
	move.l	#0,morerows		;
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#row1title,a1		;pointer to title in a1
	move.l	#row1title,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	bra 	lookmore		;and wait again
nxt4:
	cmp	#key2,d4		;was it the 2 line key?
	bne	nxt5			;if not then try the next
	move.l	#1,rowstogo		;it was so set up 2 lines 
	move.l	#1,morerows		;
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#row2title,a1		;pointer to title in a1
	move.l	#row2title,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	bra 	lookmore		;and wait again
nxt5:
	cmp	#key3,d4		;was it the 3 line key?
	bne	nxt6			;if not then try the next
	move.l	#2,rowstogo		;it was so set up 3 lines 
	move.l	#2,morerows		;
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#row3title,a1		;pointer to title in a1
	move.l	#row3title,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	bra 	lookmore		;and wait again
nxt6:
	cmp	#key4,d4		;was it the 4 line key?
	bne	nxt7			;if not then try the next
	move.l	#3,rowstogo		;it was so set up 4 lines 
	move.l	#3,morerows		;
	move.l	intbase,a6		;previously saved base in a6
	move.l	windowhd,a0		;pointer to window in a0
	move.l	#row4title,a1		;pointer to title in a1
	move.l	#row4title,a2		;pointer to same title in a2
	jsr	SetWindowTitles(a6)	;call the set titles function

	bra 	lookmore		;and wait again
nxt7:
	bra	lookmsg			;wasn't one of ours so wait again
msgend:
	rts

;-------------------------------

beep:
	move.l	intbase,a6		;intuition base in a6
	move.l	screenhd,a0		;screen address in a0
	jsr	DisplayBeep(a6)		;beep the display
	rts

;----------------------------------------------------------

screen_defs:				;SCREEN TABLE
	x_pos:		dc.w	0	;initial x position
	y_pos:		dc.w	0	;initial y position
	width:		dc.w	wid	;width
height:			dc.w	high	;height
	depth:		dc.w	1	;depth, 4 = 16 colours
	detail_pen:	dc.b	3	;detail pen colour is red
	block_pen:	dc.b	1	;background is white
	view_modes:	dc.w	$8004	;hi-res
	screen_type:	dc.w	15	;custom screen
	font:		dc.l	0	;standard character set
	title:		dc.l	sname	;pointer to screen title
	gadgets:	dc.l	0	;no gadgets
	bitmap:		dc.l	0	;no bitmap

window_defs:				;WINDOW TABLE
			dc.w	0	;x position
			dc.w	0	;y position
			dc.w	wid	;width
winhigh:		dc.w	high	;height
			dc.b	1	;detail pen
			dc.b	0	;background pen
			dc.l	$200200	;IDCMP - CLOSEWINDOW and VANILLAKEYS
			dc.l	$1000	;ACTIVATE but no gadgets
			dc.l	0	;first gadget - none of our own
			dc.l	0	;checkmark - standard
			dc.l	winname	;pointer to window name
screenhd:		dc.l	0	;screen pointer - filled in later
			dc.l	0	;no bitmap of our own
			dc.w	150	;smallest width
			dc.w	50	;smallest height
			dc.w	wid	;greatest width
screenhigh:		dc.w	high	;greatest height
			dc.w	15	;screen type - Custom screen

	small:		dc.w	wid
			dc.w	256	;small screen size

	large:		dc.w	wid	
			dc.w	512	;large screen size

	dosbase:	dc.l	0	;space for Dos base	

	intbase:	dc.l	0	;space for Intuition base

	grabase:	dc.l	0	;space for graphics base
	
	filehd:		dc.l	0	;space for the file handle

	rastport:	dc.l	0	;space for the rastport

	windowhd:	dc.l	0	;space for window pointer

	signalmask:	dc.l	0	;space for signal mask

	viewhd:		dc.l	0	;space for a viewport address

	bithd:		dc.l	0	;space for the bitmap handle

	sbytes:		dc.l	0	;space for the screen size

	wbytes:		dc.l	0	;space for the width in bytes

	esctoggle:	dc.l	0	;toggle for escape key

	gotoggle:	dc.l	0	;toggle for go key	

	stoptoggle:	dc.l	0	;toggle for mouse button

	rowstogo:	dc.l	1	;number of rows to go
	morerows:	dc.l	1	;working rows to go
	
	under:		dc.l    1	;initially black
	over:		dc.l	2	;initially white

	restart:	dc.l	0	;don't

	centre:		dc.l	ctr	;centre value

	filename:	dc.b	'ram:fax.pic',0
					;filename to save to

	DosName:	dc.b	'dos.library',0
					;library name, 0 byte terminated

	GraName:	dc.b	'graphics.library',0
					;library name, 0 byte terminated
	
	IntName:	dc.b	'intuition.library',0
					;library name, 0 byte terminated

	sname:		dc.b	'  FAX on the Radio',0
					;screen title, 0 byte terminated

	winname:	dc.b	'  FAX - 120 lines per minute  '
			dc.b	'-  Press s,g,1,2,3,4 or ESC ',0
					;window title, 0 byte terminated

	waittitle:	dc.b	'  WAITING...................',0
					;waiting window title

	syntitle:	dc.b	'  SYNCHRONISING.............',0
					;synchronising window title
	
	savetitle:	dc.b	'  SAVING....................',0
					;saving window title

	savedtitle:	dc.b	'  SAVED                     ',0
					;saved window title

	row1title:	dc.b	'  1 row at a time selected  ',0
	row2title:	dc.b	'  2 rows at a time selected ',0
	row3title:	dc.b	'  3 rows at a time selected ',0
	row4title:	dc.b	'  4 rows at a time selected ',0

	end				
