Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sh / banner
1 ;
2 ; banner.sh
3 ;
4 ; A startup banner window
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
13 ; Sapphire 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 ; Sapphire 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 Sapphire. 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 ; banner
32 ; bnr_doBanner
33
34 [ :LNOT::DEF:banner__dfn
35 GBLL banner__dfn
36
37 ;+ LIB sapphire:^.bsh.banner
38
39 ; --- banner ---
40 ;
41 ; On entry: R0 == pointer to definition block, or 0
42 ; R1 == R12 value to pass to setup routine, if present
43 ;
44 ; On exit: --
45 ;
46 ; Use: Displays a startup banner and initialises the library and
47 ; client. This call should be used as a replacement for
48 ; sapphire_libInit.
49 ;
50 ; If R0 is 0 on entry, no banner window is used; instead
51 ; an hourglass percentage is displayed to indicate the
52 ; amount of initialisation performed so far.
53 ;
54 ; Alternatively, it should point to a table consisting of
55 ; a flags word and optional arguments specified by the flags
56 ; in order. The options you can specify are a slider and
57 ; percentage count icon (used to display current progress),
58 ; a setup routine, and the leafname of a sprites file to
59 ; attach to the banner window.
60 ;
61 ; The setup routine is passed the banner dialogue handle in
62 ; R0. It should fill in parts of the banner window, such as
63 ; the licencee name and serial number that can't be determined
64 ; until runtime (for safeness), and maybe version information
65 ; too.
66
67 IMPORT banner
68
69 ; --- bnr_doBanner ---
70 ;
71 ; On entry: R0 == pointer to definition block, or 0
72 ; R1 == R12 value to pass to setup routine, if present
73 ; R2 == pointer to library initialisation table
74 ;
75 ; On exit: --
76 ;
77 ; Use: Displays a startup banner and initialises the library and
78 ; client. This routine is used to support dynamic linking.
79
80 IMPORT bnr_doBanner
81
82 ;----- Flags ----------------------------------------------------------------
83
84 bFlag_slider EQU (1<<0) ;Has a progress slider
85 ;+0 icon number for slider
86 ;+4
87
88 bFlag_counter EQU (1<<1) ;Has a percentage indicator
89 ;+0 icon number for indicator
90 ;+4
91
92 bFlag_setup EQU (1<<2) ;Needs a setup routine
93 ;+0 == address of routine
94 ;+4
95
96 bFlag_sprites EQU (1<<3) ;Load a sprite file
97 ;+0 == name of sprite file
98 ;+n
99
100 ;----- Macros ---------------------------------------------------------------
101
102 GBLA bnr__f
103 GBLA bnr__c
104 bnr__c SETA 0
105
106 ; --- Macro: BANNER ---
107 ;
108 ; Arguments: --
109 ;
110 ; Use: Begins construction of a banner block.
111
112 MACRO
113 $label BANNER
114 bnr__f SETA 0
115 ALIGN
116 $label
117 DCD bnr__fl$bnr__c
118 MEND
119
120 ; --- Macro: BFLAG ---
121 ;
122 ; Arguments: f == flag to set
123 ;
124 ; Use: Sets a flag in the banner header, making sure they go in
125 ; order.
126
127 MACRO
128 BFLAG $f
129 [ bnr__f >= $f
130 ! 1,"Banner flags built in wrong order"
131 ]
132 bnr__f SETA bnr__f :OR: $f
133 MEND
134
135 ; --- Macro: BNSLIDE ---
136 ;
137 ; Arguments: icon == icon number of slider in banner window
138 ;
139 ; Use: Registers the banner window's slider.
140
141 MACRO
142 BNSLIDE $icon
143 BFLAG bFlag_slider
144 DCD $icon
145 MEND
146
147 ; --- Macro: BNCOUNT ---
148 ;
149 ; Arguments: icon == icon number of percentage counter
150 ;
151 ; Use: Registers the banner window's percentage counter.
152
153 MACRO
154 BNCOUNT $icon
155 BFLAG bFlag_counter
156 DCD $icon
157 MEND
158
159 ; --- Macro: BNSETUP ---
160 ;
161 ; Arguments: rout == address of setup routine
162 ;
163 ; Use: Registers the banner window's setup routine.
164
165 MACRO
166 BNSETUP $rout
167 BFLAG bFlag_setup
168 DCD $rout
169 MEND
170
171 ; --- Macro: BNSPRT ---
172 ;
173 ; Arguments: name == leafname of sprite file
174 ;
175 ; Use: Registers the banner window's sprite file name.
176
177 MACRO
178 BNSPRT $name
179 BFLAG bFlag_sprites
180 DCB "$name",0
181 MEND
182
183 ; --- Macro: BNEND ---
184 ;
185 ; Arguments: --
186 ;
187 ; Use: Terminates a banner window definition.
188
189 MACRO
190 BNEND
191 ALIGN
192 bnr__fl$bnr__c EQU bnr__f
193 bnr__c SETA bnr__c+1
194 MEND
195
196 ]
197
198 ;----- That's all, folks ----------------------------------------------------
199
200 END