Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/kernel.asm @ 1071:853a796a1bcd
Removed logbook
author | boisy |
---|---|
date | Mon, 31 Mar 2003 14:10:56 +0000 |
parents | dd89c62ea2ca |
children | 607fcc81c5ae |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * OS9p1 - OS-9 Level One V2 P1 module | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
201 | 8 * 14 From Tandy OS-9 Level One VR 02.00.00 |
300 | 9 * 15 Module validation consists only of module BGP 02/07/21 |
10 * header parity check. CRC check is not done | |
11 * unless D.CRC is set to 1, which is NOT the | |
12 * default case. By default, D.CRC is set | |
13 * to 0, thus there is no CRC checking. Speeds | |
14 * up module loads quite a bit. | |
306 | 15 * The Init module has a bit in a compatibility |
16 * byte that can turn on/off CRC checking | |
0 | 17 |
18 | |
19 nam OS9 | |
20 ttl OS-9 Level One V2 P1 module | |
21 | |
22 ifp1 | |
23 use defsfile | |
24 use scfdefs | |
25 endc | |
26 | |
27 tylg set Systm+Objct | |
28 atrv set ReEnt+rev | |
29 rev set $01 | |
300 | 30 edition set 15 |
0 | 31 |
32 L0000 mod eom,name,tylg,atrv,OS9Cold,size | |
33 | |
34 size equ . | |
35 | |
36 name fcs /OS9/ | |
37 fcb edition | |
38 | |
39 fcc /CC/ | |
40 | |
41 InitNam fcs /INIT/ | |
42 | |
43 P2Nam fcs /OS9P2/ | |
44 | |
45 VectCode bra SWI3Jmp | |
46 nop | |
47 bra SWI2Jmp | |
48 nop | |
49 bra SWIJmp | |
50 nop | |
51 bra NMIJmp | |
52 nop | |
53 bra IRQJmp | |
54 nop | |
55 bra FIRQJmp | |
56 | |
57 SWI3Jmp jmp [>D.SWI3] | |
58 SWI2Jmp jmp [>D.SWI2] | |
59 SWIJmp jmp [>D.SWI] | |
60 NMIJmp jmp [>D.NMI] | |
61 IRQJmp jmp [>D.IRQ] | |
62 FIRQJmp jmp [>D.FIRQ] | |
63 VectCSz equ *-VectCode | |
64 | |
65 | |
66 SysTbl fcb F$Link | |
67 fdb FLink-*-2 | |
68 | |
69 fcb F$Fork | |
70 fdb FFork-*-2 | |
71 | |
72 fcb F$Chain | |
73 fdb FChain-*-2 | |
74 | |
75 fcb F$Chain+$80 | |
76 fdb SFChain-*-2 | |
77 | |
78 fcb F$PrsNam | |
79 fdb FPrsNam-*-2 | |
80 | |
81 fcb F$CmpNam | |
82 fdb FCmpNam-*-2 | |
83 | |
84 fcb F$SchBit | |
85 fdb FSchBit-*-2 | |
86 | |
87 fcb F$AllBit | |
88 fdb FAllBit-*-2 | |
89 | |
90 fcb F$DelBit | |
91 fdb FDelBit-*-2 | |
92 | |
93 fcb F$CRC | |
94 fdb FCRC-*-2 | |
95 | |
96 fcb F$SRqMem+$80 | |
97 fdb FSRqMem-*-2 | |
98 | |
99 fcb F$SRtMem+$80 | |
100 fdb FSRtMem-*-2 | |
101 | |
102 fcb F$AProc+$80 | |
103 fdb FAProc-*-2 | |
104 | |
105 fcb F$NProc+$80 | |
106 fdb FNProc-*-2 | |
107 | |
108 fcb F$VModul+$80 | |
109 fdb FVModul-*-2 | |
110 | |
111 fcb F$SSvc | |
112 fdb FSSvc-*-2 | |
113 | |
114 fcb $80 | |
115 | |
116 * | |
117 * OS-9 Genesis! | |
118 OS9Cold equ * | |
119 * clear out system globals from $0020-$0400 | |
120 ldx #D.FMBM | |
121 ldy #$400-D.FMBM | |
122 clra | |
123 clrb | |
124 L007F std ,x++ | |
125 leay -2,y | |
126 bne L007F | |
127 * set up system globals | |
128 inca | |
129 inca D = $200 | |
130 std <D.FMBM $200 = start of free memory bitmap | |
131 addb #$20 | |
132 std <D.FMBM+2 $220 = end of free memory bitmap | |
133 addb #$02 | |
134 std <D.SysDis $222 = addr of sys dispatch tbl | |
135 addb #$70 | |
296 | 136 std <D.UsrDis $292 = addr of usr dispatch tbl |
0 | 137 clrb |
138 inca D = $300 | |
139 std <D.ModDir $300 = mod dir start | |
140 stx <D.ModDir+2 X = $400 = mod dir end | |
141 leas >$0100,x S = $500 (system stack?) | |
142 | |
143 * Check for valid RAM starting at $400 | |
144 ChkRAM leay ,x | |
145 ldd ,y store org contents in D | |
146 ldx #$00FF | |
147 stx ,y write pattern to ,Y | |
148 cmpx ,y same as what we wrote? | |
149 bne L00C2 nope, not RAM here! | |
150 ldx #$FF00 try different pattern | |
151 stx ,y write it to ,Y | |
152 cmpx ,y same as what we wrote? | |
153 bne L00C2 nope, not RAM here! | |
154 std ,y else restore org contents | |
155 leax >$0100,y check top of next 256 block | |
977
dd89c62ea2ca
os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents:
308
diff
changeset
|
156 cmpx #BTStart stop short of boot track mem |
0 | 157 bcs ChkRAM |
158 leay ,x | |
159 * Here, Y = end of RAM | |
160 L00C2 leax ,y X = end of RAM | |
161 stx <D.MLIM save off memory limit | |
162 | |
163 * Copy vector code over to address $100 | |
164 pshs y,x | |
165 leax >VectCode,pcr | |
247 | 166 ldy #D.XSWI3 |
0 | 167 ldb #VectCSz |
168 L00D2 lda ,x+ | |
169 sta ,y+ | |
170 decb | |
171 bne L00D2 | |
172 puls y,x | |
173 * validate modules at top of RAM (kernel, etc.) | |
174 L00DB lbsr ValMod | |
175 bcs L00E6 | |
176 ldd M$Size,x | |
177 leax d,x go past module | |
178 bra L00EC | |
179 L00E6 cmpb #E$KwnMod | |
180 beq L00EE | |
181 leax 1,x | |
182 L00EC bne L00DB | |
183 | |
184 * copy vectors to system globals | |
185 L00EE leay >Vectors,pcr | |
186 leax >L0000,pcr | |
187 pshs x | |
188 ldx #D.SWI3 | |
189 L00FB ldd ,y++ | |
190 addd ,s | |
191 std ,x++ | |
192 cmpx #$0036 | |
193 bls L00FB | |
194 leas 2,s restore stack | |
195 | |
196 * fill in more system globals | |
197 leax >URtoSs,pcr | |
198 stx <D.URtoSs | |
199 leax >UsrIRQ,pcr | |
200 stx <D.UsrIRQ | |
201 leax >UsrSvc,pcr | |
202 stx <D.UsrSvc | |
203 leax >SysIRQ,pcr | |
204 stx <D.SysIRQ | |
205 stx <D.SvcIRQ | |
206 leax >SysSvc,pcr | |
207 stx <D.SysSvc | |
208 stx <D.SWI2 | |
209 leax >Poll,pcr | |
210 stx <D.Poll | |
211 leax >Clock,pcr | |
212 stx <D.Clock | |
213 stx <D.AltIRQ | |
214 | |
215 * install system calls | |
216 leay >SysTbl,pcr | |
217 lbsr InstSSvc | |
218 | |
219 * link to init module | |
220 lda #Systm+0 | |
221 leax >InitNam,pcr | |
222 os9 F$Link | |
223 lbcs OS9Cold | |
224 stu <D.Init | |
308 | 225 lda Feature1,u get feature byte 1 |
306 | 226 bita #CRCOn CRC on? |
227 beq GetMem branch if not (already cleared earlier) | |
228 inc <D.CRC else turn on CRC checking | |
229 GetMem ldd MaxMem+1,u | |
0 | 230 clrb |
231 cmpd <D.MLIM | |
232 bcc L0158 | |
233 std <D.MLIM | |
234 L0158 ldx <D.FMBM | |
235 ldb #$F8 | |
236 stb ,x | |
237 clra | |
238 ldb <D.MLIM | |
239 negb | |
240 tfr d,y | |
241 negb | |
242 lbsr L065A | |
243 | |
244 * jump into OS9p2 here | |
245 leax >P2Nam,pcr | |
246 lda #Systm+Objct | |
247 os9 F$Link | |
248 lbcs OS9Cold | |
249 jmp ,y | |
165 | 250 SWI3 pshs pc,x,b |
0 | 251 ldb #P$SWI3 |
252 bra L018C | |
165 | 253 SWI2 pshs pc,x,b |
0 | 254 ldb #P$SWI2 |
255 bra L018C | |
247 | 256 DUMMY rti |
165 | 257 SVCIRQ jmp [>D.SvcIRQ] |
258 SWI pshs pc,x,b | |
0 | 259 ldb #P$SWI |
260 L018C ldx >D.Proc | |
261 ldx b,x get SWI entry | |
262 stx 3,s put in PC on stack | |
263 puls pc,x,b | |
264 | |
265 UsrIRQ leay <L01B1,pcr | |
266 * transition from user to system state | |
267 URtoSs clra | |
268 tfr a,dp clear direct page | |
269 ldx <D.Proc | |
270 ldd <D.SysSvc | |
271 std <D.SWI2 | |
272 ldd <D.SysIRQ | |
273 std <D.SvcIRQ | |
274 leau ,s | |
275 stu P$SP,x | |
276 lda P$State,x | |
277 ora #SysState | |
278 sta P$State,x | |
279 jmp ,y | |
280 | |
281 L01B1 jsr [>D.Poll] | |
282 bcc L01BD | |
283 ldb ,s | |
284 orb #$10 | |
285 stb ,s | |
286 L01BD lbra L0255 | |
287 | |
288 SysIRQ clra | |
289 tfr a,dp | |
290 jsr [>D.Poll] | |
291 bcc L01CF | |
292 ldb ,s | |
293 orb #$10 | |
294 stb ,s | |
295 L01CF rti | |
296 Poll comb | |
297 rts | |
298 | |
299 Clock ldx <D.SProcQ | |
300 beq L01FD | |
301 lda P$State,x | |
302 bita #TimSleep | |
303 beq L01FD | |
304 ldu P$SP,x | |
305 ldd P$SP,u | |
306 subd #$0001 | |
307 std P$SP,u | |
308 bne L01FD | |
309 L01E7 ldu P$Queue,x | |
310 bsr L021A | |
311 leax ,u | |
312 beq L01FB | |
313 lda P$State,x | |
314 bita #TimSleep | |
315 beq L01FB | |
316 ldu P$SP,x | |
317 ldd P$SP,u | |
318 beq L01E7 | |
319 L01FB stx <D.SProcQ | |
320 L01FD dec <D.Slice | |
321 bne ClockRTI | |
322 lda <D.TSlice | |
323 sta <D.Slice | |
324 ldx <D.Proc | |
325 beq ClockRTI | |
326 lda P$State,x | |
327 ora #TimOut | |
328 sta P$State,x | |
329 bpl L0212 branch if not system state | |
330 ClockRTI rti | |
331 | |
332 L0212 leay >L0255,pcr | |
333 bra URtoSs | |
334 | |
335 * X = proc desc | |
336 FAProc ldx R$X,u | |
337 L021A pshs u,y | |
338 ldu #$003F | |
339 bra L0228 | |
340 L0221 ldb P$Age,u | |
341 incb | |
342 beq L0228 | |
343 stb P$Age,u | |
344 L0228 ldu P$Queue,u U = proc desc | |
345 bne L0221 | |
346 ldu #$003F | |
347 lda P$Prior,x | |
348 sta P$Age,x | |
349 orcc #IntMasks | |
350 L0235 leay ,u | |
351 ldu P$Queue,u | |
352 beq L023F | |
353 cmpa P$Age,u | |
354 bls L0235 | |
355 L023F stu P$Queue,x | |
356 stx P$Queue,y | |
357 clrb | |
358 puls pc,u,y | |
359 | |
360 UsrSvc leay <L024E,pcr | |
361 orcc #IntMasks | |
362 lbra URtoSs | |
363 | |
364 L024E andcc #^IntMasks | |
365 ldy <D.UsrDis | |
366 bsr L0278 | |
367 L0255 ldx <D.Proc get current proc desc | |
368 beq FNProc branch to FNProc if none | |
369 orcc #IntMasks | |
370 ldb P$State,x | |
371 andb #^SysState | |
372 stb P$State,x | |
373 bitb #TimOut | |
374 beq L02D1 | |
375 andb #^TimOut | |
376 stb P$State,x | |
377 bsr L021A | |
378 bra FNProc | |
379 | |
380 * system call entry | |
381 SysSvc clra | |
382 tfr a,dp set direct page to 0 | |
383 leau ,s | |
384 ldy <D.SysDis | |
385 bsr L0278 | |
386 rti | |
387 | |
388 L0278 pshs u | |
389 ldx R$PC,u point X to PC | |
390 ldb ,x+ get func code at X | |
391 stx R$PC,u restore updated PC | |
392 lslb multiply by 2 | |
393 bcc L0288 branch if user call | |
394 rorb | |
395 ldx -2,y | |
396 bra L0290 | |
397 L0288 cmpb #$6E | |
398 bcc L02A7 | |
399 ldx b,y X = addr of system call | |
400 beq L02A7 | |
401 L0290 jsr ,x jsr into system call | |
402 L0292 puls u | |
403 tfr cc,a | |
404 bcc FixCC branch if no error | |
405 stb R$B,u store error code | |
406 FixCC ldb R$CC,u get caller's CC | |
407 andb #^(Negative+Zero+TwosOvfl+Carry) | |
408 stb R$CC,u | |
409 anda #Negative+Zero+TwosOvfl+Carry | |
410 ora R$CC,u | |
411 sta R$CC,u | |
412 rts | |
413 L02A7 comb | |
414 ldb #E$UnkSvc | |
415 bra L0292 | |
416 | |
417 * no signal handler, exit with signal value as exit code | |
418 L02AC ldb P$State,x | |
419 orb #SysState | |
420 stb P$State,x | |
421 ldb <P$Signal,x | |
422 andcc #^(IntMasks) | |
423 os9 F$Exit | |
424 | |
425 FNProc clra | |
426 clrb | |
427 std <D.Proc | |
428 bra L02C2 | |
429 * execution goes here when there are no active processes | |
430 L02C0 cwai #^(IntMasks) | |
431 L02C2 orcc #IntMasks | |
432 ldx <D.AProcQ get next active process | |
433 beq L02C0 CWAI if none | |
434 ldd P$Queue,x get queue ptr | |
435 std <D.AProcQ store in Active Q | |
436 stx <D.Proc store in current process | |
437 lds P$SP,x get process' stack ptr | |
438 L02D1 ldb P$State,x get state | |
439 bmi L0308 branch if system state | |
440 bitb #Condem process condemned? | |
441 bne L02AC branch if so... | |
442 ldb <P$Signal,x get signal no | |
443 beq L02FF branch if none | |
444 decb decrement | |
445 beq L02FC branch if wake up | |
446 ldu <P$SigVec,x get signal handler addr | |
447 beq L02AC branch if none | |
448 ldy <P$SigDat,x get data addr | |
449 ldd $06,s | |
450 pshs u,y,b,a | |
451 ldu $0A,s | |
452 lda <P$Signal,x | |
453 ldb $09,s | |
454 tfr d,y | |
455 ldd $06,s | |
456 pshs u,y,b,a | |
457 clrb | |
458 L02FC stb <P$Signal,x | |
459 L02FF ldd <P$SWI2,x | |
460 std <D.SWI2 | |
461 ldd <D.UsrIRQ | |
462 std <D.SvcIRQ | |
463 L0308 rti | |
464 | |
465 FLink pshs u save caller regs | |
466 ldd R$A,u | |
467 ldx R$X,u | |
468 lbsr L0443 | |
469 bcc FLinkOK | |
470 ldb #E$MNF | |
471 bra L033D | |
472 * U = module dir entry | |
473 FLinkOK ldy ,u get module ptr | |
474 ldb M$Revs,y | |
475 bitb #ReEnt reentrant? | |
476 bne L032A branch if so | |
477 tst $02,u link count zero? | |
478 beq L032A yep, ok to link to nonreent | |
479 comb else module is busy | |
480 ldb #E$ModBsy | |
481 bra L033D | |
482 L032A inc $02,u increment link count | |
483 ldu ,s get caller regs from stack | |
484 stx R$X,u | |
485 sty R$U,u | |
486 ldd M$Type,y | |
487 std R$D,u | |
488 ldd M$IDSize,y | |
489 leax d,y | |
490 stx R$Y,u | |
491 L033D puls pc,u | |
492 | |
493 FVModul pshs u | |
494 ldx R$X,u | |
495 bsr ValMod | |
496 puls y | |
497 stu R$U,y | |
498 rts | |
499 * X = address of module to validate | |
500 ValMod bsr ChkMHCRC | |
501 bcs L039A | |
502 lda M$Type,x | |
503 pshs x,a | |
504 ldd M$Name,x | |
505 leax d,x X = addr of name in mod | |
506 puls a | |
507 lbsr L0443 | |
508 puls x | |
509 bcs L039B | |
510 ldb #E$KwnMod | |
511 cmpx ,u | |
512 beq L03A1 | |
513 lda M$Revs,x | |
514 anda #RevsMask | |
515 pshs a | |
516 ldy ,u | |
517 lda M$Revs,y | |
518 anda #RevsMask | |
519 cmpa ,s+ same revision as other mod? | |
520 bcc L03A1 | |
521 pshs y,x | |
522 ldb M$Size,u | |
523 bne L0395 | |
524 ldx ,u | |
525 cmpx <D.BTLO | |
526 bcc L0395 | |
527 ldd $02,x | |
528 addd #$00FF | |
529 tfr a,b | |
530 clra | |
531 tfr d,y | |
532 ldb ,u | |
533 ldx <D.FMBM | |
534 os9 F$DelBit | |
535 clr $02,u | |
536 L0395 puls y,x | |
537 L0397 stx ,u | |
538 clrb | |
539 L039A rts | |
540 L039B leay ,u | |
541 bne L0397 | |
542 ldb #E$DirFul | |
543 L03A1 coma | |
544 rts | |
545 | |
546 * check module header and CRC | |
547 * X = address of potential module | |
548 ChkMHCRC ldd ,x | |
549 cmpd #M$ID12 sync bytes? | |
550 bne L03B1 nope, not a module here | |
551 leay M$Parity,x | |
552 bsr ChkMHPar check header parity | |
553 bcc L03B5 branch if ok | |
554 L03B1 comb | |
555 ldb #E$BMID | |
556 rts | |
297
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
557 |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
558 L03B5 |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
559 * Following 4 lines added to support no CRC checks - 2002/07/21 |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
560 lda <D.CRC is CRC checking on? |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
561 bne DoCRCCk branch if so |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
562 clrb |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
563 rts |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
564 |
eda95fad0c31
Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents:
296
diff
changeset
|
565 DoCRCCk pshs x |
0 | 566 ldy M$Size,x |
567 bsr ChkMCRC checkm module CRC | |
568 puls pc,x | |
569 * check module header parity | |
570 * Y = pointer to parity byte | |
571 ChkMHPar pshs y,x | |
572 clra | |
573 ChkM010 eora ,x+ | |
574 cmpx 2,s compare to addr of M$Parity | |
575 bls ChkM010 | |
576 cmpa #$FF | |
577 puls pc,y,x | |
578 * X = address of potential module | |
579 * Y = size of module | |
580 ChkMCRC ldd #$FFFF | |
581 pshs b,a | |
582 pshs b,a | |
583 leau 1,s | |
584 L03D4 lda ,x+ | |
585 bsr CRCAlgo | |
586 leay -1,y dec Y (size of module) | |
587 bne L03D4 continue | |
588 clr -1,u | |
589 lda ,u | |
590 cmpa #CRCCon1 | |
591 bne L03EC | |
592 ldd 1,u | |
593 cmpd #CRCCon23 | |
594 beq L03EF | |
595 L03EC comb | |
596 ldb #E$BMCRC | |
597 L03EF puls pc,y,x | |
598 | |
599 * F$CRC | |
600 FCRC ldx R$X,u | |
601 ldy R$Y,u | |
602 beq L0402 | |
603 ldu R$U,u | |
604 L03FA lda ,x+ | |
605 bsr CRCAlgo | |
606 leay -1,y | |
607 bne L03FA | |
608 L0402 clrb | |
609 rts | |
610 | |
611 CRCAlgo eora ,u | |
612 pshs a | |
613 ldd $01,u | |
614 std ,u | |
615 clra | |
616 ldb ,s | |
617 lslb | |
618 rola | |
619 eora 1,u | |
620 std 1,u | |
621 clrb | |
622 lda ,s | |
623 lsra | |
624 rorb | |
625 lsra | |
626 rorb | |
627 eora 1,u | |
628 eorb 2,u | |
629 std 1,u | |
630 lda ,s | |
631 lsla | |
632 eora ,s | |
633 sta ,s | |
634 lsla | |
635 lsla | |
636 eora ,s | |
637 sta ,s | |
638 lsla | |
639 lsla | |
640 lsla | |
641 lsla | |
642 eora ,s+ | |
643 bpl L0442 | |
644 ldd #$8021 | |
645 eora ,u | |
646 sta ,u | |
647 eorb 2,u | |
648 stb 2,u | |
649 L0442 rts | |
650 | |
651 L0443 ldu #$0000 | |
652 tfr a,b | |
653 anda #TypeMask | |
654 andb #LangMask | |
655 pshs u,y,x,b,a | |
656 bsr EatSpace | |
657 cmpa #PDELIM pathlist char? | |
658 beq L049C branch if so | |
659 lbsr L074D parse name | |
660 bcs L049D return if error | |
661 ldu <D.ModDir | |
662 L045B pshs u,y,b | |
663 ldu ,u | |
664 beq L048B | |
665 ldd $04,u | |
666 leay d,u | |
667 ldb ,s | |
668 lbsr L07AB | |
669 bcs L0493 | |
670 lda $05,s | |
671 beq L0476 | |
672 eora $06,u | |
673 anda #$F0 | |
674 bne L0493 | |
675 L0476 lda $06,s | |
676 beq L0480 | |
677 eora $06,u | |
678 anda #$0F | |
679 bne L0493 | |
680 L0480 puls u,x,b | |
681 stu $06,s | |
682 bsr EatSpace | |
683 stx $02,s | |
684 clra | |
685 bra L049D | |
686 L048B ldd $0B,s | |
687 bne L0493 | |
688 ldd $03,s | |
689 std $0B,s | |
690 L0493 puls u,y,b | |
691 leau $04,u | |
692 cmpu <D.ModDir+2 | |
693 bcs L045B | |
694 L049C comb | |
695 L049D puls pc,u,y,x,b,a | |
696 | |
697 EatSpace lda #C$SPAC | |
698 EatSpc10 cmpa ,x+ | |
699 beq EatSpc10 | |
700 lda ,-x | |
701 rts | |
702 | |
703 FFork ldx <D.PrcDBT | |
704 os9 F$All64 | |
705 bcs L0517 | |
706 ldx <D.Proc | |
707 pshs x save calling proc desc on stack | |
708 ldd P$User,x | |
709 std P$User,y | |
710 lda P$Prior,x | |
711 clrb | |
712 std P$Prior,y | |
713 ldb #SysState | |
714 stb P$State,y | |
715 sty <D.Proc | |
716 ldd <P$NIO,x | |
717 std <P$NIO,y | |
718 ldd <P$NIO+2,x | |
719 std <P$NIO+2,y | |
720 leax <P$DIO,x | |
721 leay <P$DIO,y | |
722 ldb #DefIOSiz | |
723 * copy I/O stuff from parent to child | |
724 L04D7 lda ,x+ | |
725 sta ,y+ | |
726 decb | |
727 bne L04D7 | |
728 * X/Y = address of path table in respective proc desc | |
729 * Dup stdin/stdout/stderr | |
730 ldb #$03 | |
731 L04E0 lda ,x+ | |
732 os9 I$Dup | |
733 bcc L04E8 | |
734 clra | |
735 L04E8 sta ,y+ | |
736 decb | |
737 bne L04E0 | |
738 bsr L0553 | |
739 bcs L050C | |
740 puls y get parent proc desc | |
741 sty <D.Proc | |
742 lda P$ID,x get ID of new process | |
743 sta R$A,u store in caller's A | |
744 ldb P$CID,y get child id of parent | |
745 sta P$CID,y store new proc in parent's CID | |
746 lda P$ID,y get ID of parent | |
747 std P$PID,x store in child proc desc | |
748 ldb P$State,x update state of child | |
749 andb #^SysState | |
750 stb P$State,x | |
751 os9 F$AProc insert child in active Q | |
752 rts | |
753 L050C pshs b | |
754 os9 F$Exit | |
755 comb | |
756 puls x,b | |
757 stx <D.Proc | |
758 rts | |
759 L0517 comb | |
760 ldb #E$PrcFul | |
761 rts | |
762 | |
763 FChain bsr L0543 | |
764 bcs L0531 | |
765 orcc #IntMasks | |
766 ldb $0D,x | |
767 andb #$7F | |
768 stb $0D,x | |
769 L0527 os9 F$AProc | |
770 os9 F$NProc | |
771 | |
772 SFChain bsr L0543 | |
773 bcc L0527 | |
774 L0531 pshs b | |
775 stb <P$Signal,x | |
776 ldb P$State,x | |
777 orb #Condem | |
778 stb P$State,x | |
779 ldb #$FF | |
780 stb P$Prior,x | |
781 comb | |
782 puls pc,b | |
783 L0543 pshs u | |
784 ldx <D.Proc | |
785 ldu <P$PModul,x | |
786 os9 F$UnLink | |
787 ldu ,s | |
788 bsr L0553 | |
789 puls pc,u | |
790 L0553 ldx <D.Proc | |
791 pshs u,x | |
792 ldd <D.UsrSvc | |
793 std <P$SWI,x | |
794 std <P$SWI2,x | |
795 std <P$SWI3,x | |
796 clra | |
797 clrb | |
798 sta <P$Signal,x | |
799 std <P$SigVec,x | |
800 lda R$A,u | |
801 ldx R$X,u | |
802 os9 F$Link | |
803 bcc L0578 | |
804 os9 F$Load | |
805 bcs L05E7 | |
806 L0578 ldy <D.Proc | |
807 stu <P$PModul,y | |
808 cmpa #Prgrm+Objct | |
809 beq L058B | |
810 cmpa #Systm+Objct | |
811 beq L058B | |
812 comb | |
813 ldb #E$NEMod | |
814 bra L05E7 | |
815 L058B leay ,u Y = addr of module | |
816 ldu 2,s get U off stack (caller regs) | |
817 stx R$X,u | |
818 lda R$B,u | |
819 clrb | |
820 cmpd M$Mem,y compare passed mem to module's | |
821 bcc L059B branch if less than | |
822 ldd M$Mem,y | |
823 L059B addd #$0000 | |
824 bne L05A0 | |
825 L05A0 os9 F$Mem | |
826 bcs L05E7 | |
827 subd #R$Size subtract registers | |
828 subd R$Y,u subtract parameter area | |
829 bcs L05E5 | |
830 ldx R$U,u get parameter area | |
831 ldd R$Y,u get parameter size | |
832 pshs b,a | |
833 beq L05BE | |
834 leax d,x point to end of param area | |
835 L05B6 lda ,-x get byte, dec X | |
836 sta ,-y save byte in data area, dec X | |
837 cmpx R$U,u at top of param area? | |
838 bhi L05B6 | |
839 * set up registers for return of F$Fork/F$Chain | |
840 L05BE ldx <D.Proc | |
841 sty -$08,y put in X on caller stack | |
842 leay -R$Size,y back up register size | |
843 sty P$SP,x | |
844 lda P$ADDR,x | |
845 clrb | |
846 std R$U,y lowest address | |
847 sta R$DP,y set direct page | |
848 adda P$PagCnt,x | |
849 std R$Y,y | |
850 puls b,a | |
851 std R$D,y size of param area | |
852 ldb #Entire | |
853 stb R$CC,y | |
854 ldu <P$PModul,x get addr of prim. mod | |
855 ldd M$Exec,u | |
856 leau d,u | |
857 stu R$PC,y put in PC on caller reg | |
858 clrb | |
859 L05E5 ldb #E$IForkP | |
860 L05E7 puls pc,u,x | |
861 | |
862 FSRqMem ldd R$D,u | |
863 addd #$00FF | |
864 clrb | |
865 std R$D,u | |
866 ldx <D.FMBM+2 | |
867 ldd #$01FF | |
868 pshs b,a | |
869 bra L0604 | |
870 L05FA dec $01,s | |
871 ldb $01,s | |
872 L05FE lsl ,s | |
873 bcc L060A | |
874 rol ,s | |
875 L0604 leax -1,x | |
876 cmpx <D.FMBM | |
877 bcs L0620 | |
878 L060A lda ,x | |
879 anda ,s | |
880 bne L05FA | |
881 dec 1,s | |
882 subb 1,s | |
883 cmpb 1,u | |
884 rora | |
885 addb 1,s | |
886 rola | |
887 bcs L05FE | |
888 ldb 1,s | |
889 clra | |
890 incb | |
891 L0620 leas 2,s | |
892 bcs L0635 | |
893 ldx <D.FMBM | |
894 tfr d,y | |
895 ldb 1,u | |
896 clra | |
897 exg d,y | |
898 bsr L065A | |
899 exg a,b | |
900 std 8,u | |
901 L0633 clra | |
902 rts | |
903 L0635 comb | |
904 ldb #E$MemFul | |
905 rts | |
906 | |
907 FSRtMem ldd R$D,u | |
908 addd #$00FF | |
909 tfr a,b | |
910 clra | |
911 tfr d,y | |
912 ldd R$U,u | |
913 beq L0633 | |
914 tstb | |
915 beq L064E | |
916 comb | |
917 ldb #E$BPAddr | |
918 rts | |
919 L064E exg a,b | |
920 ldx <D.FMBM | |
921 bra L06AD | |
922 | |
923 FAllBit ldd R$D,u | |
924 leau R$X,u | |
925 pulu y,x | |
926 L065A pshs y,x,b,a | |
927 bsr L0690 | |
928 tsta | |
929 pshs a | |
930 bmi L0671 | |
931 lda ,x | |
932 L0665 ora ,s | |
933 leay -1,y | |
934 beq L0689 | |
935 lsr ,s | |
936 bcc L0665 | |
937 sta ,x+ | |
938 L0671 tfr y,d | |
939 sta ,s | |
940 lda #$FF | |
941 bra L067B | |
942 L0679 sta ,x+ | |
943 L067B subb #$08 | |
944 bcc L0679 | |
945 dec ,s | |
946 bpl L0679 | |
947 L0683 lsla | |
948 incb | |
949 bne L0683 | |
950 ora ,x | |
951 L0689 sta ,x | |
952 clra | |
953 leas 1,s | |
954 puls pc,y,x,b,a | |
955 L0690 pshs b | |
956 lsra | |
957 rorb | |
958 lsra | |
959 rorb | |
960 lsra | |
961 rorb | |
962 leax d,x | |
963 puls b | |
964 lda #$80 | |
965 andb #$07 | |
966 beq L06A6 | |
967 L06A2 lsra | |
968 decb | |
969 bne L06A2 | |
970 L06A6 rts | |
971 | |
972 FDelBit ldd R$D,u | |
973 leau R$X,u | |
974 pulu y,x | |
975 L06AD pshs y,x,b,a | |
976 bsr L0690 | |
977 coma | |
978 pshs a | |
979 bpl L06C4 | |
980 lda ,x | |
981 L06B8 anda ,s | |
982 leay -1,y | |
983 beq L06D8 | |
984 asr ,s | |
985 bcs L06B8 | |
986 sta ,x+ | |
987 L06C4 tfr y,d | |
988 bra L06CA | |
989 L06C8 clr ,x+ | |
990 L06CA subd #$0008 | |
991 bhi L06C8 | |
992 beq L06D8 | |
993 L06D1 lsla | |
994 incb | |
995 bne L06D1 | |
996 coma | |
997 anda ,x | |
998 L06D8 sta ,x | |
999 clr ,s+ | |
1000 puls pc,y,x,b,a | |
1001 | |
1002 FSchBit pshs u | |
1003 ldd R$D,u | |
1004 ldx R$X,u | |
1005 ldy R$Y,u | |
1006 ldu R$U,u | |
1007 bsr L06F3 | |
1008 puls u | |
1009 std R$D,u | |
1010 sty R$Y,u | |
1011 rts | |
1012 L06F3 pshs u,y,x,b,a | |
1013 pshs y,b,a | |
1014 clr 8,s | |
1015 clr 9,s | |
1016 tfr d,y | |
1017 bsr L0690 | |
1018 pshs a | |
1019 bra L0710 | |
1020 L0703 leay $01,y | |
1021 sty $05,s | |
1022 L0708 lsr ,s | |
1023 bcc L0714 | |
1024 ror ,s | |
1025 leax $01,x | |
1026 L0710 cmpx $0B,s | |
1027 bcc L0732 | |
1028 L0714 lda ,x | |
1029 anda ,s | |
1030 bne L0703 | |
1031 leay $01,y | |
1032 tfr y,d | |
1033 subd $05,s | |
1034 cmpd $03,s | |
1035 bcc L0739 | |
1036 cmpd $09,s | |
1037 bls L0708 | |
1038 std $09,s | |
1039 ldd $05,s | |
1040 std $01,s | |
1041 bra L0708 | |
1042 L0732 ldd $01,s | |
1043 std $05,s | |
1044 coma | |
1045 bra L073B | |
1046 L0739 std $09,s | |
1047 L073B leas $05,s | |
1048 puls pc,u,y,x,b,a | |
1049 | |
1050 FPrsNam ldx R$X,u | |
1051 bsr L074D | |
1052 std R$D,u | |
1053 bcs L0749 | |
1054 stx R$X,u | |
1055 L0749 sty R$Y,u | |
1056 rts | |
1057 L074D lda ,x | |
1058 cmpa #PDELIM pathlist char? | |
1059 bne L0755 branch if not | |
1060 leax 1,x go past pathlist char | |
1061 L0755 leay ,x | |
1062 clrb | |
1063 lda ,y+ | |
1064 anda #$7F | |
1065 bsr L0792 | |
1066 bcs L0772 | |
1067 L0760 incb | |
1068 lda -1,y | |
1069 bmi L076F hi bit set on this char, done | |
1070 lda ,y+ | |
1071 anda #$7F | |
1072 bsr IllChar | |
1073 bcc L0760 | |
1074 lda ,-y | |
1075 L076F andcc #^Carry | |
1076 rts | |
1077 L0772 cmpa #C$COMA comma? | |
1078 bne L0778 | |
1079 L0776 lda ,y+ | |
1080 L0778 cmpa #C$SPAC space? | |
1081 beq L0776 | |
1082 lda ,-y | |
1083 comb | |
1084 ldb #E$BNam | |
1085 rts | |
1086 | |
1087 * check for illegal characters in a pathlist | |
1088 IllChar cmpa #C$PERD period? | |
1089 beq L07C9 branch if so | |
1090 cmpa #'0 zero? | |
1091 bcs L07A2 branch if less than | |
1092 cmpa #'9 number? | |
1093 bls L07C9 branch if lower/same | |
1094 cmpa #'_ underscore? | |
1095 beq L07C9 branch if so | |
1096 L0792 cmpa #'A A? | |
1097 bcs L07A2 branch if less than | |
1098 cmpa #'Z Z? | |
1099 bls L07C9 branch if less or equal | |
1100 cmpa #'a a? | |
1101 bcs L07A2 branch if lower | |
1102 cmpa #'z z? | |
1103 bls L07C9 branch if less or equal | |
1104 L07A2 orcc #Carry | |
1105 rts | |
1106 | |
1107 FCmpNam ldb R$B,u | |
1108 leau R$X,u | |
1109 pulu y,x | |
1110 L07AB pshs y,x,b,a | |
1111 L07AD lda ,y+ | |
1112 bmi L07BE | |
1113 decb | |
1114 beq L07BA | |
1115 eora ,x+ | |
1116 anda #$DF | |
1117 beq L07AD | |
1118 L07BA orcc #Carry | |
1119 puls pc,y,x,b,a | |
1120 L07BE decb | |
1121 bne L07BA | |
1122 eora ,x | |
1123 anda #$5F | |
1124 bne L07BA | |
1125 puls y,x,b,a | |
1126 L07C9 andcc #^Carry | |
1127 rts | |
1128 | |
1129 FSSvc ldy R$Y,u | |
1130 bra InstSSvc | |
1131 SSvcLoop tfr b,a put syscall code in A | |
1132 anda #$7F kill hi bit | |
1133 cmpa #$7F is code $7F? | |
1134 beq SSvcOK | |
977
dd89c62ea2ca
os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents:
308
diff
changeset
|
1135 cmpa #$37 compare against highest call allowed |
dd89c62ea2ca
os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents:
308
diff
changeset
|
1136 bcs SSvcOK branch if A less than highest call |
0 | 1137 comb |
1138 ldb #E$ISWI | |
1139 rts | |
1140 SSvcOK lslb | |
1141 ldu <D.SysDis | |
1142 leau b,u U points to entry in table | |
1143 ldd ,y++ get addr of func | |
1144 leax d,y get absolute addr | |
1145 stx ,u store in system table | |
1146 bcs InstSSvc branch if system only | |
1147 stx <$70,u else store in user table too | |
1148 InstSSvc ldb ,y+ get system call code in B | |
1149 cmpb #$80 end of table? | |
1150 bne SSvcLoop branch if not | |
1151 rts | |
1152 | |
1153 emod | |
1154 eom equ * | |
1155 | |
165 | 1156 fdb Clock |
247 | 1157 Vectors fdb SWI3 SWI3 |
1158 fdb SWI2 SWI2 | |
1159 fdb DUMMY FIRQ | |
1160 fdb SVCIRQ IRQ | |
1161 fdb SWI SWI | |
1162 fdb DUMMY NMI | |
0 | 1163 |
1164 end | |
1165 |