Initial revision
[ssr] / StraySrc / Sculptrix / sculptrix / sh / border
1 ;
2 ; border.sh
3 ;
4 ; Plots borders given an icon block and a definition of the border shape
5 ;
6 ; © 1995-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sculptrix.
12 ;
13 ; Sculptrix 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 ; Sculptrix 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 Sculptrix. 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 ; border_plot
32
33 [ :LNOT::DEF:border__dfn
34 GBLL border__dfn
35
36 ; --- border_plot ---
37 ;
38 ; On entry: R0 == pointer to border defintion
39 ; R1 == pointer to icon block
40 ; R2,R3 == window origin position
41 ; R4 == pointer to colour table
42 ; R5 == group box title width (optional)
43 ; R6 == group box title address (optional)
44 ;
45 ; On exit: May return an error
46 ;
47 ; Use: Plots a border using the border definition.
48
49 IMPORT border_plot
50
51 ;----- Command codes --------------------------------------------------------
52 ;
53 ; We try to organise these in a way which makes it easy to decode. The
54 ; bottom two bits end up as an immediate operand in most cases, allowing us
55 ; to select entries in the icon bounding box easily.
56
57 ^ -4
58
59 # 4
60 bCmd_ret EQU {VAR} ;End border operation
61
62 # 4
63 bCmd_ldix0 EQU {VAR}+0 ;Fetch X0 of the icon
64 bCmd_ldiy0 EQU {VAR}+1 ;Fetch Y0 of the icon
65 bCmd_ldix1 EQU {VAR}+2 ;Fetch X1 of the icon
66 bCmd_ldiy1 EQU {VAR}+3 ;Fetch Y1 of the icon
67
68 # 4
69 bCmd_ldx0 EQU {VAR}+0 ;Fetch last stored X0
70 bCmd_ldy0 EQU {VAR}+1 ;Fetch last stored Y0
71 bCmd_ldx1 EQU {VAR}+2 ;Fetch last stored X1
72 bCmd_ldy1 EQU {VAR}+3 ;Fetch last stored Y1
73
74 # 4
75 bCmd_ldhc EQU {VAR}+0 ;Fetch horizontal centre
76 bCmd_ldvc EQU {VAR}+1 ;Fetch vertical centre
77
78 # 4
79 bCmd_add EQU {VAR}+0 ;Add next byte
80 bCmd_sub EQU {VAR}+1 ;Subtract next byte
81
82 # 4
83 bCmd_stx0 EQU {VAR}+0 ;Store as the X0 parameter
84 bCmd_sty0 EQU {VAR}+1 ;Store as the Y0 parameter
85 bCmd_stx1 EQU {VAR}+2 ;Store as the X1 parameter
86 bCmd_sty1 EQU {VAR}+3 ;Store as the Y1 parameter
87
88 # 4
89 bCmd_dark EQU {VAR}+0 ;Use the current `dark' col
90 bCmd_light EQU {VAR}+1 ;Use the current `light' col
91 bCmd_raw EQU {VAR}+2 ;Switch to uninverted colours
92
93 # 4
94 bCmd_icon EQU {VAR}+0 ;Set colours from icon
95 bCmd_indCol EQU {VAR}+1 ;Indirected colour
96 bCmd_litCol EQU {VAR}+2 ;Literal colour
97
98 # 4
99 bCmd_plot EQU {VAR}+0 ;Plot a rule (arg == branch)
100
101 # 4
102 bCmd_skpt EQU {VAR}+0 ;Skip past the `title'
103
104 # 4
105 bCmd_group EQU {VAR}+0 ;Plot a group box
106
107 # 4
108 bCmd_jmp EQU {VAR}+0 ;Jump to a routine
109 bCmd_call EQU {VAR}+1 ;Call subroutine
110
111 ;----- Macros ---------------------------------------------------------------
112
113 ; --- Return ---
114
115 MACRO
116 $label BRET
117 $label DCB bCmd_ret
118 MEND
119
120 ; --- Load values ---
121
122 MACRO
123 $label BLDIX0
124 $label DCB bCmd_ldix0
125 MEND
126
127 MACRO
128 $label BLDIY0
129 $label DCB bCmd_ldiy0
130 MEND
131
132 MACRO
133 $label BLDIX1
134 $label DCB bCmd_ldix1
135 MEND
136
137 MACRO
138 $label BLDIY1
139 $label DCB bCmd_ldiy1
140 MEND
141
142 ; --- Load values ---
143
144 MACRO
145 $label BLDX0
146 $label DCB bCmd_ldx0
147 MEND
148
149 MACRO
150 $label BLDY0
151 $label DCB bCmd_ldy0
152 MEND
153
154 MACRO
155 $label BLDX1
156 $label DCB bCmd_ldx1
157 MEND
158
159 MACRO
160 $label BLDY1
161 $label DCB bCmd_ldy1
162 MEND
163
164 ; --- Centring ---
165
166 MACRO
167 $label LDHC
168 $label DCB bCmd_ldhc
169 MEND
170
171 MACRO
172 $label BLDVC
173 $label DCB bCmd_ldvc
174 MEND
175
176 ; --- Arithmetic ---
177
178 MACRO
179 $label BADD $val
180 $label DCB bCmd_add,$val
181 MEND
182
183 MACRO
184 $label BSUB $val
185 $label DCB bCmd_sub,$val
186 MEND
187
188 MACRO
189 $label BSKIPT
190 $label DCB bCmd_skpt
191 MEND
192
193 ; --- Storing values ---
194
195 MACRO
196 $label BSTX0
197 $label DCB bCmd_stx0
198 MEND
199
200 MACRO
201 $label BSTY0
202 $label DCB bCmd_sty0
203 MEND
204
205 MACRO
206 $label BSTX1
207 $label DCB bCmd_stx1
208 MEND
209
210 MACRO
211 $label BSTY1
212 $label DCB bCmd_sty1
213 MEND
214
215 ; --- Colouring ---
216
217 MACRO
218 $label BLIGHT
219 $label DCB bCmd_light
220 MEND
221
222 MACRO
223 $label BDARK
224 $label DCB bCmd_dark
225 MEND
226
227 MACRO
228 $label BRAW
229 $label DCB bCmd_raw
230 MEND
231
232 MACRO
233 $label BICON
234 $label DCB bCmd_icon
235 MEND
236
237 MACRO
238 $label BINDCOL $colour
239 $label DCB bCmd_indCol,:INDEX:$colour
240 MEND
241
242 MACRO
243 $label BLITCOL $colour
244 $label DCB bCmd_litCol,$colour
245 MEND
246
247 ; --- Plotting ---
248
249 MACRO
250 $label BPLOT $rule
251 $label DCB bCmd_plot
252 ALIGN
253 B $rule
254 MEND
255
256 MACRO
257 $label BGROUP $flags
258 $label DCB bCmd_group
259 ALIGN
260 DCD $flags
261 MEND
262
263 ; --- Subroutines ---
264
265 MACRO
266 $label BJMP $addr
267 $label DCB bCmd_jmp
268 ALIGN
269 DCD $addr-{PC}-4
270 MEND
271
272 MACRO
273 $label BCALL $addr
274 $label DCB bCmd_call
275 ALIGN
276 DCD $addr-{PC}-4
277 MEND
278
279 ]
280
281 ;----- That's all, folks ----------------------------------------------------
282
283 END