annotate level2/modules/kernel/ffmodul.asm @ 1948:7010c08050b7

Couldn't give yourself write permission to a file 'cause you didn't have write prmission, fixed.
author chrish
date Mon, 12 Dec 2005 03:13:04 +0000
parents 3e5e54b2a01a
children 039ddb7c8ad7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1345
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
1 **************************************************
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
2 * System Call: F$FModul
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
3 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
4 * Function: Find module directory entry
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
5 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
6 * Input: A = Module type
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
7 * X = Module name string pointer
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
8 * Y = Name string DAT image pointer
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
9 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
10 * Output: A = Module type
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
11 * B = Module revision
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
12 * X = Updated past name string
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
13 * U = Module directory entry pointer
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
14 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
15 * Error: CC = C bit set; B = error code
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
16 *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
17 FFModul pshs u preserve register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
18 lda R$A,u get module type
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
19 ldx R$X,u get pointer to name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
20 ldy R$Y,u get pointer to DAT image of name (from caller)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
21 bsr L068D go find it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
22 puls y restore register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
23 std R$D,y save type & revision
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
24 stx R$X,y save updated name pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
25 stu R$U,y save pointer to directory entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
26 rts return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
27
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
28 * Find module in module directory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
29 * Entry: A=Module type
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
30 * X=Pointer to module name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
31 * Y=DAT image pointer for module name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
32 L068D equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
33 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
34 tfr 0,u init directory pointer to nothing
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
35 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
36 ldu #$0000
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
37 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
38 pshs d,u preserve (Why B?)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
39 bsr L0712 Go find 1st char of module name requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
40 cmpa #PDELIM Is it a '/'?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
41 beq L070B yes, exit with error
1451
3e5e54b2a01a fprsnam.asm is now ported to Level 1
boisy
parents: 1345
diff changeset
42 lbsr ParseNam parse the name to find the end & length
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
43 bcs L070E error (illegal name), exit
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
44 ldu <D.ModEnd get module directory end pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
45 bra L0700 start looking for it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
46
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
47 * Main module directory search
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
48 * Entry: A=Module type
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
49 * B=Module name length
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
50 * X=Logical address of name in Caller's 64k space
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
51 * Y=DAT image of caller (for module name)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
52 * U=Module directory Entry ptr (current module being checked)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
53 L06A1 pshs d,x,y Preserve Mod type/nm len, Log. Addr, DAT Img ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
54 pshs x,y Preserve Log. addr & DAT Img ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
55 ldy MD$MPDAT,u Does the module have a DAT Image ptr?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
56 beq L06F6 no, skip module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
57 ldx MD$MPtr,u get module pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
58 pshs x,y Save module ptr & DAT Img ptr of module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
59 ldd #M$Name # bytes to go in to get module name ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
60 lbsr L0B02 Go get the module name ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
61 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
62 addr d,x add it to module start
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
63 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
64 leax d,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
65 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
66 pshs x,y preserve module name ptr & DAT pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
67 leax 8,s Point to addr of name we are searching for
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
68 ldb 13,s get name length
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
69 leay ,s point to module name name ptr within module DAT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
70 * Stack:
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
71 * 0-1,s = Ptr to module name within Module DAT Img
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
72 * 2-3,s = Ptr to module's DAT Img
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
73 * 4-5,s = Ptr to module start
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
74 * 6-7,s = Ptr to module's DAT Img
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
75 * 8-9,s = Ptr to name we are looking for in caller's 64K space
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
76 * A-B,s = Ptr to caller's DAT Img
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
77 * C,s = Module type we are looking for (0=don't care)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
78 * D,s = Length of module name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
79 * E-F,s = Ptr to name we are looking for in caller's 64K space
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
80 * 10-11,s = Ptr to caller's DAT Img
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
81 * 12,s = Module type looking for
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
82 * 13,s = ??? (B from entry)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
83 * 14-15,s = Module directory ptr (inited to 0)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
84 lbsr L07DE compare the names
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
85 leas 4,s purge stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
86 puls y,x restore module pointer & DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
87 leas 4,s purge stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
88 bcs L06FE name didn't match, skip ahead
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
89 ldd #M$Type
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
90 lbsr L0B02
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
91 sta ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
92 stb $07,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
93 lda $06,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
94 beq L06ED
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
95 anda #TypeMask
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
96 beq L06E1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
97 eora ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
98 anda #TypeMask
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
99 bne L06FE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
100 L06E1 lda $06,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
101 anda #LangMask
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
102 beq L06ED
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
103 eora ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
104 anda #LangMask
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
105 bne L06FE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
106 L06ED puls y,x,d
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
107 abx
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
108 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
109 ldb 1,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
110 leas 4,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
111 rts
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
112
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
113 L06F6 leas 4,s purge stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
114 ldd 8,s do we have a directory pointer?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
115 bne L06FE yes, skip ahead
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
116 stu 8,s save directory entry pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
117 L06FE puls d,x,y restore pointers
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
118 L0700 leau -MD$ESize,u move back 1 entry in module table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
119 cmpu <D.ModDir at the beginning?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
120 bhs L06A1 no, check entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
121 ldb #E$MNF get error code (module not found)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
122 fcb $8C skip 2 bytes
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
123
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
124 L070B ldb #E$BNam get error code
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
125 coma set carry for error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
126 L070E stb 1,s save error code for caller
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
127 puls d,u,pc return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
128
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
129 * Skip spaces in name string & return first character of name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
130 * Entry: X=Pointer to name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
131 * Y=DAT image pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
132 * Exit : A=First character of name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
133 * B=DAT image block offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
134 * X=Logical address of name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
135 L0712 pshs y preserve DAT image pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
136 L0714 lbsr AdjBlk0 adjust pointer to offset for mapping in
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
137 lbsr L0AC8 map in block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
138 leax 1,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
139 cmpa #C$SPAC space?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
140 beq L0714 yes, eat it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
141 leax -1,x move back to first character
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
142 L0720 pshs d,cc preserve char
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
143 tfr y,d copy DAT pointer to D
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
144 subd 3,s calculate DAT image offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
145 asrb divide it by 2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
146 lbsr CmpLBlk convert X to logical address in 64k map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
147 puls cc,d,y,pc restore & return