annotate level2/modules/pipeman_named.asm @ 1099:b77631456f91

Change to makefile
author roug
date Wed, 09 Apr 2003 19:02:19 +0000
parents 02a8ba2b9092
children 8e804211cb25
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * PipeMan - OS-9 Level Two Named Pipe File Manager
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 * ------------------------------------------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * Pipeman Modified to Include the SS.Ready KDM 86/02/23
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * I$GETSTT Call.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 * Major Bug Corrected KDM 86/03/26
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * Upgraded to Level II version KDM 88/06/29
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * Added new labels and special defs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * Added code to detect EOF in SS.Ready
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * Reformatted to make the module easier CJB 88/11/11
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 * to understand during coding
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * Added named pipes, etc for Level 2 upgrade CJB 88/12/03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 * Includes SS.SSig, SS.Relea, SS.Attr, SS.FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * 1 Release 1.0 for Tandy CoCo OS9 CJB 88/12/26
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 nam PipeMan
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 ttl OS9 Level Two Named Pipe File Manager
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 * Copyright 1981, 1985, 1986, 1988 by Microware Systems Corporation
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 * All Rights Reserved
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 * Named pipe code by Burke & Burke.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * All rights assigned to Microware Systems Corporation.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 * This file contains proprietary information of Microware Systems
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 * Corporation. Persons accessing this file will be held strictly
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 * accountable for their use of the information herein.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 * PIPEMAN
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 * Pipe File Manager
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * WARNING
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 * -------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 * Opening an existing named pipe emulates IOMan's I$Close and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 * I$Dup calls. This file manager contains subroutines that
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 * mimic the current operation of IOMan. Any changes to IOMan's
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 * FMEXEC, I$Close or I$Dup calls must also be made to this code.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 * Device Driver Static Storage Layout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 * -----------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 * $00-$01 V.List Pointer in system map to pipe buffer for 1st
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 * pipe (16 bits).
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 * Pipe Buffer Data Structure
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 * --------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 * $00-$01 PP.PD Pointer to shared path descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 * $02-$03 PP.Next Pointer to next pipe buffer in system map
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 * $04-$05 PP.Prev Pointer to previous pipe buffer in system map
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 * $06-$07 PP.Rsv2 Reserved
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 * $08 PP.Data Data buffer begins at this offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 * Path Descriptor Data Structure
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 * ------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 * $00 PD.PD Path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 * $01 PD.MOD Access permissions
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 * $02 PD.CNT Number of open images (e.g. I$DUP)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 * $05 PD.CPR Current process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 * $06-$07 PD.RGS Address of caller's register stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 * $08-$09 PD.BUF System space pipe buffer base pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 *** PP.Read must have bit 4 clear; PP.Writ must be PP.Read XOR 4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 * $0A PD.Read No bytes -- offset only
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 * $0A PD.RPID Process ID of reader waiting on signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 * $0B PD.RCT Number of blocked readers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 * $0C PD.RSIG Signal to send reader
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 * $0D PD.REOR Read EOR character
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 * $0E PD.Writ No bytes -- offset only
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 * $0E PD.WPID Process ID of writer waiting on signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 * $0F PD.WCT Number of blocked writers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 * $10 PD.WSIG Signal to send writer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 * $11 PD.WEOR Write EOR character (dummy)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 *** End of special section
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 * $12-$13 PD.End Pointer to end of pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 * $14-$15 PD.NxtI Next in pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 * $16-$17 PD.NxtO Next out pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 * $18 PD.RFlg "Ready" flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 * $19 PD.Wrtn "Written" flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 * $1A-$1B PD.BCnt # queue elements currently bufered
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 * $1C PD.Own Process ID of pipe original creator
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 * $1D PD.Keep Non-zero if this pipe has been kept open artificially
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 * $1E-$1F PD.QSiz Max. size of queue (in elements)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 * .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 * .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 * $20 PD.DTP Device type $02 = PIPE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 * $21 PD.ESiz Size of each queue element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 * $22-$23 PD.ECnt Max. elements in queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 * $23-$3F PD.Name Pipe name (after moving PD.ECnt to PD.QSiz)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 * Global equates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 use defsfile
508
02a8ba2b9092 Added headers to most source files, added clock2_bb.asm
boisy
parents: 0
diff changeset
108 use pipedefs
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 use rbfdefs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 * Local Equates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 XVER equ 3 ;Version
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 * ASCII CONTROL CHARACTERS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 CR equ $0D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 * CONDITION CODES
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 * PIPEMAN SPECIAL OFFSETS.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 PM.CPR equ PD.RPID-PD.READ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 PM.CNT equ PD.RCT-PD.READ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 PM.SIG equ PD.RSIG-PD.READ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 PM.EOR equ PD.REOR-PD.READ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 * IOMAN special offsets.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 * This constant is IOMAN release-dependent.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 * It is the number of bytes between the entry stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 * pointer and the stacked PD pointer saved by *IOMAN*.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 * Currently, the stack looks like this:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 * A PL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 * 9 PH <IOMAN post-SOPEN return address>
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 * 8 UL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 * 7 UH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 * 6 YL +
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 * 5 YH <PD pointer saved by IOMAN>
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 * 4 XL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 * 3 XH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 * 2 A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 * 1 PL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 * SP-> 0 PH <post OPEN/CREATE return address>
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 * <start of stack to be used by PIPEMAN>
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 IOMAGIC equ 5 ;5 bytes to PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 * Local pipe buffer equates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 CInit equ %00100000 ;Set this bit to override PD queue parameters
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 * Conditional assembly
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 ANON set 0 ;Anonymous pipes only
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 NAMED set 1 ;Anonymous and named pipes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 MSGS set 2 ;Both types of pipes, and message queues
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 WIZBANG set NAMED ;What features are we providing?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 NODIR set 0 ;Don't allow DIR on pipe devices
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 YESDIR set 1 ;Allow DIR on pipe devices
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 PIPEDIR set YESDIR ;Does DIR work on pipes?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 SLOWPD set 0 ;Slow PD location algorithm
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 QUICKPD set 1 ;Fast PD location algorithm
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 PDALGO set QUICKPD ;How to convert PD to system path #
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 RECKLES set 0 ;Don't check for certain errors
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 CAREFUL set 1 ;Check for certain errors
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 CAUTION set CAREFUL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 * Module Header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 edition set 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 mod MODSIZE,MODNAM,FlMgr+Objct,ReEnt+XVER,JmpTbl,$0000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 * Module Name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 MODNAM fcs "PipeMan"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 * Jump table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 JmpTbl lbra Create
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 lbra Open
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 lbra MakDir
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 lbra ChgDir
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 lbra Delete
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 lbra Seek
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 lbra Read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 lbra Write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 lbra ReadLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 lbra WriteLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 lbra GetStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 lbra SetStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 lbra Close
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 * Create a named or anonymous pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 * The size of the queue is determined by examining
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 * the path descriptor, since this information has
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 * been copied there from the device descriptor.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 * Reg-U points to stacked registers of user.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 * Reg-Y points to path descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 * If success, carry clear and X points to pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 * Create function allows user to override both element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 * count and element size. Override is enabled if if bit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 * 5 of the access mode is set. For override, if MS bit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 * of Reg-Y is clear, just use Reg-Y as queue element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 * count. If MS bit of Reg-Y is set, use LS byte of
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 * Reg-Y as element size ($00 = no change) and bottom 7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 * bits of MS byte of Reg-Y as element count ($00 = no change)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 Create equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 lda R$A,U ;Get access mode
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 bita #CInit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 beq Open
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 * Handle queue size override
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 ldd R$Y,U ;Get queue size initializer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 bpl SetCnt ; (branch if just setting count)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 * Set element size and count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 tstb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 beq Creat00 ; (branch if using default size)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 stb PD.ESiz,Y ;Reg-B = size of each element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 Creat00 anda #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 beq Open ; (branch if using default count)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 tfr a,B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 * Set number of elements in queue from Reg-D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 SetCnt std PD.ECnt,Y ;Reg-D = number of elements
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 * Enter here for normal OPEN
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 Open equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 * Move number of elements in queue to make room for name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 ldd PD.ECnt,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 std PD.QSiz,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 * Parse pathname
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 clrb ;Assume anonymous pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 clra ;Assume not 1st pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 ldx R$X,U ;Point at file name in user's space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 pshs U,Y,X,D ;Save file name, PD, reg. base, 1st & anon flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 * Caller's Regs Ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 * PD Ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 * Path name uptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 * Named flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 * SP-> First flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 os9 F$PrsNam ;Error if driver name (e.g. /pipe) invalid
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 bcs BadName
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 * See if named or anonymous pipe requested.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 lbsr GtNext ;Return CC=MI if at end of path name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 cmpa #'/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 beq HasName
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 * /pipe____
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 * X Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 * Pipe is anonymous -- set up dummy name in PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 * Stack must match the named pipe setup
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 NotName tfr Y,X ;Skip any trailing blanks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 os9 F$PrsNam ; (should return carry set)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 ldd #1 ;Length of dummy name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 pshs Y,X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 ldy 10,S ;Get PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 clr PD.Name,Y ; and set dummy name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 bra GoCheck
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 * /pipe/foo____
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 * X Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 * Pipe is named -- check length and flag on stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 HasName tfr Y,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 os9 F$PrsNam ;Scan off the name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 bcs BadName
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 cmpb #NameMax ;Check length of name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311 bhi BadName
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 * Length OK. X points to start of name, Y to end of name,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 * B has name length.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
315 * Save registers & length, and do final parse to skip white
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
316
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
317 com 1,S ;Set "named" flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
319 pshs Y,X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
320
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
321 tfr Y,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
322 os9 F$PrsNam ;Error if trying for pipe subdirectory
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
323 bcc BadNam2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
324
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
325 * /pipe/foo____
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
326 * X Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
327 * Need to get the pipe name into our address space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
328 * Use the PD for a temporary buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
329
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
330 NameOK ldx <D.Proc ;Pointer to caller's PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
331 lda P$Task,X ; get caller's DAT image #
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
332 ldx <D.SysPrc ;Pointer to our PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
333 ldb P$Task,X ; get system's DAT image #
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
334 ldy 0,S ;Byte count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
335 ldx 2,S ;Source address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
336 ldu 10,S ;Get PD pointer and convert to . . .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
337 leau PD.Name,U ;Destination address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
338 lbsr MovSet ;Move block, set MSB of last byte.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
339
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
340 * Wow! Everybody's in the same address space now.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
341
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
342 * Since this is a named pipe, force mode to UPDATE.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
343 * Also, do not permit DIR. access
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
344
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
345 ldx 10,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
346 lda PD.MOD,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
347 bita #DIR.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
348 bne BadNam2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
349
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
350 ora #(READ.+WRITE.)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
351 sta PD.MOD,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
352
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
353 * See if this is an existing pipe. To do this, we
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
354 * must get the linked list head pointer from the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
355 * device driver's static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
356 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
357 * Stack looks like this:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
358 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
359 * C 2 Sysmap Reg Pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
360 * A 2 Sysmap PD Pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
361 * 8 2 Usrmap Path name pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
362 * 7 1 Named pipe flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
363 * 6 1 First pipe flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
364 * 4 2 Usrmap Pipe name end pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
365 * 2 2 Usrmap Pipe name start pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
366 * 0 2 Name length
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
367 * sp->
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
368
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
369 GoCheck ldx 10,S ;Get PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
370 ldx PD.DEV,X ;Get device table pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
371 ldu V$Stat,X ;Get static storage pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
372 ldx V.List,U ;Get pointer to head of pipe bfr linked list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
373 bne Not1st ; (reg-X = $0000 if no previous pipes)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
374
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
375 * This is the 1st pipe for this descriptor.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
376 * Reg-X = $0000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
377 * Set flag and process as a new pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
378
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
379 com 6,S ;This is the first pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
380 bra NewPipe ;This is a new pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
381
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
382 * No time like the present for some error handlers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
383
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
384 * Generic error, cleaning stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
385
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
386 BadXit2 leas 8,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
387 coma ;Set carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
388 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
389
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
390 * Bad Pathname -- 2 versions, depending on
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
391 * how much junk is on the stack.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
392
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
393 BadNam2 leas 6,S ;Clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
394 BadName ldb #E$BPNam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
395 bra BadXit2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
396
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
397 * Not Enough System RAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
398
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
399 TooBig ldb #E$NoRAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
400 BadExit leas 6,S ;Clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
401 bra BadXit2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
402
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
403 * Look up the pipe name, unless the pipe is anonymous.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
404 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
405 * Reg-U points to driver static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
406 * Reg-X points to next pipe buffer to check.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
407
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
408 Not1st tst 7,S ;Unnamed pipes are always new
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
409 beq NewPipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
410
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
411 ldy 10,S ;point at PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
412 leay PD.Name,Y ; then point at name in PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
413
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
414 * Main loop. Always at least 1 pipe buffer to check first time through.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
415 * Reg-X points to buffer to check, or $0000 if none.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
416 * Reg-Y points to desired pipe name.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
417
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
418 ChkLoop pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
419 ldx PP.PD,X ;Point at PD for this pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
420 leax PD.Name,X ; and then point at name stored in PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
421 lbsr Compare
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
422 puls X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
423 lbeq OldPipe ; (got a match)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
424
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
425 ldd PP.Next,X ;Don't fall off the edge
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
426 beq NewPipe ; (end of list)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
427
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
428 tfr D,X ;Advance to next buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
429 bra ChkLoop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
430
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
431 * Pipe name not found. Create a new pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
432 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
433 * Reg-U points to driver static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
434 * Reg-X points to last pipe buffer checked ($0000 if 1st pipe)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
435
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
436 NewPipe ldy 10,S ;Get PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
437
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
438 ifeq (PIPEDIR-YESDIR)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
439 lda PD.MOD,Y ;Check pipe attributes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
440 bita #DIR.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
441 beq NEWP1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
442
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
443 * Initialize pipe characteristics for DIR. bit set
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
444
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
445 lbsr SizDirP
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
446 * beq XYZZY ;Special if no pipes created
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
447 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
448
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
449 * Normal (non-dir) processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
450
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
451 NewP1 ldd PD.QSiz,Y ;Get max element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
452 bne DoNew ; (graceful operation if no count)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
453
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
454 * Default pipe parameters if none in PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
455
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
456 ldd #$0100 ;Assume 256 byte buffer, 1 byte element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
457 sta PD.ESiz,Y ;Reg-A = 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
458 subd #PP.Data ;Compute elements for total size = 256
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
459 std PD.QSiz,Y Use parameters in PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
460
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
461 DoNew lbsr ECtoBC ;Convert element count to byte count in D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
462 bcs TooBig ; (carry set if too big)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
463
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
464 * Carry has exit status
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
465 * Reg-D = # bytes for queue, w/o overhead
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
466 * Reg-X = previous buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
467 * Reg-U = driver static storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
468
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
469 tfr U,Y ;Save static storage pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
470
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
471 addd #PP.Data ;Add in overhead
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
472 bcs TooBig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
473
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
474 pshs D ;Save buffer size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
475 os9 F$SrqMem ;Attempt to allocate buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
476 puls D ;Recover size, clean stack, lose error msg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
477 bcs TooBig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
478
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
479 * Found enough memory for pipe buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
480 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
481 * Pointer in Reg-U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
482 * Size in Reg-D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
483 * Previous buffer in Reg-X.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
484 * Driver static storage in Reg-Y.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
485 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
486 * Initialize the buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
487
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
488 pshs U,D ;Save buffer pointer & size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
489
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
490 * Clear pipe buffer header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
491
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
492 ldb #PP.Data ;Size of header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
493 ClrBuf clr ,U+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
494 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
495 bne ClrBuf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
496
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
497 puls D,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
498
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
499 * Initialize path descriptor and other fields of pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
500 * for new pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
501 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
502 * Pointer in Reg-U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
503 * Size in Reg-D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
504 * Previous buffer in Reg-X.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
505 * Driver static storage in Reg-Y.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
506 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
507 * IOMan has already prefilled the PD to $00 and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
508 * has set PD.CNT for this path to 1.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
509
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
510 pshs Y,X ;Save static storage pointer & prev.buff
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
511
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
512 ldy (4+10),S ;Get PD pointer to Reg-Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
513 sty PP.PD,U ;Save pointer to PD in pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
514
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
515 leax D,U ;Point to end of pipe.buff + 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
516 stx PD.End,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
517
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
518 leax PP.Data,U ;Initial Next in & Next out pointers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
519 stx PD.NxtI,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
520 stx PD.NxtO,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
521
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
522 ldx <D.Proc ;Save ID of original creator
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
523 lda P$ID,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
524 sta PD.Own,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
525
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
526 puls Y,X ;Recover static storage pointer and prev.buff
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
527
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
528 stx PP.Prev,U ;Save address of previous buffer ($0 if none)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
529 bne LinkIn ; (branch if this isn't the 1st pipe)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
530
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
531 * Special -- this is the first pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
532 * Set PP.Next to $0000 and store buffer address in device memory.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
533 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
534 * Reg-U = pointer to new buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
535 * Reg-X = $0000.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
536 * Reg-Y = static storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
537
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
538 ** Zero prefill of PP header covers this
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
539 ** stx PP.Next,U ;No next buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
540 ** stx PP.Prev,U ;No previous buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
541 stu V.List,Y ;Point driver static at this buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
542 bra IsAsOld
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
543
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
544 * There are other named pipes. Link this one in correctly
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
545 * after the last one checked.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
546 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
547 * Reg-U = pointer to new buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
548 * Reg-X = Pointer to previous buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
549 * Reg-Y = static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
550
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
551 LinkIn ldd PP.Next,X ;Get old's next (could be $0000)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
552 stu PP.Next,X ;Set old's next pointing at new
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
553 std PP.Next,U ;Set new's next where old's was
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
554 stx PP.Prev,U ;Set new's prev pointing at old
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
555 pshs X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
556 ldx 0,S ;Point X at original old's next
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
557 beq Link9 ; (branch if no next -- $0000 set already)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
558 stu PP.Prev,X ;Set prev of old's original next to new
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
559 Link9 puls D,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
560
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
561 * Now we look pretty much like a new access to an old pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
562 * Fix up pointers to match "old pipe" code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
563
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
564 IsAsOld tfr U,X ;Point Reg-X at pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
565 tfr Y,U ;Point Reg-U at driver static storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
566 ldy 10,S ;Recover PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
567 stx PD.BUF,Y ;Set up buffer pointer in PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
568 bra OpnXit ; (go to common trailer code)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
569
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
570 * Pipe name found. Set up to access an old pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
571 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
572 * Reg-U points to driver static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
573 * Reg-X points to matching pipe buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
574 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
575 * We need to make this look like a DUP call, so
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
576 * there's some nasty code here to give back the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
577 * PD allocated by IOMan and go get the "original"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
578 * PD for this named pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
579
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
580 OldPipe equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
581
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
582 *** ***
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
583 * WARNING -- This code emulates IOMan's I$Close and I$Dup *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
584 *** ***
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
585
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
586 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
587 * Processing to give back the new path descriptor and use
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
588 * the original PD that the pipe was opened with.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
589 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
590 * Fake close of PD passed by IOMan
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
591 * Fake dup of named pipe's "master" PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
592 * Fix PD pointer saved on IOMAN's stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
593 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
594 * All of the subroutines preserve all regs, except as noted
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
595 * This section MUST preserve Reg-X and Reg-U. There must
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
596 * be exactly 14 bytes on the stack at this point.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
597
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
598 ldy 10,S ;Get IOMAN PD pointer (original Reg-Y)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
599
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
600 * Detach the path.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
601
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
602 pshs U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
603 ldu PD.DEV,Y ; Get device pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
604 os9 I$Detach ; Detach to compensate for IOMAN Attach
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
605 puls U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
606
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
607 * Decrement use count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
608
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
609 dec PD.CNT,Y ;Decrement use count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
610
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
611 * Give back unwanted PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
612
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
613 *** This is the way I did it originally
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
614 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
615 lda PD.PD,Y ;Get system path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
616 ldx <D.PthDBT ;Point at path table index
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
617 os9 F$Ret64 ; and give back descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
618 puls X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
619 *** This is the way the OSK named pipe manager does it.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
620 *** I had to translate, of course, but the translated
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
621 *** version doesn't work right.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
622 * pshs U,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
623 * lda PD.PD,Y ;Get system path #
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
624 * ldx <D.PthDBT ;Point at path table index
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
625 * ldu <D.SysDis ;Point at system SVC dispatch table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
626 * jsr [(F$Ret64*2),U] ;Do a RET64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
627 * puls X,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
628
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
629 * Stack clean.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
630 * Update IOMAN variables.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
631 * Reg-Y = where IOMAN thinks the PD is.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
632
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
633 ifeq (CAUTION-CAREFUL)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
634 cmpy (14+IOMAGIC),S ;Make sure the stack looks right (PD matches)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
635 beq OKMagic
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
636
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
637 * Stack is wrong; declare bad magic!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
638
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
639 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
640 ldb #E$Bug
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
641 leas 14,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
642 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
643 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
644
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
645 * Stack is right; go fix PD pointers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
646
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
647 OKMagic ldy PP.PD,X ;Get PD pointer of existing named pipe PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
648 sty 10,S ;Point PD pointer at existing PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
649 sty (14+IOMAGIC),S ;Save new IOMAN PD pointer in IOMAN stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
650 inc PD.CNT,Y ;Increment use count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
651
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
652 * End of dangerous code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
653 * This section MUST have preserved Reg-X and Reg-U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
654
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
655 * Exit code.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
656 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
657 * Reg-U points to driver static storage.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
658 * Reg-Y points to PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
659 * Reg-X points to matching pipe buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
660 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
661 * Advance caller's path name pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
662
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
663 OpnXit equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
664
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
665 * Fix use count based on PD.Keep
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
666
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
667 lda PD.CNT,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
668 suba PD.Keep,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
669 sta PD.CNT,Y ;Get rid of any artificial openings
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
670 clr PD.Keep,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
671
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
672 ifeq (PIPEDIR-YESDIR)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
673 * Handle prefill of pipe directory buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
674
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
675 lda PD.Mod,Y ;Is this a DIR. open?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
676 bita #DIR.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
677 beq OpnXt2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
678
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
679 lbsr FilDirP ;Send directory info to pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
680 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
681
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
682 OpnXt2 ldu 12,S ;Point at caller's registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
683 ldd 4,S ;Get revised path name pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
684 std R$X,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
685
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
686 leas 14,S ;Clean the stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
687
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
688 * Successful exit. Reg-X points to pipe buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
689
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
690 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
691 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
692
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
693 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
694 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
695 * Compare pipe names.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
696 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
697 * Can't use F$CmpNam here because the strings
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
698 * are in system space.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
699 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
700 * Path names are pointed to by Reg-X and Reg-Y.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
701 * Case is ignored. Returns NE if not equal, else
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
702 * EQ.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
703 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
704
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
705 Compare pshs Y,X,A ;Reg-A is temp. storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
706
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
707 * Main comparison loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
708
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
709 Cmp001 lda ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
710 anda #%11011111 ;Cheap and fast TOUPPER
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
711 sta 0,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
712
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
713 lda ,Y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
714 anda #%11011111 ;Cheap and fast TOUPPER
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
715 bmi Cmp.Y ; (exit if we find end of Y-string)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
716
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
717 cmpa 0,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
718 beq Cmp001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
719
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
720 * Names don't match. Return CC=NE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
721
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
722 puls A,X,Y,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
723
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
724 * End of "Y" string. "X" character either matches or
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
725 * it doesn't. Return CC accordingly.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
726
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
727 Cmp.Y cmpa 0,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
728 puls A,X,Y,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
729
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
730 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
731 * Convert element count in D to byte count in D.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
732 * Return carry set if too big.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
733 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
734 * Reg-Y = PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
735 * Reg-D = Element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
736 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
737
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
738 ECtoBC pshs D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
739 lda PD.ESiz,Y ;Get size of each element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
740 ldb 0,S ;Get MSB of element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
741 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
742 pshs D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
743 lda PD.ESiz,Y ;Get size of each element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
744 ldb (2+1),S ;Get LSB of element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
745 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
746 adda 1,S ;C-bit set if too big
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
747 tst ,S++ ;Z-bit clear if too big, C-bit OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
748 leas 2,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
749 bcs EB.err
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
750 bne EB.err
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
751
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
752 * OK exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
753 andcc #^Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
754 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
755
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
756 * Error exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
757 EB.err orcc #Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
758 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
759
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
760 * Get next character of path name.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
761 * Reg-Y set up as if just did a PRSNAM.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
762
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
763 GtNext ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
764 ldb P$Task,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
765 tfr Y,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
766 os9 F$LDABX
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
767 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
768
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
769 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
770 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
771 * Error hook
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
772 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
773 MAKDIR equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
774 CHGDIR equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
775 UNKNOWN comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
776 ldb #E$UNKSVC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
777 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
778
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
779 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
780 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
781 * Close a pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
782 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
783 * If there are any other pipe users, leave the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
784 * around. Also, if the pipe is named and contains
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
785 * any data, leave the pipe around even if there are
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
786 * no remaining pipe users.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
787 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
788 * PD.Keep will be non-zero if the pipe has been kept
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
789 * open artificially.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
790 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
791 * This routine is called each time a path to the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
792 * is closed.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
793 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
794
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
795 CLOSE equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
796
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
797 * Account for extra use count if pipe artificially kept open.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
798 * Then see if this is the last user of the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
799
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
800 lda PD.Keep,Y ;Account for extra pipe images
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
801 nega
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
802 clr PD.Keep,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
803 adda PD.CNT,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
804 sta PD.CNT,Y ;Set correct PD.CNT value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
805 bne READERS ; and branch if any users left
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
806
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
807 * No open paths to this pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
808 * If it's named and not empty, leave it around anyway.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
809
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
810 tst PD.Name,Y ;Named pipe?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
811 beq CLOSE2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
812
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
813 ldd PD.BCnt,Y ;How many elements buffered on named pipe?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
814 beq CLOSE2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
815
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
816 * Leave this named pipe around for a while
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
817
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
818 inc PD.CNT,Y ;Create an extra image
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
819 inc PD.Keep,Y ; and remember that we did it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
820 bra CLOXIT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
821
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
822 * Delete the pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
823 * Y = PD pointer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
824
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
825 CLOSE2 bsr ZapPipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
826 bra CloXit ;No error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
827
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
828 * Open paths left. What kind?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
829
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
830 READERS cmpa PD.RCT,Y ;Are all open paths readers?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
831 bne WRITERS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
832
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
833 * All other open paths are readers.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
834 * Send signal to next reader (let him read a bit)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
835
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
836 leax PD.Read,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
837 bra SENDSIG
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
838
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
839 * Not all readers. What kind?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
840
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
841 WRITERS cmpa PD.WCT,Y ;Are all open paths writers?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
842 bne CloXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
843
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
844 * All other open paths are writers.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
845 * Send signal to next writer (let him write a bit)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
846
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
847 leax PD.Writ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
848
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
849 * Send signal to next reader or writer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
850
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
851 SENDSIG lda PM.CPR,X ;Process ID to signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
852 beq CLOXIT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
853
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
854 ldb PM.SIG,X ;Signal code to send
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
855 beq CLOXIT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
856
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
857 * Committed to send signal: clear the flag and send it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
858
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
859 clr PM.SIG,X ;Force no pending signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
860 os9 F$SEND
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
861
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
862 * Done with close
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
863
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
864 CLOXIT clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
865 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
866
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
867 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
868 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
869 * Delete a named pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
870 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
871 * Reg-Y = PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
872 * Reg-U = caller's registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
873 * Reg-X = path name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
874 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
875
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
876 Delete lda #Read.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
877 sta PD.MOD,Y ;Need only READ permission
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
878 pshs U,Y,X,A ;***Match stack set up by IOMAN
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
879 lbsr Open ;Try to open the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
880 puls U,Y,X,A ;***Clean up special stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
881 bcs BadDel
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
882
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
883 * Disconnect from pipe, but keep pointer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
884 * Then check to see if we're the only user.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
885 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
886 * Note -- The call to OPEN updated PD.CNT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
887 * and cleared PD.Keep.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
888
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
889 dec PD.CNT,Y ;Don't count ourselves
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
890 beq DoDel ;If count is zero, OK to delete
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
891
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
892 * Pipe is in use. Return E$FNA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
893
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
894 FNAXIT comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
895 ldb #E$FNA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
896
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
897 * Exit w/ carry set and error code in B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
898
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
899 BadDel rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
900
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
901 * Perform the delete.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
902
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
903 DoDel bsr ZapPipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
904 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
905 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
906
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
907 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
908 * Return all memory for the pipe buffer specified
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
909 * in the path descriptor, and remove it from the linked list.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
910 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
911 * Reg-Y = PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
912 * Pipe buffer pointer is at PD.BUF,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
913 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
914
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
915 ZapPipe ldu PD.DEV,Y ;Get device table pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
916 ldu V$Stat,U ;Get static storage pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
917
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
918 ldx PD.BUF,Y ;Point to pipe's buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
919 ldd PP.Next,X ;Save pointer to current and next in list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
920 pshs D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
921 ldd PP.Prev,X ;Save pointer to previous in list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
922 pshs D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
923
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
924 * Reg-D has pointer to previous. If zero, we're zapping head of list.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
925 * Z-bit is already set accordingly
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
926
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
927 bne OldHead
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
928
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
929 * New head of list.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
930 * Reg-X still points to buffer to be deleted
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
931
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
932 ldd 2,S ;Get pointer to next (may be $0000)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
933 std V.List,U ; and set as new head
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
934 pshs X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
935 ldx 0,S ;Point Reg-X at next, set CC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
936 beq Zap9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
937 clr (PP.Prev+0),X ; and set no prev for next
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
938 clr (PP.Prev+1),X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
939 Zap9 puls D,X ;Point back at pipe to delete
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
940 bra ZapIt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
941
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
942 * No new head of list. Just delete from linked list.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
943 * We know there is a previous buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
944 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
945 * Reg-X points to buffer to be deleted.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
946 * Reg-D points to previous buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
947
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
948 OldHead ldu PP.Next,X ;Get U pointing at our next (may be $0000)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
949 exg D,X ;Point X at our prev, D at us
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
950 stu PP.Next,X ;Save new next for out prev
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
951 beq Zap8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
952 stx PP.Prev,U ;Point our next's prev at our original prev
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
953 Zap8 exg D,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
954
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
955 * All cleaned up. Give back the buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
956 * Reg-X points to buffer, Reg-Y points to PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
957
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
958 ZapIt ldd PD.End,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
959 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
960 subd 0,S ;Get total bytes to Reg-D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
961 puls U ;Point at buffer, clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
962 os9 F$SRtMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
963
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
964 * Exit with whatever error F$SRtMem produces
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
965
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
966 leas 4,S ;Clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
967 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
968
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
969 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
970 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
971 * Dummy hook
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
972 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
973 SEEK equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
974 Dummy clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
975 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
976
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
977 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
978 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
979 * GETSTT processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
980 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
981 * Supports the following codes:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
982 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
983 * SS.Opt Option section
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
984 * SS.Ready # bytes in queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
985 * SS.Siz Size of queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
986 * SS.EOF Queue empty
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
987 * SS.FD Bogus file descriptor (WIZBANG==MSGS)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
988 * SS.ScSiz Screen Size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
989 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
990 * SS.Opt handled in IOMAN, etc.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
991 * SS.Ready code by Kent Meyers, modified by Chris Burke
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
992 * SS.Siz, SS.EOF, SS.FD, SS.ScSiz by Chris Burke
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
993 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
994
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
995 GETSTT lda R$B,U Get User B Register ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
996 cmpa #SS.READY Test for Ready Call ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
997 bne NotSSRDY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
998
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
999 * Process SS.Rdy -- return # elements in queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1000 * If more than 255, return 255.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1002 G.Rdy ldb #255
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1003 tst (PD.BCnt+0),Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1004 bne G.Rdy0 ;Accomodate large queues (256 or more bytes)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1005 ldb (PD.BCnt+1),X ;Get element count LSB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1006
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1007 * Reg-B has LSB of element count, CC set based on value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1008
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1009 beq RDNRDY ;Not Ready if no characters
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1010
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1011 G.Rdy0 stb R$B,U ;Return count in B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1012
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1013 SST.OK equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1014 SST.Ign equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1015
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1016 G.OK clrb No Error ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1017 tfr CC,A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1018 sta R$CC,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1019 rts Return ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1020
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1021 * No characters for SS.Ready
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1022
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1023 RDNRDY tst PD.Wrtn,Y Anybody writing to pipe?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1024 bne NOTEOF (not OK if so)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1025
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1026 * No writer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1027
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1028 ldb PD.CNT,Y Exactly one path open to pipe?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1029 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1030 bne NOTEOF (OK if no, e.g. nobody or > 1)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1031
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1032 * Internal error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1033
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1034 IntErr comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1035 ldb #255
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1036 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1037
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1038 NOTEOF comb Set Error Flag ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1039 ldb #E$NOTRDY Get Error Code ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1040 rts Return ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1041
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1042 * Not SS.Ready. Check for SS.Siz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1043
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1044 NotSSRdy cmpa #SS.Size Test for Size call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1045 bne NotSSSiz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1046
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1047 * Process SS.Siz -- return size of queue in ELEMENTS.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1048
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1049 G.Siz ldd PD.QSiz,Y ;Get max. # of queue elements
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1050 std R$U,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1051 clr (R$X+0),U Set 16 MSB's to $0000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1052 clr (R$X+1),U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1053 GOK001 bra G.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1054
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1055 * Not SS.Siz. Check for SS.EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1056
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1057 NotSSSiz cmpa #SS.EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1058 bne NotSSEOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1059
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1060 * Process SS.EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1061 * Handle like SS.Rdy, but preserve Reg-B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1062
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1063 G.EOF bsr G.Siz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1064 ldb #0 ;NOT clrb -- preserve carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1065 stb R$B,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1066 bcc G.OK ;No error if ready
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1067
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1068 ldb #E$EOF ;Carry is already set
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1069 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1070
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1071 * Not SS.EOF. Check for SS.FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1072
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1073 ifeq (PIPEDIR-YESDIR)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1074 NotSSEOF cmpa #SS.FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1075 bne NotSSFD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1076
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1077 * Process SS.FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1078
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1079 lbsr DoSSFD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1080 bra G.OK ;Successful always
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1081 else
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1082 NotSSEOF equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1083 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1084
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1085 * Not SS.FD. Check for SS.ScSiz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1086
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1087 NotSSFD cmpa #SS.ScSiz ;Force UNKNOWN here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1088 lbeq UnKnown
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1089
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1090 NotSCSZ equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1091
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1092 NotSSAT equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1093
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1094 * Process unknown GETSTT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1095
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1096 * lbra UNKNOWN
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1097 bra G.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1098 * bra NotEOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1099
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1100 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1101 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1102 * SETSTT processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1103 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1104 * Supports the following codes:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1105 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1106 * SS.Opt Option section
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1107 * SS.Siz No effect unless size=0; then clears pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1108 * SS.FD No effect
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1109 * SS.SSig Set signal on data available
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1110 * SS.Relea Release signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1111 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1112 * SS.Opt handled in IOMAN, etc.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1113 * SS.Siz, SS.SSig, SS.Relea by Chris Burke, modified
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1114 * from OSK.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1115 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1116
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1117 SetStt lda R$B,U Get User B Register ++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1118 cmpa #SS.Opt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1119 beq SST.Ign ; (ignore)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1120 cmpa #SS.FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1121 beq SST.Ign
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1122
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1123 * Check for SS.SIZ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1124
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1125 cmpa #SS.Size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1126 bne NoS.Siz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1127
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1128 ldd R$U,U ;Get caller's size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1129 bne SST.Ign
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1130
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1131 * Clear the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1132
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1133 ldx PD.Buf,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1134 leau PP.Data,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1135 stu PD.NxtI,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1136 stu PD.NxtO,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1137 clr (PD.BCnt+0),Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1138 clr (PD.BCnt+1),Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1139 clr PD.RFlg,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1140 clr PD.Wrtn,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1141
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1142 QST.OK bra SST.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1143
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1144 * Check for SS.SSig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1145
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1146 NoS.Siz cmpa #SS.SSig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1147 bne NoS.Sig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1148
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1149 leax PD.Read,Y ;Point at read packet
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1150 tst PM.Cpr,X ;Error if already somebody waiting
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1151 bne NOTEOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1152
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1153 * Set signal trap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1154
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1155 lda PD.CPR,Y ;Set process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1156 sta PM.CPR,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1157 lda (R$X+1),U ;Get signal code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1158 sta PM.Sig,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1159 tst PD.BCnt,Y ;Immediate signal if
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1160 lbne SendSig
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1161
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1162 bra QST.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1163
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1164 * Check for release of signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1165
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1166 NoS.Sig cmpa #SS.Relea
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1167 bne NoS.Rel
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1168
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1169 leax PD.Read,Y ;Point at read packet
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1170 lda PM.CPR,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1171 cmpa PD.CPR,Y ;Our process set it?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1172 bne QST.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1173
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1174 * Release signal trap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1175
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1176 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1177 lbra Switch
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1178
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1179 * Not SS.Relea. Check for SS.Attr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1180
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1181 NoS.Rel cmpa #SS.Attr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1182 bne NoS.Atr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1183
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1184 * Change attributes if allowed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1185
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1186 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1187 lda P$ID,X ;Are we superuser?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1188 beq SAT.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1189 tst PD.Own,Y ;Is creator still attached?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1190 bne SAT.XX
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1191
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1192 sta PD.Own,Y ;Inherit pipe if owner abandoned it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1193
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1194 SAT.XX cmpa PD.Own,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1195 lbne FNAXit ;If can't match PID, E$FNA error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1196
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1197 * Change attributes.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1198 * Reg-U points at caller's registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1199
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1200 SAT.OK lda R$A,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1201 ora #(READ.+WRITE.) ;We insist . . .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1202 sta PD.MOD,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1203 bra QST.OK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1204
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1205 * Unknown SETSTT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1206
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1207 NoS.Atr lbra Unknown
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1208
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1209 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1210 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1211 * Read CR-terminated line or element count from
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1212 * pipe with no editing. Note that this call is
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1213 * not well defined for element sizes other than
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1214 * 1 byte.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1215 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1216
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1217 READLN ldb PD.ESiz,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1218 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1219 bne RddEOF ;EOF error if more than 1 byte per element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1220
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1221 ldb #CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1222 stb PD.REOR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1223 bra READ001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1224
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1225 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1226 * Read element count from pipe with no editing.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1227 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1228 * Note that if there are fewer elements in the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1229 * than the user wants to read, and there are no writers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1230 * for the pipe, we return all elements followed by E$EOF.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1231 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1232
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1233 READ clr PD.REOR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1234
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1235 * Generic read. PD.REOR = terminator if non-null
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1236
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1237 READ001 leax PD.Read,Y ;Get PID of reader (us)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1238 lbsr GETFREE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1239 bcs RddRTS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1240
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1241 ldd R$Y,U ;Desired element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1242 beq RddXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1243
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1244 * Set up for outer loop -- push zero element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1245 * and space for buffer pointers on stack.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1246
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1247 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1248 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1249 pshs D ;Initial count of elements read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1250 leas -4,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1251 ldx R$X,U ;Initial buffer start address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1252 bra RddNext
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1253
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1254 * Enter here to block on read. If there are no writers,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1255 * return E$EOF.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1256
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1257 CantRdd pshs X ;Save buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1258
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1259 leax PD.Read,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1260 lbsr SigSlp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1261 lbcs RddDone
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1262
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1263 * Inner loop to read bytes.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1264 * Here for initial attempt to read,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1265 * or to retry after blocking
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1266
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1267 READOK ldx <D.PROC ;Point to our task descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1268 ldb P$TASK,X ++LII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1269 puls X ++LII Recover current buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1270
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1271 * Inner read loop. Read one element.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1272 * Note that we could use F$Move for elements larger
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1273 * than 1 byte, because queue size is always an even
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1274 * multiple of element size.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1275
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1276 RddMore lbsr DOREAD ;Get byte to A, or CS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1277 bcs CantRdd
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1278
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1279 os9 F$STABX ;Put byte in caller's buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1280 leax 1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1281 tst PD.REOR,Y ;Is there an EOR character?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1282 beq NotRdLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1283
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1284 cmpa PD.REOR,Y ;Did we match it?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1285 beq RddEOL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1286
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1287 NotRdLn cmpx 0,S ;Compare current addr. to end addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1288 blo RddMore ; and loop until done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1289
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1290 * Done with element. Check for next.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1291
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1292 pshs X ;Save buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1293
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1294 bsr CntDn ;Update queue count, etc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1295 cmpd R$Y,U ;Got all elements?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1296 bhs RddTail
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1297
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1298 * Outer loop -- read one element at a time.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1299 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1300 * X = next data pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1301 * Y = PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1302
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1303 RddNext stx 0,S ;Set new start address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1304 ldb PD.ESiz,Y ;Size of one element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1305 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1306 addd 0,S ;Compute end address of current element bfr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1307 std 2,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1308 bra READOK ;Go to element reading loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1309
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1310 * Read an EOL. Advance element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1311
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1312 RddEOL pshs X ;Save buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1313 bsr CntDn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1314
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1315 * Read everything, or aborting
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1316
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1317 RddDone ldd 4,S ;Get element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1318
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1319 * Tail end of read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1320
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1321 RddTail std R$Y,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1322 leas 6,S ;Clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1323 bne RddSome ;Success if read more than 0 elements
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1324
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1325 * EOF error if no bytes read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1326
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1327 RddEOF comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1328 ldb #E$EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1329 bra RddXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1330
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1331 * Successful exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1332
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1333 RddSome clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1334
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1335 RddXit leax PD.Read,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1336 lbra SWITCH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1337
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1338 * Decrement queued count, inc read count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1339
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1340 CntDn ldd #-1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1341 bra CUpDn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1342
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1343 * Increment queued count, inc written count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1344
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1345 CntUp ldd #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1346
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1347 CUpDn addd PD.BCnt,Y ;Modify count of elements queued
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1348 std PD.BCnt,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1349
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1350 * Bump I/O count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1351
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1352 IOCnt ldd (2+4),S ;Bump count of elements read/written
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1353 addd #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1354 std (2+4),S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1355 RDDRTS rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1356
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1357 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1358 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1359 * Write CR-terminated line or element count to
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1360 * pipe with no editing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1361 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1362
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1363 WRITELN ldb PD.ESiz,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1364 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1365 bne RddEOF ;EOF error if more than 1 byte per element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1366
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1367 ldb #CR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1368 stb PD.WEOR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1369 bra Wrt001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1370
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1371 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1372 * Write byte count to pipe with no editing.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1373 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1374
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1375 WRITE clr PD.WEOR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1376
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1377 * Generic entry point
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1378
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1379 Wrt001 leax PD.Writ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1380 lbsr GETFREE ;Check I/O queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1381 bcs WrtXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1382
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1383 ldd R$Y,U ;Element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1384 beq WrtXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1385
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1386 * Set up for outer loop -- push zero element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1387 * and space for buffer pointers on stack.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1388
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1389 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1390 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1391 pshs D ;Initial count of elements read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1392 leas -4,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1393 ldx R$X,U ;Initial buffer start address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1394 bra WrtNext
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1395
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1396 * Enter here to block on write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1397
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1398 CantWrt pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1399
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1400 leax PD.Writ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1401 lbsr SigSlp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1402 bcs WrtErr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1403
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1404 * Begin (or resume) write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1405
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1406 WRITOK ldx <D.PROC ++LII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1407 ldb P$TASK,X ;Get our DAT image #
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1408 puls X ++LII
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1409
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1410 * Main write loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1411
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1412 WrtMore os9 F$LDABX ;Get a byte from caller's buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1413 lbsr DOWRITE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1414 bcs CantWrt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1415
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1416 leax 1,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1417 tst PD.WEOR,Y ;EOL character defined?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1418 beq NotWrLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1419
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1420 cmpa PD.WEOR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1421 beq WrtEOL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1422
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1423 * See if at end of buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1424
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1425 NotWrLn cmpx 0,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1426 blo WrtMore
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1427
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1428 * Done with element. Check for next.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1429
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1430 pshs X ;Save buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1431
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1432 bsr CntUp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1433 cmpd R$Y,U ;Put all elements?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1434 bhs WrtTail
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1435
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1436 * Outer loop -- write one element at a time.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1437
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1438 WrtNext stx 0,S ;Set new start address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1439 ldb PD.ESiz,Y ;Size of one element
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1440 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1441 addd 0,S ;Compute end address of current element bfr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1442 std 2,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1443 bra WRITOK ;Go to element reading loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1444
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1445 * Wrote an EOL. Advance element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1446
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1447 WrtEOL pshs X ;Save buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1448 bsr CntUp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1449
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1450 * Wrote everything, or aborting
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1451
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1452 WrtDone ldd 4,S ;Get element count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1453
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1454 * Tail end of write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1455
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1456 WrtTail std R$Y,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1457 leas 6,S ;Clean stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1458
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1459 * Successful exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1460
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1461 WrtSome clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1462
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1463 WrtXit leax PD.Writ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1464 bra SWITCH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1465
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1466 * Error exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1467
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1468 WrtErr pshs B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1469 ldd (4+1),S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1470 std R$Y,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1471 puls B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1472
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1473 leas 6,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1474 bra WrtXit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1475
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1476 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1477 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1478 * I/O queue manipulation routines
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1479 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1480
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1481 GETFREE lda PM.CPR,X ;Is any process using this resource?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1482 beq SETPMCPR ; (branch if not)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1483
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1484 cmpa PD.CPR,Y ;Does caller control this resource?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1485 beq OURDEVIC ; (branch if so)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1486
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1487 inc PM.CNT,X ;Bump # of active r/w images
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1488 ldb PM.CNT,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1489 cmpb PD.CNT,Y ;See if equal to # of open images
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1490 bne SETQUEUE ; (if not, run everybody else to free it)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1491
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1492 lbsr SENDSIG ;Yes -- wake up next process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1494 * Process number in Reg-A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1495 * Put the process into the I/O queue and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1496 * sleep until a signal wakes us up
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1497
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1498 SETQUEUE os9 F$IOQU
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1499 dec PM.CNT,X ;Caller is asleep, so 1 less active
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1500 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1501 ldx <D.PROC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1502 ldb P$SIGNAL,X ;Get caller's signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1503 puls X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1504 beq GETFREE ;Loop until there's a signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1505
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1506 coma ;Error if caller is waiting
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1507 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1508
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1509 * Nobody using the resource. Grab it.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1510
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1511 SETPMCPR ldb PD.CPR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1512 stb PM.CPR,X ;Make caller "owner"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1513
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1514 * Exit -- caller owns the pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1515
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1516 OURDEVIC clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1517 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1518
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1519 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1520 * Set a wakeup signal for the calling process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1521 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1522
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1523 SigSlp ldb PM.CNT,X ;Active image count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1524 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1525 cmpb PD.CNT,Y ;Everybody active?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1526 bne SgSlp01 ; (if not, try sending signals)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1527
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1528 * Nobody on the other end to signal.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1529 * Error if anonymous, else hang out a bit.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1530
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1531 tst PD.Name,Y ;If anonymous pipe & nobody left, error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1532 beq WRITEROR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1533
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1534 * Named pipe and nobody to signal. Not an error if data in pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1535
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1536 tst PD.BCnt,Y ;Number of items in pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1537 beq WRITEROR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1538
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1539 * Send signal to other end of pipe (may not be one, though)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1540
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1541 SgSlp01 stb PM.CNT,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1542 ldb #S$WAKE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1543 stb PM.SIG,X ;Force caller's signal to "wakeup"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1544 clr PD.CPR,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1545 pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1546 tfr X,D ;Switch from reader to writer or vis-a-vis
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1547 eorb #4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1548 tfr D,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1549 lbsr SENDSIG ;Send signal to opposite end of pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1550 ldx #0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1551 os9 F$SLEEP ;Caller sleeps until signaled
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1552 ldx <D.PROC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1553 ldb P$SIGNAL,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1554 puls X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1555 dec PM.CNT,X ;Caller is asleep, so 1 less active
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1556 tstb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1557 bne GOTSIGNL ;Error if opposite end set no signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1558
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1559 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1560 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1561
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1562 * WRITE ERROR hook
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1563
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1564 WRITEROR ldb #E$WRITE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1565
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1566 * Generic error hook
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1567
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1568 GOTSIGNL coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1569 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1570
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1571 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1572 * Release this end of the pipe, and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1573 * send a signal to the other end.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1574 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1575 * Enter pointing to variables for
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1576 * this end; exit pointing to variables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1577 * for opposite end.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1578 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1579
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1580 SWITCH pshs CC,B,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1581 clr PM.CPR,X ;No process controlling current end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1582 tfr X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1583 eorb #4 ;Switch to other end (MAGIC)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1584 tfr D,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1585 lbsr SENDSIG ;Awaken other end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1586 puls CC,B,U,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1587
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1588 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1589 * Write one byte to queue described in path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1590 * descriptor. Return CS if queue full.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1591 * Doesn't update count of ELEMENTS queued.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1592 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1593
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1594 DOWRITE pshs B,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1595 ldx PD.NxtI,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1596 ldb PD.RFlg,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1597 beq SETREADY ;(say data available)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1598
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1599 cmpx PD.NxtO,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1600 bne STORDATA ;(branch if queue not full)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1601
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1602 * Error -- queue is full
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1603
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1604 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1605 puls B,X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1606
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1607 * Mark data available in queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1608
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1609 SETREADY ldb #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1610 stb PD.RFlg,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1611
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1612 * Put data in Reg-A into queue, and advance
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1613 * pointer to next in w/ wrap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1614
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1615 STORDATA sta ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1616 cmpx PD.End,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1617 blo WTNOWRAP
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1618
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1619 ldx PD.BUF,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1620 leax PP.Data,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1621
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1622 WTNOWRAP stx PD.NxtI,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1623
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1624 * Don't step Character Input Counter.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1625
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1626 clr PD.Wrtn,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1627 puls B,X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1628
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1629 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1630 * Read one byte from queue described in path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1631 * descriptor. Return CS if none available.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1632 * Doesn't update count of ELEMENTS queued.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1633 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1634
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1635 DOREAD lda PD.RFlg,Y ;Any data?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1636 bne DATAREDY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1637
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1638 * No data -- return CS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1639
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1640 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1641 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1642
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1643 * Get data from queue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1644
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1645 DATAREDY pshs X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1646 ldx PD.NxtO,Y ;Get next out pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1647 lda ,X+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1648 cmpx PD.End,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1649 blo RDNOWRAP
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1650
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1651 ldx PD.BUF,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1652 leax PP.Data,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1653
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1654 * Save updated next out pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1655
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1656 RDNOWRAP stx PD.NxtO,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1657 cmpx PD.NxtI,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1658 bne NOTEMPTY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1659
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1660 clr PD.RFlg,Y ;Mark queue empty
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1661
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1662 * Don't decrement Character Input Counter.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1663
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1664 NOTEMPTY equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1665
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1666 * Exit with character in Reg-A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1667
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1668 andcc #^Carry ;Clear carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1669 puls X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1670
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1671 page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1672 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1673 * Utility placed here to not make assembly listing obsolete.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1674 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1675
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1676 MovSet os9 F$Move ;Do inter-process block move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1677
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1678 * Force set MSB at end of name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1679
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1680 tfr Y,D ;Byte count to D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1681 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1682 lda B,U ;Get last byte of name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1683 ora #%10000000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1684 sta B,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1685
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1686 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1687
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1688 ifeq (PIPEDIR-YESDIR)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1689
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1690 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1691 * Find out how many pipes there are for the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1692 * current device, and set up device descriptor
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1693 * so that pipe buffer will hold 32 bytes of
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1694 * data for each.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1695 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1696 * Reg-Y = PD pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1697 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1698 * Exit with size set up in PD.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1699 * CC=EQ if no pipes.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1700 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1701
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1702 SizDirP pshs X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1703
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1704 clrb ;Clear count of pipes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1705 ldx PD.Dev,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1706 ldx V$Stat,X ;Point at static storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1707 ldx V.List,X ;Get head of linked list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1708 beq GotCnt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1709
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1710 * There are some pipes. Count them.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1711
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1712 PCount incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1713 ldx PP.Next,X ;Track down linked list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1714 bne PCount
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1715
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1716 * Now Reg-B = pipe count. Need 32 bytes per pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1717
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1718 GotCnt incb ;Add one for us!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1719 lda #32
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1720 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1721 std PD.QSiz,Y ;Set element count for this pipe
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1722 lda #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1723 sta PD.ESiz,Y ;Set element size to 1 byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1724
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1725 puls D,X,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1726
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1727 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1728 * Fill pipe buffer with directory data.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1729 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1730 * The data is organized like an RBF directory:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1731 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1732 * Offset Data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1733 * -------- --------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1734 * $00-$1C Pipe name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1735 * $1D DAT task number of pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1736 * $1E-$1F Address of pipe buffer in task
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1737 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1738 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1739 FilDirP pshs U,X,D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1740
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1741 ldx PD.Dev,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1742 ldx V$Stat,X ;Point at static storage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1743 ldx V.List,X ;Get head of linked list
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1744 beq GotFil
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1745
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1746 * Write data for pipe buffer @X to pipe with PD @Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1747
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1748 FD000 ldu PP.PD,X ;Point at PD for pipe to be dumped
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1749 leau PD.Name,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1750 ldb #NameMax
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1751
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1752 FD001 lda ,u+ ;Write pipe name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1753 bsr QWrite
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1754 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1755 bne FD001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1756
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1757 ldu <D.SysPrc ;Get system DAT image number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1758 lda P$Task,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1759 bsr QWrite
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1760
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1761 pshs X ;Get pipe buffer pointer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1762 lda ,S+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1763 bsr QWrite
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1764 lda ,S+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1765 bsr QWrite
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1766
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1767 * Advance to next pipe buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1768
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1769 ldx PP.Next,X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1770 bne FD000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1771
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1772 * All done. Restore regs & exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1773
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1774 GotFil puls D,X,U,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1775
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1776 * Byte saver
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1777
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1778 QWrite lbra DoWrite
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1779
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1780 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1781 * Immortal entry point
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1782 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1783 Immort coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1784 sbcb #38
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1785 lsrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1786 fcb $42 ;SBCB op-code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1787
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1788 * Fall through to SS.FD processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1789
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1790 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1791 * Routine to process SS.FD call on an open pipe.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1792 * Creates a pseudo-FD in the user's buffer (@R$X).
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1793 * Desired byte count in R$Y.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1794 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1795 * The pseudo-file descriptor sector includes the following:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1796 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1797 * Offset Description
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1798 * -------- --------------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1799 * $00 Attributes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1800 * $01-$02 Owner's *PROCESS* ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1801 * $03-$07 Zeros (date of last access)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1802 * $08 Use count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1803 * $09-$0C Number of items queued
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1804 * $0D-$0F Zeros (creation date)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1805 * $10-$FF Zeros (segment list -- at least 5 zeros needed)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1806 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1807
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1808 DoSSFD pshs D,X,Y,U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1809
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1810 ldb #(16+5) ;Clear data on stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1811 SSFD01 clr ,-S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1812 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1813 bne SSFD01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1814
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1815 * Set attributes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1816 lda PD.Mod,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1817 sta FD.ATT,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1818
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1819 * Set owner's process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1820 lda PD.Own,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1821 sta (FD.OWN+1),S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1822
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1823 * Set use count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1824 lda PD.CNT,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1825 sta FD.LNK,S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1826
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1827 * Set queue count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1828
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1829 ldd PD.BCNT,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1830 std (FD.SIZ+2),S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1831
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1832 * Now copy the data into the caller's buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1833
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1834 ldx <D.SysPrc ;Pointer to our PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1835 lda P$Task,X ; get system's DAT image # (source)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1836 ldx <D.Proc ;Pointer to caller's PD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1837 ldb P$Task,X ; get caller's DAT image # (dest)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1838 ldy R$Y,U ;Byte count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1839 leax 0,S ;Source address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1840 ldu R$X,U ;Destination address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1841 os9 F$Move ;Do the move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1842
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1843 * All done.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1844
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1845 leas (16+5),S
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1846 puls U,X,Y,D,PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1847
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1848 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1849
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1850 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1851
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1852 MODSIZE equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1853
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1854 end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1855