NEW
  AUTO 3,1
*--------------------------------------
* K.PFTAdd
*  In : 
*  Out : 
*--------------------------------------
K.PFTAdd
*--------------------------------------
* K.PFTRemove
*  In : 
*  Out : 
*--------------------------------------
K.PFTRemove		
				clc
K.PFTRemove.RTS	rts
*--------------------------------------
* PFT.CheckPath
*  In : 
*   (pStack),y = PATH (C-String)
*  Out : 
*--------------------------------------
PFT.CheckPath0	ldy #0
				.HS 2C					BIT ABS
PFT.CheckPath2	ldy #2
				.HS 2C					BIT ABS
PFT.CheckPath4	ldy #4

				stx .6+1				Save SYSCALL #

				lda (pStack),y
				pha
				iny
				lda (pStack),y
				>PUSHA
				pla
				>PUSHA
				
				>PUSHWI K.Buf256
				>SYSCALL2 realpath
				bcs K.PFTRemove.RTS

				ldx #0

.1				lda Flt.Table.hPath,x
				beq .8

				jsr K.GetMemPtr
				>STYA ZPPtr1

				ldy #$ff

.2				iny
				lda (ZPPtr1),y			"/FILTER\0"
				beq .3					end of filter string....

				cmp K.Buf256,y			can be \0
				beq .2

				bra .8

.3				lda K.Buf256,y			path is "/FILTER/..." ?
				cmp #'/'
				bne .8

				lda Flt.Table.hLib,x	get hLib
				jsr K.GetMemPtr
				>STYA .7+1
				pla						discard JSR return @
				pla
				>LDYAI K.Buf256			pass full path to handler

.6				ldx #$ff				SELF MODIFIED SYSCALL #			
.7				jmp $ffff				SELF MODIFIED

.8				inx
				cpx #K.FLT.MAX
				bne .1

				>LDYAI K.Buf256
*--------------------------------------
PFT.YAToMLIPATH	>STYA .1+1

				ldx #0					no filter, prodos path

.1				lda  $ffff,x			SELF MODIFIED
				beq .2

				inx
				sta K.MLI.PATH,x
				cpx #MLI.MAXPATH
				bne .1

.2				stx K.MLI.PATH
				inx
				stz K.MLI.PATH,x		Make ending 0 for /dev/xxx path

				>LDYAI K.MLI.PATH
				>STYA K.MLI.PARAMS+1

				clc
				rts
*--------------------------------------
* PFT.CheckNodeA
*  In : 
*   A = hFILE
*  Out : 
*--------------------------------------
PFT.CheckNodeA	stx .80+1				Save SYSCALL #
				sta .81+1				Save hFILE

				tax
				lda OF.Table.hFD-1,x
				beq .9

				sta IO.hFD
				ldy OF.Table.hPath-1,x	if 0, its a hDEV
				bne .10

				tax
				ldy Dev.Table-1,x
				lda Dev.Table,x
				bra .11

.10				jsr K.GetMemPtr
.11				>STYA pFD
				ldy #S.FD.HANDLER
				lda (pFD),y
				beq .8					Handler is 0, back to kernel....

				jsr K.GetMemPtr
				>STYA .1+1
				pla						discard JSR return @
				pla
				ldx .80+1				restore SYSCALL #
				lda .81+1				restore passed hFILE

.1				jmp $ffff				SELF MODIFIED

.8				lda (pFD)				#S.FD.T
				bne .80
				ldy #S.FD.REG.REF
				lda (pFD),y
				sta K.MLI.PARAMS+1

.80				ldx #$ff				SELF MODIFIED
.81				lda #$ff				SELF MODIFIED
				clc
				rts

.9				lda #E.INVH
				sec
				rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.PFT
LOAD USR/SRC/SYS/KERNEL.S
ASM
