annotate level2/modules/rbf2.asm @ 1514:b7d6cb1df834

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