;
; aofGen.sh
;
; Generate AOF files from BASIC
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's BASIC Assembler Supplement.
;
; BAS is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; BAS is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with BAS.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Overview -------------------------------------------------------------
;
; Functions provided:
;
;  aof_init
;  aof_pass
;  aof_firstPass
;  aof_ensure
;  aof_area
;  aof_entry
;  aof_import
;  aof_iImport
;  aof_export
;  aof_reloc
;  aof_noReloc
;  aof_save

		[	:LNOT::DEF:aofGen__dfn
		GBLL	aofGen__dfn

; --- aof_init ---
;
; On entry:	R7 == address of workspace
;		R8-R12 set up by BASIC
;
; On exit:	--
;
; CALL syntax:	asmCode%
;
; Use:		Initialises workspace for generation of AOF code.  Remembers
;		that code generation will start at asmCode%.

		IMPORT	aof_init

; --- aof_pass ---
;
; On entry:	--
;
; On exit:	--
;
; Use:		Signals the start of a new assembly pass.

		IMPORT	aof_pass

; --- aof_firstPass ---
;
; On entry:	--
;
; On exit:	CS if on first pass, CC otherwise
;
; Use:		Informs the caller whether we're on the first or second pass.

		IMPORT	aof_firstPass

; --- aof_ensure ---
;
; On entry:	R0 == address of anchor and size info
;		R1 == free space required
;
; On exit:	R0 == address of first free byte in area
;
; Use:		Ensures that there is the requested quantity of memory free
;		in the given block.  If not, bas_noMem is called.

		IMPORT	aof_ensure

; --- aof_area ---
;
; On entry:	R0 == AREA attributes word
;		R7 == address of workspace
;		R8-R12 set up by BASIC
;
; On exit:	--
;
; CALL syntax:	name$
;
; Use:		Makes a new AREA start at the current location.

		IMPORT	aof_area

; --- aof_entry ---
;
; On entry:	--
;
; On exit:	--
;
; Use:		Sets the image entry point to be the current location.

		IMPORT	aof_entry

; --- aof_import ---
;
; On entry:	R0 == pointer to variable name
;		R1 == pointer to symbol name
;		R3 == attribute bits (not including bits 0,1)
;
; On exit:	--
;
; Use:		Imports a symbol, and sets the given variable to point to
;		it.  If the symbol is already imported, another alias is
;		set up, but no actual symbol is created.

		IMPORT	aof_import

; --- aof_iImport ---
;
; On entry:	R0 == WEAK flag
;		R7 == address of workspace
;		R8-R12 set up by BASIC
;
; On exit:	--
;
; CALL syntax:	name$,alias$
;
; Use:		Imports a symbol name$, and makes the variable whose name
;		is in alias$ refer to it.

		IMPORT	aof_iImport

; --- aof_export ---
;
; On entry:	R0 == STRONG flag
;		R7 == pointer to workspace
;		R8-R12 as set up by BASIC
;
; On exit:	--
;
; CALL syntax:	alias$,name$
;
; Use:		Exports the value held in the given alias as the symbol
;		name$.

		IMPORT	aof_export

; --- aof_reloc ---
;
; On entry:	R7 == workspace address
;
; On exit:	--
;
; Use:		Marks the current address as being the start of a relocation
;		block.  If a relocation block is current, this is a no-op.

		IMPORT	aof_reloc

; --- aof_noReloc ---
;
; On entry:	R7 == workspace address
;
; On exit:	--
;
; Use:		Marks the current address as being the start of a non-
;		relocation block.  If a non-relocation block is current,
;		this is a no-op.

		IMPORT	aof_noReloc

; --- aof_save ---
;
; On entry:	R7 == workspace address
;		R8-R12 set up by BASIC
;
; On exit:	--
;
; CALL syntax:	file$
;
; Use:		Saves the current AOF file.  It also resets all the AOF
;		state, so that another AOF file can be built subsequently.

		IMPORT	aof_save

		]

;----- That's all, folks ----------------------------------------------------

		END
