# HG changeset patch # User boisy # Date 1041808312 0 # Node ID 1cf59b6e12df4937b44f3cfc46652d4d1e3a3c8a # Parent 26d34f1c5aebb7cca0ec1e8af551723973806005 Brought over from NitrOS-9 diff -r 26d34f1c5aeb -r 1cf59b6e12df level2/modules/pipeman.asm --- a/level2/modules/pipeman.asm Sun Jan 05 22:49:28 2003 +0000 +++ b/level2/modules/pipeman.asm Sun Jan 05 23:11:52 2003 +0000 @@ -1,318 +1,399 @@ ******************************************************************** -* PipeMan - Pipe file manager +* PipeMan - NitrOS-9 Pipe File Manager +* +* Enhanced and re-written by Alan DeKok +* +* 'show grf.3.a | eat' (eat is cat, but just does a I$ReadLn, and not I$WritLn) +* April 10, 1996 14:05:15 +* April 10, 1996 14:07:47 +* 15.2 seconds per iteration +* i.e. everything but the screen writes +* +* fast SCF+fast pipe +* 'show grf.3.a | cat', 10 times +* April 10, 1996 13:17:54 +* April 10, 1996 13:21:57 +* 24.3 seconds per iteration +* 9.1 solely for pipes +* +* fast SCF+old slow pipe +* April 10, 1996 13:30:24 +* April 10, 1996 13:38:04 +* 46.0 seconds per iteration +* 30.8 solely for pipes +* +* speedup percent is (30.8-9.1)/30.8 = 70% +* +* Pipes are more than doubled in speed! +* +* 32 byte read and write buffers * * $Id$ * * Ed. Comments Who YY/MM/DD * ------------------------------------------------------------------ -* 4 Original OS-9 L2 Tandy distribution -* Added comments from Curtis Boyle's code BGP 98/10/22 nam PipeMan - ttl Pipe file manager + ttl NitrOS-9 Pipe File Manager - ifp1 + ifp1 use defsfile - use pipedefs - endc + endc -rev set $01 +tylg set FlMgr+Objct +atrv set ReEnt+Rev +rev set $03 edition set 4 - mod eom,Name,FlMgr+Objct,ReEnt+rev,Start,0 + mod eom,name,tylg,atrv,start,size + + rmb $0000 +SIZE equ . -Name fcs /PipeMan/ + org PD.FST +PD.READ rmb 4 +PD.WRITE rmb 4 +PD.END rmb 2 end of the buffer +PD.WPTR rmb 2 write pointer +PD.RPTR rmb 2 read pointer +PD.BLOCK rmb 1 0=block reads, 1=OK to read block flag + + org $0000 +P.CPR rmb 1 process ID +P.CNT rmb 1 count +P.SIG rmb 1 signal code +P.FLAG rmb 1 raw/edit flag + +name fcs /PipeMan/ fcb edition -Start lbra Create Create, same as open - lbra Open Open - lbra UnkSvc MakDir - lbra UnkSvc ChgDir - lbra UnkSvc Delete - lbra L0040 Seek - lbra PRead PRead - lbra PWrite PWrite - lbra L00AB PRdLn - lbra L0105 PWrLn - lbra L0040 GetStat - lbra L0040 SetStat - lbra Close Return to system +start lbra Create + lbra Open + lbra MakDir + lbra ChgDir + lbra Delete +Seek clrb + rts + nop + lbra Read + lbra Write + lbra ReadLn + lbra WritLn +GetStt clrb + rts + nop +SetStt clrb + rts + nop +Close lda PD.CNT,y + bne L008E + LDU PD.BUF,y if no one's using it, + clrb + inca + os9 F$SRtMem return the memory + clrb + rts -UnkSvc comb Exit with Unknown Service error - ldb #E$UnkSvc - rts +L008E leax PD.READ,y + cmpa PD.READ+P.CNT,y is the read count zero? + Beq L009C + + cmpa PD.WRITE+P.CNT,y is the write count zero? + bne L00A9 + leax PD.WRITE,y -L0040 clrb No error & return +L009C lda P.CPR,x get process ID that's reading/writing + beq L00A9 if none + ldb P.SIG,x get signal code + beq L00A9 + clr P.SIG,x + os9 F$Send send a wake-up signal to the process +L00A9 clrb rts -* Open or create a Pipe -Create -Open ldu PD.RGS,y get Caller's register stack ptr - ldx R$X,u get pointer to pathname - pshs y preserve descriptor pointer - os9 F$PrsNam is it legal? - bcs L007B no, exit with error - ldx