37
|
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 *
|
|
72 fcc "/D0"
|
|
73 * IFNE DD
|
|
74 * fcc "/DD"
|
|
75 * ELSE
|
|
76 * fcc "/H0"
|
|
77 * ENDC
|
|
78 fcb C$CR
|
|
79 HDDev equ *
|
|
80 fcc "/DD"
|
|
81 * IFNE DD
|
|
82 * fcc "/DD/"
|
|
83 * ELSE
|
|
84 * fcc "/H0/"
|
|
85 * ENDC
|
|
86 ExecDir fcc "/D0/CMDS"
|
|
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 mdirprm fcc "-e"
|
|
112 fcb C$CR
|
|
113
|
|
114 * Default time packet
|
|
115 DefTime
|
|
116 * dtb
|
|
117
|
|
118 IFEQ atari+corsham
|
|
119 IFEQ Level-1
|
|
120 * BASIC reset code (CoCo port only)
|
|
121 * BasicRst fcb $55
|
|
122 * neg <$0074
|
|
123 * nop
|
|
124 * clr >PIA0Base+3
|
|
125 * nop
|
|
126 * nop
|
|
127 * sta >$FFDF turn off ROM mode
|
|
128 * jmp >Bt.Start+2 jump to boot
|
|
129 * BasicRL equ *-BasicRst
|
|
130 ENDC
|
|
131 ENDC
|
|
132
|
|
133 Init fcs /Init/
|
|
134
|
|
135 * Entry: X = pointer to start of nul terminated string
|
|
136 * Exit: D = length of string
|
|
137 strlen pshs x
|
|
138 ldd #-1
|
|
139 go@ addd #$0001
|
|
140 tst ,x+
|
|
141 bne go@
|
|
142 puls x,pc
|
|
143
|
|
144 * Display carriage-return/line-feed.
|
|
145 WriteCR pshs y
|
|
146 leax CrRtn,pcr
|
|
147 ldy #$0001
|
|
148 os9 I$WritLn
|
|
149 puls y,pc
|
|
150
|
|
151 **********************************************************
|
|
152 * SysGo Entry Point
|
|
153 **********************************************************
|
|
154 start leax >IcptRtn,pcr
|
|
155 os9 F$Icpt
|
|
156 * Set priority of this process
|
|
157 os9 F$ID
|
|
158 ldb #DefPrior
|
|
159 os9 F$SPrior
|
|
160
|
|
161 * Write OS name and Machine name strings
|
|
162 leax Init,pcr
|
|
163 clra
|
|
164 pshs u
|
|
165 os9 F$Link
|
|
166 bcs SignOn
|
|
167 stx <InitAddr
|
|
168 ldd OSName,u point to OS name in INIT module
|
|
169 leax d,u point to install name in INIT module
|
|
170 bsr strlen
|
|
171 tfr d,y
|
|
172 lda #$01
|
|
173 os9 I$Write
|
|
174 bsr WriteCR
|
|
175 ldd InstallName,u
|
|
176 leax d,u point to install name in INIT module
|
|
177 bsr strlen
|
|
178 tfr d,y
|
|
179 lda #$01
|
|
180 os9 I$Write
|
|
181 bsr WriteCR
|
|
182
|
|
183 * Show rest of banner
|
|
184 SignOn
|
|
185 puls u
|
|
186 leax >Banner,pcr
|
|
187 ldy #BannLen
|
|
188 lda #$01 standard output
|
|
189 os9 I$Write write out banner
|
|
190
|
|
191 * Set default time
|
|
192 * leax >DefTime,pcr
|
|
193 * os9 F$STime set time to default
|
|
194
|
|
195 IFEQ ROM
|
|
196 * Change EXEC and DATA dirs
|
|
197 leax >ExecDir,pcr
|
|
198 lda #EXEC.
|
|
199 os9 I$ChgDir change exec. dir
|
|
200 leax >DefDev,pcr
|
|
201 * Made READ. so that no write occurs at boot (Boisy on Feb 5, 2012)
|
|
202 lda #READ.
|
|
203 os9 I$ChgDir change data dir.
|
|
204 bcs L0125
|
|
205 leax >HDDev,pcr
|
|
206 lda #EXEC.
|
|
207 os9 I$ChgDir change exec. dir to HD
|
|
208 ENDC
|
|
209
|
|
210 L0125 equ *
|
|
211 pshs u,y
|
|
212 IFEQ atari+corsham
|
|
213 IFEQ Level-1
|
|
214 * Setup BASIC code (CoCo port only)
|
|
215 * leax >BasicRst,pcr
|
|
216 * ldu #D.CBStrt
|
|
217 * ldb #BasicRL
|
|
218 *CopyLoop lda ,x+
|
|
219 * sta ,u+
|
|
220 * decb
|
|
221 * bne CopyLoop
|
|
222 ELSE
|
|
223 os9 F$ID get process ID
|
|
224 lbcs L01A9 fail
|
|
225 leax ,u
|
|
226 os9 F$GPrDsc get process descriptor copy
|
|
227 lbcs L01A9 fail
|
|
228 leay ,u
|
|
229 ldx #$0000
|
|
230 ldb #$01
|
|
231 os9 F$MapBlk
|
|
232 bcs L01A9
|
|
233
|
|
234 * lda #$55 set flag for Color BASIC
|
|
235 * sta <D.CBStrt,u
|
|
236 * Copy our default I/O ptrs to the system process
|
|
237 ldd <D.SysPrc,u
|
|
238 leau d,u
|
|
239 leau <P$DIO,u
|
|
240 leay <P$DIO,y
|
|
241 ldb #DefIOSiz-1
|
|
242 L0151 lda b,y
|
|
243 sta b,u
|
|
244 decb
|
|
245 bpl L0151
|
|
246 ENDC
|
|
247 ENDC
|
|
248 *
|
|
249 * IFEQ ROM
|
|
250 * Fork shell startup here
|
|
251 * IFEQ atari+corsham
|
|
252 * Added 12/14/03: If SHIFT is held down, startup is not run (CoCo only)
|
|
253 * lda #$01 standard output
|
|
254 * ldb #SS.KySns
|
|
255 * os9 I$GetStt
|
|
256 * bcs DoStartup
|
|
257 * bita #SHIFTBIT SHIFT key down?
|
|
258 * bne L0186 Yes, don't to startup or autoex
|
|
259 * ENDC
|
|
260
|
|
261 *DoStartup leax >Shell,pcr
|
|
262 * leau >Startup,pcr
|
|
263 * ldd #256
|
|
264 * ldy #StartupL
|
|
265 * os9 F$Fork
|
|
266 * bcs DoAuto Startup failed..
|
|
267 * os9 F$Wait
|
|
268 * ENDC
|
|
269
|
|
270 * Fork AutoEx here
|
|
271 *DoAuto leax >AutoEx,pcr
|
|
272 * leau >CRtn,pcr
|
|
273 * ldd #$0100
|
|
274 * ldy #$0001
|
|
275 * os9 F$Fork
|
|
276 * bcs L0186 AutoEx failed..
|
|
277 * os9 F$Wait
|
|
278
|
|
279 IFEQ Level-1
|
|
280 leax >MDIR,pcr
|
|
281 leau >mdirprm,pcr
|
|
282 ldd #$0100
|
|
283 ldy #$0003
|
|
284 os9 F$Fork
|
|
285 bcs L0186 AutoEx failed..
|
|
286 os9 F$Wait
|
|
287 bra L0186
|
|
288 MDIR fcs "mdir"
|
|
289 fcb $0d
|
|
290 ENDC
|
|
291 L0186 equ *
|
|
292 puls u,y
|
|
293 FrkShell leax >ShellPrm,pcr
|
|
294 leay ,u
|
|
295 ldb #ShellPL
|
|
296 L0190 lda ,x+
|
|
297 sta ,y+
|
|
298 decb
|
|
299 bne L0190
|
|
300 * Fork final shell here
|
|
301 leax >Shell,pcr
|
|
302 lda #$01 D = 256 (B already 0 from above)
|
|
303 ldy #ShellPL
|
|
304 IFGT Level-1
|
|
305 os9 F$Chain Level 2/3. Should not return..
|
|
306 ldb #$06 it did! Fatal. Load error code
|
|
307 bra Crash
|
|
308
|
|
309 L01A9 ldb #$04 error code
|
|
310 Crash clr >DPort+$08 turn off disk motor
|
|
311 jmp <D.Crash fatal error
|
|
312 ELSE
|
|
313 os9 F$Fork Level 1.
|
|
314 bcs DeadEnd Fatal.
|
|
315 os9 F$Wait
|
|
316 bcc FrkShell OK, go start shell.
|
|
317 DeadEnd bra DeadEnd
|
|
318 ENDC
|
|
319
|
|
320 IcptRtn rti
|
|
321
|
|
322 emod
|
|
323 eom equ *
|
|
324 end
|