1145
|
1 **************************************************
|
|
2 * System Call: F$AProc
|
|
3 *
|
|
4 * Function: Insert process into active process queue
|
|
5 *
|
|
6 * Input: X = Address of process descriptor
|
|
7 *
|
|
8 * Output: None
|
|
9 *
|
|
10 * Error: CC = C bit set; B = error code
|
|
11 *
|
|
12 FAProc ldx R$X,u Get ptr to process to activate
|
|
13 L0D11 clrb
|
|
14 pshs cc,b,x,y,u
|
|
15 lda P$Prior,x Get process priority
|
|
16 sta P$Age,x Save it as age (How long it's been around)
|
|
17 orcc #IntMasks Shut down IRQ's
|
|
18 ldu #(D.AProcQ-P$Queue) Get ptr to active process queue
|
|
19 bra L0D29 Go through the chain
|
|
20 * Update active process queue
|
|
21 * X=Process to activate
|
|
22 * U=Current process in queue links
|
|
23 L0D1F inc P$Age,u update current process age
|
|
24 bne L0D25 wrap?
|
|
25 dec P$Age,u yes, reset it to max.
|
|
26 L0D25 cmpa P$Age,u match process ages??
|
|
27 bhi L0D2B no, skip update
|
|
28 L0D29 leay ,u point Y to current process
|
|
29 L0D2B ldu P$Queue,u get pointer to next process in chain
|
|
30 bne L0D1F Still more in chain, keep going
|
|
31 ldd P$Queue,y
|
|
32 stx P$Queue,y save new process to chain
|
|
33 std P$Queue,x
|
|
34 puls cc,b,x,y,u,pc
|