Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/kernel/fvmodul.asm @ 3278:ea1afb494127
defs: Add Bt.Sec for atari and corsham
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sat, 07 Mar 2020 23:52:40 +0100 |
parents | f3e0210ecd83 |
children |
rev | line source |
---|---|
1145 | 1 ************************************************** |
2 * System Call: F$VModul | |
3 * | |
3164
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
4 * Function: Validate a module. |
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
5 * |
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
6 * Checks the module header parity and (if enabled) |
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
7 * the CRC bytes of the module. |
1145 | 8 * |
9 * Input: X = Address of module to verify | |
3164
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
10 * D = DAT image pointer |
1145 | 11 * |
12 * Output: U = Address of module directory entry | |
13 * | |
14 * Error: CC = C bit set; B = error code | |
15 * | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
16 FVModul pshs u preserve register stack pointer |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
17 ldx R$X,u get block offset |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
18 ldy R$D,u get DAT image pointer |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
19 bsr L0463 validate it |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
20 ldx ,s get register stack pointer |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
21 stu R$U,x save address of module directory entry |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
22 puls u,pc restore & return |
1145 | 23 |
24 * Validate module - shortcut for calls within OS9p1 go here (ex. OS9Boot) | |
25 * Entry: X=Module block offset | |
26 * Y=Module DAT image pointer | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
27 L0463 pshs x,y save block offset & DAT Image ptr |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
28 lbsr L0586 Go check module ID & header parity |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
29 bcs L0495 Error, exit |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
30 ldd #M$Type Get offset to module type |
3164
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
31 lbsr L0B02 go get 2 bytes (module type) |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
32 andb #LangMask Just keep language mask |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
33 pshs d Preserve ??? & language |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
34 ldd #M$Name get offset to module name |
3164
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
35 lbsr L0B02 go get 2 bytes (offset) |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
36 leax d,x Point X to module name |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
37 puls a Restore type/language |
3164
f3e0210ecd83
L2 kernel: Small corrections and expansion of comments (no functional change)
Neal Crook <foofoobedoo@gmail.com>
parents:
3123
diff
changeset
|
38 lbsr L068D Find module in module directory |
1145 | 39 puls a |
40 bcs L0497 | |
1248 | 41 andb #$0F |
1145 | 42 IFNE H6309 |
43 subr a,b | |
44 ELSE | |
45 pshs a | |
46 subb ,s+ | |
47 ENDC | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
48 blo L0497 If wrapped, skip ahead |
1145 | 49 ldb #E$KwnMod |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
50 fcb $8C skip 2 bytes |
1145 | 51 L0491 ldb #E$DirFul |
52 L0493 orcc #Carry | |
53 L0495 puls x,y,pc | |
54 | |
55 L0497 ldx ,s | |
56 lbsr L0524 | |
57 bcs L0491 | |
58 sty ,u | |
59 stx MD$MPtr,u | |
60 IFNE H6309 | |
61 clrd | |
62 ELSE | |
63 clra | |
64 clrb | |
65 ENDC | |
66 std MD$Link,u | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
67 ldd #M$Size Get offset to size of module |
1145 | 68 lbsr L0B02 |
69 IFNE H6309 | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
70 addr x,d Add it to module ptr |
1145 | 71 ELSE |
72 pshs x | |
73 addd ,s++ | |
74 ENDC | |
75 std MD$MBSiz,u | |
76 ldy [MD$MPDAT,u] get pointer to module DAT | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
77 ldx <D.ModDir get module directory pointer |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
78 pshs u save module pointer |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
79 fcb $8C skip 2 bytes |
1145 | 80 |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
81 L04BC leax MD$ESize,x move to next entry |
1145 | 82 L04BE cmpx <D.ModEnd |
83 bcc L04CD | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
84 cmpx ,s match? |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
85 beq L04BC no, keep looking |
1145 | 86 cmpy [MD$MPDAT,x] DAT match? |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
87 bne L04BC no, keep looking |
1145 | 88 bsr L04F2 |
89 | |
90 L04CD puls u | |
91 ldx <D.BlkMap Get ptr to block map | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
92 ldd MD$MBSiz,u Get size of module |
1145 | 93 addd #$1FFF Round up to nearest 8K block |
94 lsra Divide by 32 | |
95 lsra | |
96 lsra | |
97 lsra | |
98 lsra | |
99 ldy MD$MPDAT,u | |
100 | |
101 IFNE H6309 | |
102 tfr a,e | |
103 L04DE ldd ,y++ | |
104 oim #ModBlock,d,x | |
105 dece | |
106 ELSE | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
107 L04DE pshs a,x save block size, blkmap |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
108 ldd ,y++ D = image block # |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
109 leax d,x X = blkmap ptr |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
110 ldb ,x get block marker |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
111 orb #ModBlock set module in block |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
112 stb ,x marker |
1145 | 113 puls x,a |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
114 deca count-- |
1145 | 115 ENDC |
116 bne L04DE no, keep going | |
117 | |
118 clrb clear carry | |
119 puls x,y,pc return | |
120 | |
121 L04F2 pshs d,x,y,u | |
122 ldx ,x | |
123 | |
124 IFNE H6309 | |
125 tfr x,w Dupe to faster index register | |
126 clrd | |
127 L04FA ldy ,w | |
128 beq L0503 | |
129 std ,w++ | |
130 bra L04FA | |
131 L0503 ldy 2,s | |
132 ELSE | |
133 pshs x | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
134 clra D=0000 |
1145 | 135 clrb |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
136 L04FA ldy ,x last entry? |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
137 beq L0503 ..yes |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
138 std ,x++ no, clear |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
139 bra L04FA and loop |
1145 | 140 L0503 puls x |
141 ldy 2,s | |
142 ENDC | |
143 | |
144 ldu MD$MPDAT,u | |
145 puls d | |
146 | |
147 L050C cmpx MD$MPDAT,y | |
148 bne L051B | |
149 stu MD$MPDAT,y | |
150 cmpd MD$MBSiz,y | |
151 bcc L0519 | |
152 ldd MD$MBSiz,y | |
153 L0519 std MD$MBSiz,y | |
154 L051B leay MD$ESize,y | |
155 cmpy <D.ModEnd | |
156 bne L050C | |
157 puls x,y,u,pc | |
158 | |
159 L0524 pshs x,y,u | |
160 ldd #M$Size | |
161 lbsr L0B02 | |
162 addd ,s | |
163 addd #$1FFF | |
164 lsra | |
165 lsra | |
166 lsra | |
167 lsra | |
168 lsra | |
169 tfr a,b | |
170 pshs b | |
171 * incb | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
172 comb one byte shorter than incb;lslg;negb |
1145 | 173 lslb |
174 * negb | |
175 sex | |
176 bsr L054E | |
177 bcc L054C | |
178 os9 F$GCMDir get rid of empty slots in module directory | |
179 IFNE H6309 | |
180 tfr 0,u | |
181 ELSE | |
182 ldu #$0000 | |
183 ENDC | |
184 stu $05,s | |
185 bsr L054E | |
186 L054C puls b,x,y,u,pc | |
187 | |
188 L054E ldx <D.ModDAT | |
189 leax d,x | |
190 cmpx <D.ModEnd | |
1239 | 191 bcs S.Poll |
1145 | 192 ldu 7,s |
193 bne L056E | |
194 ldy <D.ModEnd | |
195 leay MD$ESize,y | |
196 IFNE H6309 | |
197 cmpr x,y | |
198 ELSE | |
1239 | 199 pshs x |
1145 | 200 cmpy ,s++ |
201 ENDC | |
1239 | 202 bhi S.Poll |
1145 | 203 sty <D.ModEnd |
204 leay -MD$ESize,y | |
205 sty $07,s | |
206 L056E stx <D.ModDAT | |
207 IFNE H6309 | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
208 ldd $05,s Get source ptr |
1145 | 209 stx $05,s |
210 ldf 2,s | |
211 clre | |
212 rolw | |
213 tfm d+,x+ | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
214 stw ,x Save 0 |
1145 | 215 ELSE |
216 ldy 5,s | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
217 ldb 2,s B=block count |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
218 stx 5,s return dir datimg ptr |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
219 L0577 ldu ,y++ copy images |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
220 stu ,x++ to new mod dat entry |
1145 | 221 decb |
222 bne L0577 | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
223 clr ,x zero flag |
1145 | 224 clr 1,x |
225 ENDC | |
226 rts | |
227 | |
228 * Default interrupt handling routine on first booting OS9p1 | |
1239 | 229 S.Poll orcc #Carry |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
230 rts |
1145 | 231 |
232 * Check module ID & calculate module header parity & CRC | |
233 * Entry: X=Block offset of module | |
234 * Y=DAT image pointer of module | |
235 L0586 pshs x,y save block offset & DAT pointer | |
236 IFNE H6309 | |
237 clrd | |
238 ELSE | |
239 clra | |
240 clrb | |
241 ENDC | |
242 lbsr L0B02 get module ID | |
243 cmpd #M$ID12 legal module? | |
244 beq L0597 yes, calculate header parity | |
245 ldb #E$BMID get bad module ID error | |
246 bra L05F3 return error | |
247 * Calculate module header parity | |
248 L0597 leax 2,x point to start location of header calc | |
249 lbsr AdjBlk0 adjust it for block 0 | |
250 IFNE H6309 | |
251 ldw #($4A*256+M$Revs) Get initial value & count (7 bytes of header) | |
252 L05A2 lbsr LDAXY get a byte from module | |
253 eorr a,e add it into running parity | |
254 decf done full header? | |
255 bne L05A2 no, keep going | |
256 ince valid parity? | |
257 ELSE | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
258 leas -1,s make var |
1239 | 259 ldd #($4A*256+M$Revs) Get initial value & count (7 bytes of header) |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
260 L05A2 sta ,s save crc |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
261 lbsr LDAXY get next byte |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
262 eora ,s do crc |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
263 decb more? |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
264 bne L05A2 ..loop |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
265 leas 1,s drop var |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
266 inca $FF+1 = 00 |
1145 | 267 ENDC |
268 beq L05B5 yes, skip ahead | |
269 ldb #E$BMHP get module header parity error | |
270 bra L05F3 return with error | |
271 L05B5 puls x,y restore module pointer & DAT pointer | |
272 * this checks if the module CRC checking is on or off | |
273 lda <D.CRC is CRC checking on? | |
274 bne L05BA yes - go check it | |
275 IFNE H6309 | |
276 clrd no, clear out | |
277 ELSE | |
278 clra | |
279 clrb | |
280 ENDC | |
281 rts and return | |
282 * Begin checking Module CRC | |
283 * Entry: X=Module pointer | |
284 * Y=DAT image pointer of module | |
285 L05BA ldd #M$Size get offset to module size | |
286 lbsr L0B02 get module size | |
287 IFNE H6309 | |
288 tfr d,w move length to W | |
289 pshs y,x preserve [X]=Buffer pointer,[Y]=DAT pointer | |
290 ELSE | |
291 pshs y,x,b,a preserve [X]=Buffer pointer,[Y]=DAT pointer | |
292 ENDC | |
293 ldd #$FFFF initial CRC value of $FFFFFF | |
294 pshs d set up local 24 bit variable | |
295 pshs b | |
296 lbsr AdjBlk0 adjust module pointer into block 0 for mapping | |
297 leau ,s point to CRC accumulator | |
298 * Loop: W=# bytes left to use in CRC calc | |
299 L05CB equ * | |
300 IFNE H6309 | |
301 tstf on 256 byte boundary? | |
302 ELSE | |
303 tstb | |
304 ENDC | |
305 bne L05D8 no, keep going | |
306 pshs x give up some time to system | |
307 ldx #1 | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
308 os9 F$Sleep |
1145 | 309 puls x restore module pointer |
310 L05D8 lbsr LDAXY get a byte from module into A | |
311 bsr CRCCalc add it to running CRC | |
312 IFNE H6309 | |
313 decw Dec # bytes left to calculate CRC with | |
314 ELSE | |
315 ldd 3,s | |
316 subd #$0001 | |
317 std 3,s | |
318 ENDC | |
319 bne L05CB Still more, continue | |
320 IFNE H6309 | |
321 puls b,x yes, restore CRC | |
322 ELSE | |
323 puls b,x,y yes, restore CRC | |
324 ENDC | |
325 cmpb #CRCCon1 CRC MSB match constant? | |
326 bne L05F1 no, exit with error | |
327 cmpx #CRCCon23 LSW match constant? | |
328 beq L05F5 yes, skip ahead | |
329 L05F1 ldb #E$BMCRC Bad Module CRC error | |
330 L05F3 orcc #Carry Set up for error | |
331 L05F5 puls x,y,pc exit | |
332 | |
333 * Calculate 24 bit CRC | |
334 * Entry: A=Byte to add to CRC | |
335 * U=Pointer to 24 bit CRC accumulator | |
336 * | |
337 * Future reference note: Do not use W unless preserved, contains module | |
338 * byte counts from routines that come here!! | |
339 CRCCalc eora ,u | |
340 pshs a | |
341 ldd 1,u | |
342 std ,u | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
343 clra |
1145 | 344 ldb ,s |
345 IFNE H6309 | |
346 lsld | |
347 ELSE | |
348 aslb | |
349 rola | |
350 ENDC | |
351 eora 1,u | |
352 std 1,u | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
353 clrb |
1145 | 354 lda ,s |
355 IFNE H6309 | |
356 lsrd | |
357 lsrd | |
358 eord 1,u | |
359 ELSE | |
360 lsra | |
361 rorb | |
362 lsra | |
363 rorb | |
364 eora 1,u | |
365 eorb 2,u | |
366 ENDC | |
367 std 1,u | |
368 lda ,s | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
369 lsla |
1145 | 370 eora ,s |
371 sta ,s | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
372 lsla |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
373 lsla |
1145 | 374 eora ,s |
375 sta ,s | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
376 lsla |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
377 lsla |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
378 lsla |
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
379 lsla |
1145 | 380 eora ,s+ |
381 bpl L0635 | |
382 IFNE H6309 | |
383 eim #$80,,u | |
384 eim #$21,2,u | |
385 ELSE | |
386 ldd #$8021 | |
387 eora ,u | |
388 sta ,u | |
389 eorb 2,u | |
390 stb 2,u | |
391 ENDC | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
392 L0635 rts |
1145 | 393 |
394 | |
395 ************************************************** | |
396 * System Call: F$CRC | |
397 * | |
398 * Function: Compute CRC | |
399 * | |
400 * Input: X = Address to start computation | |
401 * Y = Byte count | |
402 * U = Address of 3 byte CRC accumulator | |
403 * | |
404 * Output: CRC accumulator is updated | |
405 * | |
406 * Error: CC = C bit set; B = error code | |
407 * | |
408 FCRC ldd R$Y,u get # bytes to do | |
409 beq L0677 nothing there, so nothing to do, return | |
410 ldx R$X,u get caller's buffer pointer | |
411 pshs d,x save # bytes & buffer pointer | |
412 leas -3,s allocate a 3 byte buffer | |
413 ldx <D.Proc point to current process descriptor | |
414 lda P$Task,x get its task number | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
415 ldb <D.SysTsk get the system task number |
1145 | 416 ldx R$U,u point to user's 24 bit CRC accumulator |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
417 ldy #3 number of bytes to move |
1145 | 418 leau ,s point to our temp buffer |
419 pshs d,x,y save [D]=task #'s,[X]=Buff,[Y]=3 | |
420 lbsr L0B2C move CRC accumulator to temp buffer | |
421 ldx <D.Proc point to current process descriptor | |
422 leay <P$DATImg,x point to its DAT image | |
423 ldx 11,s restore the buffer pointer | |
424 lbsr AdjBlk0 make callers buffer visible | |
425 IFNE H6309 | |
426 ldw 9,s get byte count | |
427 ENDC | |
428 L065D lbsr LDAXY get byte from callers buffer | |
429 bsr CRCCalc add it to CRC | |
430 IFNE H6309 | |
431 decw done? | |
432 ELSE | |
433 ldd 9,s | |
434 subd #$0001 | |
435 std 9,s | |
436 ENDC | |
437 bne L065D no, keep going | |
438 puls d,x,y restore pointers | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
439 exg a,b swap around the task numbers |
1145 | 440 exg x,u and the pointers |
441 lbsr L0B2C move accumulator back to user | |
442 leas 7,s clean up stack | |
443 L0677 clrb no error | |
3123
039ddb7c8ad7
l2 kernel: Remove tabs and trailing whitespace, align comments
Neal Crook <foofoobedoo@gmail.com>
parents:
1248
diff
changeset
|
444 rts |