
	opt	o+,ow-
	
; A program that opens a small, inactive window on the Workbench screen. When
;the window is closed a requester appears. Selecting Quit will exit the prog.
;Selecting HELP will cause a CON: window to open. Enter the name of the
;command you require info on and press return. Either one of two windows will
;open, an error window if no info was found or a window showing the required
;info. Hitting the close gadget on either window will return you to the
;initial window.

; M.Meany.   

; Project started:25 June 1990
; Completed v1.0 :28 June 1990 window,requester,con:,window... YEUK!!!
; Waits for message 'properly' now:6 August 1990
; Added string gadget for user input:8 August 1990


ciaapra	=	$bfe001
dma	=	$dff000

	incdir	"df0:include/"
	include	"exec/exec_lib.i"
	include	"exec/exec.i"
	include	"intuition/intuition_lib.i"
	include	"intuition/intuition.i"
	include	"libraries/dos_lib.i"
	include	"libraries/dos.i"
	include	"libraries/dosextens.i"
	include	"graphics/gfx.i"
	include	"graphics/graphics_lib.i"

; Adapted easystart.i from Devpac includes.

	movem.l	d0/a0,-(sp)	save initial values
	clr.l	returnMsg

	sub.l	a1,a1
	CALLEXEC	FindTask	find us
	move.l	d0,a4
	

	tst.l	pr_CLI(a4)
	beq.s	fromWorkbench

* we were called from the CLI
	movem.l	(sp)+,d0/a0	restore regs
	bra	end_startup	and run the user prog
	

* we were called from the Workbench
fromWorkbench
	lea	pr_MsgPort(a4),a0
	CALLEXEC	WaitPort	wait for a message
	lea	pr_MsgPort(a4),a0
	CALLEXEC	GetMsg	then get it
	move.l	d0,returnMsg	save it for later reply
	movem.l	(sp)+,d0/a0	restore
end_startup
	bsr.s	_main			call our program

* returns to here with exit code in d0
	move.l	d0,-(sp)	save it

	tst.l	returnMsg
	beq.s	exitToDOS	if I was a CLI

	CALLEXEC	Forbid
	move.l	returnMsg(pc),a1
	CALLEXEC	ReplyMsg

exitToDOS
	move.l	(sp)+,d0	exit code
	rts

* startup code variable

returnMsg	dc.l	0

* the program starts here
	even

_main	bsr	intopen	open Intuitiomn library
	tst.l	d0	check all is ok
	beq.s	cant_open_int
	bsr	gfxopen
	tst.l	d0
	beq.s	cant_open_gfx
	bsr	do_my_stuff	call main routine
cant_open_gfx	bsr	intclose	close Intuition library
cant_open_int	rts		return to o/s

; Subroutine to open Intuition library
	
intopen	lea	INTNAME,a1	a1-->library name
	moveq.l	#0,d0
	CALLEXEC	OpenLibrary	open this library
	move.l	d0,_IntuitionBase  store pointer to lib
	rts		return to calling routine

; Subroutine to open Graphics library
	
gfxopen	lea	GFXNAME,a1	a1-->library name
	moveq.l	#0,d0
	CALLEXEC	OpenLibrary	open this library
	move.l	d0,_GfxBase	store pointer to lib
	rts		return to calling routine

; This is the main control subroutine 

do_my_stuff	bsr	smallwindow	waits to be activated
	tst.l	d7	was window closed ?
	beq.s	stuff_done	if so exit program
	bsr	get_input	get user input
	bsr	find	locate relevant data
	bsr	enlighten	display data
	bra	do_my_stuff	do it all again
stuff_done	rts

; Open a small intuition window that waits to be closed or activated.

smallwindow	lea	small_window,a0	a0-->window structure
	CALLINT	OpenWindow	open this window
	move.l	d0,window.ptr	save window pointer
