NEW
  AUTO 3,1
*--------------------------------------
DIR				jsr CORE.GetNCharNB
				bcs .91

				>LDYA L.CC.DIRS
				jsr CC.LookupID
				bcs .91

				jmp (J.CC.DIRS,x)

.91				lda #E.CSYN
				sec
.99				rts
*--------------------------------------
DIR.DEFINE		clc
				bit bPass2
				bmi .8

				jsr CC.CheckSpace
				bcs .90

				jsr CC.IsLetter
				bcs .90

				ldx #SYM.SC.DEFINE
				>LDA.G CC.hDefines
				jsr SYM.NewKey
				bcs .99

				>STYA ZPPtr1			SymID

				jsr CC.SkipX

				jsr CC.CheckSpace
				bcs .99

				ldy #$ff

.1				iny
				lda (ZPLineBufPtr),y
				beq .2

				cmp #C.CR
				bne .1

				dey

.2				iny

				phy

				>PUSHB.G CC.hDefines
				>PUSHW ZPPtr1			SymID
				>PUSHW ZPLineBufPtr

				ply
				lda #0
				>PUSHYA					DataLen

				>SYSCALL SListAddData
				bcs .99

.8				jmp CORE.SkipLine

.90				lda #E.CSYN
				sec
.99				rts
*--------------------------------------
DIR.INCLUDE		lda #0					>STZ.G PathBuf
				sta (pData)

				jsr CC.CheckSpace
				bcs .99

				cmp #'"'
				beq .1

				cmp #'<'
				bne .90

				>PUSHW L.ENV.INCLUDE
				>PUSHW pData			>PUSHEA.G PathBuf
				>SYSCALL GetEnv
				bcs .90

				lda #'>'

.1				sta ArgIndex

				ldy #$ff

.2				iny
				lda (pData),y
				bne .2

.3				jsr CC.GetNextChar
				beq .90

				cmp ArgIndex
				beq .4

				sta (pData),y
				iny
				cpy #MLI.MAXPATH
				bne .3

.90				lda #E.CSYN
				sec
.99				rts

.4				phy
				jsr CC.GetNextChar		skip " or >
				ply

				lda #0
				sta (pData),y			terminate string

				>LDYA pData
				jmp FIO.FOpen
*--------------------------------------
DIR.IFDEF		clc
				.HS B0					BCS
DIR.IFNDEF		sec

				ror ZPPtr1
				
				jsr CC.CheckSpace
				bcs DIR.ESYN

				jsr CC.IsLetter
				bcs DIR.ESYN

				>PUSHB.G CC.hDefines
				>PUSHW ZPLineBufPtr
				>PUSHWI 0				ScopeID
				>SYSCALL SListLookup
	
				ror
				eor ZPPtr1
				asl
				
				>LDA.G CC.DirState
				ror
				sta (pData),y

				>DEC.G CC.DirDepth
				cmp #$F8
				bcs .8
				
				lda #E.OOB
				sec
				rts
				
.8				clc
				rts
*--------------------------------------
DIR.ELSE		>LDA.G CC.DirDepth
				beq DIR.ESYN
				
				>LDA.G CC.DirState
				eor #$80
				sta (pData),y
				clc
				rts
*--------------------------------------
DIR.ENDIF		>LDA.G CC.DirDepth
				beq DIR.ESYN
				
				inc
				sta (pData),y

				>LDA.G CC.DirState
				asl
				sta (pData),y
				
				clc
				rts

DIR.ESYN		lda #E.ESYN
				sec
				rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.dir
LOAD usr/src/bin/cc.s
ASM
