Initial revision
[ssr] / StraySrc / Libraries / BAS / src / sh / aofGen
1 ;
2 ; aofGen.sh
3 ;
4 ; Generate AOF files from BASIC
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's BASIC Assembler Supplement.
12 ;
13 ; BAS is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
16 ; any later version.
17 ;
18 ; BAS is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
22 ;
23 ; You should have received a copy of the GNU General Public License
24 ; along with BAS. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27 ;----- Overview -------------------------------------------------------------
28 ;
29 ; Functions provided:
30 ;
31 ; aof_init
32 ; aof_pass
33 ; aof_firstPass
34 ; aof_ensure
35 ; aof_area
36 ; aof_entry
37 ; aof_import
38 ; aof_iImport
39 ; aof_export
40 ; aof_reloc
41 ; aof_noReloc
42 ; aof_save
43
44 [ :LNOT::DEF:aofGen__dfn
45 GBLL aofGen__dfn
46
47 ; --- aof_init ---
48 ;
49 ; On entry: R7 == address of workspace
50 ; R8-R12 set up by BASIC
51 ;
52 ; On exit: --
53 ;
54 ; CALL syntax: asmCode%
55 ;
56 ; Use: Initialises workspace for generation of AOF code. Remembers
57 ; that code generation will start at asmCode%.
58
59 IMPORT aof_init
60
61 ; --- aof_pass ---
62 ;
63 ; On entry: --
64 ;
65 ; On exit: --
66 ;
67 ; Use: Signals the start of a new assembly pass.
68
69 IMPORT aof_pass
70
71 ; --- aof_firstPass ---
72 ;
73 ; On entry: --
74 ;
75 ; On exit: CS if on first pass, CC otherwise
76 ;
77 ; Use: Informs the caller whether we're on the first or second pass.
78
79 IMPORT aof_firstPass
80
81 ; --- aof_ensure ---
82 ;
83 ; On entry: R0 == address of anchor and size info
84 ; R1 == free space required
85 ;
86 ; On exit: R0 == address of first free byte in area
87 ;
88 ; Use: Ensures that there is the requested quantity of memory free
89 ; in the given block. If not, bas_noMem is called.
90
91 IMPORT aof_ensure
92
93 ; --- aof_area ---
94 ;
95 ; On entry: R0 == AREA attributes word
96 ; R7 == address of workspace
97 ; R8-R12 set up by BASIC
98 ;
99 ; On exit: --
100 ;
101 ; CALL syntax: name$
102 ;
103 ; Use: Makes a new AREA start at the current location.
104
105 IMPORT aof_area
106
107 ; --- aof_entry ---
108 ;
109 ; On entry: --
110 ;
111 ; On exit: --
112 ;
113 ; Use: Sets the image entry point to be the current location.
114
115 IMPORT aof_entry
116
117 ; --- aof_import ---
118 ;
119 ; On entry: R0 == pointer to variable name
120 ; R1 == pointer to symbol name
121 ; R3 == attribute bits (not including bits 0,1)
122 ;
123 ; On exit: --
124 ;
125 ; Use: Imports a symbol, and sets the given variable to point to
126 ; it. If the symbol is already imported, another alias is
127 ; set up, but no actual symbol is created.
128
129 IMPORT aof_import
130
131 ; --- aof_iImport ---
132 ;
133 ; On entry: R0 == WEAK flag
134 ; R7 == address of workspace
135 ; R8-R12 set up by BASIC
136 ;
137 ; On exit: --
138 ;
139 ; CALL syntax: name$,alias$
140 ;
141 ; Use: Imports a symbol name$, and makes the variable whose name
142 ; is in alias$ refer to it.
143
144 IMPORT aof_iImport
145
146 ; --- aof_export ---
147 ;
148 ; On entry: R0 == STRONG flag
149 ; R7 == pointer to workspace
150 ; R8-R12 as set up by BASIC
151 ;
152 ; On exit: --
153 ;
154 ; CALL syntax: alias$,name$
155 ;
156 ; Use: Exports the value held in the given alias as the symbol
157 ; name$.
158
159 IMPORT aof_export
160
161 ; --- aof_reloc ---
162 ;
163 ; On entry: R7 == workspace address
164 ;
165 ; On exit: --
166 ;
167 ; Use: Marks the current address as being the start of a relocation
168 ; block. If a relocation block is current, this is a no-op.
169
170 IMPORT aof_reloc
171
172 ; --- aof_noReloc ---
173 ;
174 ; On entry: R7 == workspace address
175 ;
176 ; On exit: --
177 ;
178 ; Use: Marks the current address as being the start of a non-
179 ; relocation block. If a non-relocation block is current,
180 ; this is a no-op.
181
182 IMPORT aof_noReloc
183
184 ; --- aof_save ---
185 ;
186 ; On entry: R7 == workspace address
187 ; R8-R12 set up by BASIC
188 ;
189 ; On exit: --
190 ;
191 ; CALL syntax: file$
192 ;
193 ; Use: Saves the current AOF file. It also resets all the AOF
194 ; state, so that another AOF file can be built subsequently.
195
196 IMPORT aof_save
197
198 ]
199
200 ;----- That's all, folks ----------------------------------------------------
201
202 END