wait_for_msg	move.l	window.ptr,a0	
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	WaitPort	wait for something to happen
	move.l	window.ptr,a0	a0-->window pointer
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	GetMsg	get any messages
	tst.l	d0	was there a message ?
	beq	wait_for_msg	if not loop back
	move.l	d0,a1	a1-->message
	move.l	im_Class(a1),d2	d2=IDCMP flags
	CALLEXEC	ReplyMsg	answer os or it get angry
	cmp.l	#CLOSEWINDOW,d2	window closed ?
	beq.s	give_requester	if so carry on
	bra	wait_for_msg	else wait for next message
give_requester	move.l	window.ptr,a0	a0-->window
	lea	body,a1	a1-->requester text
	lea	left,a2	a2-->requester button text
	lea	right,a3	a3-->requester button text
	moveq.l	#0,d0	left activated by click
	move.l	d0,d1	right activated by click
	move.l	#250,d2	requester width
	move.l	#70,d3	requester height
	CALLINT	AutoRequest	turn it on !
	move.l	d0,d7	save result of requester
	move.l	window.ptr,a0	a0-->window
	CALLINT	CloseWindow	close this window
	rts
	
; Use a string gadget to get users input.

get_input	lea	large_window,a0	a0-->window structure
	CALLINT	OpenWindow	open this window
	move.l	d0,window.ptr	save its pointer
	move.l	window.ptr,a0
	lea	str_gadg,a1
	moveq.l	#0,d0
	move.w	#-1,d0
	CALLINT	AddGadget
	lea	str_gadg,a0
	move.l	window.ptr,a1
	CALLINT	RefreshGadgets
wait_for_msg1	move.l	window.ptr,a0	a0-->window	
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	WaitPort	wait for something to happen
	move.l	window.ptr,a0	a0-->window pointer
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	GetMsg	get any messages
	tst.l	d0	was there a message ?
	beq	wait_for_msg1	if not loop back
	move.l	d0,a1	a1-->message
	move.l	im_Class(a1),d2	d2=IDCMP flags
	CALLEXEC	ReplyMsg	answer o/s or it gets angry
	cmp.l	#CLOSEWINDOW,d2	window closed ?
	beq.s	U2	if so carry on
	cmp.l	#GADGETUP,d2
	beq.s	U2
	bra	wait_for_msg1

U2	lea	mnemonic,a0
	bsr	ucase
	move.l	window.ptr,a0
	lea	str_gadg,a1
	CALLINT	RemoveGadget
	move.l	window.ptr,a0	a0-->window
	CALLINT	CloseWindow	close this window
	moveq.l	#0,d2
	lea	mnemonic,a0
test_EOI	cmpi.b	#0,(a0)+
	beq.s	got_input
	addq.w	#1,d2
	bra	test_EOI
got_input	rts


; A subroutine to search a string of chars and convert all lower case letters
;to upper case. The search ends when either $00 or $0A is encountered.

; Entry   a0--> start of string

ucase	moveq.l	#0,d0	clear d0
next_char	move.b	(a0),d0	get next byte
	tst.b	d0	is it $00 ?
	beq.s	end_search	if so weve finished
	cmpi.b	#$0A,d0	is it $0A ?
	beq.s	end_search	if so weve finished
	cmpi.b	#'a',d0	} these lines ensure that
	blt.s	dont_convert	} only characters in the
	cmpi.b	#'z',d0	} range a-->z get converted
	bgt.s	dont_convert	}
	sub.b	#$20,d0	convert from LCASE to UCASE
dont_convert	move.b	d0,(a0)+	put this byte back!
	bra	next_char	loop back for next byte
end_search	rts		search complete so leave

; A subroutine that takes the users input and tries to find a match in a
;predefined list of supported words. No match is indicated by setting d0=0

find	lea	list,a0	a0-->start of known word list
	lea	mnemonic,a1	a1-->users input
	move.l	(a0)+,d1	d1=number of words in list

