annotate level2/modules/rbf2.asm @ 1904:fd159d660df5

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