1204
|
1 ********************************************************************
|
|
2 * RBF - Random Block File Manager
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Modified for 6309 Native mode by Bill Nobel, L. Curtis Boyle & Wes Gale
|
|
7 *
|
|
8 * This also contains the patch for un-deleting files
|
|
9 *
|
|
10 * Undocumented SetStt/GetStt calls:
|
|
11 *
|
|
12 * GetStt:
|
|
13 * SS.FD ($0F) - Returns a file descriptor
|
|
14 * Entry: R$A=Path #
|
|
15 * R$B=SS.FD ($0F)
|
|
16 * R$X=Pointer to a 256 byte buffer
|
|
17 * R$Y=# bytes of FD required
|
|
18 * SS.FDInf ($20) - Directly reads a file descriptor from anywhere
|
|
19 * on drive.
|
|
20 * Entry: R$A=Path #
|
|
21 * R$B=SS.FDInf ($20)
|
|
22 * R$X=Pointer to a 256 byte buffer
|
|
23 * R$Y= MSB - Length of read
|
|
24 * LSB - MSB of logical sector #
|
|
25 * R$U= LSW of logical sector #
|
|
26 * SetStt:
|
|
27 * SS.FD ($0F) - Writes a file descriptor
|
|
28 * Entry: R$A=Path #
|
|
29 * R$B=SS.FD ($0F)
|
|
30 * R$X=Pointer to a maximum 256 byte buffer
|
|
31 * R$Y=# bytes of FD to write
|
|
32 * SS.Ticks ($10) - Set # ticks to wait for record lock release
|
|
33 * Entry: R$A=Path #
|
|
34 * R$B=SS.Ticks ($10)
|
|
35 * R$X=# Ticks to wait
|
|
36 * SS.Lock ($11) - Force Lock/Release of a file.
|
|
37 * Locks from current position to a specified size
|
|
38 * Entry: R$A=Path #
|
|
39 * R$B=SS.Lock ($11)
|
|
40 * R$X=LSW of end byte position
|
|
41 * R$U=MSW of end byte position
|
|
42 * SS.Attr ($1C) - Allows changing of file/directory attributes
|
|
43 * If changing directory attribute it scans to
|
|
44 * see if directory is empty.
|
|
45 * Entry: R$A=Path #
|
|
46 * R$B=SS.Attr ($1C)
|
|
47 * R$X= LSB - File attributes
|
|
48 * SS.RsBit ($1E) - Reserve bitmap sector (doesn't allocate)
|
|
49 * Locks the bitmap sector from other programs
|
|
50 * so they cannot allocate in it.
|
|
51 * Useful when working in allocation map.
|
|
52 * Entry: R$A=Path #
|
|
53 * R$B=SS.RsBit ($1E)
|
|
54 * R$X= LSB - Sector # of bitmap
|
|
55 *
|
|
56 * Ed. Comments Who YY/MM/DD
|
|
57 * ------------------------------------------------------------------
|
|
58 * ??? Started putting in comments from buggy 1.09 ??? 93/09/19
|
|
59 * code
|
|
60 * ??? Fixed WP error bug on file delete ??? 93/09/19
|
|
61 * Fixed FD read error bug in delete
|
|
62 * ??? Fixed long overdue LHA bug ??? 94/07/15
|
|
63 * Modified M$Exec driver calls @ L11EB to use
|
|
64 * V$DRIVEX
|
|
65 * ??? Changed L11EB to just PSHS/PULS A,X,PC ??? 94/07/27
|
|
66 * instead of D,X,PC (saves 2 cycles per
|
|
67 * driver call)
|
|
68 * Changed BRA L12C6 @ L128E to PULS PC,U,X
|
|
69 * ??? NitrOS-9 2.00 distribution ??? ??/??/??
|
|
70 * 35 Fixed FD.SEG bug GH ??/??/??
|
|
71 * Folded RBF 30 comments into this version BGP 03/04/21
|
1529
|
72 * 36 Fix for LSN0 DD.TOT=0 lockout problem RVH 03/05/01
|
1204
|
73
|
|
74 nam RBF
|
|
75 ttl Random Block File Manager
|
|
76
|
|
77 ifp1
|
|
78 use defsfile
|
|
79 endc
|
|
80
|
|
81 rev set $01
|
|
82 ty set FlMgr
|
|
83 IFNE H6309
|
|
84 lg set Obj6309
|
|
85 ELSE
|
|
86 lg set Objct
|
|
87 ENDC
|
|
88 tylg set ty+lg
|
|
89 atrv set ReEnt+rev
|
1529
|
90 edition set 36
|
1204
|
91
|
|
92 org $00
|
|
93 size equ .
|
|
94
|
|
95 mod eom,name,tylg,atrv,start,size
|
|
96
|
|
97 name fcs /RBF/
|
|
98 fcb edition
|
|
99
|
1529
|
100 *L0012 fcb DRVMEM (inlined RBF36)
|
1204
|
101
|
|
102
|
|
103 ****************************
|
|
104 *
|
|
105 * Main entry point for RBF
|
|
106 *
|
|
107 * Entry: Y = Path descriptor pointer
|
|
108 * U = Register stack pointer
|
|
109
|
|
110 start bra Create
|
|
111 nop
|
|
112 lbra Open
|
|
113 lbra MakDir
|
|
114 lbra ChgDir
|
|
115 lbra Delete
|
|
116 lbra Seek
|
|
117 lbra Read
|
|
118 lbra Write
|
|
119 lbra ReadLn
|
|
120 lbra WriteLn
|
|
121 lbra GetStat
|
|
122 lbra SetStat
|
|
123 lbra Close
|
|
124
|
|
125
|
|
126 *
|
|
127 * I$Create Entry Point
|
|
128 *
|
|
129 * Entry: A = access mode desired
|
|
130 * B = file attributes
|
|
131 * X = address of the pathlist
|
|
132 *
|
|
133 * Exit: A = pathnum
|
|
134 * X = last byte of pathlist address
|
|
135 *
|
|
136 * Error: CC Carry set
|
|
137 * B = errcode
|
|
138 *
|
|
139 Create pshs y Preserve path desc ptr
|
|
140 leas -$05,s Make 5 byte buffer on stack
|
|
141 IFNE H6309
|
|
142 aim #^DIR.,R$B,u
|
|
143 ELSE
|
|
144 lda R$B,u force directory bit off
|
|
145 anda #^DIR.
|
|
146 sta R$B,u
|
|
147 ENDC
|
|
148 lbsr FindFile try & find it in directory
|
|
149 bcs Creat47 branch if doesn't exist
|
|
150
|
|
151 * File already exists
|
|
152 ldb #E$CEF else exists error
|
|
153 Creat47 cmpb #E$PNNF not found?
|
|
154 bne Creat7E
|
|
155
|
|
156 * File doesn't exist, create it
|
|
157 cmpa #PDELIM full path?
|
|
158 beq Creat7E yes, return
|
|
159 pshs x preserve filename pointer
|
|
160 ldx PD.RGS,y get register stack pointer
|
|
161 stu R$X,x save updated pathname pointer
|
|
162 * These 4 did have < in front, made 3 byte cmnds but some are 2!
|
|
163 ldb PD.SBP,y get physical sector # of segment list
|
|
164 ldx PD.SBP+1,y
|
|
165 lda PD.SSZ,y get size of segment list in bytes
|
|
166 ldu PD.SSZ+1,y
|
|
167 pshs u,x,b,a preserve it all
|
|
168 ldx PD.RGS,y get register stack pointer
|
|
169 * Calculate default file size, if enabled
|
|
170 * This sets D to 0 if bit 5 of R$A is NOT set. If bit 5 of R$A is set
|
|
171 * when called, register Y will contain a default file size
|
|
172 lda R$A,x get file mode (read/write/update)
|
|
173 clrb
|
|
174 anda #PEXEC. bit 5 set?
|
|
175 beq Creat6E no, skip ahead
|
|
176 ldd R$Y,x get default file size
|
|
177 * account for FD sector, I think.
|
|
178 * changed from addd #1, bcc, ldd #$FFFF.
|
|
179 * The INCD gets D=$0000 (and CC.Z set) if it overflows from $FFFF->$0000
|
|
180 * then if it's zero, a DECD forces it to be $FFFF
|
|
181 Creat6E addd #1 above 64k in size? (bug fix, thanks Gene K.)
|
|
182 bcc Creat75 no, skip ahead: changed from BCC
|
|
183 ldd #$FFFF force it to 64k
|
|
184 Creat75 lbsr FatScan find the space in the allocation map
|
|
185 bcc Creat83 got it, skip ahead
|
|
186 leas 6,s purge segment sizes from stack
|
|
187 * and fall through to routine which returns with an error.
|
|
188
|
|
189 Creat7C leas 2,s purge user's pathname pointer
|
|
190 Creat7E leas 5,s purge local data
|
|
191 lbra ErMemRtn return with error
|
|
192
|
|
193 * Create the file
|
|
194 Creat83 std $0B,s save segment size
|
|
195 ldb PD.SBP,y save segment physical sector # in path desc.
|
|
196 ldx PD.SBP+1,y starting LSN
|
|
197 stb $08,s on stack too
|
|
198 stx $09,s
|
|
199 puls u,x,b,a restore segment physical sector # & sizes
|
|
200 stb PD.SBP,y save it as current
|
|
201 stx PD.SBP+1,y
|
|
202 sta PD.SSZ,y
|
|
203 stu PD.SSZ+1,y
|
|
204 * Find empty slot in directory sector for new file
|
|
205 IFNE H6309
|
|
206 ldq PD.DCP,y get directory entry pointer for new file
|
|
207 stq PD.CP,y save it as current file pointer
|
|
208 ELSE
|
|
209 ldd PD.DCP,y
|
|
210 std PD.CP,y
|
|
211 ldd PD.DCP+2,y
|
|
212 std PD.CP+2,y
|
|
213 ENDC
|
|
214 lbsr L0957 move entry into sector buffer
|
|
215 bcs CreatB5
|
|
216 CreatAC tst ,x file exist here already?
|
|
217 beq CreatC7 no, found empty slot, skip ahead
|
|
218 lbsr L0942 point to next entry
|
|
219 bcc CreatAC try again
|
|
220 CreatB5 cmpb #E$EOF end of directory?
|
|
221 bne Creat7C no, return error
|
|
222 * Create the directory entry for new file
|
|
223 ldd #DIR.SZ get size of directory entry
|
|
224 lbsr Writ599 add it to size of directory
|
|
225 bcs Creat7C out of alloc?
|
|
226 lbsr MDir263 set file size in file descriptor
|
|
227 lbsr L0957 read in a directory sector
|
|
228 CreatC7 leau ,x point to directory entry
|
|
229 lbsr Creat169 clear it out
|
|
230 puls x restore pathname pointer
|
|
231 os9 F$PrsNam parse it to get filename
|
|
232 bcs Creat7E
|
|
233 cmpb #29 length of name right size?
|
|
234 bls CreatD9 yes, skip ahead
|
|
235 ldb #29 else force it to 29 chars
|
|
236 CreatD9 clra move length to Y
|
|
237 tfr d,y
|
|
238 lbsr Writ5CB move name of file to directory entry
|
|
239 tfr y,d move length of name to D
|
|
240 ldy $05,s restore PDpointer
|
|
241 decb subtract 1 off length
|
|
242 IFNE H6309
|
|
243 oim #$80,b,u set high bit on last char of name
|
|
244 ELSE
|
|
245 lda b,u
|
|
246 ora #$80
|
|
247 sta b,u
|
|
248 ENDC
|
|
249 ldb ,s get logical sector # of file desc
|
|
250 ldx $01,s
|
|
251 stb DIR.FD,u save it into directory entry
|
|
252 stx DIR.FD+1,u
|
|
253 lbsr L1205 flush sector to disk
|
|
254 bcs Creat151
|
|
255 * Setup file descriptor
|
|
256 ldu PD.BUF,y get sector buffer pointer
|
|
257 bsr Creat170 clear it out
|
|
258 lda #FDBUF get file descriptor in buffer flag
|
|
259 sta PD.SMF,y save it as current sector buffer state
|
|
260 ldx PD.RGS,y get register stack pointer
|
|
261 lda R$B,x get file attributes
|
|
262 sta FD.ATT,u save it as current attributes
|
|
263 ldx <D.Proc get process pointer
|
|
264 ldd P$User,x get user #
|
|
265 std FD.OWN,u save creation user
|
|
266 lbsr L02D1 place date & time into file descriptor
|
|
267 ldd FD.DAT,u get date last modified
|
|
268 std FD.Creat,u save it as creation date (since we just made it)
|
|
269 ldb FD.DAT+2,u
|
|
270 stb FD.Creat+2,u
|
|
271 ldb #$01 get link count
|
|
272 stb FD.LNK,u
|
|
273 ldd 3,s get segment size in sectors
|
|
274 IFNE H6309
|
|
275 decd is it 1?
|
|
276 ELSE
|
|
277 subd #$0001
|
|
278 ENDC
|
|
279 beq Creat131 yes, skip ahead
|
|
280 leax FD.SEG,u point to the start of the segment list
|
|
281 std FDSL.B,x save segment size
|
|
282 ldd 1,s get LSW of physical sector # of seg start
|
|
283 addd #1 we need to carry below, fr the adcb! (bug fix, thanks Gene K.)
|
|
284 std FDSL.A+1,x save LSW
|
|
285 ldb ,s get MSB of physical sector # of segment start
|
|
286 adcb #$00 need carry status of addd above
|
|
287 stb FDSL.A,x save MSB
|
|
288 Creat131 ldb ,s get p hysical sector # of segment start
|
|
289 ldx 1,s
|
|
290 lbsr L1207 flush file descriptor to disk
|
|
291 bcs Creat151
|
|
292 lbsr L0A90 sort out any ocnflict for this sector
|
|
293 stb PD.FD,y save file descriptor physical sector # to pd
|
|
294 stx PD.FD+1,y
|
|
295 lbsr L0A2A update file/record lock for this sector
|
|
296 leas $05,s purge sector buffer from stack
|
|
297 ldx PD.Exten,y get path extension pointer
|
|
298 lda #EofLock set the file to EOF lock
|
|
299 sta PE.Lock,x
|
|
300 bra Open1CC
|
|
301 * Error on fD write to disk
|
|
302 Creat151 puls u,x,a restore segment start & size
|
|
303 sta PD.SBP,y put it into path descriptor
|
|
304 stx PD.SBP+1,y
|
|
305 clr PD.SSZ,y
|
|
306 stu PD.SSZ+1,y
|
|
307 pshs b save error code
|
|
308 lbsr ClrFBits
|
|
309 puls b restore error code
|
|
310 RtnMemry lbra ErMemRtn return with error
|
|
311
|
|
312 * Clear out directory entry
|
|
313 * Entry: U = Directory entry pointer
|
|
314 Creat169
|
|
315 IFNE H6309
|
|
316 ldw #DIR.SZ get size of directory entry (name & LSN of FD)
|
|
317 ELSE
|
1513
|
318 ldd #DIR.SZ A = 0 so clear loop passes once +BGP+
|
1204
|
319 ENDC
|
|
320 bra Creat174 clear it out
|
|
321
|
|
322 * Clear out sector buffer
|
|
323 * Entry: U = Sector buffer pointer
|
|
324 Creat170
|
|
325 IFNE H6309
|
|
326 ldw #$0100 get size of sector buffer
|
|
327 ELSE
|
|
328 clrb
|
1209
|
329 ENDC
|
1513
|
330 lbsr SSBits +BGP+
|
1204
|
331 Creat174 pshs u,x preserve regs
|
1209
|
332 IFNE H6309
|
|
333 leax <Creat170+3,pcr point to NULL byte
|
1513
|
334 CreatL tfm x,u+ clear buffer
|
|
335 deca +BGP+
|
|
336 bpl CreatL +BGP+
|
1209
|
337 ELSE
|
1204
|
338 l1 clr ,u+
|
|
339 decb
|
|
340 bne l1
|
1513
|
341 deca +BGP+
|
|
342 bpl l1 +BGP+
|
1204
|
343 ENDC
|
|
344 puls pc,u,x restore & return
|
|
345
|
|
346
|
|
347 *
|
|
348 * I$Open Entry Point
|
|
349 *
|
|
350 * Entry: A = access mode desired
|
|
351 * X = address of the pathlist
|
|
352 *
|
|
353 * Exit: A = pathnum
|
|
354 * X = last byte of pathlist address
|
|
355 *
|
|
356 * Error: CC Carry set
|
|
357 * B = errcode
|
|
358 *
|
|
359 Open pshs y preserve path descriptor pointer
|
|
360 lbsr FindFile try & find the file in current directory
|
|
361 bcs RtnMemry couldn't find it, return error
|
|
362 ldu PD.RGS,y get register stack pointer
|
|
363 stx R$X,u save updated pathname pointer
|
|
364 ldd PD.FD+1,y do we have a file descriptor?
|
|
365 bne Open1BB
|
|
366 lda PD.FD,y
|
|
367 bne Open1BB yes, skip ahead
|
|
368 * File descriptor doesn't exist
|
|
369 ldb PD.MOD,y get current file mode
|
|
370 andb #DIR. is it a directory?
|
|
371 lbne Clos29D yes, return not accessible eror
|
|
372 std PD.SBP,y set segment physical start to 0
|
|
373 sta PD.SBP+2,y
|
|
374 std PD.SBL,y do logical as well
|
|
375 sta PD.SBL+2,y
|
|
376 ldx PD.DTB,y get pointer to drive table
|
|
377 lda DD.TOT+2,x get total # sectors on drive
|
1529
|
378 * resave nonzero DD.TOT here and recopy
|
|
379 OpenFix equ *
|
1204
|
380 std PD.SIZ+2,y copy it to file size (B=0)
|
|
381 sta PD.SSZ+2,y copy it to segment size as well
|
|
382 ldd DD.TOT,x
|
|
383 std PD.SIZ,y
|
|
384 std PD.SSZ,y
|
1529
|
385 * BUG FIX: handle special case of DD.TOT=0 in LSN0 which blocks
|
|
386 * all subsequent accesses. NOTE: since we can only access LSN0
|
|
387 * for any non-zero value, set DD.TOT=1 to avoid NOT READY error.
|
|
388 bne OpenRet MSW nonzero, OK
|
|
389 lda DD.TOT+2,x MSW=0, check LSB
|
|
390 bne OpenRet LSB nonzero, OK
|
|
391 inca DD.TOT=0, make it 1
|
|
392 sta DD.TOT+2,x fix drive table
|
|
393 bra OpenFix and resave (B=0)
|
|
394 OpenRet puls pc,y restore & return
|
1204
|
395
|
|
396 Open1BB lda PD.MOD,y get file mode
|
|
397 lbsr ChkAttrs can user access file?
|
|
398 bcs RtnMemry no, return no permission error
|
|
399 bita #WRITE. open for write?
|
|
400 beq Open1CC no, skip ahead
|
|
401 lbsr L02D1 update last date modified to current
|
|
402 lbsr L11FD update file descriptor on disk
|
|
403 Open1CC puls y restore path descriptor pointer
|
|
404
|
|
405 * Update the path descriptor from the FD sector pointed to by U
|
|
406 Open1CE
|
|
407 IFNE H6309
|
|
408 clrd get a 16 bit zero value
|
|
409 ELSE
|
|
410 clra
|
|
411 clrb
|
|
412 ENDC
|
|
413 std PD.CP+2,y set seek pointer to start of file
|
|
414 std PD.CP,y
|
|
415 std PD.SBL,y set segment start
|
|
416 sta PD.SBL+2,y
|
|
417 sta PD.SSZ,y set segment size
|
|
418 lda FD.ATT,u get file attributes
|
|
419 sta PD.ATT,y put it into path descriptor
|
|
420 ldd FD.SEG,u get the file's segment start sector #
|
|
421 std PD.SBP,y
|
|
422 lda FD.SEG+2,u
|
|
423 sta PD.SBP+2,y
|
|
424 ldd FD.SEG+FDSL.B,u
|
|
425 std PD.SSZ+1,y
|
|
426 * ldq FD.SIZ,u
|
|
427 ldd FD.SIZ,u get file size
|
|
428 ldx FD.SIZ+2,u
|
|
429 ldu PD.Exten,y get path extension pointer
|
|
430 cmpu PE.Confl,u head of the conflict tree?
|
|
431 beq Open209 yes, skip ahead
|
|
432 ldu PE.Confl,u get the conflicting path ext. pointer
|
|
433 ldu PE.PDptr,u get back pointer to the PD of conflicting process
|
|
434 * ldq PD.SIZ,u
|
|
435 ldd PD.SIZ,u get his size instead
|
|
436 ldx PD.SIZ+2,u
|
|
437 * stq PD.SIZ,y
|
|
438 Open209 std PD.SIZ,y set file size in path descriptor of caller
|
|
439 stx PD.SIZ+2,y
|
|
440 clr PD.SMF,y clear the state flags
|
|
441 rts return
|
|
442
|
|
443
|
|
444 *
|
|
445 * I$MakDir Entry Point
|
|
446 *
|
|
447 * Entry: X = address of the pathlist
|
|
448 *
|
|
449 * Exit: X = last byte of pathlist address
|
|
450 *
|
|
451 * Error: CC Carry set
|
|
452 * B = errcode
|
|
453 *
|
|
454 MakDir lbsr Create create a file descriptor
|
|
455 bcs MDir261 problem, return error
|
|
456 lda PD.ATT,y get attributes
|
|
457 ora #SHARE. set shareable bit
|
|
458 lbsr ChkAttrs can user access directory?
|
|
459 bcs MDir261 no, return error
|
|
460 ldd #DIR.SZ*2 get default directory size (for '.' & '..')
|
|
461 std PD.SIZ+2,y save it in path descriptor (MSW set to 0)
|
|
462 bsr MDir273 write out file descriptor
|
|
463 bcs MDir261 error, return
|
|
464 lbsr L0C6F
|
|
465 bcs MDir261
|
|
466 lbsr RdFlDscr read in file descriptor
|
|
467 ldu PD.BUF,y get pointer to file descriptor
|
|
468 IFNE H6309
|
|
469 oim #DIR.,FD.ATT,u set directory bit in attributes
|
|
470 ELSE
|
|
471 lda FD.ATT,u
|
|
472 ora #DIR.
|
|
473 sta FD.ATT,u
|
|
474 ENDC
|
|
475 bsr MDir266
|
|
476 bcs MDir261
|
|
477 lbsr Creat170 clear out sector
|
|
478 ldd #$2EAE get directory entry name for current & parent dir
|
|
479 std ,u save parent name
|
|
480 stb DIR.SZ,u save current name
|
|
481 * This is smaller and faster than the old method
|
|
482 * ldq PD.DFD-1,y get directory FD pointer into low 24-bits of Q
|
|
483 * clra make sure high byte is zero
|
|
484 * stq DIR.FD-1,u save in the dir: '.' and '..' have <28 char names
|
|
485 lda PD.DFD,y
|
|
486 sta DIR.FD,u
|
|
487 ldd PD.DFD+1,y
|
|
488 std DIR.FD+1,u
|
|
489 * ldq PD.FD-1,y get current FD into lower 24-bits of Q
|
|
490 * clra ensure high byte is zero
|
|
491 * stq DIR.SZ+DIR.FD-1,u save in the directory
|
|
492 lda PD.FD,y
|
|
493 sta DIR.SZ+DIR.FD,u
|
|
494 ldd PD.FD+1,y
|
|
495 std DIR.SZ+DIR.FD+1,u
|
|
496
|
|
497 lbsr L1205 flush new directory ssector to disk
|
|
498 MDir261 bra Rt100Mem return to system all ok
|
|
499
|
|
500 * Set new file size in file descriptor
|
|
501 * Entry: None
|
|
502 * Exit : New file size set in file descriptor on disk
|
|
503 MDir263 lbsr RdFlDscr read in file descriptor
|
|
504 MDir266 ldx PD.BUF,y get sector pointer
|
|
505 IFNE H6309
|
|
506 ldq PD.SIZ,y get current file size
|
|
507 stq FD.SIZ,x save it in file descriptor
|
|
508 ELSE
|
|
509 ldd PD.SIZ,y
|
|
510 std FD.SIZ,x
|
|
511 ldd PD.SIZ+2,y
|
|
512 std FD.SIZ+2,x
|
|
513 ENDC
|
|
514 clr PD.SMF,y clear state flags
|
|
515 MDir273 lbra L11FD
|
|
516
|
|
517
|
|
518 *
|
|
519 * I$Close Entry Point
|
|
520 *
|
|
521 * Entry: A = path number
|
|
522 *
|
|
523 * Exit:
|
|
524 *
|
|
525 * Error: CC Carry set
|
|
526 * B = errcode
|
|
527 *
|
|
528 Close clra
|
|
529 tst PD.CNT,y any open paths?
|
|
530 bne Clos29C yes, return
|
|
531 lbsr L1237 flush current sector of needed
|
|
532 bcs Rt100Mem error, skip ahead
|
|
533 ldb PD.MOD,y get access mode
|
|
534 bitb #WRITE. is it write?
|
|
535 beq Rt100Mem no, skip ahead
|
|
536 ldd PD.FD,y
|
|
537 bne Clos290
|
|
538 lda PD.FD+2,y
|
|
539 beq Rt100Mem
|
|
540 Clos290 bsr MDir263 set new file size in file descriptor
|
|
541 lbsr Gst5E5 reached EOF?
|
|
542 bcc Rt100Mem no, skip ahead
|
|
543 lbsr L0EFE
|
|
544 bra Rt100Mem skip ahead
|
|
545 Clos29C rts return
|
|
546 * Return file not accessible error
|
|
547 Clos29D ldb #E$FNA
|
|
548 ErMemRtn coma
|
|
549 Clos2A0 puls y
|
|
550
|
|
551 * Generalized return to system
|
|
552 Rt100Mem pshs b,cc preserve error status
|
|
553 ldu PD.BUF,y get sector buffer pointer
|
|
554 beq RtMem2CF none, skip ahead
|
1513
|
555 lbsr SSize +BGP+
|
|
556 * ldd #$0100 get size of sector buffer -BGP-
|
1204
|
557 os9 F$SRtMem return the memory to system
|
|
558 ldx PD.Exten,y get path extension pointer
|
|
559 beq RtMem2CF none, return
|
|
560 lbsr L0A90 scan conflict list?
|
|
561 lda PE.PE,x return path extension to system
|
|
562 ldx <D.PthDBT
|
|
563 os9 F$Ret64
|
|
564 RtMem2CF puls pc,b,cc restore error status & return
|
|
565
|
|
566 * Place date & time into file descriptor
|
|
567 L02D1 lbsr RdFlDscr read in file descriptor sector
|
|
568 ldu PD.BUF,y get pointer to it
|
|
569 lda FD.LNK,u get link count
|
|
570 ldx <D.Proc get current process pointer
|
|
571 pshs x,a preserve 'em
|
|
572 ldx <D.SysPrc switch to system process descriptor
|
|
573 stx <D.Proc
|
|
574 leax FD.DAT,u point to date last modified
|
|
575 os9 F$Time put currenttime there
|
|
576 * Gene Heskett's STUPID "LDA #$01, STA $00FF,u" CRAP went here. DAMN DAMN DAMN
|
|
577 * He's NEVER getting the RBF source again!
|
|
578 puls x,a restore link count & current process
|
|
579 stx <D.Proc
|
|
580 sta FD.LNK,u
|
|
581 rts return
|
|
582
|
|
583
|
|
584 *
|
|
585 * I$ChgDir Entry Point
|
|
586 *
|
|
587 * Entry:
|
|
588 *
|
|
589 * Exit:
|
|
590 *
|
|
591 * Error: CC Carry set
|
|
592 * B = errcode
|
|
593 *
|
|
594 ChgDir pshs y preserve path descriptor pointer
|
|
595 IFNE H6309
|
|
596 oim #$80,PD.MOD,y ensure the directory bit is set
|
|
597 ELSE
|
|
598 lda PD.MOD,y
|
|
599 ora #$80
|
|
600 sta PD.MOD,y
|
|
601 ENDC
|
|
602 lbsr Open go open the directory
|
|
603 bcs Clos2A0 exit on error
|
|
604 ldx <D.Proc get current process pointer
|
|
605 ldu PD.FD+1,y get LSW of file descriptor sector #
|
|
606 ldb PD.MOD,y get current file mode
|
|
607 bitb #UPDAT. read or write mode?
|
|
608 beq CD30D no, skip ahead
|
|
609 * Change current data dir
|
|
610 ldb PD.FD,y
|
|
611 stb P$DIO+3,x
|
|
612 stu P$DIO+4,x
|
|
613 CD30D ldb PD.MOD,y get current file mode
|
|
614 bitb #EXEC. is it execution dir?
|
|
615 beq CD31C no, skip ahead
|
|
616 * Change current execution directory
|
|
617 ldb PD.FD,y
|
|
618 stb P$DIO+9,x
|
|
619 stu P$DIO+10,x
|
|
620 CD31C clrb clear errors
|
|
621 bra Clos2A0 return to system
|
|
622
|
|
623
|
|
624 *
|
|
625 * I$Delete Entry Point
|
|
626 *
|
|
627 * Entry:
|
|
628 *
|
|
629 * Exit:
|
|
630 *
|
|
631 * Error: CC Carry set
|
|
632 * B = errcode
|
|
633 *
|
|
634 * NOTE: Bug for write protected disk has been fixed - 93/09/19
|
|
635 *
|
|
636 Delete pshs y preserve path descriptor pointer
|
|
637 lbsr FindFile does the file exist?
|
|
638 bcs Clos2A0 no, return error
|
|
639 ldd PD.FD+1,y do we have a file descriptor?
|
|
640 bne Del332 yes, skip ahead
|
|
641 tst PD.FD,y
|
|
642 IFNE H6309
|
|
643 beq Clos29D no, return not accessible error
|
|
644 ELSE
|
|
645 lbeq Clos29D
|
|
646 ENDC
|
|
647 Del332 lda #SHARE.+WRITE. get attributes to check
|
|
648 lbsr ChkAttrs can user delete ths file?
|
|
649 lbcs Clos2A0 no, return error
|
|
650 ldu PD.RGS,y get registered stack pointer
|
|
651 stx R$X,u save updated pathname pointer
|
|
652 lbsr RdFlDscr read in file descriptor
|
|
653 * BUG FIX: Below used to read 'lbcs L03D4' which expects the file descriptor
|
|
654 * sector # & a temporary buffer to be stored on the stack but it
|
|
655 * isn't there yet. Restored back to RBF 28 error handling
|
|
656 * lbcs L02B2 error, return to system (FD read error fix)
|
|
657 lbcs Del3D4 error, rturn to system (FD read error fix)
|
|
658 ldx PD.BUF,y get pointer to the file descriptor
|
|
659 dec FD.LNK,x decrement link count
|
|
660 beq Del358 down to zero, delete the file descriptor
|
|
661 lbsr L11FD write updated file descriptor
|
|
662 pshs u,x,b
|
|
663 IFNE H6309
|
|
664 clrd
|
|
665 ELSE
|
|
666 clra
|
|
667 clrb
|
|
668 ENDC
|
|
669 std $03,s
|
|
670 bra Del39F
|
|
671
|
1209
|
672
|
|
673 * Return Sector Size bits
|
|
674 * Entry:
|
|
675 * Y = path desc ptr
|
|
676 * Exit:
|
|
677 * A = sector size (0 = 256, 1 = 512, 2 = 1024, 3 = 2048)
|
|
678 SSBits lda PD.TYP,y get type byte
|
|
679 anda #TYP.SSM mask out non-sector size bits
|
|
680 lsra shift bits into place
|
|
681 rts
|
|
682
|
|
683
|
|
684 * Sector Size mask table
|
|
685 SSTable fcb $01,$02,$04,$08
|
|
686
|
|
687
|
|
688 * Return Sector Size
|
|
689 * Entry:
|
|
690 * Y = path desc ptr
|
|
691 * Exit:
|
|
692 * D = sector size (256, 512, 1024, 2048)
|
|
693 SSize pshs x
|
|
694 leax SSTable,pc
|
|
695 bsr SSBits
|
|
696 lda a,x
|
|
697 clrb
|
|
698 puls x,pc
|
|
699
|
|
700
|
1204
|
701 * RBF30 start
|
|
702 Del358 ldb PD.FD,y get LSN of file descriptor
|
|
703 ldx PD.FD+1,y
|
|
704 pshs u,x,b preserve 'em
|
1513
|
705 bsr SSize +BGP+
|
|
706 * ldd #$0100 allocate a temporary sector buffer -BGP-
|
1204
|
707 os9 F$SRqMem
|
|
708 bcc Del36C got it, skip ahead
|
|
709 IFNE H6309
|
|
710 clrd
|
|
711 ELSE
|
|
712 clra
|
|
713 clrb
|
|
714 ENDC
|
|
715 bra Del37A return with eror
|
|
716
|
|
717 Del36C stu $03,s save pointer to sector buffer
|
|
718 ldx PD.BUF,y
|
|
719 IFNE H6309
|
|
720 ldw #$0100
|
1209
|
721 DelCpy tfm x+,u+ copy the sector
|
1513
|
722 deca +BGP+
|
|
723 bne DelCpy +BGP+
|
1204
|
724 ELSE
|
1209
|
725 clrb
|
1513
|
726 pshs a +BGP+
|
1204
|
727 DelLoop lda ,x+
|
|
728 sta ,u+
|
|
729 decb
|
|
730 bne DelLoop
|
1513
|
731 dec ,s +BGP+
|
|
732 bne DelLoop +BGP+
|
|
733 puls a +BGP+
|
1204
|
734 ENDC
|
|
735 ldd $03,s
|
|
736 Del37A std $03,s save buffer pointer to U on stack
|
|
737 * Start back into RBF28 code again
|
|
738 IFNE H6309
|
|
739 clrd
|
|
740 ELSE
|
|
741 clra
|
|
742 clrb
|
|
743 ENDC
|
|
744 std PD.SIZ,y set file size to zero
|
|
745 std PD.SIZ+2,y
|
|
746 lbsr L0EFE set the file size to PD.SIZ
|
|
747 bcs Del3EF
|
|
748 ldb PD.FD,y grab file descriptor sector number
|
|
749 ldx PD.FD+1,y
|
|
750 stb PD.SBP,y copy it to the segment beginning sector number
|
|
751 stx PD.SBP+1,y
|
|
752 ldx PD.BUF,y point to the buffer
|
|
753 * RBF34
|
|
754 * LDD $13,X : FD.SEG+3, grab the size of the FIRST segment of the file
|
|
755 * addd #$0001
|
|
756 * THEN std PD.SSZ+1,y
|
|
757 *
|
|
758 * Why? RBF automatically makes the FIRST SEGMENT of the file fill the rest
|
|
759 * of the cluster that was allocated for the file descriptor.
|
|
760 * Why not LDX PD.DTB,y LDD DD.BIT,x ???
|
|
761 *
|
|
762 * Gene H: My problem with this fix from rbf28 is in proving to me
|
|
763 * $13,x is the correct location to read! I can't seem to find
|
|
764 * the defines to match the $13,x address.
|
|
765 * ldd FD.SEG+FDSL.B,x grab the size of the first segment
|
|
766 ldd <$13,x this code is REQUIRED for multiple
|
|
767 IFNE H6309
|
|
768 incd sector/cluster operation, don't remove!
|
|
769 ELSE
|
|
770 addd #$0001 sector cluster operation, DO NOT REMOVE!
|
|
771 ENDC
|
|
772 std PD.SSZ+1,y
|
|
773 lbsr ClrFBits delete a segment
|
|
774 Del39F bcs Del3EF
|
|
775 lbsr L1237 flush the sector
|
|
776 lbsr L0A90
|
|
777 lda PD.DFD,y
|
|
778 sta PD.FD,y
|
|
779 ldd PD.DFD+1,y
|
|
780 std PD.FD+1,y
|
|
781 lbsr RdFlDscr get the file descriptor
|
|
782 bcs Del3EF
|
|
783 lbsr L0A2A
|
|
784 ldu PD.BUF,y
|
|
785 lbsr Open1CE update PD entries from FD entries
|
|
786 IFNE H6309
|
|
787 ldq PD.DCP,y get current directory entry pointer
|
|
788 stq PD.CP,y save it as current pointer
|
|
789 ELSE
|
|
790 ldd PD.DCP,y
|
|
791 std PD.CP,y
|
|
792 ldd PD.DCP+2,y
|
|
793 std PD.CP+2,y
|
|
794 ENDC
|
|
795 lbsr L0957 read in the directory sector
|
|
796 bcs Del3EF
|
|
797 clr ,x clear first byte of filename in directory entry
|
|
798 lbsr L1205 flush the sector to disk
|
|
799 * RBF30 start
|
|
800 Del3D4 ldu $03,s get temporary sector buffer pointer
|
|
801 * the patch at Del3EF-3F9 munged the stack for this one - GH
|
|
802 beq Del3F9 none allocated, return to process
|
|
803 ldb ,s get the old file descriptor logical sector #
|
|
804 ldx $01,s
|
|
805 stb PD.FD,y put it back into path descriptor
|
|
806 stx PD.FD+1,y
|
|
807 ldx PD.BUF,y get current sector buffer pointer
|
|
808 stx 1,s save it a sec
|
|
809 stu PD.BUF,y put original sector pointer into path descriptor
|
|
810 lbsr L11FD write the old file descriptor to disk
|
|
811 ldu 1,s get temporary sector pointer
|
|
812 stu PD.BUF,y save it as current
|
|
813 Del3EF pshs b,cc preserve rror status & code if any (WP bug fix - raises stack offsets+2)
|
|
814 ldu $05,s get temporary sector buffer pointer (this was a 3)
|
|
815 beq Del3F5 didn't allocate one, skip ahead (different, new label! no mem to return)
|
1513
|
816 lbsr SSize +BGP+
|
|
817 * ldd #$0100 get size of it -BGP-
|
1204
|
818 os9 F$SRtMem return the memory back to the system
|
|
819 Del3F5 puls b,cc restore error status & code (WP bug fix)
|
|
820 Del3F9 leas 5,s purge stack
|
|
821 * Start back into RBF28 code
|
|
822 lbra Clos2A0 return to system
|
|
823
|
|
824
|
|
825 *
|
|
826 * I$Seek Entry Point
|
|
827 *
|
|
828 * Entry:
|
|
829 *
|
|
830 * Exit:
|
|
831 *
|
|
832 * Error: CC Carry set
|
|
833 * B = errcode
|
|
834 *
|
|
835 Seek ldb PD.SMF,y get state flags
|
|
836 bitb #SINBUF do we have a sector in buffer?
|
|
837 beq Seek417 no, skip ahead
|
|
838 lda R$X+1,u calculate if we need a new sector
|
|
839 ldb R$U,u
|
|
840 subd PD.CP+1,y
|
|
841 bne Seek412
|
|
842 lda R$X,u
|
|
843 sbca PD.CP,y
|
|
844 beq Seek41B no need to get another sector, skip ahead
|
|
845 Seek412 lbsr L1237 flush the current sector to disk
|
|
846 bcs Seek41F
|
|
847 Seek417 ldd R$X,u get & set new file pointer
|
|
848 std PD.CP,y
|
|
849 Seek41B ldd R$U,u
|
|
850 std PD.CP+2,y
|
|
851 Seek41F rts return
|
|
852
|
|
853
|
|
854 *
|
|
855 * I$ReadLn Entry Point
|
|
856 *
|
|
857 * Entry:
|
|
858 *
|
|
859 * Exit:
|
|
860 *
|
|
861 * Error: CC Carry set
|
|
862 * B = errcode
|
|
863 *
|
|
864 ReadLn bsr RdLn463 check if record locked for amount to be read
|
|
865 beq RdLn446 zero bytes to read, return
|
|
866 bsr RdLn447
|
|
867 pshs u,y,x,b,a
|
|
868 exg x,u
|
|
869 IFNE H6309
|
|
870 tfr 0,y smaller, same speed as LDY #$0000
|
|
871 ELSE
|
|
872 ldy #$0000
|
|
873 ENDC
|
|
874 lda #$0D a carriage return
|
|
875 RdLn430 leay 1,y go up one byte
|
|
876 cmpa ,x+ is it a CR?
|
|
877 beq RdLn439 yes, we're done
|
|
878 decb count down
|
|
879 bne RdLn430 until done one sector, at least
|
|
880 RdLn439 ldx 6,s get old U
|
|
881 bsr RdLn49B move bytes from the system to user
|
|
882 sty $0A,s save Y on-stack, above calling routine????
|
|
883 puls u,y,x,b,a restore registers
|
|
884 ldd $02,s get old saved Y from above
|
|
885 * addr d,x
|
|
886 leax d,x point to how many bytes we've read
|
|
887 RdLn446 rts and exit
|
|
888
|
|
889 RdLn447 lbsr Read4D3 do reading, calling this routine back again
|
|
890 leax -1,x back up a byte
|
|
891 lbsr L097F get a byte from another task (F$LDABX)
|
|
892 cmpa #$0D is it a CR?
|
|
893 beq RdLn459 yes, skip ahead
|
|
894 ldd $02,s check data saved on-stack???
|
|
895 bne Read4D9 if not zero, skip ahead
|
|
896 RdLn459 ldu PD.RGS,y grab caller's register stack
|
|
897 ldd R$Y,u get number of bytes to read
|
|
898 subd $02,s take out data read last sector??
|
|
899 std R$Y,u save as data bytes to read
|
|
900 bra Read4C0 skip ahead
|
|
901
|
|
902 * Calculate if read will be record locked with another process
|
|
903 * Entry: U=Register stack pointer
|
|
904 RdLn463 ldd R$Y,u get requested read length
|
|
905 lbsr L0B0C record locked with somebody else?
|
|
906 bcs RdLn497 yes, return deadlock error
|
|
907 ldd R$Y,u get requested read length
|
|
908 bsr RdLn473 calculate if we will have an EOF error
|
|
909 bcs RdLn497 we did, return error
|
|
910 std R$Y,u save # bytes available
|
|
911 rts return
|
|
912
|
|
913 * Calculate if read length will overrun file length
|
|
914 * Entry: D=Requested # bytes to read from file
|
|
915 * Exit : D=# bytes available
|
|
916 RdLn473 pshs d preserve length
|
|
917 IFNE H6309
|
|
918 ldq PD.SIZ,y get current file size
|
|
919 subw PD.CP+2,y subtract off LSW of current byte pointer
|
|
920 tfr w,x save it in the old register
|
|
921 sbcd PD.CP,y subtract off current byte pointer
|
|
922 ELSE
|
|
923 ldd PD.SIZ+2,y
|
|
924 subd PD.CP+2,y
|
|
925 tfr d,x
|
|
926 ldd PD.SIZ,y
|
|
927 sbcb PD.CP+1,y
|
|
928 sbca PD.CP,y
|
|
929 ENDC
|
|
930 bcs RdLn494 it will overrun, return EOF error
|
|
931 bne RdLn491 some bytes left, return OK
|
|
932 tstb
|
|
933 bne RdLn491
|
|
934 cmpx ,s do we have enough bytes?
|
|
935 bhs RdLn491 yes, return OK
|
|
936 stx ,s save # bytes available
|
|
937 beq RdLn494 it's 0, return EOF error
|
|
938 RdLn491 clrb clear error status
|
|
939 puls pc,b,a retrieve # bytes & return
|
|
940 * Return EOF error
|
|
941 RdLn494 comb set carry for error
|
|
942 ldb #E$EOF get error code
|
|
943 RdLn497 leas $02,s purge length off stack
|
|
944 bra Read4C5 return
|
|
945
|
|
946 * Move bytes from system to user
|
|
947 * Entry: X=Source pointer
|
|
948 * Y=Byte count
|
|
949 * U=Destination pointer
|
|
950 RdLn49B pshs x
|
|
951 ldx <D.Proc get current process pointer
|
|
952 lda <D.SysTsk get source task #
|
|
953 ldb P$Task,x get destination task #
|
|
954 puls x
|
|
955 os9 F$Move move 'em
|
|
956 rts return
|
|
957
|
|
958
|
|
959 *
|
|
960 * I$Read Entry Point
|
|
961 *
|
|
962 * Entry:
|
|
963 *
|
|
964 * Exit:
|
|
965 *
|
|
966 * Error: CC Carry set
|
|
967 * B = errcode
|
|
968 *
|
|
969 Read bsr RdLn463 record locked?
|
|
970 beq Read4BB no, allow it
|
|
971 bsr Read4BC do reading
|
|
972 Read4AF pshs u,y,x,b,a save data on the stack
|
|
973 exg x,u
|
|
974 tfr d,y
|
|
975 bsr RdLn49B move bytes from system to user
|
|
976 puls u,y,x,b,a restore registers
|
|
977 * addr d,x
|
|
978 leax d,x point to end of data copied?
|
|
979 Read4BB rts
|
|
980
|
|
981 Read4BC bsr Read4D3 do some reading/writing
|
|
982 bne Read4D9 not done, continue
|
|
983 Read4C0 clrb
|
|
984 Read4C1 leas -2,s clear out crap on the stack
|
|
985 Read4C3 leas $0A,s
|
|
986 * Error processor for read & write
|
|
987 Read4C5 pshs b,cc preserve error status
|
|
988 lda PD.MOD,y get file mode
|
|
989 bita #WRITE. was it write?
|
|
990 bne Read4D0 yes, return
|
|
991 lbsr L0B02 clear lock status, and send signals
|
|
992 Read4D0 puls b,cc,pc restore & return
|
|
993
|
|
994 * do reading/writing
|
|
995 Read4D3 ldd R$X,u get caller's buffer pointer
|
|
996 ldx R$Y,u get length of read
|
|
997 pshs x,b,a preserve 'em
|
|
998 Read4D9 lda PD.SMF,y get stat flags
|
|
999 bita #SINBUF sector in buffer/
|
|
1000 bne Read4F9 yes, read it
|
|
1001 tst PD.CP+3,y read pointer on even sector?
|
|
1002 bne Read4F4 no, skip ahead
|
|
1003 tst $02,s MSB of length have anything?
|
|
1004 beq Read4F4 no, skip ahead
|
|
1005 leax >Writ571,pcr WritLn or ReadLn?
|
|
1006 cmpx $06,s check the stack
|
|
1007 bne Read4F4 skipahead
|
|
1008 lbsr L1098 find a segment
|
|
1009 bra Read4F7
|
|
1010
|
|
1011 Read4F4 lbsr L1256
|
|
1012 Read4F7 bcs Read4C1
|
|
1013 Read4F9 ldu PD.BUF,y get sector buffer pointer
|
|
1014 clra
|
|
1015 ldb PD.CP+3,y
|
|
1016 * addr d,u
|
|
1017 leau d,u point to offset within the buffer
|
|
1018 negb get D=number of byte left to read in the sector?
|
|
1019 sbca #$FF not quite sure what this is...
|
|
1020 ldx ,s grab caller's buffer pointer
|
|
1021 cmpd $02,s check bytes left in sector against number to read
|
|
1022 bls Read50C lower, OK
|
|
1023 ldd $02,s grab number of bytes to read
|
|
1024 Read50C pshs b,a save
|
|
1025 jsr [$08,s] call our calling routine!
|
|
1026 stx $02,s save new address to write to on-stack
|
|
1027 IFNE H6309
|
|
1028 aim #^BufBusy,PD.SMF,y
|
|
1029 ELSE
|
|
1030 ldb PD.SMF,y
|
|
1031 andb #^BufBusy
|
|
1032 stb PD.SMF,y
|
|
1033 ENDC
|
|
1034 ldb $01,s get LSB of bytes read
|
|
1035 addb PD.CP+3,y add it to current pointer
|
|
1036 stb PD.CP+3,y save new file position
|
|
1037 bne Read530 didn't grab whole sector, skip ahead
|
|
1038 lbsr L1237 flush the sector
|
|
1039 inc PD.CP+2,y add
|
|
1040 bne Read52E
|
|
1041 inc PD.CP+1,y
|
|
1042 bne Read52E
|
|
1043 inc PD.CP,y
|
|
1044 Read52E bcs Read4C3
|
|
1045 Read530 ldd $04,s grab number of bytes to read/write
|
|
1046 subd ,s++ take out number we've read/written
|
|
1047 std $02,s save on-stack
|
|
1048 jmp [$04,s] go back to calling routine with D,X on-stack
|
|
1049
|
|
1050
|
|
1051 *
|
|
1052 * I$WritLn Entry Point
|
|
1053 *
|
|
1054 * Entry:
|
|
1055 *
|
|
1056 * Exit:
|
|
1057 *
|
|
1058 * Error: CC Carry set
|
|
1059 * B = errcode
|
|
1060 *
|
|
1061 WriteLn pshs y save PD pointer
|
|
1062 clrb
|
|
1063 ldy R$Y,u grab size of data to write
|
|
1064 beq WtLn55E exit if none
|
|
1065 ldx <D.Proc get process descriptor pointer
|
|
1066 ldb P$Task,x grab task number
|
|
1067 ldx R$X,u and where to get data from
|
|
1068 * ATD: Could make this quite a bit larger, and probably faster, by doing the
|
|
1069 * PipeMan-style copy 32 bytes onto the stack via F$Move, and check that.
|
|
1070 * Doing F$LDABX for a lot of data is _really_ slow. PipeMan test indicate
|
|
1071 * that it could probably double in speed...
|
|
1072 WtLn547 leay -$01,y back up one byte
|
|
1073 beq WtLn55E if done, exit
|
|
1074 os9 F$LDABX grab one byte from the user
|
|
1075 leax $01,x go up a byte
|
|
1076 cmpa #$0D is it a CR?
|
|
1077 bne WtLn547 no, keep it up until done
|
|
1078 tfr y,d get number of bytes left
|
|
1079 nega \
|
|
1080 * a negd was tried here, but may have caused runaway writes>64k
|
|
1081 negb / invert it
|
|
1082 sbca #$00
|
|
1083 addd R$Y,u add to bytes to write
|
|
1084 std R$Y,u save new number of bytes to write
|
|
1085 WtLn55E puls y restore PD pointer, and fall through to Write
|
|
1086
|
|
1087
|
|
1088 *
|
|
1089 * I$Write Entry Point
|
|
1090 *
|
|
1091 * Entry:
|
|
1092 *
|
|
1093 * Exit:
|
|
1094 *
|
|
1095 * Error: CC Carry set
|
|
1096 * B = errcode
|
|
1097 *
|
|
1098 Write ldd R$Y,u get size of write
|
|
1099 lbsr L0B0C wait for I/O lock
|
|
1100 bcs Writ598 error, return
|
|
1101 ldd R$Y,u get size again
|
|
1102 beq Writ597 zero, nothing to write so return
|
|
1103 bsr Writ599 expand the file if needed
|
|
1104 bcs Writ598 error on expand, return
|
|
1105 bsr Writ582
|
|
1106 Writ571 pshs y,b,a
|
|
1107 tfr d,y
|
|
1108 bsr Writ5CB
|
|
1109 puls y,b,a
|
|
1110 leax d,x
|
|
1111 IFNE H6309
|
|
1112 oim #(BUFMOD!SINBUF),PD.SMF,y
|
|
1113 ELSE
|
|
1114 pshs a
|
|
1115 lda PD.SMF,y
|
|
1116 ora #(BUFMOD!SINBUF)
|
|
1117 sta PD.SMF,y
|
|
1118 puls a
|
|
1119 ENDC
|
|
1120 rts
|
|
1121
|
|
1122 Writ582 lbsr Read4D3 go read stuff
|
|
1123 lbne Read4D9
|
|
1124 leas $08,s skip stuff on stack
|
|
1125 ldy PD.Exten,y
|
|
1126 lda #$01
|
|
1127 lbsr L0AD1
|
|
1128 ldy PE.PDptr,y
|
|
1129 Writ597 clrb
|
|
1130 Writ598 rts
|
|
1131
|
|
1132 * Add bytes to current file position with file length extension
|
|
1133 * Entry: D=# bytes to add
|
|
1134 Writ599 addd PD.CP+2,y add length to LSW of current pointer
|
|
1135 tfr d,x copy it
|
|
1136 ldd PD.CP,y get MSW
|
|
1137 IFNE H6309
|
|
1138 adcd #0 add in any carry from above
|
|
1139 ELSE
|
|
1140 adcb #0
|
|
1141 adca #0
|
|
1142 ENDC
|
|
1143 Writ5A3 cmpd PD.SIZ,y MSW past eof?
|
|
1144 bcs Writ597 no, return
|
|
1145 bhi Writ5AF yes, add a sector
|
|
1146 cmpx PD.SIZ+2,y LSW past eof?
|
|
1147 bls Writ597 no, return
|
|
1148 Writ5AF pshs u preserve U
|
|
1149 ldu PD.SIZ+2,y get LSW of current size
|
|
1150 stx PD.SIZ+2,y save new size
|
|
1151 ldx PD.SIZ,y get MSW of new size
|
|
1152 std PD.SIZ,y save new size
|
|
1153 * ATD: L0C6F looks like it already saves U and X, so saving them here is
|
|
1154 * unnecessary.
|
|
1155 pshs u,x preserve old size
|
|
1156 lbsr L0C6F allocate new size of file
|
|
1157 puls u,x restore old size
|
|
1158 bcc Writ5C9 no error from allocate, return
|
|
1159 stx PD.SIZ,y put old size back
|
|
1160 stu PD.SIZ+2,y
|
|
1161 Writ5C9 puls pc,u restore U & return
|
|
1162
|
|
1163 * Move bytes from user to system
|
|
1164 * Entry: X=Source pointer
|
|
1165 * Y=Byte count
|
|
1166 * U=Destination pointer
|
|
1167 Writ5CB pshs x
|
|
1168 ldx <D.Proc get source task #
|
|
1169 lda P$Task,x
|
|
1170 ldb <D.SysTsk get destination task #
|
|
1171 puls x
|
|
1172 os9 F$Move move 'em
|
|
1173 rts return
|
|
1174
|
|
1175
|
|
1176 *
|
|
1177 * I$GetStat Entry Point
|
|
1178 *
|
|
1179 * Entry:
|
|
1180 *
|
|
1181 * Exit:
|
|
1182 *
|
|
1183 * Error: CC Carry set
|
|
1184 * B = errcode
|
|
1185 *
|
|
1186 GetStat ldb R$B,u get function code
|
|
1187 beq Gst5FF it's SS.Opt, go process
|
|
1188
|
1513
|
1189 * SS.Opt
|
1204
|
1190 * Entry A=path number
|
|
1191 * B=$00
|
|
1192 * X=address to put 32 byte packet
|
|
1193 cmpb #SS.EOF EOF check?
|
|
1194 bne Gst5EB no, skip ahead
|
|
1195 clr R$B,u default to no EOF
|
|
1196 Gst5E5 clra get length & clear carry
|
|
1197 ldb #$01
|
|
1198 lbra RdLn473 go calculate EOF status & return
|
|
1199
|
|
1200 * SS.Ready
|
|
1201 * check for data avail on dev
|
|
1202 * Entry A=path number
|
|
1203 * B=$01
|
|
1204 Gst5EB cmpb #SS.Ready is it SS.Ready?
|
|
1205 bne Gst5F2 no, keep checking
|
|
1206 clr R$B,u always mark no data ready
|
|
1207 rts
|
|
1208
|
|
1209 * SS.SIZ
|
|
1210 * Entry A=path num
|
|
1211 * B=$02
|
|
1212 * Exit X=msw of files size
|
|
1213 * U=lsw of files size
|
|
1214 Gst5F2 cmpb #SS.Size is it SS.Size?
|
|
1215 bne Gst600 no, keep checking
|
|
1216 IFNE H6309
|
|
1217 * faster and smaller than 2 LDD's, PD.SIZ+2 >$0F, so we can't use short n,R
|
|
1218 ldq PD.SIZ,y get current file size
|
|
1219 Gst5F8 std R$X,u save to the user
|
|
1220 stw R$U,u save LSW
|
|
1221 ELSE
|
|
1222 ldd PD.SIZ,y
|
|
1223 std R$X,u
|
|
1224 ldd PD.SIZ+2,y
|
|
1225 std R$U,u
|
|
1226 ENDC
|
|
1227 Gst5FF rts return
|
|
1228
|
1513
|
1229 * SS.Pos
|
1204
|
1230 * Entry A=path num
|
|
1231 * B=$05
|
|
1232 * Exit X=msw of pos
|
|
1233 * U=lsw of pos
|
1513
|
1234 Gst600 cmpb #SS.Pos is it SS.Pos?
|
1204
|
1235 bne Gst60D no, keep checking
|
|
1236 IFNE H6309
|
|
1237 * use 2 LDD, STD, same size as ldq/std/stw, PD.CP+2 <$0F, we can use short n,R
|
|
1238 ldq PD.CP,y get current file pointer
|
|
1239 bra Gst5F8
|
|
1240 ELSE
|
|
1241 ldd PD.CP,y get current file pointer
|
|
1242 std R$X,u save MSW
|
|
1243 ldd PD.CP+2,y get current file pointer
|
|
1244 std R$U,u save LSW
|
|
1245 rts
|
|
1246 ENDC
|
|
1247
|
|
1248 * Getstt(SS.FD)
|
|
1249 * Entry: R$A = Path #
|
|
1250 * R$B = SS.FD ($0F)
|
|
1251 * R$X = ptr to 256 byte buffer
|
|
1252 * R$Y = # of bytes of FD required
|
|
1253 Gst60D cmpb #SS.FD is it SS.FD?
|
|
1254 bne Gst627 no, keep checking
|
|
1255 lbsr RdFlDscr go get file descriptor
|
|
1256 bcs Gst5FF exit on error
|
|
1257 ldu PD.RGS,y get register stack pointer
|
|
1258 ldd R$Y,u get # bytesof FD he wants
|
|
1259 tsta legal value?
|
|
1260 beq Gst620 yes, skip ahead
|
|
1261 ldd #$0100 get max size of FD
|
|
1262 Gst620 ldx R$X,u get pointer
|
|
1263 ldu PD.BUF,y get pointer to FD
|
|
1264 lbra Read4AF move it to user space
|
|
1265
|
|
1266 * Getstt(SS.FDInf)
|
|
1267 * Entry: R$A = Path #
|
|
1268 * R$B = SS.FDInf ($20)
|
|
1269 * R$X = ptr to 256 byte buffer
|
|
1270 * R$Y = msb - Length of read
|
|
1271 * lsb - MSB of LSN
|
|
1272 * R$U = LSW of LSN
|
|
1273 Gst627 cmpb #SS.FDInf SS.FDInf?
|
|
1274 bne Gst640 no, let driver handle it
|
|
1275 lbsr L1237 check for sector flush
|
|
1276 bcs Gst5FF
|
|
1277 ldb R$Y,u get MSB of sector #
|
|
1278 ldx R$U,u get LSW of sector #
|
|
1279 lbsr L113A read the sector
|
|
1280 bcs Gst5FF error, return
|
|
1281 ldu PD.RGS,y get register stack pointer
|
|
1282 ldd R$Y,u get length of data to move
|
|
1283 clra clear MSB
|
|
1284 bra Gst620 move it to user
|
|
1285
|
|
1286 * Let driver handle the rest
|
|
1287 Gst640 lda #D$GSTA get getstat function offset
|
|
1288 lbra L113C send it to driver
|
|
1289
|
|
1290
|
|
1291 *
|
|
1292 * I$SetStat Entry Point
|
|
1293 *
|
|
1294 * Entry:
|
|
1295 *
|
|
1296 * Exit:
|
|
1297 *
|
|
1298 * Error: CC Carry set
|
|
1299 * B = errcode
|
|
1300 *
|
|
1301 SetStat ldb R$B,u get function code
|
1513
|
1302 * TODO: remove next line since SS.Opt is 0
|
|
1303 cmpb #SS.Opt
|
|
1304 bne Sst659 not SS.Opt, skip ahead
|
1204
|
1305 ldx R$X,u get pointer to option packet
|
|
1306 leax $02,x skip device type and drive #
|
|
1307 leau PD.STP,y get pointer to start of data
|
|
1308 ldy #(PD.TFM-PD.STP) get # bytes to move (not including PD.TFM)
|
|
1309 lbra Writ5CB move 'em & return
|
|
1310
|
|
1311 * SS.Size
|
|
1312 Sst659 cmpb #SS.Size is it SS.Size?
|
|
1313 bne Sst69B
|
|
1314 ldd PD.FD+1,y is there a file descriptor?
|
|
1315 bne Sst669
|
|
1316 tst PD.FD,y
|
|
1317 lbeq Sst7A8 no, return error
|
|
1318 Sst669 lda PD.MOD,y get file mode
|
|
1319 bita #WRITE. is it write?
|
|
1320 beq Sst697 no, return error
|
|
1321 ldd R$X,u get MSW of new size
|
|
1322 ldx R$U,u get LSW of new size
|
|
1323 cmpd PD.SIZ,y
|
|
1324 bcs Sst682
|
|
1325 bne Sst67F
|
|
1326 cmpx PD.SIZ+2,y
|
|
1327 bcs Sst682
|
|
1328 * New size is larger
|
|
1329 Sst67F lbra Writ5A3 add new size to file
|
|
1330 * New size is smaller
|
|
1331 Sst682 std PD.SIZ,y
|
|
1332 stx PD.SIZ+2,y
|
|
1333 ldd PD.CP,y
|
|
1334 ldx PD.CP+2,y
|
|
1335 pshs x,b,a
|
|
1336 lbsr L0EFE delete from end of the file
|
|
1337 puls u,x
|
|
1338 stx PD.CP,y restore current position
|
|
1339 stu PD.CP+2,y
|
|
1340 rts
|
|
1341 * Return bad mode error
|
|
1342 Sst697 comb set carry
|
|
1343 ldb #E$BMode get bad mod error
|
|
1344 Sst69A rts return
|
|
1345
|
|
1346 * SetStt(SS.FD) #$0F - returns FD to disk
|
|
1347 * Entry: R$A = Path #
|
|
1348 * R$B = SS.FD ($0F)
|
|
1349 * R$X = ptr to 256 byte buffer
|
|
1350 * R$Y = # bytes to write
|
|
1351 Sst69B cmpb #SS.FD is it SS.FD?
|
|
1352 bne Sst6D9 no, keep checking
|
|
1353 lda PD.MOD,y
|
|
1354 bita #WRITE. is it write mode?
|
|
1355 beq Sst697 no, return bad mode error
|
|
1356 lbsr RdFlDscr read in file descriptor
|
|
1357 bcs Sst69A error, return
|
|
1358 pshs y preserve path descriptor pointer
|
|
1359 ldx R$X,u get pointer to caller's buffer
|
|
1360 ldu PD.BUF,y get pointer to FD
|
|
1361 ldy <D.Proc get current process pointer
|
|
1362 ldd P$User,y get user #
|
|
1363 bne Sst6BC not super user, skip ahead
|
|
1364 * Change owner of file
|
|
1365 ldd #$0102 get offset & # of bytes to move
|
|
1366 bsr Sst6CB
|
|
1367 * Change date last modified
|
|
1368 Sst6BC ldd #$0305
|
|
1369 bsr Sst6CB
|
|
1370 * Change creation date
|
|
1371 ldd #$0D03
|
|
1372 bsr Sst6CB
|
|
1373 puls y
|
|
1374 lbra L11FD
|
|
1375 * Offset into FD sector
|
|
1376 * Entry: A=# bytes to offset
|
|
1377 * B=# bytes to put
|
|
1378 Sst6CB pshs u,x
|
|
1379 leax a,x
|
|
1380 leau a,u
|
|
1381 clra
|
|
1382 tfr d,y
|
|
1383 lbsr Writ5CB
|
|
1384 puls pc,u,x
|
|
1385
|
|
1386 Sst6D9 cmpb #SS.Lock is it SS.Lock?
|
|
1387 bne Sst6F8 no, keep checking
|
|
1388 ldd R$U,u get MSW of size
|
|
1389 ldx R$X,u get LSW of size
|
|
1390 cmpx #$FFFF lock whole file?
|
|
1391 bne Sst6F5 no, skip ahead
|
|
1392 cmpx R$U,u
|
|
1393 bne Sst6F5 after this line, we're SURE that D=$FFFF
|
|
1394 ldu PD.Exten,y
|
|
1395 IFNE H6309
|
|
1396 oim #FileLock,PE.Lock,u
|
|
1397 ELSE
|
|
1398 lda PE.Lock,u
|
|
1399 ora #FileLock
|
|
1400 sta PE.Lock,u
|
|
1401 ENDC
|
|
1402 * ATD: This next line is unnecessary after the check done, above
|
|
1403 lda #$FF ?? if X=$FFFF, then D=$FFFF too.
|
|
1404 Sst6F5 lbra L0B1B
|
|
1405
|
|
1406 * SS.Ticks
|
|
1407 Sst6F8 cmpb #SS.Ticks is it SS.Ticks?
|
|
1408 bne Sst705 no, keep checking
|
|
1409 ldd R$X,u get # of ticks
|
|
1410 ldx PD.Exten,y put it into path extension
|
|
1411 std PE.TmOut,x
|
|
1412 rts return
|
|
1413
|
|
1414 * SS.RsBit
|
|
1415 Sst705 cmpb #SS.RsBit reserve bitmap sector?
|
|
1416 bne Sst715 no, keep checking
|
|
1417 ldx PD.DTB,y get drive table pointer
|
|
1418 lda R$X+1,u get sector #
|
|
1419 sta V.ResBit,x put it into drive table
|
|
1420 clr V.MapSct,x clear mapped sector
|
|
1421 Sst714 rts return
|
|
1422
|
|
1423 * SS.Attr
|
|
1424 Sst715 cmpb #SS.Attr is it SS.Attr?
|
|
1425 bne Sst784 no, keep checking
|
|
1426 lbsr RdFlDscr get the file descriptor from drive
|
|
1427 bcs Sst714 error, return
|
|
1428 ldx <D.Proc get pointer to current process
|
|
1429 * Note, should'nt this be lda? User number is 8 bits, not 16
|
|
1430 ldd P$User,x get user number
|
|
1431 beq Sst72A it's super user, skip ahead
|
|
1432 ldx PD.BUF,y get pointer to FD
|
|
1433 cmpd FD.OWN,x user # match owner of file?
|
|
1434 bne Sst780 no, return not accessible error
|
|
1435 Sst72A lda R$X+1,u get attributes from caller
|
|
1436 tfr a,b copy it
|
|
1437 ldu PD.BUF,y get pointer to FD
|
|
1438 eorb FD.ATT,u directory bit set?
|
|
1439 bpl Sst77B no, save new attributes & return
|
|
1440 tsta is user setting directory bit?
|
|
1441 bmi Sst764 yes, return directory not empty error
|
|
1442 * Directory attributes changing, check if it's root dir
|
|
1443 ldx PD.DTB,y get pointer to drive table
|
|
1444 ldd DD.DIR,x get MSW of sector # to root directory
|
|
1445 cmpd PD.FD,y match current FD sector #?
|
|
1446 bne Sst749 no, skip ahead
|
|
1447 ldb DD.DIR+2,x get LSB of sector # to root directory
|
|
1448 cmpb PD.FD+2,y match current FD sector #?
|
|
1449 beq Sst780 yes, return not accessible error
|
|
1450 * Scan directory to see if there's any files and/or directories
|
|
1451 Sst749 ldb PD.CP,y get current directory entry pointer
|
|
1452 ldx PD.CP+1,y
|
|
1453 pshs x,b preserve it
|
|
1454 * ATD: there should be a CLRD here
|
|
1455 std PD.CP,y ??? This code doesn't look correct...
|
|
1456 * ATD: should be DIR.SZ*2: so we skip '..' and '.'
|
|
1457 ldb #DIR.SZ
|
|
1458 std PD.CP+2,y
|
|
1459 Sst755 lbsr L0942 move to next filename in directory
|
|
1460 bcs Sst768 error in read, check for EOF
|
|
1461 tst ,x filename exist?
|
|
1462 beq Sst755 no, keep looking
|
|
1463 puls x,b restore current pointer
|
|
1464 stb PD.CP,y
|
|
1465 stx PD.CP+1,y
|
|
1466 * Report directory not empty error
|
|
1467 Sst764 ldb #E$DNE get directory not empty error
|
|
1468 bra Sst782 return
|
|
1469 Sst768 puls x,a restore current pointer
|
|
1470 sta PD.CP,y
|
|
1471 stx PD.CP+1,y
|
|
1472 cmpb #E$EOF at the end of directory?
|
|
1473 bne Sst782 no, some other error
|
|
1474 lbsr RdFlDscr get file descriptor from drive
|
|
1475 ldu PD.BUF,y get sector pointer
|
|
1476 ldx PD.RGS,y get register stack pointer
|
|
1477 lda R$X+1,x get attributes
|
|
1478 Sst77B sta FD.ATT,u set 'em
|
|
1479 lbra L11FD write FD to disk & return
|
|
1480 * Return file not accessible
|
|
1481 Sst780 ldb #E$FNA get file not accessible error
|
|
1482 Sst782 coma set carry
|
|
1483 rts return
|
|
1484
|
|
1485 * SetStt(SS.FSig)
|
|
1486 Sst784 cmpb #SS.FSig SS.FSig send signal on write
|
|
1487 bne Sst7A3
|
|
1488 lda PD.ATT,y
|
|
1489 bita #SHARE.
|
|
1490 lbne L0A8B
|
|
1491 ldx PD.Exten,y
|
|
1492 lda R$X+1,u
|
|
1493 sta PE.SigSg,x
|
|
1494 ldu <D.Proc
|
|
1495 lda P$ID,u was <P$ID,u
|
|
1496 sta PE.SigID,x
|
|
1497 clrb
|
|
1498 rts
|
|
1499
|
|
1500 Sst7A3 lda #D$PSTA call the driver SetStt routine
|
|
1501 lbra L113C
|
|
1502
|
|
1503 Sst7A8 comb
|
|
1504 ldb #E$UnkSvc unknown service request
|
|
1505 Sst7AB rts
|
|
1506
|
|
1507
|
|
1508 * Find a file in current data/execution directory
|
|
1509 * Called by Create/Open & Delete
|
|
1510 *
|
|
1511 * Entry: U=caller's stack reg. ptr
|
|
1512 * Y=Path dsc. ptr
|
1209
|
1513 FindFile
|
1513
|
1514 lbsr SSize +BGP+
|
|
1515 * ldd #$0100 get size of sector -BGP-
|
1204
|
1516 * Note, following line is stb PD.SMF,y in v30!
|
|
1517 stb PD.FST,y clear state flags??
|
1209
|
1518 os9 F$SRqMem request a 256 byte sector buffer
|
1204
|
1519 bcs Sst7AB couldn't get memory, return with error
|
|
1520 stu PD.BUF,y save ptr to sector buffer
|
|
1521 leau ,y point U to path descriptor
|
|
1522 ldx <D.PthDBT get ptr to path escriptor block tables
|
|
1523 os9 F$All64 allocate path descriptor
|
|
1524 exg y,u exchange pointers
|
|
1525 bcs Sst7AB couldn't get path descriptor, return error
|
|
1526 stu PD.Exten,y save pointer to path extension
|
|
1527 clr PE.SigID,u clear send signal proc. ID
|
|
1528 sty PE.PDptr,u save back pointer to path descriptor
|
|
1529 stu PE.Wait,u init waiting extension to myself
|
|
1530 ldx PD.RGS,y get register stack pointer
|
|
1531 ldx R$X,x get pointer to pathname
|
|
1532 pshs u,y,x
|
|
1533 leas -$04,s make a buffer
|
|
1534 IFNE H6309
|
|
1535 clrd
|
|
1536 ELSE
|
|
1537 clra
|
|
1538 clrb
|
|
1539 ENDC
|
|
1540 sta PD.FD,y init file descriptor logical sector #
|
|
1541 std PD.FD+1,y
|
|
1542 std PD.DSK,y init disk ID
|
|
1543 lbsr L097F get a byte from caller's X
|
|
1544 sta ,s save it
|
1209
|
1545 cmpa #PDELIM is it a device?
|
1204
|
1546 bne Sst7FB no, skip ahead
|
|
1547 lbsr GtDvcNam go parse it
|
|
1548 sta ,s save last character
|
|
1549 lbcs L090D error in parse, return
|
|
1550 leax ,y point X to last character
|
|
1551 ldy $06,s get path descriptor pointer
|
|
1552 bra Sst81E skip ahead
|
|
1553 Sst7FB anda #$7F strip high bit
|
|
1554 cmpa #PENTIR entire device flag?
|
|
1555 beq Sst81E yes, go process
|
1513
|
1556 lda #PDELIM place delimiter as last char
|
1204
|
1557 sta ,s
|
|
1558 leax -$01,x bump path pointer back 1
|
|
1559 lda PD.MOD,y get file mode
|
|
1560 ldu <D.Proc get pointer to current process
|
|
1561 leau P$DIO,u point to default data directory FD sector #
|
|
1562 bita #EXEC. does he want execution dir?
|
|
1563 beq Sst814 no, skip ahead
|
|
1564 leau $06,u point to execution dir
|
|
1565 Sst814 ldb $03,u get LSB of logical sector # of FD to dir
|
|
1566 stb PD.FD,y put it in path descriptor
|
|
1567 ldd $04,u get MSW of logical sector # of FD to dir
|
|
1568 std PD.FD+1,y
|
|
1569 Sst81E ldu PD.DEV,y get pointer to device table
|
|
1570 stu PD.DVT,y copy it for user
|
|
1571 lda PD.DRV,y get drive #
|
1529
|
1572 ldb #DRVMEM get sizeof drive tables
|
|
1573 * confusion reigns supreme here - NO MORE!
|
|
1574 * The data stored at L0012 *IS* the drive table sizeof.
|
|
1575 * MY question is why this RBF constant is stored as a variable.
|
|
1576 * Why would it need to be changed, and by who?
|
1204
|
1577 mul calculate offset into drive tables
|
|
1578 addd V$STAT,u add start of static memory
|
|
1579 addd #DRVBEG add offset to drive tables
|
|
1580 std PD.DTB,y save pointer to drive table
|
|
1581 lda ,s get character back
|
|
1582 anda #$7F strip high bit
|
|
1583 cmpa #PENTIR was it entire flag?
|
|
1584 bne Sst83F no, keep going
|
|
1585 leax $01,x move to next character
|
|
1586 bra Sst861 go on
|
|
1587
|
|
1588 Sst83F lbsr L1110 read in LSN0
|
|
1589 lbcs L0915 error, return
|
|
1590 ldu PD.BUF,y get sector buffer pointer from the read-in sector
|
|
1591
|
|
1592 * otherwise use the pointer from PD.DTB
|
|
1593 ldd DD.DSK,u get disk ID
|
|
1594 std PD.DSK,y put it in path descriptor
|
|
1595 ldd PD.FD+1,y does it have a file descriptor?
|
|
1596 bne Sst861 yes, skip ahead
|
|
1597 lda PD.FD,y
|
|
1598 bne Sst861
|
|
1599 lda DD.DIR,u get LSN of root directory
|
|
1600 sta PD.FD,y put it in path descriptor
|
|
1601 ldd DD.DIR+1,u
|
|
1602 std PD.FD+1,y
|
|
1603 Sst861 stx $04,s save pointer to pathname
|
|
1604 stx $08,s
|
|
1605
|
|
1606 Sst865 lbsr L1237 flush sector buffer
|
|
1607 lbcs L0915 error, exit
|
|
1608 lda ,s get last character of pathname
|
|
1609 anda #$7F mask off high bit
|
|
1610 cmpa #PENTIR entire device flag?
|
|
1611 beq Sst87B yes, skip ahead
|
|
1612 lbsr RdFlDscr read in file descriptor
|
|
1613 lbcs L0915 error, return
|
|
1614 Sst87B lbsr L0A2A check if directory is busy
|
|
1615 lda ,s
|
|
1616 cmpa #PDELIM was the trailing character a slash?
|
|
1617 bne L08EF no, skip ahead
|
|
1618 clr $02,s
|
|
1619 clr $03,s
|
|
1620 lda PD.MOD,y get file mode
|
|
1621 ora #DIR. mask in directory bit
|
|
1622 lbsr ChkAttrs can user access directory?
|
|
1623 bcs L090D no, return
|
|
1624 lbsr Open1CE setup path descriptor & start scan
|
|
1625 ldx $08,s get pathname pointer
|
|
1626 leax $01,x bump to next character
|
|
1627 lbsr GtDvcNam check for valid name
|
|
1628 std ,s save length of name
|
|
1629 stx $04,s save updated name pointer
|
|
1630 sty $08,s
|
|
1631 ldy $06,s get path descriptor pointer
|
|
1632 bcs L090D error in pathname, return
|
|
1633 pshs u,y
|
|
1634 ldu PD.Exten,y get pointer to path extension
|
|
1635 leau PE.FilNm,u point to filename buffer
|
|
1636 clra clear MSB of name length
|
|
1637 tfr d,y move it to Y
|
|
1638 lbsr Writ5CB move filename to temp area
|
|
1639 puls u,y
|
|
1640 lbsr L0957 read in a directory sector
|
|
1641 bra L08C1
|
|
1642
|
|
1643 * Scan diretory for name
|
|
1644 L08BC bsr L0918 get file descriptor
|
|
1645 IFNE H6309
|
|
1646 L08BE bsr L0942 get next directory entry from drive
|
|
1647 ELSE
|
|
1648 L08BE lbsr L0942
|
|
1649 ENDC
|
|
1650 L08C1 bcs L090D error,
|
|
1651 tst ,x filename exists?
|
|
1652 beq L08BC no, get next entry
|
|
1653 clra
|
|
1654 ldb $01,s
|
|
1655 exg x,y
|
|
1656 ldx PD.Exten,x get path extension pointer
|
|
1657 leax PE.FilNm,x point to user's filename
|
|
1658 lbsr L09BF compare the names
|
|
1659 ldx $06,s get pointer to path descriptor
|
|
1660 exg x,y
|
|
1661 bcs L08BE names don't match, skip to next
|
|
1662 bsr L0926 cop this DIR file descriptor to path descriptor
|
|
1663 lda DIR.FD,x
|
|
1664 sta PD.FD,y
|
|
1665 ldd DIR.FD+1,x
|
|
1666 std PD.FD+1,y
|
|
1667 lbsr L0A90 check record lock?
|
|
1668 lbra Sst865 go try again
|
|
1669
|
|
1670 L08EF ldx $08,s
|
|
1671 tsta last character?
|
|
1672 bmi L08FC yes, skip ahead
|
|
1673 os9 F$PrsNam parse the name
|
|
1674 leax ,y go to the next part of the name
|
|
1675 ldy $06,s
|
|
1676 L08FC stx $04,s
|
|
1677 clra
|
|
1678 L08FF lda ,s
|
|
1679 leas $04,s
|
|
1680 pshs b,a,cc
|
|
1681 IFNE H6309
|
|
1682 aim #^BufBusy,PD.SMF,y
|
|
1683 ELSE
|
|
1684 lda PD.SMF,y
|
|
1685 anda #^BufBusy
|
|
1686 sta PD.SMF,y
|
|
1687 ENDC
|
|
1688 puls pc,u,y,x,b,a,cc
|
|
1689
|
|
1690 L090D cmpb #E$EOF
|
|
1691 bne L0915
|
|
1692 bsr L0918
|
|
1693 ldb #E$PNNF
|
|
1694 L0915 coma
|
|
1695 bra L08FF
|
|
1696
|
|
1697 L0918 pshs d
|
|
1698 lda $04,s
|
|
1699 cmpa #PDELIM
|
|
1700 beq L0940
|
|
1701 ldd $06,s
|
|
1702 bne L0940
|
|
1703 bra L0928 fewer clock cycles
|
|
1704 L0926 pshs d
|
|
1705 L0928 stx $06,s
|
|
1706 lda PD.FD,y
|
|
1707 sta PD.DFD,y
|
|
1708 ldd PD.FD+1,y
|
|
1709 std PD.DFD+1,y
|
|
1710 IFNE H6309
|
|
1711 ldq PD.CP,y
|
|
1712 stq PD.DCP,y
|
|
1713 ELSE
|
|
1714 ldd PD.CP,y
|
|
1715 std PD.DCP,y
|
|
1716 ldd PD.CP+2,y
|
|
1717 std PD.DCP+2,y
|
|
1718 ENDC
|
|
1719 L0940 puls pc,b,a
|
|
1720
|
|
1721 * Move to next directory entry
|
1209
|
1722 * BGP - Sector Size issue needs to be resolved here
|
1204
|
1723 L0942 ldb PD.CP+3,y get current byte pointer
|
|
1724 addb #DIR.SZ add in diretory entry size
|
|
1725 stb PD.CP+3,y save it back
|
|
1726 bcc L0957 didn't wrap, skip ahead (need new sector)
|
|
1727 lbsr L1237 check for sector flush
|
|
1728 inc PD.CP+2,y
|
|
1729 bne L0957
|
|
1730 inc PD.CP+1,y
|
|
1731 bne L0957
|
|
1732 inc PD.CP,y
|
|
1733 L0957 ldd #DIR.SZ get directory entry size
|
|
1734 lbsr RdLn473 end of directory?
|
|
1735 bcs L097E yes, return
|
|
1736 ldd #DIR.SZ get directory entry size
|
|
1737 lbsr L0B0C
|
|
1738 bcs L097E yes, return
|
|
1739 lda PD.SMF,y get state flags
|
|
1740 bita #SINBUF sector in buffer?
|
|
1741 bne L0977 yes, skip ahead
|
|
1742 lbsr L1098
|
|
1743 bcs L097E
|
|
1744 lbsr L1256
|
|
1745 bcs L097E
|
|
1746 L0977 ldb PD.CP+3,y get offset into sector
|
|
1747 lda PD.BUF,y get MSB of sector buffer pointer
|
|
1748 tfr d,x move it to X
|
|
1749 clrb clear error status
|
|
1750 L097E rts return
|
|
1751
|
|
1752 * Get a byte from other task
|
|
1753 L097F pshs u,x,b
|
|
1754 ldu <D.Proc
|
|
1755 ldb P$Task,u
|
|
1756 os9 F$LDABX
|
|
1757 puls pc,u,x,b
|
|
1758
|
|
1759 GtDvcNam os9 F$PrsNam parse the filename
|
|
1760 pshs x preserve pointer to name
|
|
1761 bcc L09B7 no error, check name length & return
|
|
1762 clrb clear a counter flag
|
|
1763 L0992 pshs a preserve last character
|
|
1764 anda #$7F clear high bit of last character
|
|
1765 cmpa #'. is it current data directory?
|
|
1766 puls a restore last character
|
|
1767 bne L09AD no, skip ahead
|
|
1768 incb flag it's a dir
|
|
1769 leax 1,x
|
|
1770 tsta is it the last character of pathname?
|
|
1771 bmi L09AD yes, skip ahead
|
|
1772 bsr L097F get next character
|
|
1773 cmpb #$03 third character of DIR?
|
|
1774 bcs L0992 no, try again
|
|
1775 lda #PDELIM
|
|
1776 decb
|
|
1777 leax -3,x
|
|
1778 L09AD tstb
|
|
1779 bne L09B5
|
|
1780 L09B0 comb
|
|
1781 ldb #E$BPNam
|
|
1782 puls pc,x
|
|
1783
|
|
1784 L09B5 leay ,x
|
|
1785 L09B7 cmpb #DIR.FD-DIR.NM past maximum size of name?
|
|
1786 bhi L09B0 yes, return error
|
|
1787 andcc #^Carry clear error status
|
|
1788 puls pc,x return
|
|
1789
|
|
1790 * Check for a match of 2 names
|
|
1791 * Entry: Y=Pointer to high bit terminated string #1
|
|
1792 * X=Pointer to string #2
|
|
1793 * B=Length of string #1
|
|
1794 L09BF pshs y,x,b,a
|
|
1795 L09C1 lda ,y+ get a byte from #2
|
|
1796 bmi L09D1 last one, skip ahead
|
|
1797 decb done length?
|
|
1798 beq L09CE yes, return no match
|
|
1799 eora ,x+
|
|
1800 anda #$DF match from #1?
|
|
1801 beq L09C1 yes, check next char
|
|
1802 L09CE comb set carry
|
|
1803 puls pc,y,x,b,a return
|
|
1804
|
|
1805 L09D1 decb decrement length
|
|
1806 bne L09CE not done, return no match
|
|
1807 eora ,x
|
|
1808 anda #$5F
|
|
1809 bne L09CE
|
|
1810 clrb clear carry for match
|
|
1811 puls pc,y,x,b,a
|
|
1812
|
|
1813 * Check if user can access file/directory
|
|
1814 * Entry: A=Attributes of file/directory to check
|
|
1815 * Exit : Carry set - User cannot access otherwise clear
|
|
1816 ChkAttrs tfr a,b copy attributes
|
|
1817 anda #(EXEC.!UPDAT.) keep only file related junk
|
|
1818 andb #(DIR.!SHARE.) ...and directory related junk
|
|
1819 pshs x,b,a preserve
|
|
1820 lbsr RdFlDscr get file descriptor
|
|
1821 bcs L0A0C error, return
|
|
1822 ldu PD.BUF,y get pointer to FD
|
|
1823 ldx <D.Proc get current process pointer
|
|
1824 ldd P$User,x get user #
|
|
1825 beq L09F5 super user, skp ahead
|
|
1826 cmpd FD.OWN,u match owner of file?
|
|
1827 L09F5 puls a restore owner attributes
|
|
1828 beq L09FC got owner, skip ahead
|
|
1829 lsla shift attributes to public area
|
|
1830 lsla
|
|
1831 lsla
|
|
1832 L09FC ora ,s merge with directory bits
|
|
1833 anda #^SHARE. strip off shareable bit
|
|
1834 pshs a save it
|
|
1835 ora #DIR. set directory bit
|
|
1836 anda FD.ATT,u keep only bits we want from attributes
|
|
1837 cmpa ,s can he access it?
|
|
1838 beq L0A15 yes, check directory bits
|
|
1839 ldb #E$FNA get error code
|
|
1840 L0A0C leas $02,s purge attributes from stack
|
|
1841 coma set carry
|
|
1842 puls pc,x restore & return
|
|
1843
|
|
1844 L0A11 ldb #E$Share,s get shareable file error
|
|
1845 bra L0A0C return
|
|
1846
|
|
1847 L0A15 ldb 1,s get directory bits
|
|
1848 orb FD.ATT,u mask in with current
|
|
1849 bitb #SHARE. shareable bit set?
|
|
1850 beq L0A28 no, return
|
|
1851 ldx PD.Exten,y get path extension
|
|
1852 cmpx PE.Confl,x conflicting with anyone?
|
|
1853 bne L0A11 yes, return error
|
|
1854 lda #FileLock
|
|
1855 sta PE.Lock,x
|
|
1856 L0A28 puls pc,x,b,a
|
|
1857
|
|
1858
|
|
1859 L0A2A pshs u,y,x
|
|
1860 IFNE H6309
|
|
1861 clrd
|
|
1862 ELSE
|
|
1863 clra
|
|
1864 clrb
|
|
1865 ENDC
|
|
1866 std PD.CP,y init current byte pointer
|
|
1867 std PD.CP+2,y smaller than STQ
|
|
1868 sta PD.SSZ,y init segment size
|
|
1869 std PD.SSZ+1,y
|
|
1870 ldb PD.FD,y get current FD sector #
|
|
1871 ldx PD.FD+1,y
|
|
1872 pshs x,b preserve it
|
|
1873 ldu PD.DTB,y get drive table pointer
|
|
1874 ldy PD.Exten,y get drive extension pointer
|
|
1875 sty PE.Confl,y make it conflict with myself
|
|
1876 leau DD.SIZ,u point to local data
|
|
1877 bra L0A51
|
|
1878 * Sort file conflict list???
|
|
1879 L0A4F ldu V.FileHd-DD.SIZ,u
|
|
1880 L0A51 ldx V.FileHd-DD.SIZ,u get open file list extension pointer
|
|
1881 beq L0A7F none, skip return
|
|
1882 ldx PE.PDptr,x get pointer to its path descriptor
|
|
1883 ldd PD.FD,x get the file descriptor LSN
|
|
1884 cmpd ,s sector lower than mine?
|
|
1885 bcs L0A4F yes, skip to next
|
|
1886 bhi L0A7F no, return
|
|
1887 ldb PD.FD+2,x
|
|
1888 cmpb 2,s
|
|
1889 blo L0A4F yes, skip to next
|
|
1890 bhi L0A7F no, return
|
|
1891 ldx PD.Exten,x get the path extension pointer
|
|
1892 IFNE H6309
|
|
1893 tim #FileLock,PE.Lock,y entire file locked?
|
|
1894 ELSE
|
|
1895 ldb PE.Lock,y
|
|
1896 bitb #FileLock
|
|
1897 ENDC
|
|
1898 bne L0A8B yes, return error
|
|
1899 sty PE.NxFil,y terminate list with pointer to myself
|
|
1900 ldd PE.Confl,x
|
|
1901 std PE.Confl,y
|
|
1902 sty PE.Confl,x
|
|
1903 bra L0A86
|
|
1904
|
|
1905 L0A7F ldx PE.NxFil,u
|
|
1906 stx PE.NxFil,y
|
|
1907 sty PE.NxFil,u
|
|
1908
|
|
1909 L0A86 clrb
|
|
1910 L0A87 leas $03,s
|
|
1911 puls pc,u,y,x
|
|
1912
|
|
1913 L0A8B comb
|
|
1914 ldb #E$Share
|
|
1915 bra L0A87
|
|
1916
|
|
1917 L0A90 pshs u,y,x,b,a
|
|
1918 ldu PD.DTB,y
|
|
1919 leau DD.SIZ,u
|
|
1920 ldx PD.Exten,y
|
|
1921 leay ,x
|
|
1922 bsr L0ACF
|
|
1923 bra L0AA5
|
|
1924 L0AA1 ldx PE.Confl,x
|
|
1925 beq L0ACA
|
|
1926 L0AA5 cmpy PE.Confl,x
|
|
1927 bne L0AA1
|
|
1928 ldd PE.Confl,y
|
|
1929 std PE.Confl,x
|
|
1930 bra L0AB2
|
|
1931 L0AB0 ldu PE.NxFil,u
|
|
1932 L0AB2 ldd PE.NxFil,u
|
|
1933 beq L0ACA end of list, store end & return
|
|
1934 cmpy PE.NxFil,u find myself/
|
|
1935 bne L0AB0 no, keep looking
|
|
1936 ldx PE.NxFil,y get next in line from me
|
|
1937 cmpy PE.Confl,y end of conflict list?
|
|
1938 beq L0AC8 yes, skip ahead
|
|
1939 ldx PE.Confl,y get conflicting path extension
|
|
1940 ldd PE.NxFil,y get next in line from me
|
|
1941 std PE.NxFil,x save it into conflicting extension
|
|
1942 L0AC8 stx PE.NxFil,u save conflicting extension as next
|
|
1943 L0ACA sty PE.Confl,y
|
|
1944 puls pc,u,y,x,b,a
|
|
1945
|
|
1946 L0ACF lda #(EofLock!FileLock!RcdLock) get all types of lockout flags
|
|
1947 L0AD1 pshs u,y,x,b,a
|
|
1948 bita PE.Lock,y anything locked?
|
|
1949 beq L0AE0 no, skip ahead
|
|
1950 coma invert lock bits
|
|
1951 anda PE.Lock,y clear 'em
|
|
1952 sta PE.Lock,y save 'em
|
|
1953 bita #FileLock is whole file locked?
|
|
1954 bne L0AFD yes, return
|
|
1955 L0AE0 leau ,y
|
|
1956 L0AE2 ldx PE.Wait,u
|
|
1957 cmpy PE.Wait,u
|
|
1958 beq L0AFA
|
|
1959 stu PE.Wait,u
|
|
1960 leau ,x
|
|
1961 lda PE.Owner,u
|
|
1962 ldb #S$Wake
|
|
1963 os9 F$Send
|
|
1964 bra L0AE2
|
|
1965 L0AFA stu PE.Wait,u
|
|
1966 L0AFD puls pc,u,y,x,b,a
|
|
1967
|
|
1968 L0AFF comb
|
|
1969 ldb #E$Share
|
|
1970 L0B02 pshs y,b,cc
|
|
1971 ldy PD.Exten,y
|
|
1972 bsr L0ACF
|
|
1973 puls pc,y,b,cc
|
|
1974
|
|
1975 L0B0C equ *
|
|
1976 IFNE H6309
|
|
1977 tfr 0,x
|
|
1978 ELSE
|
|
1979 ldx #$0000
|
|
1980 ENDC
|
|
1981 bra L0B1B
|
|
1982
|
|
1983 L0B11 ldu PD.Exten,y
|
|
1984 lda PE.Req,u
|
|
1985 sta PE.Lock,u
|
|
1986 bra L0B1D
|
|
1987
|
|
1988 * Entry: D=LSW of byte position
|
|
1989 * X=
|
|
1990 * Y=Path descriptor pointer
|
|
1991 * U=
|
|
1992 L0B1B pshs u,y,x,b,a preserve regs
|
|
1993 L0B1D ldu PD.Exten,y get pointer to path extension
|
|
1994 lda PE.Lock,u get lockout status
|
|
1995 sta PE.Req,u preserve it
|
|
1996 lda ,s get
|
|
1997 bsr L0B9F lock the record
|
|
1998 bcc L0B9D
|
|
1999 ldu <D.Proc get current proces pointer
|
|
2000 lda PE.Owner,x get owner ID of locked segment
|
|
2001 L0B30 os9 F$GProcP get a pointer to it
|
|
2002 bcs L0B42 no process left, skip ahead
|
|
2003 lda P$DeadLk,y get dominant proc ID
|
|
2004 beq L0B42 none, skip ahead
|
|
2005 cmpa P$ID,u same as current?
|
|
2006 bne L0B30 no, try again (walks down the process tree)
|
|
2007 ldb #E$DeadLk get deadlock error code
|
|
2008 bra L0B9A set carry & return
|
|
2009
|
|
2010 L0B42 lda PE.Owner,x get owner of this segment
|
|
2011 sta P$DeadLk,u save as the dominant deadlock process
|
|
2012 ldy 4,s get path descriptor pointer
|
|
2013 IFNE H6309
|
|
2014 aim #^BufBusy,PD.SMF,y
|
|
2015 ELSE
|
|
2016 lda PD.SMF,y
|
|
2017 anda #^BufBusy
|
|
2018 sta PD.SMF,y
|
|
2019 ENDC
|
|
2020 ldu PD.Exten,y get the path extension
|
|
2021 ldd PE.Wait,x
|
|
2022 stu PE.Wait,x
|
|
2023 std PE.Wait,u
|
|
2024 lbsr L0C56
|
|
2025 ldx PE.TmOut,u get timeout time to wait for release of segment
|
|
2026 os9 F$Sleep delay a bit
|
|
2027 pshs x preserve time slept
|
|
2028 leax ,u point X to path extension
|
|
2029 bra L0B6F skip ahead
|
|
2030
|
|
2031 L0B6C ldx PE.Wait,x
|
|
2032 L0B6F cmpu PE.Wait,x
|
|
2033 bne L0B6C
|
|
2034 ldd PE.Wait,u
|
|
2035 std PE.Wait,x
|
|
2036 stu PE.Wait,u
|
|
2037 puls x restore time slept
|
|
2038 ldu <D.Proc
|
|
2039 clr P$DeadLk,u
|
|
2040 lbsr L1053
|
|
2041 bcs L0B9A
|
|
2042 leax ,x X=0?
|
|
2043 bne L0B11 no,
|
|
2044 ldu PD.Exten,y get pointer to extension
|
|
2045 ldx PE.TmOut,u get timeout time
|
|
2046 lbeq L0B11 zero, go try again
|
|
2047 ldb #E$Lock get lock error code
|
|
2048 L0B9A coma set carry
|
|
2049 stb $01,s save error code
|
|
2050 L0B9D puls pc,u,y,x,b,a
|
|
2051
|
|
2052 L0B9F
|
|
2053 IFNE H6309
|
|
2054 tstd std -$02,s only to set cc.flags? 4 cycles to 1!
|
|
2055 ELSE
|
|
2056 cmpd #$0000
|
|
2057 ENDC
|
|
2058 bne L0BAA
|
|
2059 cmpx #$0000 the leax may be buggy
|
|
2060 lbeq L0B02
|
|
2061 L0BAA bsr L0BC2
|
|
2062 lbcs L0AFF
|
|
2063 pshs u,y,x
|
|
2064 ldy PD.Exten,y
|
|
2065 lda #$01
|
|
2066 lbsr L0AD1
|
|
2067 ora PE.Lock,y
|
|
2068 sta PE.Lock,y
|
|
2069 clrb
|
|
2070 puls pc,u,y,x
|
|
2071
|
|
2072 L0BC2 pshs u,y,b,a
|
|
2073 leau ,y
|
|
2074 ldy PD.Exten,y
|
|
2075 subd #$0001 NOT a DECD: does't set CC.C
|
|
2076 bcc L0BD1
|
|
2077 leax -1,x
|
|
2078 L0BD1 addd PD.CP+2,u
|
|
2079 exg d,x
|
|
2080 IFNE H6309
|
|
2081 adcd PD.CP,u oughta do same - GH
|
|
2082 ELSE
|
|
2083 adcb PD.CP+1,u
|
|
2084 adca PD.CP,u
|
|
2085 ENDC
|
|
2086 bcc L0BE0
|
|
2087 ldx #$FFFF
|
|
2088 tfr x,d
|
|
2089 L0BE0 std PE.HiLck,y
|
|
2090 stx PE.HiLck+2,y
|
|
2091 cmpd PD.SIZ,u
|
|
2092 bcs L0BF8
|
|
2093 bhi L0BF0
|
|
2094 cmpx PD.SIZ+2,u
|
|
2095 bcs L0BF8
|
|
2096 L0BF0 equ *
|
|
2097 IFNE H6309
|
|
2098 oim #EofLock,PE.Lock,y
|
|
2099 ELSE
|
|
2100 lda PE.Lock,y
|
|
2101 ora #EofLock
|
|
2102 sta PE.Lock,y
|
|
2103 ENDC
|
|
2104 bra L0C01
|
|
2105 L0BF8 lda #EofLock
|
|
2106 bita PE.Lock,y
|
|
2107 beq L0C01
|
|
2108 lbsr L0AD1
|
|
2109 L0C01 equ *
|
|
2110 IFNE H6309
|
|
2111 ldq PD.CP,u
|
|
2112 stq PE.LoLck,y
|
|
2113 ELSE
|
|
2114 ldd PD.CP,u
|
|
2115 std PE.LoLck,y
|
|
2116 ldd PD.CP+2,u
|
|
2117 std PE.LoLck+2,y
|
|
2118 ENDC
|
|
2119 lda PD.CPR,u
|
|
2120 sta PE.Owner,y
|
|
2121 leax ,y
|
|
2122 L0C10 cmpy PE.Confl,x
|
|
2123 beq L0C54
|
|
2124 ldx PE.Confl,x
|
|
2125 ldb PE.Owner,y
|
|
2126 cmpb PE.Owner,x
|
|
2127 beq L0C10
|
|
2128 lda PE.Lock,x
|
|
2129 beq L0C10
|
|
2130 ora PE.Lock,y
|
|
2131 bita #FileLock either path locked?
|
|
2132 bne L0C53 yes, skip ahead
|
|
2133 lda PE.Lock,x
|
|
2134 anda PE.Lock,y
|
|
2135 bita #EofLock both at eof?
|
|
2136 bne L0C53
|
|
2137 ldd PE.LoLck,x
|
|
2138 cmpd PE.HiLck,y
|
|
2139 bhi L0C10
|
|
2140 bcs L0C43
|
|
2141 ldd PE.LoLck+2,x
|
|
2142 cmpd PE.HiLck+2,y
|
|
2143 bhi L0C10
|
|
2144 beq L0C53
|
|
2145 L0C43 ldd PE.HiLck,x
|
|
2146 cmpd PE.LoLck,y
|
|
2147 bcs L0C10
|
|
2148 bhi L0C53
|
|
2149 ldd PE.HiLck+2,x
|
|
2150 cmpd PE.LoLck+2,y
|
|
2151 bcs L0C10
|
|
2152 L0C53 comb
|
|
2153 L0C54 puls pc,u,y,b,a
|
|
2154
|
|
2155 L0C56 pshs y,x,b,a
|
|
2156 ldx <D.Proc
|
|
2157 lda P$IOQN,x get I/O queue next ptr
|
|
2158 beq L0C6C none, exit
|
|
2159 clr P$IOQN,x set to none
|
|
2160 ldb #S$Wake
|
|
2161 os9 F$Send wake up
|
|
2162 os9 F$GProcP get process descriptor pointer
|
|
2163 clr P$IOQP,y clear its I/O queue previous pointer
|
|
2164 L0C6C clrb
|
|
2165 puls pc,y,x,b,a
|
|
2166
|
|
2167 L0C6F pshs u,x
|
|
2168 L0C71 bsr L0CD1
|
|
2169 bne L0C81
|
|
2170 cmpx PD.SSZ+1,y
|
|
2171 bcs L0CC8
|
|
2172 bne L0C81
|
|
2173 lda PD.SIZ+3,y
|
|
2174 beq L0CC8
|
|
2175 L0C81 lbsr RdFlDscr
|
|
2176 bcs L0CC5
|
|
2177 ldx PD.CP,y
|
|
2178 ldu PD.CP+2,y grab current position
|
|
2179 pshs u,x save it
|
|
2180 IFNE H6309
|
|
2181 ldq PD.SIZ,y go to the end of the file
|
|
2182 stq PD.CP,y
|
|
2183 ELSE
|
|
2184 ldd PD.SIZ,y
|
|
2185 std PD.CP,y
|
|
2186 ldd PD.SIZ+2,y
|
|
2187 std PD.CP+2,y
|
|
2188 ENDC
|
|
2189 lbsr L10B2 search ???
|
|
2190 puls u,x restore current position
|
|
2191 stx PD.CP,y and save back in PD again
|
|
2192 stu PD.CP+2,y
|
|
2193 bcc L0CC8
|
|
2194 cmpb #E$NES non-existing segment error?
|
|
2195 bne L0CC5
|
|
2196 bsr L0CD1
|
|
2197 bne L0CB1
|
|
2198 tst PD.SIZ+3,y
|
|
2199 beq L0CB4
|
|
2200 leax 1,x
|
|
2201 bne L0CB4
|
|
2202 L0CB1 ldx #$FFFF
|
|
2203 L0CB4 tfr x,d
|
|
2204 tsta
|
|
2205 bne L0CC1
|
|
2206 cmpb PD.SAS,y
|
|
2207 bcc L0CC1
|
|
2208 ldb PD.SAS,y
|
|
2209 L0CC1 bsr L0D07 go do something...
|
|
2210 bcc L0C71
|
|
2211 L0CC5 coma
|
|
2212 puls pc,u,x
|
|
2213
|
|
2214 L0CC8 lbsr L1098
|
|
2215 bcs L0CC5
|
|
2216 bsr L0CDF
|
|
2217 puls pc,u,x
|
|
2218
|
|
2219 L0CD1 ldd PD.SIZ+1,y
|
|
2220 subd PD.SBL+1,y
|
|
2221 tfr d,x
|
|
2222 ldb PD.SIZ,y
|
|
2223 sbcb PD.SBL,y
|
|
2224 rts
|
|
2225
|
|
2226 L0CDF clra
|
|
2227 ldb #$02
|
|
2228 pshs u,x
|
|
2229 ldu PD.Exten,y
|
|
2230 bra L0CFD
|
|
2231
|
|
2232 L0CE9 ldu PE.PDptr,u
|
|
2233 ldx PD.SIZ,y don't do LDQ/STQ, as A and B are used below
|
|
2234 stx PD.SIZ,u
|
|
2235 ldx PD.SIZ+2,y
|
|
2236 stx PD.SIZ+2,u
|
|
2237 bitb PD.MOD,y
|
|
2238 beq L0CFA
|
|
2239 inca
|
|
2240 L0CFA ldu PD.Exten,u
|
|
2241 L0CFD ldu PE.Confl,u
|
|
2242 cmpy PE.PDptr,u
|
|
2243 bne L0CE9
|
|
2244 tsta
|
|
2245 puls pc,u,x
|
|
2246
|
|
2247 * Update a file descriptor
|
|
2248 L0D07 pshs u,x
|
|
2249 lbsr FatScan search and allocate D sectors
|
|
2250 bcs L0D4E exit on error
|
|
2251 lbsr RdFlDscr read a FD from disk
|
|
2252 bcs L0D4E exit on error
|
|
2253 ldu PD.BUF,y grab the buffer pointer
|
|
2254 IFNE H6309
|
|
2255 clrd
|
|
2256 tfr d,w
|
|
2257 stq FD.SIZ,u set the file size to zero
|
|
2258 ELSE
|
|
2259 clra
|
|
2260 clrb
|
|
2261 std FD.SIZ,u
|
|
2262 std FD.SIZ+2,u
|
|
2263 ENDC
|
|
2264 leax FD.SEG,u point to the segment size
|
|
2265 ldd FDSL.B,x grab the segment size
|
|
2266 beq L0D96 exit if zero
|
|
2267 ldd PD.BUF,y grab the buffer pointer
|
|
2268 inca point to the end of it
|
1209
|
2269
|
|
2270 * Following 3 lines support larger sector sizes that
|
|
2271 * allow the segment list to extend beyond 48 entries.
|
|
2272 * pshs a
|
|
2273 * lbsr SSBits
|
|
2274 * adda ,s+
|
|
2275
|
1204
|
2276 pshs d save on-stack
|
|
2277 bra L0D36 skip ahead
|
|
2278
|
|
2279 L0D29 clrb
|
|
2280 ldd -$02,x grab previous segment sector size
|
|
2281 beq L0D4A zero: exit
|
|
2282 * Add in checks to see if this segment's LSN is $00000000?
|
|
2283 addd FD.SIZ+1,u add sector size to total file size
|
|
2284 std FD.SIZ+1,u
|
|
2285 bcc L0D36
|
|
2286 inc FD.SIZ,u increment file size if 24-bit overflow
|
|
2287 L0D36 leax FDSL.S,x go up one segment in the FD
|
|
2288 cmpx ,s done yet?
|
|
2289 bcs L0D29 no, continue
|
|
2290 * or do check for last segment LSN0, size 1 here?
|
|
2291 lbsr ClrFBits delete a segment?
|
|
2292 IFNE H6309
|
|
2293 clrd
|
|
2294 ELSE
|
|
2295 clra
|
|
2296 clrb
|
|
2297 ENDC
|
|
2298 sta PD.SSZ,y segment size is zero
|
|
2299 std PD.SSZ+1,y
|
|
2300 comb
|
|
2301 ldb #E$SLF segment list full error
|
|
2302
|
|
2303 L0D4A leas 2,s remove pointer to end of PD.BUF from the stack
|
|
2304 leax -FDSL.S,x back up a segment
|
|
2305 L0D4E bcs L0DB3
|
|
2306 ldd -4,x
|
|
2307 addd -2,x
|
|
2308 pshs b,a
|
|
2309 ldb -5,x
|
|
2310 adcb #$00
|
|
2311 cmpb PD.SBP,y
|
|
2312 puls d
|
|
2313 bne L0D96
|
|
2314 cmpd PD.SBP+1,y
|
|
2315 bne L0D96
|
|
2316 ldu PD.DTB,y
|
|
2317 ldd DD.BIT,u
|
|
2318 ldu PD.BUF,y
|
|
2319 subd #1
|
|
2320 coma
|
|
2321 comb comd is prolly wrong reg order!
|
|
2322 pshs d
|
|
2323 ldd -$05,x
|
|
2324 IFNE H6309
|
|
2325 eord PD.SBP,y
|
|
2326 lsrd
|
|
2327 lsrd
|
|
2328 lsrd
|
|
2329 andd ,s++
|
|
2330 tstd
|
|
2331 ELSE
|
|
2332 eora PD.SBP,y
|
|
2333 eorb PD.SBP+1,y
|
|
2334 lsra
|
|
2335 rorb
|
|
2336 lsra
|
|
2337 rorb
|
|
2338 lsra
|
|
2339 rorb
|
|
2340 anda ,s+
|
|
2341 andb ,s+
|
|
2342 cmpd #$0000
|
|
2343 ENDC
|
|
2344 bne L0D96
|
|
2345 ldd -2,x
|
|
2346 addd PD.SSZ+1,y
|
|
2347 bcs L0D96
|
|
2348 std -2,x
|
|
2349 bra L0DA5
|
|
2350
|
|
2351 L0D96 ldd PD.SBP,y
|
|
2352 std ,x
|
|
2353 lda PD.SBP+2,y
|
|
2354 sta 2,x
|
|
2355 ldd PD.SSZ+1,y
|
|
2356 std 3,x
|
|
2357 L0DA5 ldd FD.SIZ+1,u
|
|
2358 addd PD.SSZ+1,y
|
|
2359 std FD.SIZ+1,u
|
|
2360 bcc L0DB0
|
|
2361 inc FD.SIZ,u
|
|
2362
|
|
2363 L0DB0 lbsr L11FD flush a FD sector tothe disk
|
|
2364 L0DB3 puls pc,u,x
|
|
2365
|
|
2366 * Search the allocation bitmap for a number of free sectors
|
|
2367 * Entry: D = number of sectors to look for
|
|
2368 * Y = PD pointer
|
|
2369 * 0,S = number of clusters to allocate
|
|
2370 * 2,S = DD.BIT number of sectors per cluster
|
|
2371 * 4,S = DD.MAP number of bytes in the allocation bitmap
|
|
2372 * 6,S = V.MapSCT lowest reasonable bitmap sector number (current bitmap sect)
|
|
2373 * 7,S = sector number of the largest contiguous free bits found
|
|
2374 * 8,S = number of contiguous free bits found
|
|
2375 * 10,s = bit offset into the sector of the found contiguous bits
|
|
2376 * 10,s = also DD.BIT number of sectors per cluster
|
|
2377 * 12,S = number of sectors to search for (D from the calling routine)
|
|
2378 * 16,S = PD pointer (Y from the calling routine)
|
|
2379 FatScan pshs u,y,x,b,a
|
|
2380 ldb #$0C
|
|
2381 L0DB9 clr ,-s reserve 12 bytes of junk on-stack
|
|
2382 decb
|
|
2383 bne L0DB9
|
|
2384 ldx PD.DTB,y
|
|
2385 ldd DD.MAP,x number of bytes in allocation bitmap
|
|
2386 std 4,s
|
|
2387 ldd DD.BIT,x number of sectors per cluster
|
|
2388 std 2,s
|
|
2389 std 10,s
|
|
2390 ldx PD.DEV,y get pointer to device table entry
|
|
2391 ldx V$DESC,x point to descriptor
|
|
2392 leax M$DTyp,x get device type
|
|
2393 subd #1
|
|
2394 addb IT.SAS-M$DTyp,x add in one sector allocation size
|
|
2395 adca #0 make it 16-bit
|
|
2396 bra L0DDD default to greater of SAS or DD.BIT
|
|
2397
|
|
2398 L0DDB equ *
|
|
2399 IFNE H6309
|
|
2400 lsrd shift D to the right
|
|
2401 ELSE
|
|
2402 lsra
|
|
2403 rorb
|
|
2404 ENDC
|
|
2405 L0DDD lsr $0A,s shift DD.BIT to the right
|
|
2406 ror $0B,s
|
|
2407 bcc L0DDB loop until carry is set
|
|
2408 std ,s D = number of clusters to allocate
|
|
2409 ldd 2,s get old DD.BIT
|
|
2410 std $0A,s save on-stack again
|
|
2411 subd #$0001
|
|
2412 addd $0C,s add in to the number of sectors we're asked to
|
|
2413 bcc L0DF7 allocate
|
|
2414 ldd #$FFFF if larger than 64K sectors, default to 64K
|
|
2415 bra L0DF7 skip ahead
|
|
2416
|
|
2417 L0DF5 equ *
|
|
2418 IFNE H6309
|
|
2419 lsrd shift number of sectors to allocate
|
|
2420 ELSE
|
|
2421 lsra
|
|
2422 rorb
|
|
2423 ENDC
|
|
2424 L0DF7 lsr $0A,s
|
|
2425 ror $0B,s
|
|
2426 bcc L0DF5 loop, and continue
|
|
2427 * ATD: remove this code for HD's, to allow >2048 cluster segments???
|
|
2428 * It may be easier to read in the FD, and COMPACT it by looking for
|
|
2429 * LSN+SIZE=next segment LSN. But that would take 48*(30?) clock cycles,
|
|
2430 * which is a lot of time... but maybe not compared to F$All/F$Sch, and
|
|
2431 * the sector read/writes...
|
|
2432 cmpa #8 at least 256*8 bits to allocate?
|
|
2433 bcs L0E04 number of clusters is OK, skip ahead
|
|
2434 ldd #$0800 force one sector of clusters max. to be allocated
|
|
2435 L0E04 std $0C,s save as the number of clusters to allocate
|
|
2436 lbsr L1036 make us the current user of the allocation bitmap
|
|
2437 lbcs L0EF2 exit on error
|
|
2438 ldx PD.DTB,y get drive table
|
|
2439 ldd V.DiskID,x and old disk ID
|
|
2440 cmpd DD.DSK,x check against the current disk ID
|
|
2441 bne L0E26 if not the same, make us the current disk ID
|
|
2442 lda V.BMapSz,x same allocation bitmap size?
|
|
2443 cmpa DD.MAP,x
|
|
2444 bne L0E26 no, skip ahead
|
|
2445 ldb V.MapSct,x another check
|
|
2446 cmpb DD.MAP,x
|
|
2447 bcs L0E34
|
|
2448
|
|
2449 L0E26 ldd DD.DSK,x get current disk ID
|
|
2450 std V.DiskID,x make us the disk to use
|
|
2451 lda DD.MAP,x grab number of sectors in allocation bitmap
|
|
2452 sta V.BMapSz,x save for later
|
|
2453 clrb
|
|
2454 stb V.MapSct,x make this zero for now
|
|
2455 L0E34 incb account for LSN0
|
|
2456 stb 6,s lowest reasonable bitmap sector number
|
|
2457 * ATD: Is this line necessary? All calls to L0E34 set up X already
|
|
2458 ldx PD.DTB,y get drive table pointer again
|
|
2459 cmpb V.ResBit,x check B against reserved bitmap sector
|
|
2460 beq L0E70 same, skip ahead
|
|
2461 lbsr L1091 go read in a bitmap sector
|
|
2462 lbcs L0EF2
|
|
2463 ldb 6,s grab copy of V.MapSCT again
|
|
2464 cmpb 4,s check against number of sectors in allocation bitmap
|
|
2465 bls L0E51 lower, continue
|
|
2466 clra if at end of the allocation bitmap,
|
|
2467 ldb 5,s don't search it all, but just to the end of the
|
|
2468 bra L0E54 last sector in the allocation bitmap
|
|
2469
|
|
2470 * ATD: This the routine that we would fix to cache a compressed version
|
|
2471 * of the allocation bitmap. i.e. largest group of contiguous free sectors,
|
|
2472 * where 255 == 256 by definition. At 1 byte/sector, max. 256 sectors in the
|
|
2473 * allocation bitmap, max. 256 bytes. The search should be a LOT faster then,
|
|
2474 * as we'll only have to search memory and not read in all those sectors.
|
|
2475 * If we're really daring, we could build the new FD without reading the
|
|
2476 * allocation bitmap _at_all_, and just use a 'best-fit' algorithm on the
|
|
2477 * cached version, and update the bitmap later.
|
|
2478 * RBF doesn't do any other search bit calls, so this is the routine.
|
|
2479 L0E51 ldd #$0100
|
|
2480 L0E54 ldx PD.BUF,y where to start searching
|
|
2481 leau d,x where to stop searching
|
|
2482 ldy $0C,s number of bits to find
|
|
2483 * ATD: force it to be less than 1 sector here...
|
|
2484 IFNE H6309
|
|
2485 clrd at starting bit number 0
|
|
2486 ELSE
|
|
2487 clra
|
|
2488 clrb
|
|
2489 ENDC
|
|
2490 os9 F$SchBit
|
|
2491 bcc L0E9D found bits
|
|
2492 cmpy 8,s check number of found bits against our maximum
|
|
2493 bls L0E70 smaller, skip ahead
|
|
2494 sty 8,s save as new maximum
|
|
2495 std $0A,s save starting bit number
|
|
2496 lda 6,s grab current sector
|
|
2497 sta 7,s save for later
|
|
2498 L0E70 ldy <$10,s grab old PD pointer
|
|
2499 ldb 6,s grab current bitmap sector number
|
|
2500 cmpb 4,s check against highest sector number of bitmap
|
|
2501 bcs L0E81 we're OK, skip ahead
|
|
2502 bhi L0E80 we're too high, skip ahead
|
|
2503 tst 5,s check bytes in the sector
|
|
2504 bne L0E81 not zero: skip ahead
|
|
2505 L0E80 clrb
|
|
2506 L0E81 ldx PD.DTB,y get drive table pointer again
|
|
2507 cmpb V.MapSct,x check against lowest reasonable bitmap sector
|
|
2508 bne L0E34 ifnot the same, continue
|
|
2509
|
|
2510 ldb 7,s grab sector number of largest block found
|
|
2511 beq L0EF0 zero, exit with E$Full error
|
|
2512 cmpb 6,s is it the current sector?
|
|
2513 beq L0E96 yes, skip ahead
|
|
2514 stb 6,s make it the current sector
|
|
2515 lbsr L1091 go read the sector in from disk
|
|
2516
|
|
2517 L0E96 ldx PD.BUF,y point to the sector in the buffer
|
|
2518 ldd $0A,s grab starting bit number
|
|
2519 ldy 8,s and number of bits to allocate
|
|
2520 L0E9D std $0A,s save starting bit number
|
|
2521 sty 8,s and number of bits to allocate
|
|
2522 os9 F$AllBit go allocate the bits
|
|
2523 ldy $10,s grab the PD pointer again
|
|
2524 ldb $06,s and the sector number
|
|
2525 lbsr L1069 write it out to disk
|
|
2526 bcs L0EF2 exit on error
|
|
2527 * ATD: add check for segments left to allocate, if we've allocated
|
|
2528 * one entire sector's worth???
|
|
2529 * What about special-purpose code to read the allocation bitmap byte by byte
|
|
2530 * and do it that way? I dunno...
|
|
2531 * Have some routine inside L0DB5 call another routine which allocates segments
|
|
2532 * one sector at a time... have a check: got one sector?
|
|
2533 * ATD: We'll probably have to add in allocation bitmap caching for this
|
|
2534 * to work properly....
|
|
2535 ldx PD.DTB,y drive table pointer
|
|
2536 lda 6,s current sector
|
|
2537 deca decreemnt
|
|
2538 sta V.MapSct,x AHA! Last searched sector for later use
|
|
2539 clrb
|
|
2540 lsla move high bit of A into CC.C
|
|
2541 rolb move CC.C into B
|
|
2542 lsla etc.
|
|
2543 rolb cannot do a ROLD, as that would be LSB, ROLA
|
|
2544 lsla i.e. move the 3 high bits of A into low bits of B
|
|
2545 rolb and shift A by 3
|
|
2546 stb PD.SBP,y save segment beginning physical sector number
|
|
2547 ora $0A,s OR in with the start bit number
|
|
2548 ldb $0B,s grab LSB of starting bit number
|
|
2549 ldx 8,s and number of free sectors found
|
|
2550 * ATD: Is this next line really necessary?
|
|
2551 ldy $10,s get PD pointer
|
|
2552 std PD.SBP+1,y save low 2 bytes of segment beginning physical SN
|
|
2553 stx PD.SSZ+1,y and segment size in clusters
|
|
2554 ldd 2,s grab number of sectors per cluster
|
|
2555 bra L0EE6
|
|
2556
|
|
2557 L0ED7 lsl PD.SBP+2,y shift physical sector numberup
|
|
2558 rol PD.SBP+1,y to LSN, to account for cluster size
|
|
2559 rol PD.SBP,y
|
|
2560 lsl PD.SSZ+2,y
|
|
2561 rol PD.SSZ+1,y shift segment cluster size to sector size
|
|
2562 L0EE6
|
|
2563 IFNE H6309
|
|
2564 lsrd
|
|
2565 ELSE
|
|
2566 lsra
|
|
2567 rorb
|
|
2568 ENDC
|
|
2569 bcc L0ED7
|
|
2570
|
|
2571 clrb no errors
|
|
2572 ldd PD.SSZ+1,y number of sectors allocated
|
|
2573 bra L0EFA and return to the user
|
|
2574
|
|
2575 L0EF0 ldb #E$Full
|
|
2576 L0EF2 ldy $10,s get old Y off of the stack
|
|
2577 lbsr L1070 return allocation bitmap?
|
|
2578 coma
|
|
2579 L0EFA leas $0E,s skip 12-byte buffer, and D
|
|
2580 puls pc,u,y,x
|
|
2581
|
|
2582 * Set the size of a file to PD.SIZ, where PD.SIZ is SMALLER than the
|
|
2583 * current size of the file.
|
|
2584 L0EFE clra clear the carry
|
|
2585 * This code ensures that directories are never shrunk in size.
|
|
2586 lda PD.MOD,y access mode
|
|
2587 bita #DIR. directory?
|
|
2588 bne L0F6F yes (bit set), exit immediately
|
|
2589 IFNE H6309
|
|
2590 ldq PD.SIZ,y grab size of the file
|
|
2591 stq PD.CP,y make it the current position
|
|
2592 ELSE
|
|
2593 ldd PD.SIZ,y
|
|
2594 std PD.CP,y
|
|
2595 ldd PD.SIZ+2,y
|
|
2596 std PD.CP+2,y
|
|
2597 ENDC
|
|
2598 ldd #$FFFF
|
|
2599 tfr d,x
|
|
2600 lbsr L0B1B
|
|
2601 bcs L0F6E
|
|
2602 lbsr L0CDF
|
|
2603 bne L0F6F exit
|
|
2604 lbsr L10B2 find a segment
|
|
2605 bcc L0F26
|
|
2606 cmpb #E$NES non-existing segment error
|
|
2607 bra L0F67
|
|
2608
|
|
2609 L0F26 ldd PD.SBL+1,y not quite sure what's going on here...
|
|
2610 subd PD.CP+1,y
|
|
2611 addd PD.SSZ+1,y
|
|
2612 tst PD.CP+3,y on a sector boundary?
|
|
2613 beq L0F35 yes, skip ahead
|
|
2614 IFNE H6309
|
|
2615 decd ok here, carry NOT used below
|
|
2616 ELSE
|
|
2617 subd #$0001
|
|
2618 ENDC
|
|
2619 L0F35 pshs d
|
|
2620 ldu PD.DTB,y number of sectors per cluster
|
|
2621 ldd DD.BIT,u
|
|
2622 IFNE H6309
|
|
2623 decd
|
|
2624 comd
|
|
2625 andd ,s++
|
|
2626 ELSE
|
|
2627 subd #$0001
|
|
2628 coma
|
|
2629 comb
|
|
2630 anda ,s+
|
|
2631 andb ,s+
|
|
2632 ENDC
|
|
2633 ldu PD.SSZ+1,y
|
|
2634 std PD.SSZ+1,y
|
|
2635 beq L0F69
|
|
2636 tfr u,d
|
|
2637 subd PD.SSZ+1,y
|
|
2638 pshs x,b,a
|
|
2639 addd PD.SBP+1,y
|
|
2640 std PD.SBP+1,y
|
|
2641 bcc L0F5F
|
|
2642 inc PD.SBP,y
|
|
2643 L0F5F bsr ClrFBits delete a segment
|
|
2644 bcc L0F70
|
|
2645 leas 4,s
|
|
2646 cmpb #E$IBA illegal block address
|
|
2647
|
|
2648 L0F67 bne L0F6E
|
|
2649 L0F69 lbsr RdFlDscr
|
|
2650 bcc L0F79
|
|
2651 L0F6E coma
|
|
2652 L0F6F rts
|
|
2653
|
|
2654 L0F70 lbsr RdFlDscr
|
|
2655 bcs L0FC9
|
|
2656 puls x,b,a
|
|
2657 std FDSL.B,x
|
|
2658 L0F79 ldu PD.BUF,y
|
|
2659 IFNE H6309
|
|
2660 ldq PD.SIZ,y grab file size from the PD
|
|
2661 stq FD.SIZ,u save in the FD file size
|
|
2662 ELSE
|
|
2663 ldd PD.SIZ,y
|
|
2664 std FD.SIZ,u
|
|
2665 ldd PD.SIZ+2,y
|
|
2666 std FD.SIZ+2,u
|
|
2667 ENDC
|
|
2668 tfr x,d
|
|
2669 clrb
|
|
2670 inca
|
|
2671 leax FDSL.S,x go to the next segment
|
|
2672 pshs x,b,a
|
|
2673 bra L0FB4
|
|
2674 L0F8E ldd -2,x
|
|
2675 beq L0FC1
|
|
2676 std PD.SSZ+1,y
|
|
2677 ldd -FDSL.S,x grab stuff from the last segment
|
|
2678 std PD.SBP,y
|
|
2679 lda -FDSL.B,x
|
|
2680 sta PD.SBP+2,y save sector beginning physical sector number
|
|
2681 bsr ClrFBits delete a segment
|
|
2682 bcs L0FC9
|
|
2683 stx 2,s
|
|
2684 lbsr RdFlDscr
|
|
2685 bcs L0FC9
|
|
2686 ldx 2,s
|
|
2687 IFNE H6309
|
|
2688 clrd
|
|
2689 ELSE
|
|
2690 clra
|
|
2691 clrb
|
|
2692 ENDC
|
|
2693 std -$05,x clear out the segment
|
|
2694 sta -$03,x
|
|
2695 std -$02,x
|
|
2696 L0FB4 lbsr L11FD
|
|
2697 bcs L0FC9
|
|
2698 ldx 2,s
|
|
2699 leax FDSL.S,x go to the next segment
|
|
2700 cmpx ,s
|
|
2701 bcs L0F8E if not done, do another
|
|
2702 L0FC1 equ *
|
|
2703 IFNE H6309
|
|
2704 clrd
|
|
2705 ELSE
|
|
2706 clra
|
|
2707 clrb
|
|
2708 ENDC
|
|
2709 sta PD.SSZ,y
|
|
2710 std PD.SSZ+1,y segment size is zero
|
|
2711 L0FC9 leas 4,s
|
|
2712 rts
|
|
2713
|
|
2714 * de-allocate a segment
|
|
2715 ClrFBits pshs u,y,x,a get device table pointer
|
|
2716 ldx PD.DTB,y
|
|
2717
|
|
2718 * ATD: Added next few lines to ENSURE that LSN0 and the allocation bitmap
|
|
2719 * are NEVER marked as de-allocated in the allocation bitmap
|
|
2720 * ldd PD.SBP,y grab beginning segment physical LSN
|
|
2721 * bne L0FD0 skip next code if too high
|
|
2722 * ldd DD.MAP,x get number of bytes in allocation bitmap
|
|
2723 * addd #$01FF add 1 for LSN0, round up a sector: A=lowest LSN
|
|
2724 * cmpa PD.SBP+2,y check LSN0 + DD.MAP against LSN to deallocate
|
|
2725 * blo L0FD0 if PD.SBP is higher than LSN0 + DD.MAP, allow it
|
|
2726 * ldb #E$IBA illegal block address: can't deallocate LSN0
|
|
2727 * bra L1033 or the allocation bitmap sectors from the bitmap!
|
|
2728
|
|
2729 ldd DD.BIT,x
|
|
2730 IFNE H6309
|
|
2731 decd
|
|
2732 ELSE
|
|
2733 subd #$0001
|
|
2734 ENDC
|
|
2735 addd PD.SBP+1,y
|
|
2736 std PD.SBP+1,y
|
|
2737 ldd DD.BIT,x
|
|
2738 bcc L0FF4
|
|
2739 inc PD.SBP,y
|
|
2740 bra L0FF4
|
|
2741
|
|
2742 L0FE5 lsr PD.SBP,y convert sector number to cluster number
|
|
2743 ror PD.SBP+1,y
|
|
2744 ror PD.SBP+2,y
|
|
2745 lsr PD.SSZ+1,y
|
|
2746 ror PD.SSZ+2,y
|
|
2747 L0FF4 equ *
|
|
2748 IFNE H6309
|
|
2749 lsrd
|
|
2750 ELSE
|
|
2751 lsra
|
|
2752 rorb
|
|
2753 ENDC
|
|
2754 bcc L0FE5
|
|
2755
|
|
2756 clrb
|
|
2757 ldd PD.SSZ+1,y
|
|
2758 beq L1034
|
|
2759 ldd PD.SBP,y
|
|
2760 IFNE H6309
|
|
2761 lsrd
|
|
2762 lsrd
|
|
2763 lsrd get cluster byte number into D
|
|
2764 ELSE
|
|
2765 lsra
|
|
2766 rorb
|
|
2767 lsra
|
|
2768 rorb
|
|
2769 lsra
|
|
2770 rorb
|
|
2771 ENDC
|
|
2772 tfr b,a
|
|
2773 ldb #E$IBA
|
|
2774 cmpa DD.MAP,x is the LSN too high: mapped outside of the bitmap?
|
|
2775 bhi L1033 yes, error out
|
|
2776 inca
|
|
2777 sta ,s
|
|
2778 L1012 bsr L1036 flush the sector, and OWN the bitmap
|
|
2779 bcs L1012
|
|
2780 ldb ,s grab the sector number
|
|
2781 bsr L1091 go read a sector fro the allocation bitmap
|
|
2782 bcs L1033
|
|
2783 ldx PD.BUF,y where to start
|
|
2784 ldd PD.SBP+1,y bit offset to delete
|
|
2785 * ATD: keep deleting sectors until we're done!
|
|
2786 anda #$07 make sure it's within the current sector
|
|
2787 * ATD: fix segment sizes!
|
|
2788 ldy PD.SSZ+1,y number of clusters to deallocate
|
|
2789 os9 F$DelBit go delete them (no error possible)
|
|
2790 ldy 3,s
|
|
2791 ldb ,s grab bitmap sector number again
|
|
2792 bsr L1069 go write it out
|
|
2793 bcc L1034 xit on error
|
|
2794 L1033 coma
|
|
2795 L1034 puls pc,u,y,x,a
|
|
2796
|
|
2797 L1036 lbsr L1237 flush the sector to disk
|
|
2798 bra L1043 skip ahead
|
|
2799
|
|
2800 L103B lbsr L0C56 wakeup the process
|
|
2801 os9 F$IOQu queue the process
|
|
2802 bsr L1053 check for process wakeup
|
|
2803 L1043 bcs L1052 error, return
|
|
2804 ldx PD.DTB,y get drive table ptr
|
|
2805 lda V.BMB,x bitmap sector
|
|
2806 bne L103B if set, continue
|
|
2807 lda PD.CPR,y get our process number
|
|
2808 sta V.BMB,x make us the current user of the bitmap
|
|
2809 L1052 rts
|
|
2810
|
|
2811 * Wait for process to wakeup
|
|
2812 L1053 ldu <D.Proc get current process pointer
|
|
2813 ldb P$Signal,u get pending signal
|
|
2814 cmpb #S$Wake is it what we're looking for?
|
|
2815 bls L1060 yes, skip ahead
|
|
2816 cmpb #S$Intrpt is it a keyboard interrupt/
|
|
2817 bls L1067 no, return error [B]=Error code
|
|
2818 L1060 clra clear error status
|
|
2819 IFNE H6309
|
|
2820 tim #Condem,P$State,u is process dead?
|
|
2821 ELSE
|
|
2822 lda P$State,u
|
|
2823 bita #Condem
|
|
2824 ENDC
|
|
2825 beq L1068 no, skip ahead
|
|
2826 L1067 coma flag error
|
|
2827 L1068 rts return
|
|
2828
|
|
2829 * Write a file allocation bitmap sector
|
|
2830 * Entry: B=Logical sector #
|
|
2831 L1069 clra clear MSB of LSW to logical sector #
|
|
2832 tfr d,x move it to proper register
|
|
2833 clrb clear MSB of logical sector #
|
|
2834 lbsr L1207 flush the sector to drive
|
|
2835 L1070 pshs cc preserve error status from write
|
|
2836 ldx PD.DTB,y get drive table pointer
|
|
2837 lda PD.CPR,y get the current process using it
|
|
2838 cmpa V.BMB,x same as process using the bit-map sector?
|
|
2839 bne L108F no, return
|
|
2840 clr V.BMB,x clear the use flag
|
|
2841 ldx <D.Proc get current process pointer
|
|
2842 lda P$IOQN,x get next process in line for sector
|
|
2843 beq L108F none, return
|
|
2844 lbsr L0C56 wake up the process
|
|
2845 ldx #1 sleep for balance of tick
|
|
2846 os9 F$Sleep
|
|
2847 L108F puls pc,cc restore error status & return
|
|
2848
|
|
2849 * Read a sector from file allocation bit map
|
|
2850 * Entry: B=Logical sector #
|
|
2851 L1091 clra clear MSB of LSW to logical sector #
|
|
2852 tfr d,x move to proper register
|
|
2853 clrb clear MSB of logical sector #
|
|
2854 lbra L113A go read the sector
|
|
2855
|
|
2856 * Entry: Y=Path descriptor pointer
|
|
2857 L1098 ldd PD.CP+1,y
|
|
2858 subd PD.SBL+1,y
|
|
2859 tfr d,x
|
|
2860 ldb PD.CP,y
|
|
2861 sbcb PD.SBL,y
|
|
2862 cmpb PD.SSZ,y
|
|
2863 bcs L10B0
|
|
2864 bhi L10B2 yes, scan the segment list
|
|
2865 cmpx PD.SSZ+1,y
|
|
2866 bcc L10B2
|
|
2867 L10B0 clrb
|
|
2868 L10B1 rts
|
|
2869
|
|
2870 * Scan file segment list to get proper segment based on current byte position
|
|
2871 * in the file. Once found it will be placed in the path descriptor
|
|
2872 * Entry: None
|
|
2873 L10B2 pshs u preserve
|
|
2874 bsr RdFlDscr get the file descriptor
|
|
2875 bcs L110E error, return
|
|
2876 IFNE H6309 init the start point of search in path descriptor
|
|
2877 clrd
|
|
2878 ELSE
|
|
2879 clra
|
|
2880 clrb
|
|
2881 ENDC
|
|
2882 std PD.SBL,y
|
|
2883 stb PD.SBL+2,y
|
|
2884 ldu PD.BUF,y get sector buffer pointer
|
|
2885 leax FD.SEG,u point to segment list
|
|
2886 lda PD.BUF,y get MSB of sector buffer pointer
|
|
2887 ldb #$FC get size of segment table
|
|
2888 pshs b,a save as table end pointer
|
|
2889 * Scan segment list for the proper segment
|
|
2890 L10CB ldd FDSL.B,x get segment size in sectors
|
|
2891 beq L10F0 last one, exit with non existing segment error
|
|
2892 addd PD.SBL+1,y add to segment start LSN
|
|
2893 tfr d,u copy it
|
|
2894 ldb PD.SBL,y
|
|
2895 adcb #0
|
|
2896 cmpb PD.CP,y this the segment we want?
|
|
2897 bhi L10FD yes, move the segment start & size to descriptor
|
|
2898 bne L10E4 no, save this segment & keep looking
|
|
2899 cmpu PD.CP+1,y
|
|
2900 bhi L10FD
|
|
2901 L10E4 stb PD.SBL,y
|
|
2902 stu PD.SBL+1,y
|
|
2903 leax FDSL.S,x move to next segment
|
|
2904 cmpx ,s done?
|
|
2905 bcs L10CB no, keep going
|
|
2906
|
|
2907 * Return Non-Existing segment error
|
|
2908 L10F0 equ *
|
|
2909 IFNE H6309
|
|
2910 clrd
|
|
2911 ELSE
|
|
2912 clra
|
|
2913 clrb
|
|
2914 ENDC
|
|
2915 sta PD.SSZ,y zero out the segment
|
|
2916 std PD.SSZ+1,y
|
|
2917 comb set the carry
|
|
2918 ldb #E$NES non-existing segment
|
|
2919 bra L110C return
|
|
2920
|
|
2921 * Move segment to path descriptor
|
|
2922 L10FD ldd FDSL.A,x get start physical sector #
|
|
2923 std PD.SBP,y put it in path descriptor
|
|
2924 lda FDSL.A+2,x
|
|
2925 sta PD.SBP+2,y
|
|
2926 ldd FDSL.B,x get segment size
|
|
2927 std PD.SSZ+1,y put it in path descriptor
|
|
2928 L110C leas 2,s
|
|
2929 L110E puls pc,u
|
|
2930
|
|
2931 * Read LSN0 from drive
|
|
2932 * Entry: Y=Path descriptor pointer
|
|
2933 L1110 pshs x,b preserve regs used
|
|
2934 lbsr L1237 flush sector buffer
|
|
2935 bcs L111F error, return
|
|
2936 clrb get LSN
|
|
2937 ldx #$0000
|
|
2938 bsr L113A read the sector
|
|
2939 bcc L1121 no error, return
|
|
2940 L111F stb ,s save error code
|
|
2941 L1121 puls pc,x,b restore & return
|
|
2942
|
|
2943 * Read a file descriptor from disk
|
|
2944 * Entry: Y=Path descriptor pointer
|
|
2945 RdFlDscr
|
|
2946 IFNE H6309
|
|
2947 tim #FDBUF,PD.SMF,y FD already here?
|
|
2948 ELSE
|
|
2949 ldb PD.SMF,y
|
|
2950 bitb #FDBUF
|
|
2951 ENDC
|
|
2952 bne L10B0 yes, return no error
|
|
2953 lbsr L1237 flush any sector here
|
|
2954 bcs L10B1 error, return
|
|
2955 IFNE H6309
|
|
2956 oim #FDBUF,PD.SMF,y
|
|
2957 ELSE
|
|
2958 lda PD.SMF,y
|
|
2959 ora #FDBUF
|
|
2960 sta PD.SMF,y
|
|
2961 ENDC
|
|
2962 ldb PD.FD,y get MSB of logical sector
|
|
2963 ldx PD.FD+1,y get LSW of logical sector
|
|
2964 L113A lda #D$READ get read offset
|
|
2965 * Send command to device driver
|
|
2966 * Entry: A=Driver Command offset
|
|
2967 * B=MSB of logical sector #
|
|
2968 * X=LSW of logical sector #
|
|
2969 * Y=Path descriptor pointer
|
|
2970 L113C pshs u,y,x,b,a preserve it all
|
|
2971 IFNE H6309
|
|
2972 oim #InDriver,PD.SMF,y flag we're in ddriver
|
|
2973 ELSE
|
|
2974 lda PD.SMF,y
|
|
2975 ora #InDriver
|
|
2976 sta PD.SMF,y
|
|
2977 ENDC
|
|
2978 ldx <D.Proc get current process pointer
|
|
2979 lda P$Prior,x get its priority
|
|
2980 tfr a,b copy it
|
|
2981 addb #3 add 3 to it
|
|
2982 bcc L1150 didn't wrap, skip ahead
|
|
2983 ldb #$FF force it to max
|
|
2984 L1150 stb P$Prior,x save priority
|
|
2985 stb P$Age,x asage too
|
|
2986 ldx PD.Exten,y get path extension pointer
|
|
2987 sta PE.Prior,x save original priority there
|
|
2988 ldu PD.DEV,y get device table pointer
|
|
2989 ldu V$STAT,u get static mem pointer
|
|
2990 bra L1166 go execute driver
|
|
2991 * Wait for device
|
|
2992 L1160 lbsr L0C56 wakeup waiting process
|
|
2993 os9 F$IOQu queue device
|
|
2994 * Device ready, send command
|
|
2995 L1166 lda V.BUSY,u driver already busy?
|
|
2996 bne L1160 yes, queue it
|
|
2997 lda PD.CPR,y get current process #
|
|
2998 sta V.BUSY,u save it as busy
|
|
2999 ldd ,s get command & logical sector from stack
|
|
3000 ldx 2,s
|
|
3001 pshs u save static mem
|
|
3002 bsr L11EB send it to driver
|
|
3003 puls u restore static mem
|
|
3004 ldy 4,s get path descriptor pointer
|
|
3005 pshs cc preserve driver error status
|
|
3006 bcc L1181 no error, skip ahead
|
|
3007 stb 2,s save driver's error code
|
|
3008 L1181 equ *
|
|
3009 IFNE H6309
|
|
3010 aim #^InDriver,PD.SMF,y clear in driver flag
|
|
3011 ELSE
|
|
3012 lda PD.SMF,y
|
|
3013 anda #^InDriver
|
|
3014 sta PD.SMF,y
|
|
3015 ENDC
|
|
3016 clr V.BUSY,u
|
|
3017 ldx PD.Exten,y
|
|
3018 lda PE.Prior,x
|
|
3019 ldx <D.Proc
|
|
3020 sta P$Prior,x
|
|
3021 ******
|
|
3022 * this code is in v31 only
|
|
3023 lda ,s get driver error status
|
|
3024 bita #Carry was there an error?
|
|
3025 bne L11CB yes, return with it
|
|
3026 lda 1,s get the driver command
|
|
3027 cmpa #D$WRIT was it write sector?
|
|
3028 bne L11CB no, return
|
|
3029 pshs u,y,x preserve regs
|
|
3030 ldy PD.Exten,y
|
|
3031 leau ,y
|
|
3032 L11A7 ldx PE.Confl,u
|
|
3033 cmpy PE.Confl,u
|
|
3034 beq L11C9
|
|
3035 leau ,x
|
|
3036
|
|
3037 * Check for signal on data write
|
|
3038 lda PE.SigID,u anything to send signal to?
|
|
3039 beq L11A7 no, skip to next in chain
|
|
3040 ldx <D.Proc get current process
|
|
3041 cmpa P$ID,x
|
|
3042 beq L11A7
|
|
3043 clr PE.SigID,u
|
|
3044 ldb PE.SigSg,u
|
|
3045 os9 F$Send
|
|
3046 bra L11A7
|
|
3047
|
|
3048 L11C9 puls u,y,x
|
|
3049 L11CB lda P$IOQN,x any process waiting?
|
|
3050 beq L11E9 no, return
|
|
3051 lda $01,y
|
|
3052 bita #$04
|
|
3053 bne L11E9
|
|
3054 ldx PD.DTB,y get driver table pointer
|
|
3055 lda PD.CPR,y get current process ID
|
|
3056 cmpa V.BMB,x same as bitmap use process?
|
|
3057 beq L11E9 yes, return
|
|
3058 lbsr L0C56
|
|
3059 ldx #1 sleep for balance of tick
|
|
3060 os9 F$Sleep
|
|
3061 L11E9 puls pc,u,y,x,b,a,cc restore & return
|
|
3062
|
|
3063 * Execute device driver
|
|
3064 * Entry: A=Driver command offset
|
|
3065 * B=MSB of logical sector #
|
|
3066 * X=LSW of logical sector #
|
|
3067 * Y=Path descriptor pointer
|
|
3068 * U=Static memory pointer
|
|
3069 L11EB pshs pc,x,b,a
|
|
3070 ldx $03,y
|
|
3071 ldd ,x
|
|
3072 ldx ,x
|
|
3073 addd $09,x
|
|
3074 addb ,s
|
|
3075 adca #$00
|
|
3076 std $04,s
|
|
3077 puls pc,x,b,a
|
|
3078
|
|
3079 * Write file descriptor to disk
|
|
3080 * Entry: Y=Path descriptor pointer
|
|
3081 L11FD ldb PD.FD,y get MSB of LSN
|
|
3082 ldx PD.FD+1,y get LSW of LSn
|
|
3083 bra L1207 send it to disk
|
|
3084
|
|
3085
|
|
3086 * Flush sector buffer to disk
|
|
3087 * Entry: Y=Path descriptor pointer
|
|
3088 L1205 bsr L1220 calulate LSN
|
|
3089 L1207 lda #D$WRIT get driver write offset
|
|
3090 pshs x,b,a preserve that & LSN
|
|
3091 ldd PD.DSK,y get disk ID of this sector
|
|
3092 beq L1216 nothing, send it to driver
|
|
3093 ldx PD.DTB,y get drive table pointer
|
|
3094 cmpd DD.DSK,x match ID from drive?
|
|
3095 L1216 puls x,b,a restore regs
|
|
3096 lbeq L113C ID matches, send data to driver
|
|
3097 comb set carry
|
|
3098 ldb #E$DIDC get ID change error code
|
|
3099 rts return
|
|
3100
|
|
3101 * Calculate logical sector # of current sector in buffer
|
|
3102 * Exit : B=MSB of logical sector #
|
|
3103 * X=LSW of logical sector #
|
|
3104 L1220 ldd PD.CP+1,y get current logical sector loaded
|
|
3105 subd PD.SBL+1,y subtract it from segment list LSN
|
|
3106 tfr d,x copy answer
|
|
3107 ldb PD.CP,y get MSB of byte position
|
|
3108 sbcb PD.SBL,y subtract it from segment start
|
|
3109 exg d,x
|
|
3110 addd PD.SBP+1,y add in physical segment sector #
|
|
3111 exg d,x
|
|
3112 adcb PD.SBP,y now the MSB
|
|
3113 rts return
|
|
3114
|
|
3115 * Check if sector buffer needs to be flushed to disk
|
|
3116 * Entry: Y=Path descriptor pointer
|
|
3117 L1237 clrb clear carry
|
|
3118 pshs u,x preserve regs
|
|
3119 ldb PD.SMF,y get state flags
|
1214
|
3120 andb #(BufBusy!FDBUF!SINBUF) anything in buffer?
|
1204
|
3121 beq L1254 no, return
|
|
3122 tfr b,a duplicate flags
|
|
3123 eorb PD.SMF,y clear them
|
|
3124 stb PD.SMF,y save 'em
|
|
3125 andb #BUFMOD has buffer been modified?
|
|
3126 beq L1254 no, return
|
|
3127 eorb PD.SMF,y clear that bit
|
|
3128 stb PD.SMF,y save it
|
|
3129 bita #SINBUF is there even a sector in buffer?
|
|
3130 beq L1254 no, return
|
|
3131 bsr L1205 flush the sector to drive
|
|
3132 L1254 puls pc,u,x restore & return
|
|
3133
|
|
3134 L1256 pshs u,x
|
|
3135 lbsr L1098
|
|
3136 bcs L12C6
|
|
3137 bsr L1237
|
|
3138 bcs L12C6
|
|
3139 L1261 ldb PD.CP,y
|
|
3140 ldu PD.CP+1,y
|
|
3141 leax ,y
|
|
3142 ldy PD.Exten,y
|
|
3143 L126B ldx PD.Exten,x
|
|
3144 cmpy PE.Confl,x
|
|
3145 beq L12B5
|
|
3146 ldx PE.Confl,x
|
|
3147 ldx PE.PDptr,x
|
|
3148 cmpu PD.CP+1,x
|
|
3149 bne L126B
|
|
3150 cmpb PD.CP,x
|
|
3151 bne L126B
|
|
3152 lda PD.SMF,x
|
|
3153 bita #SINBUF
|
|
3154 beq L126B
|
|
3155 bita #InDriver
|
|
3156 bne L128E
|
|
3157 bita #BufBusy
|
|
3158 beq L12A0
|
|
3159 L128E lda PD.CPR,x
|
|
3160 ldy PE.PDptr,y
|
|
3161 lbsr L0C56
|
|
3162 os9 F$IOQu
|
|
3163 lbsr L1053
|
|
3164 bcc L1261
|
|
3165 puls u,x,pc
|
|
3166
|
|
3167 L12A0 ldy PE.PDptr,y
|
|
3168 ldd PD.BUF,x
|
|
3169 ldu PD.BUF,y
|
|
3170 std PD.BUF,y
|
|
3171 stu PD.BUF,x
|
|
3172 lda PD.SMF,x \ careful, don't use oim here
|
|
3173 ora #BufBusy >takes state from x and
|
|
3174 sta PD.SMF,y / stores to y, is infamous "lha" bug
|
|
3175 clr PD.SMF,x
|
|
3176 puls pc,u,x
|
|
3177
|
|
3178 L12B5 ldy PE.PDptr,y
|
|
3179 lbsr L1220
|
|
3180 lbsr L113A
|
|
3181 bcs L12C6
|
|
3182 IFNE H6309
|
|
3183 oim #(BufBusy!SINBUF),PD.SMF,y
|
|
3184 ELSE
|
|
3185 pshs a
|
|
3186 lda PD.SMF,y
|
|
3187 ora #(BufBusy!SINBUF)
|
|
3188 sta PD.SMF,y
|
|
3189 puls a
|
|
3190 ENDC
|
|
3191 L12C6 puls pc,u,x
|
|
3192
|
|
3193 emod
|
|
3194 eom equ *
|
|
3195 end
|
|
3196
|