;  Subroutine to search through a list of words checking each for a match
; with a supplied word. Each word in the list is preceded by its ID number
; (1 byte) and its length (1 byte). On exit d0 contains the ID number of
; the word if found and zero otherwise. This obviously means that all ID
; numbers must be non zero. All ID numbers are treated as unsigned.

;  This routine comes from a adventure game I was toying with ( no GFX )

;ENTRY :	a0-->The list of words
;	a1-->The word to find
;	d1=number of words in the list
;	d2=the length of the word to find
;EXIT  :	d0=The words ID ( encoded in table as explained above )

CHKWRD	moveq.l	#0,d0	clear d0
	move.b	(a0)+,d0	read past words ID
	move.b	(a0)+,d0	d0=next entries length
	cmp.b	d0,d2	same as required length?
	bne.s	NXTWRD	if not then next word
	move.l	a0,a2	a2-->word in list
	move.l	a1,a3	a3-->word to find
	subi.b	#1,d0	decrease char count
CHKNXTBYT	cmp.b	(a2)+,(a3)+	compare chars+step to next
	bne.s	NOMATCH	if diffirent then exit loop
	dbra	d0,CHKNXTBYT	if same check next until fin
	moveq.l	#0,d0	clear d0
	suba.l	#2,a0	a0-->word ID
	move.b	(a0),d0	d0=word ID
	bra.s	CHKWRDFIN	all done so leave
NOMATCH	suba.l	#1,a0	a0-->word len
	move.b	(a0)+,d0	d0=word len
NXTWRD	and.l	#$ff,d0	mask off word len
	add.l	d0,a0	add to list pointer
	dbra	d1,CHKWRD	loop back till list checked
	moveq.l	#0,d0	d0=0 (word not found)
	bra	not_found
CHKWRDFIN	subi.w	#1,d0	correct offset
	asl.w	#2,d0	multiply by 4 
	lea	def_table,a0	a0-->pointer table
	adda.l	d0,a0	add offset
	move.l	(a0),a0	a0-->required data
	not.w	d0	make non zero (word found)
not_found	rts

; This routine opens an Intuition window, builds a IText structure and
;displays the info required by the user. The window remains on screen
;until close gadget is clicked.

enlighten	tst.l	d0	ensure word found
	bne.s	show_text	jump if it was
	lea	error_window,a0	a0-->window structure
	CALLINT	OpenWindow	open the window
	move.l	d0,window.ptr	save handle
	lea	error_text,a1	a1-->error message
	movea.l	d0,a0	a0-->window
	move.l	50(a0),a0	
	moveq.l	#50,d0	x position of text
	moveq.l	#15,d1	y position of text
	CALLINT	PrintIText	print error message
	bra	wait_for_msg1
show_text	movea.l	a0,a5	save pointer to text
	lea	large_window,a0	a0-->window structure
	CALLINT	OpenWindow	open this window
	move.l	d0,window.ptr	save handle
	move.l	d0,a0
	move.l	wd_RPort(a0),rastport.ptr
	move.l	rastport.ptr,a1
	moveq.l	#1,d0
	CALLGRAF	SetAPen
	move.l	#2,d0
	move.l	#11,d1
	move.l	#297,d2
	move.l	#208,d3
	ext.l	d0
	ext.l	d1
	ext.l	d2
	ext.l	d3
	move.l	rastport.ptr,a1
	CALLGRAF	RectFill
	movea.l	a5,a0	retrieve pointer
	lea	line0,a1	a1-->text destination
	movea.l	a1,a2	make a working copy
	move.w	#224,d1	init counter 36bytes,25lines
	moveq.l	#0,d2	used to clear destination
clear_loop	move.l	d2,(a2)+	clear next long word
	dbra	d1,clear_loop	until all done
	move.w	(a0)+,d0	number of lines to display
	subi.w	#1,d0	correct counter
