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

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