comparison level2/modules/ioman.asm @ 704:671274e822df

Integrated NitrOS-9 IOMan with OS-9 Level Two. Note that DEVSIZ and POLSIZ have both increased in size!
author boisy
date Fri, 03 Jan 2003 16:59:58 +0000
parents b3bfa479f8d0
children 6f84b2ce58a6
comparison
equal deleted inserted replaced
703:6bb15a5a5821 704:671274e822df
1 ******************************************************************** 1 ********************************************************************
2 * IOMan - OS-9 Level Two V3 I/O Manager 2 * IOMan - NitrOS-9 Level Two I/O Manager module
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Ed. Comments Who YY/MM/DD 6 * Ed. Comments Who YY/MM/DD
7 * ------------------------------------------------------------------ 7 * ------------------------------------------------------------------
8 * ?? Cleaned up some formatting KDM 87/05/15 8 * NitrOS-9 2.00 distribution ??/??/??
9 * 14 IOMAN ignores device address high byte now ??? ??/??/?? 9 * 13 Fixed a long-standing bug in IOMan where BGP 02/04/30
10 * (FFXXXX vs 07XXXX etc ignored) 10 * the I$Detach routine would deallocate the
11 * 15 Fixed IOQueue sort bug BGP 98/10/08 11 * V$STAT area. This is because the V$USRS
12 * 15r2 Made minor optimizations as per Curtis Boyle's BGP 98/10/10 12 * offset on the stack, where the temporary
13 * optimization document 13 * device table entry was being built, contained
14 * Added comments from version provided by BGP 98/10/21 14 * zero. I$Detach wouldn't bother to do a lookup
15 * Curtis Boyle 15 * to see if it should release the memory if this
16 * 15r3 Fixed IDetach static storage wipeout bug BGP 02/05/11 16 * value was zero, so we now force I$Detach to do
17 17 * the lookup no matter the V$USRS value.
18 nam IOMan 18 * 13r2 Made more source changes, found discrepancy BGP 02/12/31
19 ttl OS-9 Level Two V3 I/O Manager 19 * in value of POLSIZ in certain areas, fixed.
20 20 * Also added 6809 conditional code for future
21 ifp1 21 * integration into OS-9 Level Two.
22 use defsfile 22
23 endc 23 nam IOMan
24 ttl NitrOS-9 Level Two I/O Manager module
25
26 * Disassembled 02/04/29 23:10:07 by Disasm v1.6 (C) 1988 by RML
27
28 IFP1
29 use defsfile
30 endc
24 31
25 tylg set Systm+Objct 32 tylg set Systm+Objct
26 atrv set ReEnt+rev 33 atrv set ReEnt+rev
27 rev set $03 34 rev set $02
28 edition set 15 35 edition set 13
29 36
30 mod eom,name,tylg,atrv,IOManEnt,size 37 mod eom,name,tylg,atrv,start,size
31 38
32 size equ . 39 u0000 rmb 0
33 40 size equ .
34 name fcs /IOMan/ 41
35 fcb edition 42 name fcs /IOMan/
36 43 fcb edition
44
45 start ldx <D.Init get pointer to init module
46 lda DevCnt,x get number of entries in device table
47 ldb #DEVSIZ get size of each entry
48 mul calculate size needed for device table
49 pshs d preserve it
50 lda PollCnt,x get number of entries in polling table
51 ldb #POLSIZ get size of each entry
52 mul calculate size needed for polling table
53 pshs d preserve it
54 IFNE H6309
55 asld
56 ELSE
57 lslb multiply by 2
58 rola
59 ENDC
60 addd $02,s add to size of device table
61 os9 F$SRqMem allocate memory
62 bcs Crash branch if error
63 leax ,u point to memory
64 IFNE H6309
65 leay <TheZero,pcr
66 tfr d,w
67 tfm y,x+
68 ELSE
69 ClrLoop clr ,x+ clear a byte
70 subd #$0001 done?
71 bne ClrLoop no, keep going
72 ENDC
73 stu <D.DevTbl save pointer to device table
74 IFNE H6309
75 puls x,d
76 addr u,x
77 stx <D.PolTbl
78 addr d,x
79 stx <D.CLTb
80 ELSE
81 ldd ,s++ get pointer to device table
82 std <D.CLTb save to globals temporarily
83 ldd ,s++ get size of device table
84 leax d,u point x to the end of device table
85 stx <D.PolTbl save to globals
86 ldd <D.CLTb get VIRQ table size
87 leax d,x add it to end of device table
88 stx <D.CLTb and save VIRQ table address
89 ENDC
90 ldx <D.PthDBT get address of path desc table
91 os9 F$All64 split it into 64 byte chunks
92 bcs Crash branch if error
93 stx <D.PthDBT save pointer back
94 os9 F$Ret64
95 leax >IRQPoll,pcr point to polling routine
96 stx <D.Poll save the vector address
97 leay <L005F,pcr point to service vector table
98 os9 F$SSvc set up calls
99 rts and return to system
37 100
38 ****************************** 101 ******************************
39 * 102 *
40 * IOMan Main entry 103 * Fatal error Crash the system
41 * 104 *
42 105 Crash jmp <D.Crash
43 IOManEnt equ *
44 * allocate device table
45 ldx <D.Init Get pointer to init module
46 lda DevCnt,x Get number of entrys in device table
47 ldb #DEVSIZ Get size of each entry
48 mul Calculate size needed for device table
49 pshs a,b Preserve it
50 lda PollCnt,x Get number of entrys in polling table
51 ldb #POLSIZ Get size of each entry
52 mul Calculate size needed for polling table
53 pshs a,b Preserve it
54 addd 2,s Add memory required for device table
55 addd #$0018 Add another 24 bytes
56 addd #$00FF Add another 256
57 clrb Drop LSB
58 os9 F$SRqMem Request the memory
59 bcs Crash Crash system if error
60 leax ,u Point to the memory
61 L0033 clr ,x+ Clear a byte
62 subd #1 Done?
63 bhi L0033 No, keep goin
64 stu <D.DevTbl Get pointer to device table
65 ldd ,s++ Restore size of polling table
66 std <D.CLTb Save it as VIRQ table address temporarily
67 ldd ,s++ Restore size of device table
68 leax d,u Point X to the end of device table
69 stx <D.PolTbl Initialize polling table address
70 ldd <D.CLTb Get VIRQ table size
71 leax d,x Add it to X
72 stx <D.CLTb Save VIRQ table address
73 ldx <D.PthDBT Get address of path descriptor table
74 os9 F$All64 Split it into 64 byte chunks
75 bcs Crash Crash system if error
76 stx <D.PthDBT Save the pointer back
77 os9 F$Ret64
78 leax >L05F2,pcr Point to polling routine
79 stx <D.Poll Save the vector address
80 leay <L0067,pcr Point to service vector table
81 os9 F$SSvc Set them up
82 rts Let the system take over
83 106
84 ****************************** 107 ******************************
85 * 108 *
86 * Fatal error Crash the system
87 *
88
89 Crash jmp <D.Crash
90
91 ******************************
92 *
93 * System service routine vector table 109 * System service routine vector table
94 * 110 *
95 111 L005F fcb $7F
96 L0067 fcb $7F 112 fdb UsrIO-*-2
97 fdb UsrIO-*-2 113 fcb F$Load
98 fcb F$Load 114 fdb FLoad-*-2
99 fdb FLoad-*-2 115 fcb I$Detach
100 fcb I$Detach
101 fdb IDetach0-*-2 116 fdb IDetach0-*-2
102 fcb F$PErr 117 fcb F$PErr
103 fdb FPErr-*-2 118 fdb FPErr-*-2
104 fcb F$IOQu+$80 119 fcb F$IOQu+$80
105 fdb FIOQu-*-2 120 fdb FIOQu-*-2
106 fcb $FF 121 fcb $FF
107 fdb SysIO-*-2 122 fdb SysIO-*-2
108 fcb F$IRQ+$80 123 fcb F$IRQ+$80
109 fdb FIRQ-*-2 124 fdb FIRQ-*-2
110 fcb F$IODel+$80 125 fcb F$IODel+$80
111 fdb FIODel-*-2 126 fdb FIODel-*-2
112 fcb F$NMLink 127 fcb F$NMLink
113 fdb FNMLink-*-2 128 fdb FNMLink-*-2
114 fcb F$NMLoad 129 fcb F$NMLoad
115 fdb FNMLoad-*-2 130 fdb FNMLoad-*-2
116 fcb $80 131 fcb $80
117 132
118 ****************************** 133 ******************************
119 * 134 *
120 * Check device status service call? 135 * Check device status service call?
121 * 136 *
122 * Entry: U = Callers register stack pointer 137 * Entry: U = Callers register stack pointer
123 * 138 *
124 139 FIODel ldx R$X,u get address of module
125 FIODel ldx R$X,u Get address of module 140 ldu <D.Init get pointer to init module
126 ldu <D.Init Get pointer to init module 141 ldb DevCnt,u get device count
127 L008A ldb DevCnt,u Get device count 142 ldu <D.DevTbl get pointer to device table
128 ldu <D.DevTbl Get pointer to device table 143 L0086 ldy V$DESC,u descriptor exists?
129 L008E ldy V$DESC,u Descriptor exist? 144 beq L0097 no, move to next device
130 beq L009F No, move to next device 145 cmpx V$DESC,u device match?
131 cmpx V$DESC,u Device match? 146 beq L009E no, move to next device
132 beq L00A6 Yes, return Module busy 147 cmpx V$DRIV,u driver match?
133 cmpx V$DRIV,u Match driver? 148 beq L009E yes, return module busy
134 beq L00A6 Yes, return module busy 149 cmpx V$FMGR,u fmgr match?
135 cmpx V$FMGR,u Match Manager? 150 beq L009E yes, return module busy
136 beq L00A6 Yes, return module busy 151 L0097 leau DEVSIZ,u move to next dev entry
137 L009F leau DEVSIZ,u Move to next device entry 152 decb done them all?
138 decb Done them all? 153 bne L0086 no, keep going
139 bne L008E No, keep goin 154 clrb clear carry
140 clrb Clear carry 155 L009D rts and return
141 rts Return 156 L009E comb else set carry
142 L00A6 comb Set carry 157 ldb #E$ModBsy submit error
143 ldb #E$ModBsy Get error code for module busy 158 rts and return
144 rts Return 159
145 160 IFNE H6309
161 TheZero fcb $00
162 ENDC
163
146 UsrIODis fdb IAttach-UsrIODis 164 UsrIODis fdb IAttach-UsrIODis
147 fdb IDetach-UsrIODis 165 fdb IDetach-UsrIODis
148 fdb UIDup-UsrIODis 166 fdb UIDup-UsrIODis
149 fdb IUsrCall-UsrIODis 167 fdb IUsrCall-UsrIODis
150 fdb IUsrCall-UsrIODis 168 fdb IUsrCall-UsrIODis
178 fdb SISeek-SysIODis 196 fdb SISeek-SysIODis
179 fdb SIClose-SysIODis 197 fdb SIClose-SysIODis
180 fdb IDeletX-SysIODis 198 fdb IDeletX-SysIODis
181 199
182 UsrIO leax <UsrIODis,pcr 200 UsrIO leax <UsrIODis,pcr
183 bra L0105 201 bra L00EF
184 SysIO leax <SysIODis,pcr 202 SysIO leax <SysIODis,pcr
185 L0105 cmpb #I$DeletX 203 IFNE H6309
186 bhi L0114 204 L00EF cmpb #$20
187 pshs b 205 ELSE
188 lslb 206 L00EF cmpb #I$DeletX
189 ldd b,x 207 ENDC
208 bhi L00F9
209 IFNE H6309
210 ldw b,x
211 lsrb
212 jmp w,x
213 ELSE
214 pshs b
215 lslb
216 ldd b,x
217 leax d,x
218 puls b
219 jmp ,x
220 ENDC
221
222 ******************************
223 *
224 * Unknown service code error handler
225 *
226 L00F9 comb
227 ldb #E$UnkSvc
228 rts
229
230 VDRIV equ $00 \
231 VSTAT equ $02 |
232 VDESC equ $04 |--- Temporary device table entry
233 VFMGR equ $06 |
234 VUSRS equ $08 /
235 DRVENT equ $09
236 FMENT equ $0B
237 AMODE equ $0D
238 HWPG equ $0E
239 HWPORT equ $0F
240 CURDTE equ $11
241 DATBYT1 equ $13
242 DATBYT2 equ $15
243 ODPROC equ $17
244 CALLREGS equ $19
245 RETERR equ $1A
246 EOSTACK equ $1B
247
248 * Entry: U=module header pointer
249 IAttach equ *
250 IFNE H6309
251 ldw #EOSTACK get stack count
252 leas <-EOSTACK,s make stack
253 leax <TheZero,pcr point at zero
254 tfr s,y move S to Y
255 tfm x,y+ and transfer 0 to stack
256 ELSE
257 ldb #EOSTACK-1 get stack count - 1
258 IALoop clr ,-s clear each byte
259 decb decrement
260 bpl IALoop and branch until = 0
261 ENDC
262 stu <CALLREGS,s save caller regs
263 lda R$A,u access mode
264 sta AMODE,s save on stack
265 ldx <D.Proc get curr proc desc
266 stx <ODPROC,s save on stack
267 leay <P$DATImg,x point to DAT img of curr proc
268 ldx <D.SysPrc get sys proc
269 stx <D.Proc make sys proc current proc
270 ldx R$X,u get caller's X
271 lda #Devic link to device desc
272 os9 F$SLink link to it
273 bcs L0155 branch if error
274 stu VDESC,s save dev desc ptr
275 ldy <CALLREGS,s get caller regs
276 stx R$X,y save updated X
277 lda M$Port,u get hw page
278 sta HWPG,s save onto stack
279 ldd M$Port+1,u get hw addr
280 std HWPORT,s save onto stack
281 IFNE H6309
282 ldx M$PDev,u get driver name ptr
283 addr u,x add U to X
284 ELSE
285 ldd M$PDev,u get driver name ptr
286 leax d,u add D to U and put in X
287 ENDC
288 lda #Drivr driver
289 os9 F$Link link to driver
290 bcs L0155 branch if error
291 stu VDRIV,s else save addr save on stack
292 sty DRVENT,s save entry point on stack
293 ldu VDESC,s get desc ptr
294 IFNE H6309
295 ldx M$FMgr,u get fm name
296 addr u,x add U to X
297 ELSE
298 ldd M$FMgr,u get fm name
299 leax d,u add D to U and put in X
300 ENDC
301 lda #FlMgr link to fm
302 os9 F$Link link to it!
303 L0155 ldx <ODPROC,s get caller's proc desc
304 stx <D.Proc restore orig proc desc
305 bcc L016A branch if not error
306 L015C stb <RETERR,s save off error code
307 leau VDRIV,s point U to device table entry
308 os9 I$Detach detach
309 leas <RETERR,s adjust stack
310 comb set carry
311 puls pc,b exit
312 L016A stu VFMGR,s save off fm module ptr
313 sty FMENT,s save off fm entry point
314 ldx <D.Init get D.Init
315 ldb DevCnt,x get device entry count
316 IFNE H6309
317 tfr b,f
318 ELSE
319 tfr b,a
320 ENDC
321 ldu <D.DevTbl get device table pointer
322 L0177 ldx V$DESC,u get dev desc ptr
323 beq L01B4 branch if empty
324 cmpx VDESC,s same as dev desc being attached?
325 bne L0196 branch if not
326 ldx V$STAT,u get driver static
327 bne L0191 branch if zero
328 IFNE H6309
329 lde V$USRS,u get user count
330 beq L0177 branch if zero
331 pshs u,b
332 lbsr FIOQu2 call F$IOQu directly
333 puls u,b
334 ELSE
335 pshs a save off A
336 lda V$USRS,u get user count
337 beq L0188 branch if zero
338 os9 F$IOQu
339 ENDC
340 IFEQ H6309
341 L0188 puls a pull A from stack
342 ENDC
343 bra L0177
344 L0191 stu <CURDTE,s save current dev table ptr
345 ldx V$DESC,u get dev desc ptr
346 L0196 ldy M$Port+1,x get hw addr
347 cmpy HWPORT,s same as dev entry on stack?
348 bne L01B4 branch if not
349 IFNE H6309
350 lde M$Port,x get hw port
351 cmpe HWPG,s same as dev entry on stack?
352 ELSE
353 ldy M$Port,x get hw port
354 cmpy HWPG,s same as dev entry on stack?
355 ENDC
356 bne L01B4 branch if not
357 ldx V$DRIV,u get driver ptr
358 cmpx VDRIV,s same as dev entry on stack?
359 bne L01B4 branch if not
360 * A match between device table entries has occurred
361 ldx V$STAT,u get driver static
362 stx VSTAT,s save off in our statics
363 tst V$USRS,u any users for this device
364 beq L01B4 branch if not
365 IFEQ H6309
366 sta HWPG,s
367 ENDC
368 L01B4 leau DEVSIZ,u advance to the next device entry
369 decb
370 bne L0177
371 ldu <CURDTE,s get curr dev entry ptr
372 lbne L0264 branch if not zero
373 ldu <D.DevTbl
374 IFNE H6309
375 tfr f,a
376 ENDC
377 L01C4 ldx V$DESC,u get desc ptr
378 beq L01DD branch if zero
379 leau DEVSIZ,u move to next dev table entry
380 deca
381 bne L01C4
382 ldb #E$DevOvf dev table overflow
383 bra L015C
384
385 L01D1
386 IFNE H6309
387 lsrd /2
388 lsrd /4
389 lsrd /8
390 lsrd /16
391 lsrd /32
392 ELSE
393 lsra
394 rolb /2
395 lsra
396 rolb /4
397 lsra
398 rolb /8
399 lsra
400 rolb /16
401 lsra
402 rolb /32
403 ENDC
404 clra
405 rts
406
407 L01DD ldx VSTAT,s get static storage off stack
408 bne L0259 branch if already alloced
409 stu <CURDTE,s else store off ptr to dev table entry
410 ldx VDRIV,s get ptr to driver
411 ldd M$Mem,x get driver storage req
412 os9 F$SRqMem allocate memory
413 lbcs L015C branch if error
414 stu VSTAT,s save newly alloc'ed driver static storage ptr
415 IFNE H6309
416 leay VSTAT+1,s point to zero byte
417 tfr d,w tfr count to w counter
418 tfm y,u+ clear driver static storage
419 ELSE
420 Loop2 clr ,u+ clear newly alloc'ed mem
421 subd #$0001
422 bhi Loop2
423 ENDC
424 ldd HWPG,s get hwpage and upper addr
425 IFNE H6309
426 * IFNE H6309
427 bsr L01D1
428 std <DATBYT2,s save off
429 ldu #$0000
430 tfr u,y
431 stu <DATBYT1,s
432 ldx <D.SysDAT get system mem map ptr
433 L0209 ldd ,x++
434 cmpd <DATBYT2,s
435 beq L023B
436 cmpd #DAT.Free
437 bne L021D
438 sty <DATBYT1,s
439 leau -$02,x
440 L021D leay >$2000,y
441 bne L0209
442 ldb #E$NoRAM
443 IFNE H6309
444 cmpr 0,u
445 ELSE
446 cmpu #$0000
447 ENDC
448 lbeq L015C
449 ldd <DATBYT2,s
450 std ,u
451 ldx <D.SysPrc
452 IFNE H6309
453 oim #ImgChg,P$State,x
454 ELSE
455 lda P$State,x
456 ora #ImgChg
457 sta P$State,x
458 ENDC
459 os9 F$ID
460 bra L023F
461 L023B sty <DATBYT1,s
462 L023F ldd HWPORT,s
463 anda #$1F
464 addd <DATBYT1,s
465 ENDC
466 * ENDC
467 ldu VSTAT,s load U with static storage of drvr
468 clr ,u clear ??
469 std $01,u
470 ldy VDESC,s load Y with desc ptr
471 jsr [<DRVENT,s] call driver init routine
472 lbcs L015C branch if error
473 ldu <CURDTE,s
474 L0259
475 IFNE H6309
476 ldw #DEVSIZ
477 tfr s,x
478 tfm x+,u+
479 leau -DEVSIZ,u
480 ELSE
481 ldb #DEVSIZ-1 size of device table - 1
482 LilLoop lda b,s get from src
483 sta b,u save in dest
484 decb
485 bpl LilLoop
486 ENDC
487 * Here, U points to Device Table
488 L0264 ldx V$DESC,u get desc ptr in X
489 ldb M$Revs,x get revs
490 lda AMODE,s get access mode byte passed in A
491 anda M$Mode,x and with MODE byte in desc.
492 ldx V$DRIV,u X points to driver module
493 anda M$Mode,x AND with mode byte in driver
494 cmpa AMODE,s same as passed mode?
495 beq L0279 if so, ok
496 ldb #E$BMode else bad mode
497 lbra L015C and return
498 L0279 inc V$USRS,u else inc user count
499 bne L027F if not zero, continue
500 dec V$USRS,u else bump back to 255
501 L027F ldx <CALLREGS,s
502 stu R$U,x
503 leas <EOSTACK,s
504 clrb
505 rts
506
507 IDetach ldu R$U,u
508 * ldx V$DESC,u
509 *** BUG FIX
510 * The following two lines fix a long-standing bug in IOMan where
511 * the I$Detach routine would deallocate the V$STAT area. This is
512 * because the V$USRS offset on the stack, where the temporary
513 * device table entry was being built, contained 0. I$Detach wouldn't
514 * bother to do a lookup to see if it should release the memory if
515 * this value was zero, so here force I$Detach to do the lookup no
516 * matter the V$USRS value
517 * BGP 04/30/2002
518 tst V$USRS,u
519 beq IDetach2
520 *** BUG FIX
521 L0297 lda #$FF
522 cmpa V$USRS,u
523 lbeq L0351
524 dec V$USRS,u
525 lbne L0335
526 IDetach2
527 ldx <D.Init
528 ldb DevCnt,x
529 pshs u,b
530 ldx V$STAT,u
531 clr V$STAT,u
532 clr V$STAT+1,u
533 ldy <D.DevTbl
534 L02B4 cmpx V$STAT,y
535 beq L032B
536 leay DEVSIZ,y
537 decb
538 bne L02B4
539 ldy <D.Proc
540 ldb P$ID,y
541 stb V$USRS,u
542 ldy V$DESC,u
543 ldu V$DRIVEX,u
544 exg x,u
545 pshs u
546 jsr $0F,x
547 puls u
548 L02D1 ldx $01,s get ptr to dev table
549 ldx V$DRIV,x load X with driver addr
550 ldd M$Mem,x get static storage size
551 addd #$00FF round up one page
552 clrb clear lo byte
553 os9 F$SRtMem return mem
554 ldx $01,s get old U on stack
555 ldx V$DESC,x
556 IFNE H6309
557 * IFNE H6309
558 ldd M$Port,x
559 beq L032B
560 lbsr L01D1
561 cmpb #$3F
562 beq L032B
563 tfr d,y
564 IFNE H6309
565 ldf ,s
566 ENDC
567 ldu <D.DevTbl
568 L02F4 cmpu $01,s
569 beq L0309
570 ldx V$DESC,u
571 beq L0309
572 ldd M$Port,x
573 beq L0309
574 lbsr L01D1
575 IFNE H6309
576 cmpr y,d
577 ELSE
578 pshs y
579 cmpd ,s++
580 ENDC
581 beq L032B
582 L0309 leau DEVSIZ,u
583 IFNE H6309
584 decf
585 ELSE
586 dec ,s
587 ENDC
588 bne L02F4
589 ldx <D.SysPrc
590 ldu <D.SysDAT
591 IFNE H6309
592 ldf #$08
593 ELSE
594 ldb #$08
595 pshs b
596 ENDC
597 L0316 ldd ,u++
598 IFNE H6309
599 cmpr y,d
600 ELSE
601 pshs y
602 cmpd ,s++
603 ENDC
604 beq L0323
605 IFNE H6309
606 decf
607 ELSE
608 dec ,s
609 ENDC
610 bne L0316
611 IFEQ H6309
612 leas 1,s
613 ENDC
614 bra L032B
615 L0323
616 IFEQ H6309
617 leas 1,s
618 ENDC
619 ldd #DAT.Free
620 std -$02,u
621 IFNE H6309
622 oim #ImgChg,P$State,x
623 ELSE
624 lda P$State,x
625 ora #ImgChg
626 sta P$State,x
627 ENDC
628 ENDC
629 * ENDC
630 L032B puls u,b
631 ldx V$DESC,u get descriptor in X
632 clr V$DESC,u clear out descriptor
633 clr V$DESC+1,u
634 clr V$USRS,u and users
635 L0335
636 IFNE H6309
637 ldw <D.Proc
638 ELSE
639 ldd <D.Proc get curr process
640 pshs d save it
641 ENDC
642 ldd <D.SysPrc make system the current process
643 std <D.Proc
644 ldy V$DRIV,u get file manager module address
645 ldu V$FMGR,u get driver module address
646 os9 F$UnLink unlink file manager
647 leau ,y point to driver
648 os9 F$UnLink unlink driver
649 leau ,x point to descriptor
650 os9 F$UnLink unlink it
651 IFNE H6309
652 stw <D.Proc
653 ELSE
654 puls d restore current process
655 std <D.Proc
656 ENDC
657 L0351 lbsr L0595
658 clrb
659 rts
660
661 UIDup bsr LocFrPth
662 bcs L0376
663 pshs x,a
664 lda R$A,u
665 lda a,x
666 bsr L036F
667 bcs L036B
668 puls x,b
669 stb R$A,u
670 sta b,x
671 rts
672 L036B puls pc,x,a
673
674 SIDup lda R$A,u
675 L036F lbsr GetPDesc
676 bcs L0376
677 inc PD.CNT,y
678 L0376 rts
679
680 * Locate a free path in D.Proc
681 LocFrPth ldx <D.Proc
682 leax <P$Path,x
683 clra
684 L037D tst a,x
685 beq L038A
686 inca
687 cmpa #Numpaths
688 bcs L037D
689 comb
690 ldb #E$PthFul
691 rts
692 L038A andcc #^Carry
693 rts
694
695 IUsrCall bsr LocFrPth
696 bcs L039F
697 pshs u,x,a
698 bsr ISysCall
699 puls u,x,a
700 bcs L039F
701 ldb R$A,u
702 stb a,x
703 sta R$A,u
704 L039F rts
705
706 ISysCall pshs b
707 ldb R$A,u
708 bsr AllcPDsc
709 bcs L03B4
710 puls b
711 lbsr CallFMgr
712 bcs L03C3
713 lda PD.PD,y
714 sta R$A,u
715 rts
716 L03B4 puls pc,a
717
718 IMakDir pshs b
719 ldb #DIR.+WRITE.
720 L03BA bsr AllcPDsc
721 bcs L03B4
722 puls b
723 lbsr CallFMgr
724 L03C3 pshs b,cc
725 ldu PD.DEV,y
726 os9 I$Detach
727 lda PD.PD,y
728 ldx <D.PthDBT
729 os9 F$Ret64
730 puls pc,b,cc
731
732 IChgDir pshs b
733 ldb R$A,u
734 orb #DIR.
735 bsr AllcPDsc
736 bcs L03B4
737 puls b
738 lbsr CallFMgr
739 bcs L03C3
740 ldu <D.Proc
741 IFNE H6309
742 tim #PWRIT.+PREAD.+UPDAT.,PD.MOD,y
743 ELSE
744 ldb PD.MOD,y
745 bitb #PWRIT.+PREAD.+UPDAT.
746 ENDC
747 beq IChgExec
748 ldx PD.DEV,y
749 stx <P$DIO,u
750 inc V$USRS,x
751 bne IChgExec
752 dec V$USRS,x
753 IChgExec
754 IFNE H6309
755 tim #PEXEC.+EXEC.,PD.MOD,y
756 ELSE
757 bitb #PEXEC.+EXEC.
758 ENDC
759 beq L0406
760 ldx PD.DEV,y
761 stx <P$DIO+6,u
762 inc V$USRS,x
763 bne L0406
764 dec V$USRS,x
765 L0406 clrb
766 bra L03C3
767
768 IDelete pshs b
769 ldb #WRITE.
770 bra L03BA
771
772 IDeletX ldb #EXEC.+UPDAT.
773 pshs b
774 ldb R$A,u
775 bra L03BA
776
777 * Allocate path descriptor
778 AllcPDsc ldx <D.Proc
779 pshs u,x
780 ldx <D.PthDBT
781 os9 F$All64
782 bcs L0484
783 inc PD.CNT,y
784 stb PD.MOD,y
785 ldx <D.Proc
786 ldb P$Task,x
787 ldx R$X,u X points to pathlist
788 L042C os9 F$LDABX
789 leax 1,x
790 cmpa #C$SPAC skip over spaces
791 beq L042C
792 leax -1,x back up
793 stx R$X,u save back pointer
794 cmpa #PDELIM leading slash?
795 beq L0459 yep...
796 ldx <D.Proc
797 IFNE H6309
798 tim #EXEC.,PD.MOD,y
799 ELSE
800 ldb PD.MOD,y
801 bitb EXEC. exec. dir relative?
802 ENDC
803 beq L0449 nope...
804 ldx <P$DIO+6,x
805 bra L044C
806 L0449 ldx <P$DIO,x
807 L044C beq L0489
808 ldd <D.SysPrc
809 std <D.Proc
810 ldx $04,x
811 ldd $04,x
812 IFNE H6309
813 addr d,x
814 ELSE
190 leax d,x 815 leax d,x
191 puls b 816 ENDC
192 jmp ,x 817 L0459 pshs y save off path desc ptr in Y
193 818 os9 F$PrsNam
194 ****************************** 819 puls y restore path desc ptr
195 * 820 bcs L0489
196 * Unknown service code error handler 821 lda PD.MOD,y
197 * 822 os9 I$Attach attach to device
198 823 stu PD.DEV,y save dev tbl entry
199 L0114 comb 824 bcs L048B
200 ldb #E$UnkSvc 825 ldx V$DESC,u
201 rts 826 * copy options from dev desc to path desc
202 827 leax <M$Opt,x
203 * Entry: U=Module header pointer 828 IFNE H6309
204 829 ldf ,x+
205 IAttach ldb #$17 830 leau <PD.OPT,y
206 L010B clr ,-s 831 cmpf #PD.OPT
207 decb 832 bcs L047E
208 bpl L010B 833 ldf #$20
209 stu <$16,s save caller regs 834 ELSE
210 lda R$A,u access mode 835 ldb ,x+ get options count
211 sta $09,s save on stack 836 leau <PD.OPT,y
212 ldx <D.Proc 837 cmpb #PD.OPT
213 stx <$14,s save proc desc 838 bls L03E5
214 leay <P$DATImg,x 839 ldb #PD.OPT-1
215 ldx <D.SysPrc 840 ENDC
216 stx <D.Proc 841 L047E
217 ldx R$X,u 842 IFNE H6309
218 lda #Devic+0 843 clre
219 os9 F$SLink 844 tfm x+,u+
220 bcs L0154 845 ELSE
221 stu $04,s save pointer to dev desc 846 KeepLoop lda ,x+
222 ldy <$16,s get caller regs 847 sta ,u+
223 stx R$X,y 848 L03E5 decb
224 lda M$Port,u 849 bpl KeepLoop
225 sta $0B,s save extended port addr 850 ENDC
226 ldd M$Port+1,u 851 clrb
227 std $0C,s save port addr 852 L0484 puls u,x
228 ldd M$PDev,u 853 stx <D.Proc
229 leax d,u point to driver name in desc 854 rts
230 lda #Drivr+0 855
231 os9 F$Link link to driver 856 L0489 ldb #E$BPNam
232 bcs L0154 857 L048B pshs b
233 stu ,s save pointer to driver 858 lda ,y
234 ldu 4,s get dev desc ptr 859 ldx <D.PthDBT
235 ldd M$FMgr,u 860 os9 F$Ret64
236 leax d,u point to fmgr name in desc 861 puls b
237 lda #FlMgr+0 862 coma
238 os9 F$Link 863 bra L0484
239 L0154 ldx <$14,s get proc desc 864
240 stx <D.Proc 865 UISeek bsr S2UPath get user path #
241 bcc L0169 866 bcc GtPDClFM get PD, call FM
242 L015B stb <$17,s save error in B on stack 867 rts
243 leau ,s point U at stack 868
244 os9 I$Detach detach 869 SISeek lda R$A,u
245 leas <$17,s clean up stack 870 GtPDClFM bsr GetPDesc
246 comb 871 IFNE H6309
247 puls pc,b 872 bcc CallFMgr
248 L0169 stu $06,s save pointer to fmgr 873 ELSE
249 ldx <D.Init 874 lbcc CallFMgr
250 ldb DevCnt,x 875 ENDC
251 lda DevCnt,x 876 rts
252 ldu <D.DevTbl 877
253 L0173 ldx V$DESC,u 878 L04A5 ldb #E$Read
254 beq L01B0 879 IFNE H6309
255 cmpx 4,s compare to dev desc on stack 880 tim #WRITE.,,s
256 * bne L018E --BGP 881 ELSE
257 bne L0191 ++BGP 882 lda ,s
258 ldx V$STAT,u get static 883 bita #WRITE.
259 bne L018C 884 ENDC
260 pshs a 885 beq L04B2
261 lda V$USRS,u 886 ldb #E$Write
262 beq L0188 887 bra L04B2
263 os9 F$IOQu 888
264 L0188 puls a 889 L04B0 ldb #E$BMode
265 bra L0173 890 L04B2 com ,s+
266 L018C stu $0E,s save static storage 891 rts
267 L018E ldx V$DESC,u 892
268 L0191 ldy M$Port+1,x same port? 893 UIRead bsr S2UPath get user path #
269 cmpy $0C,s 894 bcc L04E3
270 bne L01B0 895 rts
271 ldy M$Port,x 896
272 cmpy $0B,s same port? 897 UIWrite bsr S2UPath
273 bne L01B0 898 bcc L04C1
274 ldx V$DRIV,u 899 rts
275 cmpx ,s same driver? 900
276 bne L01B0 901 SIWrite
277 ldx V$STAT,u 902 UIDeletX lda R$A,u
278 stx $02,s save static 903 L04C1 pshs b
279 tst V$USRS,u 904 ldb #WRITE.
280 beq L01B0 905 bra L04E7
281 sta $0A,s 906
282 L01B0 leau DEVSIZ,u 907 * get path descriptor
283 decb 908 * Passed: A = path number
284 bne L0173 909 * Returned: Y = address of path desc for path num
285 ldu $0E,s get static storage 910 GetPDesc ldx <D.PthDBT
286 lbne L020E 911 os9 F$Find64
287 ldu <D.DevTbl 912 bcs L04DD
288 L01BD ldx V$DESC,u 913 rts
289 beq L01CE 914
290 leau DEVSIZ,u 915 * System to User Path routine
291 deca 916 *
292 bne L01BD 917 * Returns:
293 ldb #E$DevOvf 918 * A = user path #
294 bra L015B 919 * X = path table in path desc. of current proc.
295 L01CA ldb #E$BMode 920 S2UPath lda R$A,u
296 bra L015B
297 L01CE ldx $02,s get driver static in X
298 lbne L0205 if not zero, already alloced
299 stu $0E,s
300 ldx ,s get ptr to driver
301 ldd M$Mem,x get driver mem size
302 addd #$00FF round to next page
303 clrb
304 os9 F$SRqMem allocate driver mem
305 lbcs L015B
306 stu $02,s save ptr to mem
307 L01E7 clr ,u+ clear driver mem
308 subd #$0001
309 bhi L01E7
310 ldd $0C,s get ???
311 ldu $02,s
312 clr ,u
313 std $01,u
314 ldy $04,s
315 ldx ,s get ptr to driver
316 ldd $09,x D holds entry to driver
317 jsr d,x call init routine
318 lbcs L015B
319 ldu $0E,s
320 * Copy device table entry here
321 L0205 ldb #$08 size of device table
322 L0207 lda b,s get from src
323 sta b,u save in dest
324 decb
325 bpl L0207
326 * Here, U points to Device Table
327 L020E ldx $04,u get desc ptr in X
328 ldb $07,x get lang byte in desc
329 lda $09,s get access mode byte passed in A
330 anda $0D,x AND with mode byte in desc
331 ldx ,u X points to driver module
332 anda $0D,x AND with mode byte in driver
333 cmpa $09,s same as ??
334 lbne L01CA if not, bad mode error
335 inc $08,u else inc user count
336 bne L0226 if not zero, continue
337 dec $08,u else dec to $FF
338 L0226 ldx <$16,s
339 stu $08,x
340 leas <$18,s
341 clrb
342 rts
343
344 IDetach ldu R$U,u get ptr to dev tbl entry
345 * ldx V$DESC,u
346 tst V$USRS,u
347 beq IDetach2
348 L0240 lda #$FF
349 cmpa $08,u
350 lbeq L02B7
351 dec $08,u
352 lbne L0299
353 IDetach2
354 ldx <D.Init
355 ldb DevCnt,x
356 pshs u,b
357 ldx $02,u
358 clr $02,u
359 clr $03,u
360 ldy <D.DevTbl
361 L025D cmpx $02,y
362 beq L028F
363 leay $09,y
364 decb
365 bne L025D
366 ldy <D.Proc
367 ldb ,y
368 stb $08,u
369 ldy $04,u
370 ldu ,u
371 exg x,u
372 ldd $09,x
373 leax d,x
374 pshs u
375 jsr $0F,x
376 L027C puls u
377 ldx $01,s get ptr to dev tbl
378 ldx ,x load X with driver addr
379 ldd M$Mem,x get static storage size
380 addd #$00FF round up one page
381 clrb
382 os9 F$SRtMem return mem
383 ldx $01,s get ptr to dev tbl
384 ldx V$DESC,x
385 L028F puls u,b
386 ldx $04,u
387 clr $04,u
388 clr $05,u
389 clr $08,u
390 L0299 ldd <D.Proc
391 pshs b,a
392 ldd <D.SysPrc
393 std <D.Proc
394 ldy ,u
395 ldu $06,u
396 os9 F$UnLink
397 leau ,y
398 os9 F$UnLink
399 leau ,x
400 os9 F$UnLink
401 puls b,a
402 std <D.Proc
403 L02B7 lbsr L0556
404 clrb
405 rts
406
407 UIDup bsr LocFrPth
408 bcs L02DC
409 pshs x,a
410 lda R$A,u
411 lda a,x
412 bsr L02D5
413 bcs L02D1
414 puls x,b
415 stb R$A,u
416 sta b,x
417 rts
418 L02D1 puls pc,x,a
419
420 SIDup lda R$A,u
421 L02D5 lbsr GetPDesc
422 bcs L02DC
423 inc PD.CNT,y
424 L02DC rts
425
426 * Locate a free path in D.Proc
427 LocFrPth ldx <D.Proc
428 leax <P$Path,x
429 clra
430 L02E3 tst a,x
431 beq L02F0
432 inca
433 cmpa #Numpaths 921 cmpa #Numpaths
434 bcs L02E3 922 bcc L04DD illegal path number
435 comb 923 ldx <D.Proc
436 ldb #E$PthFul 924 adda #P$PATH
437 rts 925 lda a,x
438 L02F0 andcc #^Carry 926 bne L04E0
439 rts 927 L04DD comb
440 928 ldb #E$BPNum
441 IUsrCall bsr LocFrPth 929 L04E0 rts
442 bcs L0305 930
443 pshs u,x,a 931 SIRead lda R$A,u get user path
444 bsr ISysCall 932 L04E3 pshs b
445 puls u,x,a
446 bcs L0305
447 ldb R$A,u
448 stb a,x
449 sta R$A,u
450 L0305 rts
451
452 ISysCall pshs b
453 ldb R$A,u
454 bsr AllcPDsc
455 bcs L031A
456 puls b
457 lbsr CallFMgr
458 bcs L0329
459 lda PD.PD,y
460 sta R$A,u
461 rts
462 L031A puls pc,a
463
464 IMakDir pshs b
465 ldb #DIR.!WRITE.
466 L0320 bsr AllcPDsc
467 bcs L031A
468 puls b
469 lbsr CallFMgr
470 L0329 pshs b,cc
471 ldu PD.DEV,y
472 os9 I$Detach
473 lda PD.PD,y
474 ldx <D.PthDBT
475 os9 F$Ret64
476 puls pc,b,cc
477
478 IChgDir pshs b
479 ldb R$A,u
480 orb #DIR.
481 bsr AllcPDsc
482 bcs L031A
483 puls b
484 lbsr CallFMgr
485 bcs L0329
486 ldu <D.Proc
487 ldb PD.MOD,y
488 bitb #PWRIT.+PREAD.+WRITE.+READ.
489 beq IChgExec
490 ldx PD.DEV,y
491 stx <P$DIO,u
492 inc V$USRS,x
493 bne IChgExec
494 dec V$USRS,x
495 IChgExec bitb #PEXEC.+EXEC.
496 beq IChgRts
497 ldx PD.DEV,y
498 stx <P$DIO+6,u
499 inc V$USRS,x
500 bne IChgRts
501 dec V$USRS,x
502 IChgRts clrb
503 bra L0329
504
505 IDelete pshs b
506 ldb #WRITE.
507 bra L0320
508
509 IDeletX ldb #DIR.+EXEC.+UPDAT.
510 pshs b
511 ldb R$A,u
512 bra L0320
513
514 * allocate path descriptor
515 AllcPDsc ldx <D.Proc
516 pshs u,x
517 ldx <D.PthDBT
518 os9 F$All64
519 bcs L03E9
520 inc PD.CNT,y
521 stb PD.MOD,y
522 ldx <D.Proc
523 ldb P$Task,x
524 ldx R$X,u X points to pathlist
525 L0392 os9 F$LDABX
526 leax 1,x
527 cmpa #C$SPAC skip over spaces
528 beq L0392
529 leax -$01,x back up
530 stx R$X,u save back pointer
531 * ldb PD.MOD,y moved down --BGP
532 cmpa #PDELIM leading slash?
533 beq L03BF yep...
534 ldb PD.MOD,y ++BGP
535 ldx <D.Proc
536 bitb #EXEC. exec. dir relative?
537 beq L03B0 nope...
538 ldx <P$DIO+6,x
539 bra L03B3
540 L03B0 ldx <P$DIO,x
541 L03B3 beq L03EE
542 ldd <D.SysPrc
543 std <D.Proc
544 ldx $04,x
545 ldd $04,x
546 leax d,x
547 L03BF pshs y save off path desc ptr in Y
548 os9 F$PrsNam
549 puls y restore path desc ptr
550 bcs L03EE
551 lda PD.MOD,y
552 os9 I$Attach attach to device
553 stu PD.DEV,y save dev tbl entry
554 bcs L03F0
555 ldx V$DESC,u
556 * copy options from dev desc to path desc
557 leax <M$Opt,x
558 ldb ,x+ get options count
559 leau <PD.OPT,y
560 cmpb #$20
561 bls L03E5
562 ldb #$1F
563 L03E1 lda ,x+
564 sta ,u+
565 L03E5 decb
566 bpl L03E1
567 clrb
568 L03E9 puls u,x
569 stx <D.Proc
570 rts
571
572 L03EE ldb #E$BPNam
573 L03F0 pshs b
574 lda ,y
575 ldx <D.PthDBT
576 os9 F$Ret64
577 puls b
578 coma
579 bra L03E9
580
581 * System to User Path routine
582 *
583 * Returns:
584 * A = user path #
585 * X = path table in path desc. of current proc.
586 S2UPth lda R$A,u
587 cmpa #NumPaths
588 bcc L040F illegal path number
589 ldx <D.Proc
590 leax <P$Path,x
591 andcc #^Carry
592 lda a,x
593 bne L0412
594 L040F comb
595 ldb #E$BPNum
596 L0412 rts
597
598 UISeek bsr S2UPth get user path #
599 bcc GtPDClFM get PD, call FM
600 rts
601
602 SISeek lda R$A,u
603 GtPDClFM bsr GetPDesc
604 lbcc CallFMgr
605 rts
606
607 UIRead bsr S2UPth get user path #
608 bcc L0428
609 rts
610
611 SIRead lda R$A,u
612 L0428 pshs b
613 ldb #EXEC.+READ. 933 ldb #EXEC.+READ.
614 L042C bsr GetPDesc 934 L04E7 bsr GetPDesc get path descriptor from path in A
615 bcs L0479 935 bcs L04B2 branch if error
616 bitb PD.MOD,y 936 bitb PD.MOD,y test bits against mode in path desc
617 beq L0477 937 beq L04B0 branch if no corresponding bits
618 ldd R$Y,u get count from user 938 ldd R$Y,u else get count from user
619 beq L0466 939 beq L051C branch if zero count
620 addd R$X,u update buffer pointer 940 addd R$X,u else update buffer pointer with size
621 bcs L046B 941 bcs L04A5 branch if carry set
622 subd #$0001 subtract 1 from count 942 IFNE H6309
623 lsra 943 decd
624 lsra 944 ELSE
625 lsra 945 subd #$0001 subtract 1 from count
626 lsra 946 ENDC
627 lsra 947 lsra / 2
628 ldb R$X,u 948 lsra / 4
629 lsrb 949 lsra / 8
630 lsrb 950 lsra / 16
631 lsrb 951 lsra / 32
632 lsrb 952 ldb R$X,u get address of buffer to hold read data
633 lsrb 953 lsrb
634 pshs b 954 lsrb
635 suba ,s+ 955 lsrb
636 ldx <D.Proc 956 lsrb
957 ldx <D.Proc
637 leax <P$DATImg,x 958 leax <P$DATImg,x
638 lslb 959 abx
639 * leax b,x --BGP 960 lsrb
640 abx ++BGP 961 IFNE H6309
641 L0457 pshs a 962 subr b,a
642 ldd ,x++ 963 tfr a,e
643 cmpd #$333E 964 ELSE
965 pshs b
966 suba ,s
967 sta ,s
968 ENDC
969 L0510 ldd ,x++
970 cmpd #DAT.Free
971 IFNE H6309
972 beq L04A5
973 dece
974 ELSE
975 bne L051X
644 puls a 976 puls a
645 beq L046B 977 bra L04A5
646 deca 978 L051X dec ,s
647 bpl L0457 979 ENDC
648 L0466 puls b 980 bpl L0510
649 lbra CallFMgr 981 IFEQ H6309
650 L046B ldb #E$Read 982 puls a
651 lda ,s 983 ENDC
652 bita #READ. 984 L051C puls b
653 bne L0479 985 CallFMgr equ *
654 ldb #E$Write 986 IFNE H6309
655 bra L0479 987 subb #$03
656 L0477 ldb #E$BMode 988 ELSE
657 L0479 com ,s+ 989 subb #$83
658 rts 990 ENDC
659 991 pshs u,y,x
660 UIWrite bsr S2UPth get user path # 992 ldx <D.Proc
661 bcc L0483 993 L0524
662 rts 994 IFNE H6309
663 995 lde $05,y
664 SIWrite lda R$A,u 996 ELSE
665 L0483 pshs b 997 tst PD.CPR,y
666 ldb #WRITE. 998 ENDC
667 bra L042C 999 bne L054B
668 1000 lda P$ID,x
669 * get path descriptor 1001 sta PD.CPR,y
670 * Passed: A = path number 1002 stu PD.RGS,y
671 * Returned: Y = address of path desc for path num 1003 ldx PD.DEV,y
672 GetPDesc pshs x 1004 ldx V$FMGREX,x get file manager address
673 ldx <D.PthDBT 1005 lda #$03 length of lbra instruction
674 os9 F$Find64 1006 mul
675 puls x 1007 jsr b,x
676 lbcs L040F 1008 L0538 pshs b,cc
677 L0496 rts 1009 bsr L0595
678 1010 ldy $04,s get Y off stack
679 UIGetStt lbsr S2UPth get user path # 1011 ldx <D.Proc
680 ldx <D.Proc 1012 lda P$ID,x
681 bcc L04A3 1013 cmpa PD.CPR,y
682 rts 1014 bne L0549
683 1015 clr PD.CPR,y
684 SIGetStt lda R$A,u 1016 L0549 puls pc,u,y,x,b,cc
685 ldx <D.SysPrc 1017 L054B pshs u,y,x,b
686 L04A3 pshs x,b,a 1018 lbsr FIOQu2
687 lda R$B,u get func code 1019 puls u,y,x,b
688 sta 1,s place func code on stack 1020 coma
689 puls a get path off stack 1021 lda <P$Signal,x
690 lbsr GtPDClFM 1022 beq L0524
691 puls x,a 1023 tfr a,b
692 pshs u,y,b,cc 1024 bra L0538
693 ldb <$20,y 1025
694 cmpb #$04 1026 UIGetStt lbsr S2UPath get usr path #
695 beq L04C0 1027 ldx <D.Proc
696 tsta SS.Opt? 1028 bcc L0568
697 beq L04C2 1029 rts
698 cmpa #SS.DevNm 1030
699 beq SSDevNm 1031 SIGetStt lda R$A,u
700 L04C0 puls pc,u,y,b,cc 1032 ldx <D.SysPrc
701 L04C2 lda <D.SysTsk 1033 L0568 pshs x,b,a
702 ldb P$Task,x 1034 lda R$B,u get func code
703 leax <PD.OPT,y 1035 sta $01,s place on stack in B
704 SSCopy ldy #32 1036 puls a get path off stack
705 ldu R$X,u 1037 lbsr GtPDClFM
706 os9 F$Move 1038 puls x,a get func code in A, sys proc in X
707 leas 2,s 1039 pshs u,y,b,cc
708 clrb 1040 tsta SS.Opt?
709 puls pc,u,y 1041 beq SSOpt
710 1042 cmpa #SS.DevNm Get device name?
711 SSDevNm lda <D.SysTsk 1043 beq SSDevNm
712 ldb P$Task,x 1044 puls pc,u,y,b,cc
713 pshs b,a 1045
714 ldx PD.DEV,y 1046 SSOpt lda <D.SysTsk
715 ldx V$DESC,x 1047 ldb P$Task,x
1048 leax <PD.OPT,y
1049 SSCopy ldy #PD.OPT
1050 ldu R$X,u
1051 os9 F$Move
1052 leas $2,s
1053 clrb
1054 puls pc,u,y
1055
1056 L0595 pshs y
1057 ldy <D.Proc get current process
1058 lda <P$IOQN,y get ID of next process in I/O queue
1059 beq L05AC branch if none
1060 clr <P$IOQN,y else clear it
1061 ldb #S$Wake get wake signal
1062 os9 F$Send wake up process ID in A with signal in B
1063 os9 F$GProcP
1064 clr P$IOQP,y
1065 L05AC clrb
1066 puls pc,y
1067
1068 SSDevNm lda <D.SysTsk
1069 ldb P$Task,x
1070 IFEQ H6309
1071 pshs d
1072 ENDC
1073 ldx PD.DEV,y
1074 ldx V$DESC,x
1075 IFNE H6309
1076 ldw M$Name,x
1077 addr w,x
1078 ELSE
716 ldd M$Name,x 1079 ldd M$Name,x
717 leax d,x 1080 leax d,x
718 puls b,a 1081 puls d
719 bra SSCopy 1082 ENDC
720 1083 bra SSCopy
721 UIClose lbsr S2UPth get user path # 1084
722 bcs L0496 1085 UIClose lbsr S2UPath get user path #
1086 bcs L05CE
1087 IFNE H6309
1088 lde R$A,u
1089 adde #$30
1090 clr e,x zero path entry
1091 ELSE
723 pshs b 1092 pshs b
724 ldb R$A,u 1093 ldb R$A,u
725 clr b,x zero path entry 1094 addb #P$PATH
1095 clr b,x
726 puls b 1096 puls b
727 bra L04FA 1097 ENDC
728 1098 bra L05D1
729 SIClose lda R$A,u 1099 L05CE rts
730 L04FA bsr GetPDesc 1100
731 bcs L0496 1101 SIClose lda R$A,u
732 dec PD.CNT,y 1102 L05D1 lbsr GetPDesc
733 tst PD.CPR,y 1103 bcs L05CE
734 bne L0506 1104 dec PD.CNT,y
735 bsr CallFMgr 1105 tst PD.CPR,y
736 L0506 tst PD.CNT,y 1106 bne L05DF
737 bne L0496 1107 lbsr CallFMgr
738 lbra L0329 1108 L05DF tst PD.CNT,y
739 L050D os9 F$IOQu 1109 bne L05CE
740 comb 1110 lbra L03C3
741 ldb <$19,x 1111
742 bne L0521 1112 FIRQ ldx R$X,u get ptr to IRQ packet
743 L0516 ldx <D.Proc 1113 ldb ,x B = flip byte
744 ldb P$ID,x 1114 ldx $01,x X = mask/priority
745 clra 1115 clra
746 lda PD.CPR,y 1116 pshs cc
747 bne L050D 1117 pshs x,b
748 stb PD.CPR,y 1118 ldx <D.Init
749 L0521 rts 1119 ldb PollCnt,x
750 1120 ldx <D.PolTbl
751 CallFMgr pshs u,y,x,b 1121 ldy R$X,u
752 bsr L0516 1122 beq L0634
753 bcs L053E 1123 tst $01,s test mask byte
754 stu PD.RGS,y 1124 beq L0662
755 lda <$20,y 1125 decb dec poll table count
756 ldx PD.DEV,y 1126 lda #POLSIZ
757 ldx V$FMGR,x 1127 mul
758 ldd M$Exec,x 1128 IFNE H6309
759 leax d,x 1129 addr d,x
760 ldb ,s get B off stack 1130 ELSE
761 subb #$83
762 lda #$03
763 mul
764 jsr d,x
765 L053E pshs b,cc
766 bsr L0556
767 ldy $05,s get Y off stack
768 lda <$20,y
769 ldx <D.Proc
770 lda P$ID,x
771 cmpa PD.CPR,y
772 bne L0552
773 clr PD.CPR,y
774 L0552 puls b,cc
775 puls pc,u,y,x,a
776 *L0556 pshs y,x --BGP
777 L0556 pshs y ++BGP
778 ldy <D.Proc
779 lda <P$IOQN,y
780 beq L056D
781 clr <P$IOQN,y
782 ldb #S$Wake
783 os9 F$Send
784 os9 F$GProcP
785 clr P$IOQP,y
786 L056D clrb
787 * puls pc,y,x --BGP
788 puls pc,y ++BGP
789
790 FIRQ ldx R$X,u get ptr to IRQ packet
791 ldb ,x get flip byte
792 ldx 1,x get mask/priority byte
793 clra
794 pshs cc
795 pshs x,b
796 ldx <D.Init
797 ldb PollCnt,x
798 ldx <D.PolTbl
799 ldy R$X,u
800 beq L05C1
801 tst $01,s test mask byte on stack
802 beq L05EC
803 decb
804 lda #POLSIZ
805 mul
806 leax d,x point to last entry in table 1131 leax d,x point to last entry in table
807 lda Q$MASK,x 1132 ENDC
808 bne L05EC 1133 lda Q$MASK,x
809 orcc #IntMasks 1134 bne L0662
810 L0596 ldb $02,s get priority byte on stack 1135 orcc #IntMasks
811 cmpb -$01,x compare to priority of prev entry 1136 L060D ldb $02,s get priority byte
812 bcs L05A9 1137 cmpb -(POLSIZ-Q$PRTY),x compare with prev entry's prior
813 ldb #$09 1138 bcs L0620
814 L059E lda ,-x 1139 ldb #POLSIZ
815 sta $09,x 1140 L0615 lda ,-x
816 decb 1141 sta POLSIZ,x
817 bne L059E 1142 decb
818 cmpx <D.PolTbl 1143 bne L0615
819 bhi L0596 1144 cmpx <D.PolTbl
820 L05A9 ldd R$D,u 1145 bhi L060D
821 std Q$POLL,x 1146 L0620 ldd R$D,u get dev stat reg
822 ldd ,s++ get flip/byte off stack 1147 std Q$POLL,x save it
823 sta Q$FLIP,x store flip 1148 ldd ,s++ get flip/mask
824 stb Q$MASK,x store mask 1149 std Q$FLIP,x save it
825 ldb ,s+ get priority off stack 1150 ldb ,s+ get priority
826 stb Q$PRTY,x 1151 stb Q$PRTY,x
827 ldd R$Y,u get IRQ SVC entry 1152 IFNE H6309
828 std Q$SERV,x 1153 ldq R$Y,u
829 ldd R$U,u get IRQ static storage ptr 1154 stq Q$SERV,x
830 std Q$STAT,x 1155 ELSE
831 puls pc,cc 1156 ldd R$Y,u get IRQ svc addr
1157 std Q$SERV,x save
1158 ldd R$U,u get IRQ svc mem ptr
1159 std Q$STAT,x save
1160 ENDC
1161 puls pc,cc
832 * Remove the ISR 1162 * Remove the ISR
833 L05C1 leas $04,s clean up stack 1163 L0634 leas $04,s clean stack
834 ldy R$U,u 1164 ldy R$U,u
835 L05C6 cmpy Q$STAT,x 1165 L0639 cmpy Q$STAT,x
836 beq L05D2 1166 beq L0645
837 leax POLSIZ,x 1167 leax POLSIZ,x
838 decb 1168 decb
839 bne L05C6 1169 bne L0639
840 clrb 1170 clrb
841 rts 1171 rts
842 L05D2 pshs b,cc 1172 IFNE H6309
843 orcc #IntMasks 1173 L0645 orcc #IntMasks
844 bra L05DF 1174 decb
1175 beq L0654
1176 lda #POLSIZ
1177 mul
1178 tfr d,w
1179 leay POLSIZ,x
1180 tfm y+,x+
1181 L0654 ldw #POLSIZ
1182 clr ,-s
1183 tfm s,x+
1184 leas $01,s
1185 andcc #^IntMasks
1186 rts
1187 ELSE
1188 L0645 pshs b,cc
1189 orcc #IntMasks
1190 bra L0565
1191
845 * Move prev poll entry up one 1192 * Move prev poll entry up one
846 L05D8 ldb POLSIZ,x 1193 L055E ldb POLSIZ,x
847 stb ,x+ 1194 stb ,x+
848 deca 1195 deca
849 bne L05D8 1196 bne L055E
850 L05DF lda #POLSIZ 1197 L0565 lda #POLSIZ
851 dec 1,s dec poll count on stack 1198 dec 1,s dec count
852 bne L05D8 1199 bne L055E
853 L05E5 clr ,x+ 1200 L056B clr ,x+
854 deca 1201 deca
855 bne L05E5 1202 bne L056B
856 puls pc,a,cc 1203 puls pc,a,cc
857 L05EC leas $04,s 1204 ENDC
858 L05EE comb 1205
859 ldb #E$Poll 1206 L0662 leas $04,s
860 rts 1207 L0664 comb
861 1208 ldb #E$Poll
862 ****************************** 1209 rts
1210
1211 ***************************
863 * 1212 *
864 * Device polling routine 1213 * Device polling routine
865 * 1214 *
866 * Entry: None 1215 * Entry: None
867 * 1216 *
868 1217
869 L05F2 ldy <D.PolTbl Get pointer to polling table 1218 IRQPoll ldy <D.PolTbl get pointer to polling table
870 ldx <D.Init Get pointer to init module 1219 ldx <D.Init get pointer to init module
871 ldb PollCnt,x Get number of entries in table 1220 ldb PollCnt,x get number of entries in table
872 bra L0600 Get check em 1221 L066F lda [Q$POLL,y] get device's status register
873 L05FB leay POLSIZ,y Move to next entry 1222 eora Q$FLIP,y flip it
874 decb Done? 1223 bita Q$MASK,y origin of IRQ?
875 beq L05EE Yep, exit with polling table full error 1224 bne L067E yes, branch
876 L0600 lda [Q$POLL,y] Get device's status register 1225 L0677 leay POLSIZ,y else move to next entry
877 eora 2,y Flip it 1226 decb done?
878 bita 3,y Origin of IRQ? 1227 bne L066F no, get next one
879 beq L05FB No, go to next device 1228 bra L0664 else branch
880 ldu Q$STAT,y Get device static storage 1229 L067E ldu Q$STAT,y get device static storage
881 pshs y,b Preserve device # & poll address 1230 pshs y,b preserve device # & poll address
882 jsr [Q$SERV,y] Execute service routine 1231 jsr [<Q$SERV,y] execute service routine
883 puls y,b Restore device # & poll address 1232 puls y,b restore device # & poll address
884 bcs L05FB Go to next device if error 1233 bcs L0677 go to next device if error
885 rts Return 1234 rts return
886 1235
887 FNMLoad pshs u 1236 FNMLoad pshs u save caller's regs ptr
888 ldx R$X,u 1237 ldx R$X,u
889 lbsr L06B5 1238 lbsr LoadMod allocate proc desc
890 bcs L066C 1239 bcs L06E2
891 ldy ,s 1240 ldy ,s put caller's regs ptr in Y
892 stx $04,y 1241 stx R$X,y
893 ldy ,u 1242 ldy ,u
894 ldx $04,u 1243 ldx $04,u
895 ldd #$0006 1244 ldd #$0006
896 os9 F$LDDDXY 1245 os9 F$LDDDXY
897 * minor optimization 1246 leay ,u
898 * puls y --BGP 1247 puls u
899 * exg y,u --BGP 1248 bra L06BF
900 leay ,u ++BGP 1249
901 puls u ++BGP 1250 FNMLink ldx <D.Proc
902 bra L0649
903
904 FNMLink ldx <D.Proc
905 leay <P$DATImg,x 1251 leay <P$DATImg,x
906 pshs u 1252 pshs u
907 ldx R$X,u 1253 ldx R$X,u
908 lda R$A,u 1254 lda R$A,u
909 os9 F$FModul 1255 os9 F$FModul
910 bcs L066C 1256 bcs L06E2
911 leay ,u 1257 leay ,u
912 puls u 1258 puls u
913 stx R$X,u 1259 stx R$X,u
914 L0649 std R$D,u 1260 L06BF std R$A,u
915 ldx $06,y 1261 ldx MD$Link,y get link count
916 beq L0653 1262 beq L06C9
917 bitb #$80 1263 bitb #ReEnt reentrant?
918 beq L0669 1264 beq L06DF branch if so
919 L0653 leax $01,x 1265 L06C9 leax 1,x increment module link count
920 beq L0659 1266 beq L06CF branch if zero
921 stx $06,y 1267 stx MD$Link,y else save new link count
922 L0659 ldx $04,y 1268 L06CF ldx MD$MPtr,y get module pointer in X
923 ldy ,y 1269 ldy MD$MPDAT,y get module DAT image ptr
924 ldd #$000B 1270 ldd #$000B
925 os9 F$LDDDXY 1271 os9 F$LDDDXY
926 bcs L0668 1272 bcs L06DE
927 std $06,u 1273 std R$Y,u
928 L0668 rts 1274 L06DE rts
929 L0669 comb 1275 L06DF comb
930 ldb #E$ModBsy 1276 ldb #E$ModBsy
931 L066C puls pc,u 1277 L06E2 puls pc,u
932 1278
933 ****************************** 1279 FLoad pshs u place caller's reg ptr on stack
934 * 1280 ldx R$X,u get pathname to load
935 * F$Load Entry point 1281 bsr LoadMod allocate a process descriptor
936 * 1282 bcs L070F exit if error
937 * Entry: U = Callers register stack 1283 puls y get caller's reg ptr in Y
938 * 1284 L06EE pshs y preserve y
939 1285 stx R$X,y save updated pathlist
940 FLoad pshs u Save register stack pointer 1286 ldy ,u get DAT image pointer
941 ldx R$X,u Get pointer to pathname 1287 ldx $04,u get offset within DAT image
942 bsr L06B5 Aloocate a process descriptor 1288 ldd #$0006 get offset to the offset
943 bcs L0699 Exit if error 1289 os9 F$LDDDXY get language & type
944 puls y Restore register stack pointer 1290 ldx ,s get caller's reg ptr in X
945 L0678 pshs y Preserve Y 1291 std R$D,x update language/type codes
946 stx R$X,y Update pathname pointer 1292 leax ,u
947 ldy ,u Get DAT Image pointer 1293 os9 F$ELink
948 ldx $04,u Get offset within the DAT image 1294 bcs L070F
949 ldd #$0006 Get offset to the offset 1295 ldx ,s get caller's reg ptr in X
950 os9 F$LDDDXY Get language & type 1296 sty R$Y,x
951 ldx ,s Get register pointer 1297 stu R$U,x
952 std R$D,x Update language/type codes 1298 L070F puls pc,u
953 leax ,u 1299
954 os9 F$ELink 1300 IDetach0 pshs u save off regs ptr
955 bcs L0699 1301 ldx R$X,u get ptr to device name
956 ldx ,s 1302 bsr LoadMod
957 sty $06,x 1303 bcs L0729
958 stu $08,x 1304 puls y
959 L0699 puls pc,u 1305 ldd <D.Proc
960 1306 pshs y,b,a
961 IDetach0 pshs u 1307 ldd R$U,y
962 ldx R$X,u 1308 std <D.Proc
963 bsr L06B5 1309 bsr L06EE
964 bcs L06B3 1310 puls x
965 puls y 1311 stx <D.Proc
966 ldd <D.Proc 1312 L0729 puls pc,u
967 pshs y,b,a 1313
968 ldd $08,y 1314 * Load module from file
969 std <D.Proc 1315 * Entry: X = pathlist to file containing module(s)
970 bsr L0678 1316 * A fake process descriptor is created, then the file is
971 puls x 1317 * opened and validated into memory.
972 stx <D.Proc 1318
973 L06B3 puls pc,u 1319 LoadMod os9 F$AllPrc allocate proc desc
974 L06B5 os9 F$AllPrc 1320 bcc L0731
975 bcc L06BB 1321 rts
976 rts 1322 L0731 leay ,u point Y at new alloced mem
977 1323 ldu #$0000
978 L06BB leay ,u 1324 pshs u,y,x,b,a
979 ldu #$0000 1325 leas <-$11,s make a stack
980 pshs u,y,x,b,a 1326 clr $07,s
981 leas <-$11,s 1327 stu ,s save $0000
982 clr $07,s 1328 stu $02,s save $0000
983 stu ,s 1329 ldu <D.Proc get proc desc ptr
984 stu $02,s 1330 stu $04,s save onto stack
985 ldu <D.Proc 1331 clr $06,s
986 stu $04,s 1332 lda P$Prior,u get priority
987 clr $06,s 1333 sta P$Prior,y save
988 lda $0A,u 1334 sta P$Age,y and save as age
989 sta $0A,y 1335 lda #EXEC. from exec dir
990 sta $0B,y 1336 os9 I$Open open it
991 lda #EXEC. 1337 lbcs L07E1 branch if error
992 os9 I$Open 1338 sta $06,s else save path
993 lbcs L0770 1339 stx <$13,s put updated pathlist in X on stack
994 sta $06,s 1340 ldx <$15,s get proc desc in Y on stack
995 stx <$13,s 1341 os9 F$AllTsk allocate task
996 ldx <$15,s 1342 bcs L07E1
997 os9 F$AllTsk 1343 stx <D.Proc save off X into curr proc
998 lbcs L0770 1344 L0765 ldx <$15,s get proc desc in Y on stack
999 stx <D.Proc 1345 lda P$Prior,x get priority
1000 L06F1 ldx <$15,s 1346 adda #$08 add eight
1001 lda $0A,x 1347 bcc L0770 branch if not overflow
1002 adda #$08 1348 lda #$FF else load highest
1003 bcc L06FC 1349 L0770 sta P$Prior,x save back
1004 lda #$FF 1350 sta P$Age,x and age
1005 L06FC sta $0A,x 1351 ldd #$0009
1006 sta $0B,x 1352 ldx $02,s
1007 ldd #$0009 1353 lbsr L0866
1008 ldx $02,s 1354 bcs L07E1
1009 lbsr L07F7 1355 ldu <$15,s get proc desc in Y on stack
1010 bcs L0770 1356 lda P$Task,u
1011 ldu <$15,s 1357 ldb <D.SysTsk
1012 lda $06,u 1358 leau $08,s
1013 ldb <D.SysTsk 1359 pshs x
1014 leau $08,s 1360 ldx $04,s
1015 pshs x 1361 os9 F$Move
1016 ldx $04,s 1362 puls x
1017 os9 F$Move 1363 ldd M$ID,u
1018 puls x 1364 cmpd #M$ID12
1019 ldd ,u 1365 bne L07DF
1020 cmpd #M$ID12 1366 ldd M$Size,u
1021 bne L076E 1367 subd #M$IDSize
1022 ldd $02,u 1368 lbsr L0866
1023 subd #$0009 1369 bcs L07E1
1024 lbsr L07F7 1370 ldx $04,s
1025 bcs L0770 1371 lda P$Prior,x
1026 ldx $04,s 1372 ldy <$15,s get proc desc ptr
1027 lda $0A,x 1373 sta P$Prior,y
1028 ldy <$15,s 1374 sta P$Age,y
1029 sta $0A,y 1375 leay <P$DATImg,y
1030 sta $0B,y 1376 tfr y,d
1031 leay <$40,y 1377 ldx $02,s
1032 tfr y,d 1378 os9 F$VModul
1033 ldx $02,s 1379 bcc L07C0
1034 os9 F$VModul 1380 cmpb #E$KwnMod
1035 bcc L074C 1381 beq L07C6
1036 cmpb #$E7 1382 bra L07E1
1037 beq L0752 1383 L07C0 ldd $02,s
1038 bra L0770 1384 addd $0A,s
1039 L074C ldd $02,s 1385 std $02,s
1040 addd $0A,s 1386 * U = mod dir entry
1041 std $02,s 1387 L07C6 ldd <$17,s
1042 L0752 ldd <$17,s 1388 bne L0765
1043 bne L06F1 1389 ldd MD$MPtr,u
1044 ldd $04,u 1390 std <$11,s
1045 std <$11,s 1391 ldd [MD$MPDAT,u]
1046 * ldx ,u --BGP 1392 std <$17,s
1047 * ldd ,x --BGP 1393 ldd MD$Link,u
1048 ldd [,u] ++BGP 1394 IFNE H6309
1049 std <$17,s 1395 incd
1050 ldd $06,u 1396 ELSE
1051 addd #$0001 1397 addd #$0001
1052 beq L06F1 1398 ENDC
1053 std $06,u 1399 beq L0765
1054 bra L06F1 1400 std MD$Link,u
1055 L076E ldb #$CD 1401 bra L0765
1056 L0770 stb $07,s 1402 L07DF ldb #E$BMID
1057 ldd $04,s 1403 L07E1 stb $07,s
1058 beq L0778 1404 ldd $04,s
1059 std <D.Proc 1405 beq L07E9
1060 L0778 lda $06,s 1406 std <D.Proc
1061 beq L077F 1407 L07E9 lda $06,s
1062 os9 I$Close 1408 beq L07F0
1063 L077F ldd $02,s 1409 os9 I$Close close path to file
1064 addd #$1FFF 1410 L07F0 ldd $02,s
1065 lsra 1411 addd #$1FFF
1066 lsra 1412 lsra
1067 lsra 1413 lsra
1068 lsra 1414 lsra
1069 lsra 1415 lsra
1070 sta $02,s 1416 lsra
1071 ldb ,s 1417 sta $02,s
1072 beq L07AE 1418 ldb ,s
1073 lsrb 1419 beq L081D
1074 lsrb 1420 lsrb
1075 lsrb 1421 lsrb
1076 lsrb 1422 lsrb
1077 lsrb 1423 lsrb
1078 subb $02,s 1424 lsrb
1079 beq L07AE 1425 subb $02,s
1080 ldx <$15,s 1426 beq L081D
1081 leax <$40,x 1427 ldx <$15,s
1082 lsla 1428 leax <P$DATImg,x
1083 leax a,x 1429 lsla
1084 clra 1430 leax a,x
1085 tfr d,y 1431 leax $01,x
1086 ldu <D.BlkMap 1432 ldu <D.BlkMap
1087 L07A6 ldd ,x++ 1433 L0816 lda ,x++
1088 clr d,u 1434 clr a,u
1089 leay -$01,y 1435 decb
1090 bne L07A6 1436 bne L0816
1091 L07AE ldx <$15,s 1437 L081D ldx <$15,s
1092 lda ,x 1438 lda P$ID,x
1093 os9 F$DelPrc 1439 os9 F$DelPrc
1094 ldd <$17,s 1440 ldd <$17,s
1095 bne L07C3 1441 bne L0832
1096 ldb $07,s 1442 ldb $07,s
1097 stb <$12,s 1443 stb <$12,s
1098 comb 1444 comb
1099 bra L07F2 1445 bra L0861
1100 L07C3 ldu <D.ModDir 1446 L0832 ldu <D.ModDir
1101 ldx <$11,s 1447 ldx <$11,s
1102 ldd <$17,s 1448 ldd <$17,s
1103 leau -$08,u 1449 leau -MD$ESize,u
1104 L07CD leau $08,u 1450 L083C leau MD$ESize,u
1105 cmpu <D.ModEnd 1451 cmpu <D.ModEnd
1106 bcs L07DC 1452 bcs L084B
1107 comb 1453 comb
1108 ldb #$DD 1454 ldb #E$MNF
1109 stb <$12,s 1455 stb <$12,s
1110 bra L07F2 1456 bra L0861
1111 L07DC cmpx $04,u 1457 L084B cmpx MD$MPtr,u
1112 bne L07CD 1458 bne L083C
1113 cmpd [,u] 1459 cmpd [MD$MPDAT,u]
1114 bne L07CD 1460 bne L083C
1115 ldd $06,u 1461 ldd MD$Link,u
1116 beq L07EE 1462 beq L085D
1117 subd #$0001 1463 subd #$0001
1118 std $06,u 1464 std MD$Link,u
1119 L07EE stu <$17,s 1465 L085D stu <$17,s
1120 clrb 1466 clrb
1121 L07F2 leas <$11,s 1467 L0861 leas <$11,s
1122 puls pc,u,y,x,b,a 1468 puls pc,u,y,x,b,a
1123 L07F7 pshs y,x,b,a 1469
1470 L0866 pshs y,x,b,a
1124 addd $02,s 1471 addd $02,s
1125 std $04,s 1472 std $04,s
1126 cmpd $08,s 1473 cmpd $08,s
1127 bls L0858 1474 bls L08C2
1128 addd #$1FFF 1475 addd #$1FFF
1129 lsra 1476 lsra
1130 lsra 1477 lsra
1131 lsra 1478 lsra
1132 lsra 1479 lsra
1133 lsra 1480 lsra
1134 cmpa #$07 1481 cmpa #$07
1135 bhi L0838 1482 bhi L08A4
1136 ldb $08,s 1483 ldb $08,s
1137 lsrb 1484 lsrb
1138 lsrb 1485 lsrb
1139 lsrb 1486 lsrb
1140 lsrb 1487 lsrb
1141 lsrb 1488 lsrb
1142 pshs b 1489 IFNE H6309
1490 subr b,a
1491 lslb
1492 exg b,a
1493 ELSE
1494 pshs b
1143 exg b,a 1495 exg b,a
1144 subb ,s+ 1496 subb ,s+
1145 lsla 1497 lsla
1498 ENDC
1146 ldu <$1D,s 1499 ldu <$1D,s
1147 leau <$40,u 1500 leau <P$DATImg,u
1148 leau a,u 1501 leau a,u
1149 clra 1502 clra
1503 IFNE H6309
1504 tfr b,f
1505 ELSE
1150 tfr d,x 1506 tfr d,x
1151 ldy <D.BlkMap 1507 ENDC
1152 * clra --BGP 1508 ldy <D.BlkMap
1153 clrb 1509 clrb
1154 L082C tst ,y+ 1510 L0899 tst ,y+
1155 beq L083D 1511 beq L08A9
1156 L0830 addd #$0001 1512 L089D equ *
1513 IFNE H6309
1514 incd
1515 ELSE
1516 addd #$0001
1517 ENDC
1157 cmpy <D.BlkMap+2 1518 cmpy <D.BlkMap+2
1158 bne L082C 1519 bne L0899
1159 L0838 comb 1520 L08A4 comb
1160 ldb #E$MemFul 1521 ldb #E$MemFul
1161 bra L0862 1522 bra L08CC
1162 L083D inc -$01,y 1523 L08A9 inc -$01,y
1163 std ,u++ 1524 std ,u++
1164 * pshs b,a --BGP 1525 IFNE H6309
1165 * ldd $0A,s --BGP 1526 lde $08,s
1166 * addd #$2000 --BGP 1527 adde #$20
1167 * std $0A,s --BGP 1528 ste $08,s
1168 * puls b,a --BGP 1529 decf
1169 pshs a ++BGP 1530 ELSE
1170 lda 9,s ++BGP 1531 pshs a
1171 adda #$20 ++BGP 1532 lda $09,s
1172 sta 9,s ++BGP 1533 adda #$20
1173 puls a ++BGP 1534 sta $09,s
1535 puls a
1174 leax -1,x 1536 leax -1,x
1175 bne L0830 1537 ENDC
1538 bne L089D
1176 ldx <$1D,s 1539 ldx <$1D,s
1177 os9 F$SetTsk 1540 os9 F$SetTsk
1178 bcs L0862 1541 bcs L08CC
1179 L0858 lda $0E,s 1542 L08C2 lda $0E,s
1180 ldx $02,s 1543 ldx $02,s
1181 ldy ,s 1544 ldy ,s
1182 os9 I$Read 1545 os9 I$Read
1183 L0862 leas $04,s 1546 L08CC leas $04,s
1184 puls pc,x 1547 puls pc,x
1185 1548
1186 ****************************** 1549 ********************************
1187 * 1550 *
1188 * F$PErr System call entry point 1551 * F$PErr System call entry point
1189 * 1552 *
1190 * Entry: U = Register stack pointer 1553 * Entry: U = Register stack pointer
1191 * 1554 *
1192 1555
1193 ErrMess fcc /ERROR #/ 1556 ErrHead fcc /ERROR #/
1557 ErrNum equ *-ErrHead
1194 fcb $2F,$3A,$30 1558 fcb $2F,$3A,$30
1195 fcb C$CR 1559 fcb C$CR
1196 ErrMessL equ *-Errmess 1560 ErrMessL equ *-ErrHead
1197 1561
1198 FPErr ldx <D.Proc Get current process pointer 1562 FPErr ldx <D.Proc get current process pointer
1199 lda <P$Path+2,x Get standard error path 1563 lda <P$PATH+2,x get stderr path
1200 beq L08B8 Return if not there 1564 beq L0922 return if not there
1201 leas -ErrMessL,s Make a buffer on the stack 1565 leas -ErrMessL,s make room on stack
1202 leax <ErrMess,pcr Point to error text 1566 * copy error message to stack
1203 leay ,s Point to buffer 1567 leax <ErrHead,pcr point to error text
1204 L087F lda ,x+ Get a byte 1568 leay ,s point to buffer
1205 sta ,y+ Store it 1569 L08E9 lda ,x+ get a byte
1206 cmpa #C$CR Done? 1570 sta ,y+ store a byte
1207 bne L087F No, keep goin 1571 cmpa #C$CR done?
1208 ldb R$B,u Get error code 1572 bne L08E9 no, keep going
1209 1573 ldb R$B,u get error #
1210 * Convert error code to decimal 1574 * Convert error code to decimal
1211 1575 L08F3 inc ErrNum+0,s
1212 L0889 inc 7,s 1576 subb #$64
1213 subb #$64 1577 bcc L08F3
1214 bcc L0889 1578 L08F9 dec ErrNum+1,s
1215 L088F dec $08,s 1579 addb #$0A
1216 addb #$0A 1580 bcc L08F9
1217 bcc L088F 1581 addb #$30
1218 addb #$30 1582 stb ErrNum+2,s
1219 stb $09,s 1583 ldx <D.Proc get current process pointer
1220 1584 ldu P$SP,x get the stack pointer
1221 ldx <D.Proc Get current process pointer 1585 leau -ErrMessL,u put a buffer on it
1222 ldu P$SP,x Get the stack pointer 1586 lda <D.SysTsk get system task number
1223 leau -ErrMessL,u Put a buffer on it 1587 ldb P$Task,x get task number of process
1224 lda <D.SysTsk Get system task number 1588 leax ,s point to error text
1225 ldb P$Task,x Get task number of process 1589 ldy #ErrMessL get length of text
1226 leax ,s Point to error text 1590 L0913 os9 F$Move move it to the process
1227 ldy #ErrMessL Get length of text 1591 leax ,u point to the moved text
1228 L08A9 os9 F$Move Move it to the process 1592 ldu <D.Proc get process pointer
1229 leax ,u Point to the moved text 1593 lda <P$PATH+2,u get path number
1230 ldu <D.Proc Get process pointer 1594 os9 I$WritLn write the text
1231 lda <P$Path+2,u Get path number 1595 leas ErrMessL,s purge the buffer
1232 os9 I$WritLn Write the text 1596 L0922 rts return
1233 leas ErrMessL,s Purge the buffer 1597
1234 L08B8 rts Return 1598 FIOQu
1235 1599 IFNE H6309
1236 FIOQu ldy <D.Proc 1600 lde R$A,u
1237 L08BC lda <P$IOQN,y 1601 ENDC
1238 beq L08DF 1602 FIOQu2
1239 cmpa R$A,u 1603 ldy <D.Proc
1240 bne L08DA 1604 IFNE H6309
1241 clr <P$IOQN,y 1605 clrf
1242 os9 F$GProcP 1606 ENDC
1243 lbcs L093F 1607 L092B lda <P$IOQN,y
1244 clr $0F,y 1608 beq L094F
1245 ldb #S$Wake 1609 IFNE H6309
1246 os9 F$Send 1610 cmpr e,a
1247 ldu <D.Proc 1611 ELSE
1248 bra L08E8 1612 cmpa R$A,u
1249 L08DA os9 F$GProcP 1613 ENDC
1250 bcc L08BC 1614 bne L094A
1251 L08DF lda R$A,u 1615 IFNE H6309
1252 ldu <D.Proc 1616 stf <P$IOQN,y
1253 os9 F$GProcP 1617 ELSE
1254 bcs L093F 1618 clr <P$IOQN,y
1255 L08E8 leax ,y 1619 ENDC
1256 lda <P$IOQN,y 1620 os9 F$GProcP
1257 beq L090A 1621 bcs L09B1
1258 os9 F$GProcP 1622 IFNE H6309
1259 bcs L093F 1623 stf P$IOQP,y
1260 ldb P$Age,u 1624 ELSE
1261 cmpb P$Age,y minor queue sort bug fixed - BGP 1625 clr P$IOQP,y
1262 bls L08E8 1626 ENDC
1263 ldb P$ID,u 1627 ldb #S$Wake
1264 stb <P$IOQN,x 1628 os9 F$Send
1265 ldb P$ID,x 1629 ldu <D.Proc
1266 stb P$IOQP,u 1630 bra L0958
1267 clr P$IOQP,y 1631 L094A os9 F$GProcP
1268 exg y,u 1632 bcc L092B
1269 bra L08E8 1633 L094F
1270 L090A lda P$ID,u 1634 IFNE H6309
1271 sta <P$IOQN,y 1635 tfr e,a
1272 lda P$ID,y 1636 ELSE
1273 sta P$IOQP,u 1637 lda R$A,u
1274 ldx #$0000 1638 ENDC
1275 os9 F$Sleep 1639 ldu <D.Proc
1276 ldu <D.Proc 1640 os9 F$GProcP
1277 lda P$IOQP,u 1641 bcs L09B1
1278 beq L093D 1642 L0958 leax ,y
1279 os9 F$GProcP 1643 lda <P$IOQN,y
1280 bcs L093D 1644 beq L097A
1281 lda <P$IOQN,y 1645 os9 F$GProcP
1282 beq L093D 1646 bcs L09B1
1283 lda <P$IOQN,u 1647 ldb P$Age,u
1284 sta <P$IOQN,y 1648 cmpb P$Age,y FYI, was cmpd, bug in OS-9 Level Two from Tandy
1285 beq L093D 1649 bls L0958
1286 clr <P$IOQN,u 1650 ldb ,u
1287 os9 F$GProcP 1651 stb <P$IOQN,x
1288 bcs L093D 1652 ldb ,x
1289 lda P$IOQP,u 1653 stb P$IOQP,u
1290 sta P$IOQP,y 1654 IFNE H6309
1291 L093D clr P$IOQP,u 1655 stf P$IOQP,y
1292 L093F rts 1656 ELSE
1293 1657 clr P$IOQP,y
1294 emod 1658 ENDC
1295 eom equ * 1659 exg y,u
1296 end 1660 bra L0958
1297 1661 L097A lda ,u
1662 sta <P$IOQN,y
1663 lda ,y
1664 sta P$IOQP,u
1665 ldx #$0000
1666 os9 F$Sleep
1667 ldu <D.Proc
1668 lda P$IOQP,u
1669 beq L09B1
1670 os9 F$GProcP
1671 bcs L09AE
1672 lda <P$IOQN,y
1673 beq L09AE
1674 lda <P$IOQN,u
1675 sta <P$IOQN,y
1676 beq L09AE
1677 IFNE H6309
1678 stf <P$IOQN,u
1679 ELSE
1680 clr <P$IOQN,u
1681 ENDC
1682 os9 F$GProcP
1683 bcs L09AE
1684 lda P$IOQP,u
1685 sta P$IOQP,y
1686 L09AE
1687 IFNE H6309
1688 stf P$IOQP,u
1689 ELSE
1690 clr P$IOQP,u
1691 ENDC
1692 L09B1 rts
1693
1694 emod
1695 eom equ *
1696 end
1697