line_loop	move.l	a1,a2	restore working copy
char_loop	move.b	(a0)+,(a2)+	copy next character
	bne.s	char_loop	until end of line
	adda.l	#36,a1	a1-->next line in structure
	dbra	d0,line_loop	until all lines done
	lea	help_text,a1	a1-->text structure
	move.l	window.ptr,a0	a0-->window
	move.l	50(a0),a0	
	moveq.l	#5,d0	x position of text
	moveq.l	#12,d1	y position of text
	CALLINT	PrintIText	print the help message

wait_for_msg2	move.l	window.ptr,a0	
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	WaitPort	wait for something to happen
	move.l	window.ptr,a0	a0-->window pointer
	move.l	wd_UserPort(a0),a0  a0-->user port
	CALLEXEC	GetMsg	get any messages
	tst.l	d0	was there a message ?
	beq	wait_for_msg2	if not loop back
	move.l	d0,a1	a1-->message
	move.l	im_Class(a1),d2	d2=IDCMP flags
	CALLEXEC	ReplyMsg	answer o/s or it gets angry
	cmp.l	#CLOSEWINDOW,d2	window closed ?
	beq.s	U3	if so carry on
	bra	wait_for_msg2	else wait for next message
U3	move.l	window.ptr,a0	a0-->window
	CALLINT	CloseWindow	close this window
	rts
	
; Subroutine that waits for left mouse button to be pressed then released.
	
mouse_press	btst	#6,ciaapra	left button pressed
	bne	mouse_press	loop back if not
mouse_release	btst	#6,ciaapra	left button pressed
	beq	mouse_release	loop back if it is
	rts		return to calling program

; Subroutine to close Intuition library

intclose	move.l	_IntuitionBase,a1  a1-->library base address
	CALLEXEC	CloseLibrary	close this library
	rts		return to calling program

; Subroutine to close Graphics library

gfxclose	move.l	_GfxBase,a1  a1-->library base address
	CALLEXEC	CloseLibrary	close this library
	rts		return to calling program

	even

; Program data area

INTNAME	dc.b	'intuition.library',0  library name
	even
_IntuitionBase	dc.l	0	library base pointer
GFXNAME	dc.b	'graphics.library',0
	even
_GfxBase	dc.l	0
window.ptr	dc.l	0	window structure pointer
rastport.ptr	dc.l	0
	even

; Structure that defines the Intuition window

small_window	dc.w	200	x co-ord
	dc.w	10	y co-ord
	dc.w	300	width
	dc.w	10	height
	dc.b	-1	foreground colour
	dc.b	-1	background colour
	dc.l	CLOSEWINDOW
	dc.l	WINDOWCLOSE!WINDOWDEPTH!NOCAREREFRESH!WINDOWDRAG
	dc.l	0	no special gadgets
	dc.l	0	standard checkmark
	dc.l	small_name	-->title
	dc.l	0
	dc.l	0	no bitmap
	dc.w	300	min x
	dc.w	10	min y
	dc.w	300	max x
	dc.w	210	max y
	dc.w	WBENCHSCREEN	screen type
	
small_name	dc.b	'68000 help ',0
	even
	
large_window	dc.w	200	x co-ord
	dc.w	10	y co-ord
	dc.w	300	width
	dc.w	210	height
	dc.b	-1	foreground colour
	dc.b	-1	background colour
	dc.l	CLOSEWINDOW!GADGETUP
	dc.l	ACTIVATE!WINDOWCLOSE!WINDOWDEPTH!WINDOWDRAG!SMART_REFRESH!NOCAREREFRESH
	dc.l	0	no special gadgets
	dc.l	0	standard checkmark
	dc.l	large_name	-->title
	dc.l	0
	dc.l	0	no bitmap
	dc.w	300	min x
	dc.w	10	min y
	dc.w	300	max x
	dc.w	210	max y
	dc.w	WBENCHSCREEN	screen type
	
