Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/kernel/fsleep.asm @ 3195:6eb2edad80d8
L2: Introduce symbol KrnBlk to define kernel block number
This is the block number that the kernel is loaded into. This is
platform-specific, a function of the behaviour of the platform MMU/DAT.
CRCs are unaffected by this change.
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Thu, 01 Jun 2017 22:13:49 +0100 |
parents | 039ddb7c8ad7 |
children |
rev | line source |
---|---|
1145 | 1 ************************************************** |
2 * System Call: F$Sleep | |
3 * | |
4 * Function: Put the calling process to sleep | |
5 * | |
6 * Input: X = Sleep time in ticks (0 = forever) | |
7 * | |
8 * Output: X = Decremented by the number of ticks that the process slept | |
9 * | |
10 * Error: CC = C bit set; B = error code | |
11 * | |
12 FSleep pshs cc preserve interupt status | |
13 ldx <D.Proc Get current process pointer | |
14 | |
15 * F$Sleep bug fix. Check if we're in system state. If so return because you | |
16 * should never sleep in system state. | |
17 cmpx <D.SysPrc is it system process? | |
18 beq SkpSleep skip sleep call | |
19 orcc #IntMasks disable interupts | |
20 lda P$Signal,x get pending signal | |
21 beq L0722 none there, skip ahead | |
22 deca wakeup signal? | |
23 bne L0715 no, skip ahead | |
24 sta P$Signal,x clear pending signal so we can wake up process | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1258
diff
changeset
|
25 L0715 |
1145 | 26 IFNE H6309 |
27 aim #^Suspend,P$State,x | |
28 ELSE | |
1239 | 29 lda P$State,x |
30 anda #^Suspend | |
31 sta P$State,x | |
1145 | 32 ENDC |
33 L071B puls cc | |
34 os9 F$AProc activate the process | |
35 bra L0780 | |
36 L0722 ldd R$X,u get callers X (contains sleep tick count) | |
37 beq L076D done, wake it up | |
1239 | 38 IFNE H6309 |
1145 | 39 decd subtract 1 from tick count |
40 ELSE | |
1239 | 41 subd #$0001 |
1145 | 42 ENDC |
43 std R$X,u save it back | |
44 beq L071B zero, wake up process | |
45 pshs x,y | |
46 ldx #(D.SProcQ-P$Queue) | |
47 L0732 std R$X,u | |
48 stx 2,s | |
49 ldx P$Queue,x | |
50 beq L074F | |
51 IFNE H6309 | |
52 tim #TimSleep,P$State,x | |
53 ELSE | |
1239 | 54 lda P$State,x |
55 bita #TimSleep | |
1145 | 56 ENDC |
57 beq L074F | |
58 ldy P$SP,x get process stack pointer | |
59 ldd R$X,u | |
60 subd R$X,y | |
61 bcc L0732 | |
62 IFNE H6309 | |
63 negd | |
64 ELSE | |
65 nega | |
66 negb | |
1258 | 67 sbca #0 |
1145 | 68 ENDC |
69 std R$X,y | |
70 L074F puls y,x | |
71 IFNE H6309 | |
72 oim #TimSleep,P$State,x | |
73 ELSE | |
1239 | 74 lda P$State,x |
75 ora #TimSleep | |
76 sta P$State,x | |
1145 | 77 ENDC |
78 ldd P$Queue,y | |
79 stx P$Queue,y | |
80 std P$Queue,x | |
81 ldx R$X,u | |
82 bsr L0780 | |
83 stx R$X,u | |
84 ldx <D.Proc | |
85 IFNE H6309 | |
86 aim #^TimSleep,P$State,x | |
87 ELSE | |
1239 | 88 lda P$State,x |
89 anda #^TimSleep | |
90 sta P$State,x | |
1145 | 91 ENDC |
92 SkpSleep puls cc,pc | |
93 | |
94 L076D ldx #D.SProcQ-P$Queue | |
95 L0770 leay ,x | |
96 ldx P$Queue,x | |
97 bne L0770 | |
98 ldx <D.Proc | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1258
diff
changeset
|
99 clra |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1258
diff
changeset
|
100 clrb |
1145 | 101 stx P$Queue,y |
102 std P$Queue,x | |
103 puls cc | |
104 | |
105 L0780 pshs dp,x,y,u,pc | |
106 L0782 leax <L079C,pc | |
107 stx 7,s | |
108 ldx <D.Proc | |
109 ldb P$Task,x This is related to the 'one-byte hack' | |
110 cmpb <D.SysTsk that stops OS9p1 from doing an F$AllTsk on | |
111 beq L0792 _every_ system call. | |
112 os9 F$DelTsk | |
113 L0792 ldd P$SP,x | |
114 IFNE H6309 | |
115 pshsw | |
116 ENDC | |
117 pshs cc,d | |
118 sts P$SP,x | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1258
diff
changeset
|
119 os9 F$NProc |
1145 | 120 |
121 L079C pshs x | |
122 ldx <D.Proc | |
123 std P$SP,x | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1258
diff
changeset
|
124 clrb |
1145 | 125 puls x,pc |