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