large_name	dc.b	'Here it is  ',0
	even

error_window	dc.w	200	x co-ord
	dc.w	10	y co-ord
	dc.w	300	width
	dc.w	40	height
	dc.b	-1	foreground colour
	dc.b	-1	background colour
	dc.l	CLOSEWINDOW
	dc.l	WINDOWCLOSE!WINDOWDEPTH!WINDOWDRAG!SMART_REFRESH
	dc.l	0	no special gadgets
	dc.l	0	standard checkmark
	dc.l	error_name	-->title
	dc.l	0
	dc.l	0	no bitmap
	dc.w	300	min x
	dc.w	10	min y
	dc.w	300	max x
	dc.w	210	max y
	dc.w	WBENCHSCREEN	screen type
	
error_name	dc.b	'SORRY ! ',0
	even

; Data for string gadget used for user input.
	
str_gadg	dc.l	0	only the one
	dc.w	50,50	x,y positions
	dc.w	100,10	width,height
	dc.w	0	normal flags
	dc.w	STRINGCENTER!GADGIMMEDIATE!RELVERIFY  activation
	dc.w	$4	string gadget
	dc.l	border
	dc.l	0
	dc.l	0
	dc.l	0
	dc.l	strinfo
	dc.w	2
	dc.l	0
	
border	dc.w	0,0
	dc.b	3,3
	dc.b	0
	dc.b	5
	dc.l	coord
	dc.l	0
	
coord	dc.w	-2,-2,100,-2,100,10,-2,10,-2,-2

strinfo	dc.l	mnemonic
	dc.l	0
	dc.w	0
	dc.w	11
	dc.w	0
	dc.w	0,0,0,0,0
	dc.l	0,0,0
	
mnemonic	dc.b	'adda',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	even

; Data for requester

body	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	50,10	text position in window
	dc.l	0	font to use (standard)
	dc.l	b_text	pointer to text
	dc.l	body1	end of text list
	
b_text	dc.b	'By your command ',0  message
	even
body1	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	57,20	text position in window
	dc.l	0	font to use (standard)
	dc.l	b_text1	pointer to text
	dc.l	0	end of text list
	
b_text1	dc.b	'M.Meany  1990 ',0  message
	even


left	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	5,3	text position in window
	dc.l	0	font to use (standard)
	dc.l	l_text	pointer to text
	dc.l	0	end of text list
	
l_text	dc.b	'HELP',0  message
	even


right	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	5,3	text position in window
	dc.l	0	font to use (standard)
	dc.l	r_text	pointer to text
	dc.l	0	end of text list
	
r_text	dc.b	'QUIT',0  message
	even
	
; Structure's that define Intuition texts.

error_text	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,0	text position in window
	dc.l	0	font to use (standard)
	dc.l	err1	pointer to text
	dc.l	error_text1	end of text list
	
err1	dc.b	'Mnemonic not recognised.',0,0,0,0,0,0,0,0,0  message
	even

error_text1	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,8	text position in window
	dc.l	0	font to use (standard)
	dc.l	err2	pointer to text
	dc.l	0	end of text list
	
err2	dc.b	'  Complain to author.',0,0,0,0,0,0,0,0,0  message
	even

help_text	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,0	text position in window
	dc.l	0	font to use (standard)
	dc.l	line0	pointer to text
	dc.l	h1	next line of text

h1	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,8	text position in window
	dc.l	0	font to use (standard)
	dc.l	line1	pointer to text
	dc.l	h2	next line of text

h2	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,16	text position in window
	dc.l	0	font to use (standard)
	dc.l	line2	pointer to text
	dc.l	h3	next line of text

h3	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,24	text position in window
	dc.l	0	font to use (standard)
	dc.l	line3	pointer to text
	dc.l	h4	next line of text

h4	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,32	text position in window
	dc.l	0	font to use (standard)
	dc.l	line4	pointer to text
	dc.l	h5	next line of text

