35
|
1 ********************************************************************
|
|
2 * SysGo - Kickstart program module
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
|
8 * ------------------------------------------------------------------
|
|
9 * 5 1998/10/12 Boisy G. Pitre
|
|
10 * Taken from OS-9 L2 Tandy distribution and modified banner for V3.
|
|
11 *
|
|
12 * 5r2 2003/01/08 Boisy G. Pitre
|
|
13 * Fixed fork behavior so that if 'shell startup' fails, system doesn't
|
|
14 * jmp to Crash, but tries AutoEx instead. Also changed /DD back to /H0
|
|
15 * for certain boot floppy cases.
|
|
16 *
|
|
17 * 2003/09/04 Boisy G. Pitre
|
|
18 * Back-ported to OS-9 Level One.
|
|
19 *
|
|
20 * 5r3 2003/12/14 Boisy G. Pitre
|
|
21 * Added SHIFT key check to prevent startup/autoex from starting if
|
|
22 * held down. Gene Heskett, this Bud's for you.
|
|
23
|
|
24 nam SysGo
|
|
25 ttl Kickstart program module
|
|
26
|
|
27 IFP1
|
|
28 use defsfile
|
|
29 ENDC
|
|
30
|
|
31 tylg set Prgrm+Objct
|
|
32 atrv set ReEnt+rev
|
|
33 rev set $03
|
|
34 edition set $05
|
|
35
|
|
36 mod eom,name,tylg,atrv,start,size
|
|
37
|
|
38
|
|
39 org 0
|
|
40 InitAddr rmb 2
|
|
41 rmb 250
|
|
42 size equ .
|
|
43
|
|
44 name fcs /SysGo/
|
|
45 fcb edition
|
|
46
|
|
47 * Default process priority
|
|
48 DefPrior set 128
|
|
49
|
|
50 Banner equ *
|
|
51 fcc /(C) 2014 The NitrOS-9 Project/
|
|
52 CrRtn fcb C$CR,C$LF
|
|
53
|
|
54 IFEQ ROM
|
|
55 IFNE NOS9DBG
|
|
56 fcc "** DEVELOPMENT BUILD **"
|
|
57 fcb C$CR,C$LF
|
|
58 fcc "** NOT FOR DISTRIBUTION! **"
|
|
59 fcb C$CR,C$LF
|
|
60 ENDC
|
|
61 * dts
|
|
62 fcb C$CR,C$LF
|
|
63 fcc !http://www.nitros9.org!
|
|
64 fcb C$CR,C$LF
|
|
65 ENDC
|
|
66
|
|
67 fcb C$LF
|
|
68 BannLen equ *-Banner
|
|
69
|
|
70 IFEQ ROM
|
|
71 DefDev equ *
|
56
|
72 fcc "/V0"
|
35
|
73 * IFNE DD
|
|
74 * fcc "/DD"
|
|
75 * ELSE
|
|
76 * fcc "/H0"
|
|
77 * ENDC
|
|
78 fcb C$CR
|
|
79 HDDev equ *
|
56
|
80 fcc "/V0"
|
35
|
81 * IFNE DD
|
|
82 * fcc "/DD/"
|
|
83 * ELSE
|
|
84 * fcc "/H0/"
|
|
85 * ENDC
|
56
|
86 ExecDir fcc "/V0/CMDS"
|
35
|
87 fcb C$CR
|
|
88 ENDC
|
|
89
|
|
90 Shell fcc "Shell"
|
|
91 fcb C$CR
|
|
92 AutoEx fcc "AutoEx"
|
|
93 fcb C$CR
|
|
94 AutoExPr fcc ""
|
|
95 fcb C$CR
|
|
96 AutoExPrL equ *-AutoExPr
|
|
97
|
|
98 IFEQ ROM
|
|
99 Startup fcc "startup -p"
|
|
100 fcb C$CR
|
|
101 StartupL equ *-Startup
|
|
102 ENDC
|
|
103
|
|
104 ShellPrm equ *
|
|
105 IFGT Level-1
|
|
106 fcc "i=/1"
|
|
107 ENDC
|
|
108 CRtn fcb C$CR
|
|
109 ShellPL equ *-ShellPrm
|
|
110
|
|
111 * Default time packet
|
|
112 DefTime
|
56
|
113 fcb 0
|
|
114 fcb 0
|
|
115 fcb 0
|
|
116 fcb 0
|
|
117 fcb 0
|
|
118 fcb 0
|
|
119 fcb 0
|
|
120 fcb 0
|
|
121 fcb 0
|
35
|
122 * dtb
|
|
123
|
|
124 IFEQ atari+corsham
|
|
125 IFEQ Level-1
|
|
126 * BASIC reset code (CoCo port only)
|
|
127 * BasicRst fcb $55
|
|
128 * neg <$0074
|
|
129 * nop
|
|
130 * clr >PIA0Base+3
|
|
131 * nop
|
|
132 * nop
|
|
133 * sta >$FFDF turn off ROM mode
|
|
134 * jmp >Bt.Start+2 jump to boot
|
|
135 * BasicRL equ *-BasicRst
|
|
136 ENDC
|
|
137 ENDC
|
|
138
|
|
139 Init fcs /Init/
|
|
140
|
|
141 * Entry: X = pointer to start of nul terminated string
|
|
142 * Exit: D = length of string
|
|
143 strlen pshs x
|
|
144 ldd #-1
|
|
145 go@ addd #$0001
|
|
146 tst ,x+
|
|
147 bne go@
|
|
148 puls x,pc
|
|
149
|
|
150 * Display carriage-return/line-feed.
|
|
151 WriteCR pshs y
|
|
152 leax CrRtn,pcr
|
|
153 ldy #$0001
|
|
154 os9 I$WritLn
|
|
155 puls y,pc
|
|
156
|
|
157 **********************************************************
|
|
158 * SysGo Entry Point
|
|
159 **********************************************************
|
|
160 start leax >IcptRtn,pcr
|
|
161 os9 F$Icpt
|
|
162 * Set priority of this process
|
|
163 os9 F$ID
|
|
164 ldb #DefPrior
|
|
165 os9 F$SPrior
|
|
166
|
|
167 * Write OS name and Machine name strings
|
|
168 leax Init,pcr
|
|
169 clra
|
|
170 pshs u
|
|
171 os9 F$Link
|
|
172 bcs SignOn
|
|
173 stx <InitAddr
|
|
174 ldd OSName,u point to OS name in INIT module
|
|
175 leax d,u point to install name in INIT module
|
|
176 bsr strlen
|
|
177 tfr d,y
|
|
178 lda #$01
|
|
179 os9 I$Write
|
|
180 bsr WriteCR
|
|
181 ldd InstallName,u
|
|
182 leax d,u point to install name in INIT module
|
|
183 bsr strlen
|
|
184 tfr d,y
|
|
185 lda #$01
|
|
186 os9 I$Write
|
|
187 bsr WriteCR
|
|
188
|
|
189 * Show rest of banner
|
|
190 SignOn
|
37
|
191 ldu ,s
|
35
|
192 leax >Banner,pcr
|
|
193 ldy #BannLen
|
|
194 lda #$01 standard output
|
|
195 os9 I$Write write out banner
|
|
196
|
56
|
197 * Set default time and start Clock module
|
|
198 leax >DefTime,pcr
|
|
199 os9 F$STime set time to default
|
35
|
200
|
37
|
201 IFEQ 1
|
|
202 leax >MDIR,pcr
|
|
203 leau >mdirprm,pcr
|
|
204 ldd #$0100
|
|
205 ldy #$0003
|
|
206 os9 F$Fork
|
|
207 bcs mdirend AutoEx failed..
|
|
208 os9 F$Wait
|
|
209 ldu ,s
|
|
210 bra mdirend
|
|
211 MDIR fcc "mdir"
|
|
212 fcb $0d
|
|
213 mdirprm fcc "-e"
|
|
214 fcb C$CR
|
|
215 mdirend
|
|
216 ldu ,s
|
|
217 ENDC
|
|
218
|
|
219 * IFEQ ROM
|
35
|
220 * Change EXEC and DATA dirs
|
|
221 leax >ExecDir,pcr
|
|
222 lda #EXEC.
|
|
223 os9 I$ChgDir change exec. dir
|
|
224 leax >DefDev,pcr
|
|
225 * Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012)
|
|
226 lda #READ.
|
|
227 os9 I$ChgDir change data dir.
|
|
228 bcs L0125
|
37
|
229 * leax >HDDev,pcr
|
|
230 * lda #EXEC.
|
|
231 * os9 I$ChgDir change exec. dir to HD
|
|
232 * ENDC
|
35
|
233
|
|
234 L0125 equ *
|
|
235 IFEQ atari+corsham
|
|
236 IFEQ Level-1
|
|
237 * Setup BASIC code (CoCo port only)
|
|
238 * leax >BasicRst,pcr
|
|
239 * ldu #D.CBStrt
|
|
240 * ldb #BasicRL
|
|
241 *CopyLoop lda ,x+
|
|
242 * sta ,u+
|
|
243 * decb
|
|
244 * bne CopyLoop
|
|
245 ELSE
|
|
246 os9 F$ID get process ID
|
|
247 lbcs L01A9 fail
|
|
248 leax ,u
|
|
249 os9 F$GPrDsc get process descriptor copy
|
|
250 lbcs L01A9 fail
|
|
251 leay ,u
|
|
252 ldx #$0000
|
|
253 ldb #$01
|
|
254 os9 F$MapBlk
|
|
255 bcs L01A9
|
|
256
|
|
257 * lda #$55 set flag for Color BASIC
|
|
258 * sta <D.CBStrt,u
|
|
259 * Copy our default I/O ptrs to the system process
|
|
260 ldd <D.SysPrc,u
|
|
261 leau d,u
|
|
262 leau <P$DIO,u
|
|
263 leay <P$DIO,y
|
|
264 ldb #DefIOSiz-1
|
|
265 L0151 lda b,y
|
|
266 sta b,u
|
|
267 decb
|
|
268 bpl L0151
|
|
269 ENDC
|
|
270 ENDC
|
|
271 *
|
|
272 * IFEQ ROM
|
|
273 * Fork shell startup here
|
|
274 * IFEQ atari+corsham
|
|
275 * Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only)
|
|
276 * lda #$01 standard output
|
|
277 * ldb #SS.KySns
|
|
278 * os9 I$GetStt
|
|
279 * bcs DoStartup
|
|
280 * bita #SHIFTBIT SHIFT key down?
|
|
281 * bne L0186 Yes, don't to startup or autoex
|
|
282 * ENDC
|
|
283
|
|
284 *DoStartup leax >Shell,pcr
|
|
285 * leau >Startup,pcr
|
|
286 * ldd #256
|
|
287 * ldy #StartupL
|
|
288 * os9 F$Fork
|
|
289 * bcs DoAuto Startup failed..
|
|
290 * os9 F$Wait
|
|
291 * ENDC
|
|
292
|
|
293 * Fork AutoEx here
|
|
294 *DoAuto leax >AutoEx,pcr
|
|
295 * leau >CRtn,pcr
|
|
296 * ldd #$0100
|
|
297 * ldy #$0001
|
|
298 * os9 F$Fork
|
|
299 * bcs L0186 AutoEx failed..
|
|
300 * os9 F$Wait
|
|
301
|
|
302 L0186 equ *
|
37
|
303 ldu ,s
|
35
|
304 FrkShell leax >ShellPrm,pcr
|
|
305 leay ,u
|
|
306 ldb #ShellPL
|
|
307 L0190 lda ,x+
|
|
308 sta ,y+
|
|
309 decb
|
|
310 bne L0190
|
|
311 * Fork final shell here
|
|
312 leax >Shell,pcr
|
|
313 lda #$01 D = 256 (B already 0 from above)
|
|
314 ldy #ShellPL
|
|
315 IFGT Level-1
|
|
316 os9 F$Chain Level 2/3. Should not return..
|
|
317 ldb #$06 it did! Fatal. Load error code
|
|
318 bra Crash
|
|
319
|
|
320 L01A9 ldb #$04 error code
|
|
321 Crash clr >DPort+$08 turn off disk motor
|
|
322 jmp <D.Crash fatal error
|
|
323 ELSE
|
|
324 os9 F$Fork Level 1.
|
|
325 bcs DeadEnd Fatal.
|
|
326 os9 F$Wait
|
|
327 bcc FrkShell OK, go start shell.
|
|
328 DeadEnd bra DeadEnd
|
|
329 ENDC
|
|
330
|
|
331 IcptRtn rti
|
|
332
|
|
333 emod
|
|
334 eom equ *
|
|
335 end
|