h5	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,40	text position in window
	dc.l	0	font to use (standard)
	dc.l	line5	pointer to text
	dc.l	h6	next line of text

h6	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,48	text position in window
	dc.l	0	font to use (standard)
	dc.l	line6	pointer to text
	dc.l	h7	next line of text

h7	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,56	text position in window
	dc.l	0	font to use (standard)
	dc.l	line7	pointer to text
	dc.l	h8	next line of text

h8	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,64	text position in window
	dc.l	0	font to use (standard)
	dc.l	line8	pointer to text
	dc.l	h9	next line of text

h9	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,72	text position in window
	dc.l	0	font to use (standard)
	dc.l	line9	pointer to text
	dc.l	h10	next line of text

h10	dc.b	2,2	colours to use
	dc.b	0	mode to use (nozmal)
	even
	dc.w	0,80	text position in window
	dc.l	0	font to use (standard)
	dc.l	line10	pointer to text
	dc.l	h11	next line of text

h11	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,88	text position in window
	dc.l	0	font to use (standard)
	dc.l	line11	pointer to text
	dc.l	h12	next line of text

h12	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,96	text position in window
	dc.l	0	font to use (standard)
	dc.l	line12	pointer to text
	dc.l	h13	next line of text

h13	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,104	text position in window
	dc.l	0	font to use (standard)
	dc.l	line13	pointer to text
	dc.l	h14	next line of text

h14	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,112	text position in window
	dc.l	0	font to use (standard)
	dc.l	line14	pointer to text
	dc.l	h15	next line of text

h15	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,120	text position in window
	dc.l	0	font to use (standard)
	dc.l	line15	pointer to text
	dc.l	h16	next line of text

h16	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,128	text position in window
	dc.l	0	font to use (standard)
	dc.l	line16	pointer to text
	dc.l	h17	next line of text

h17	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,136	text position in window
	dc.l	0	font to use (standard)
	dc.l	line17	pointer to text
	dc.l	h18	next line of text

h18	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,144	text position in window
	dc.l	0	font to use (standard)
	dc.l	line18	pointer to text
	dc.l	h19	next line of text

h19	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,152	text position in window
	dc.l	0	font to use (standard)
	dc.l	line19	pointer to text
	dc.l	h20	next line of text

h20	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,160	text position in window
	dc.l	0	font to use (standard)
	dc.l	line20	pointer to text
	dc.l	h21	next line of text

h21	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,168	text position in window
	dc.l	0	font to use (standard)
	dc.l	line21	pointer to text
	dc.l	h22	next line of text

h22	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,176	text position in window
	dc.l	0	font to use (standard)
	dc.l	line22	pointer to text
	dc.l	h23	next line of text

h23	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,184	text position in window
	dc.l	0	font to use (standard)
	dc.l	line23	pointer to text
	dc.l	h24	next line of text

h24	dc.b	2,2	colours to use
	dc.b	0	mode to use (normal)
	even
	dc.w	0,192	text position in window
	dc.l	0	font to use (standard)
	dc.l	line24	pointer to text
	dc.l	0	next line of text
	
line0	ds.b	36
line1	ds.b	36
line2	ds.b	36
line3	ds.b	36
line4	ds.b	36
line5	ds.b	36
line6	ds.b	36
line7	ds.b	36
line8	ds.b	36
line9	ds.b	36
line10	ds.b	36
line11	ds.b	36
line12	ds.b	36
line13	ds.b	36
line14	ds.b	36
line15	ds.b	36
line16	ds.b	36
line17	ds.b	36
line18	ds.b	36
line19	ds.b	36
line20	ds.b	36
line21	ds.b	36
line22	ds.b	36
line23	ds.b	36
line24	ds.b	36

; List of all recognised mnemonics

	even
list	dc.l	9
	dc.b	1,4,'ABCD'
	dc.b	2,3,'ADD'
	dc.b	3,4,'ADDA'
	dc.b	4,4,'ADDI'
	dc.b	5,4,'ADDQ'
	dc.b	6,4,'ADDX'
	dc.b	7,3,'AND'
	dc.b	8,4,'ANDI'
	dc.b	9,3,'ASL'
	
; Pointer table to definition texts

	even
def_table	dc.l	t1
	dc.l	t2
	dc.l	t3
	dc.l	t4
	dc.l	t5
	dc.l	t6
	dc.l	t7
	dc.l	t8
	dc.l	t9
	
; Mnemonic definitions

; Max text width	'01234567890123456789012345678901234'

t1	dc.w	14
	dc.b	'ABCD   Source,Dest',0
	dc.b	' ',0
	dc.b	'Addittion of two BCD numbers.',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t2	dc.w	14
	dc.b	'ADD    Source,Dest',0
	dc.b	' ',0
	dc.b	'Binary addittion: Dest=Dest+Source',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t3	dc.w	15
	dc.b	'ADDA   Source,<ea>',0
	dc.b	' ',0
	dc.b	'Binary addittion to an address',0
	dc.b	'register: An=An+Source',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t4	dc.w	15
	dc.b	'ADDI   #n,<ea>',0
	dc.b	' ',0
	dc.b	'Addittion with a constant',0
	dc.b	' <ea> = <ea> + n',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t5	dc.w	16
	dc.b	'ADDQ   #n,<ea>',0
	dc.b	' ',0
	dc.b	'Fast addittion of a constant. The',0
	dc.b	'constant must be in the range 0-->8',0
	dc.b	' <ea> = <ea> + n',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t6	dc.w	15
	dc.b	'ADDX   Source,Dest',0
	dc.b	' ',0
	dc.b	'Add with Extend flag.',0
	dc.b	'Dest = Dest + Source + X',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	
t7	dc.w	22
	dc.b	'AND    Source,Dest',0
	dc.b	' ',0
	dc.b	'Logical AND',0
	dc.b	'Dest = Dest AND Source',0
	dc.b	' ',0
	dc.b	'Truth Table for AND:',0
	dc.b	' ',0
	dc.b	'        0  1',0
	dc.b	'      +------',0
	dc.b	'    0 | 0  0',0
	dc.b	'    1 | 0  1',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even

t8	dc.w	22
	dc.b	'ANDI   #n,<ea>',0
	dc.b	' ',0
	dc.b	'Logical AND with a constant',0
	dc.b	'<ea> = <ea> AND n',0
	dc.b	' ',0
	dc.b	'Truth Table for AND:',0
	dc.b	' ',0
	dc.b	'        0  1',0
	dc.b	'      +------',0
	dc.b	'    0 | 0  0',0
	dc.b	'    1 | 0  1',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even


t9	dc.w	22
	dc.b	'ASL   n,<ea>',0
	dc.b	' ',0
	dc.b	'Arithmetic shift left (*2)',0
	dc.b	'All bits in <ea> shifted left one',0
	dc.b	'place. MSB is copied into C and X',0
	dc.b	'flags, LSB is reset to 0.',0
	dc.b	' ',0
	dc.b	' Eg. With word data:',0
	dc.b	'Before ASL.w  1011001110100111',0
	dc.b	'After ASL.w   0110011101001110',0
	dc.b	' and X flag=1, C flag=1.',0
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
	

	
	
	dc.b	' ',0
	dc.b	'Abbreviations used:',0
	dc.b	' ',0
	dc.b	'   Label     A label (Address)',0
	dc.b	'   Reg       68000 Register (An or Dn)',0
	dc.b	'   An        Address Register',0
	dc.b	'   Dn        Data Register',0
	dc.b	'   Source    Source Operand',0
	dc.b	'   Dest      Destination Operand',0
	dc.b	'   <ea>      Label, An or Dn',0
	dc.b	'   #n        Immediate value',0
	even
