NEW
  AUTO 3,1
*--------------------------------------
VEDRIVE.ReadConf
				jsr MLI
				.DA #MLIGETPREFIX
				.DA MLIGETPREFIX.P
				bcs .9

				ldx #0
				ldy CONF.FILEPATH

.1				lda	CONF.FILENAME,x
				iny
				sta	CONF.FILEPATH,y
				inx
				cpx #CONF.FILENAME.L
				bne .1

				sty CONF.FILEPATH

				lda #CONF.FILEPATH
				pha
				lda /CONF.FILEPATH
				pha
				>LDYAI VEDRIVE.CONF
				jsr PrintFYA

				jsr MLI
				.DA #MLIOPEN
				.DA MLIOPEN.P
				bcc .10

				>LDYAI VEDRIVE.CONFKO
				jsr PrintFYA
				sec
				rts

.10				lda MLIOPEN.P+5
				sta MLINEWLINE.P+1
				sta MLIREAD.P+1
				sta MLICLOSE.P+1

				jsr MLI
				.DA #MLINEWLINE
				.DA MLINEWLINE.P
				bcs .9

.2				jsr MLI
				.DA #MLIREAD
				.DA MLIREAD.P
				bcs .8

				ldx MLIREAD.P+6
				stz CONF.LBUF,x

				jsr VEDRIVE.CONF.L
				bcc .2

				>LDYAI VEDRIVE.CONFSYN
				jsr PrintFYA

				sec
				bra .9

.8				cmp #MLI.E.EOF
				sec
				bne .9

				lda CONF.NIC
				bmi .9

				lda CONF.SLOT
				beq .9

				lda CONF.SERVER
				beq .9

				clc

.9				php
				pha
				jsr MLI
				.DA #MLICLOSE
				.DA MLICLOSE.P
				pla
				plp
				rts
*--------------------------------------
VEDRIVE.CONF.L	>LDYAI CONF.LBUF
				>STYA ZPPtr1

				lda (ZPPtr1)

				cmp #13					CR
				beq .8

				cmp #'#'				comment
				beq .8

				>LDYAI CONF.KW
				jsr VEDRIVE.CONF.KW
				bcs .9
	
.1				jsr VEDRIVE.GetNextCharPtr1
				bcs .9

				cmp #32
				beq .1

				ldx idx
				jmp (.5,x)

.5				.DA VEDRIVE.CONF.KW.NIC
				.DA VEDRIVE.CONF.KW.SLOT
				.DA VEDRIVE.CONF.KW.MAC
				.DA VEDRIVE.CONF.KW.ADDRESS
				.DA VEDRIVE.CONF.KW.MASK
				.DA VEDRIVE.CONF.KW.GATEWAY
				.DA VEDRIVE.CONF.KW.SERVER
				.DA VEDRIVE.CONF.KW.PORT
				.DA VEDRIVE.CONF.KW.SIZE1
				.DA VEDRIVE.CONF.KW.SIZE2

.8				clc
.9				rts
*--------------------------------------
VEDRIVE.CONF.KW	sty ZPPtr2
				sta ZPPtr2+1

				ldy #$ff

.1				iny
				lda (ZPPtr1),y
				cmp #13					CR
				beq .2

				cmp #32					SPACE
				bne .1

.2				sty len

				stz idx

.3				lda len
				cmp (ZPPtr2)
				bne .6

				tay

.4				lda (ZPPtr2),y
				dey
				cmp (ZPPtr1),y
				bne .6

				tya
				bne .4

				lda ZPPtr1
				clc
				adc len
				sta ZPPtr1
				bcc .5

				inc ZPPtr1+1

.5				clc
				rts

.6				lda	(ZPPtr2)
				sec
				adc ZPPtr2
				sta ZPPtr2
				bcc .7

				inc ZPPtr2+1

.7				inc idx
				inc idx
				lda	(ZPPtr2)
				bne .3

				sec
				rts
*--------------------------------------
VEDRIVE.CONF.KW.NIC
				>LDYAI CONF.KW.NIC
				jsr VEDRIVE.CONF.KW
				bcs .9

				lda idx
				sta CONF.NIC

				clc
.9				rts
*--------------------------------------
VEDRIVE.CONF.KW.SLOT
				lda (ZPPtr1)
				cmp #'1'
				bcc .9

				cmp #'8'
				bcs .9

				and #$0F
				sta CONF.SLOT

				clc
				rts

.9				sec
				rts
*--------------------------------------
VEDRIVE.CONF.KW.MAC
				ldy #6
				ldx #0

.1				jsr VEDRIVE.CONF.GetHexByte
				bcs .9

				sta CONF.SRCMAC,x
				inx
				dey
				beq .9					CC

				jsr VEDRIVE.GetNextCharPtr1
				bcs .9

				cmp #':'
				sec
				bne .9

				jsr VEDRIVE.GetNextCharPtr1
				bcc .1				
				
.9				rts
*--------------------------------------
VEDRIVE.CONF.KW.ADDRESS
				ldx #CONF.ADDRESS-CONF.IPCFG
				.HS 2C					BIT ABS
VEDRIVE.CONF.KW.MASK
				ldx #CONF.MASK-CONF.IPCFG
				.HS 2C					BIT ABS
VEDRIVE.CONF.KW.GATEWAY
				ldx #CONF.GATEWAY-CONF.IPCFG
				.HS 2C					BIT ABS
VEDRIVE.CONF.KW.SERVER
				ldx #CONF.SERVER-CONF.IPCFG

VEDRIVE.CONF.GetIPatX
				jsr VEDRIVE.CONF.GetShort
				bcs .9

				ldy #4

.1				sta CONF.IPCFG,x
				inx
				dey
				beq .9					CC

				lda (ZPPtr1)
				cmp #13
				beq .9

				cmp #'.'
				sec
				bne .9
				
				jsr VEDRIVE.GetNextCharPtr1
				bcs .9

				jsr VEDRIVE.CONF.GetShort
				bcc .1

.9				rts
*--------------------------------------
VEDRIVE.CONF.KW.PORT
				jsr VEDRIVE.CONF.GetInt
				bcs .9

				lda int
				sta CONF.PORT+1

				lda int+1
				sta CONF.PORT

.9				rts
*--------------------------------------
VEDRIVE.CONF.KW.SIZE1
				stz bD1Size
				jsr VEDRIVE.CONF.GetInt
				bcs .9

				lda int
				sta CONF.D1TOTALBLK

				lda int+1
				sta CONF.D1TOTALBLK+1
				
				dec bD1Size

.9				rts
*--------------------------------------
VEDRIVE.CONF.KW.SIZE2
				stz bD2Size
				jsr VEDRIVE.CONF.GetInt
				bcs .9

				lda int
				sta CONF.D2TOTALBLK

				lda int+1
				sta CONF.D2TOTALBLK+1

				dec bD2Size
				
.9				rts
*--------------------------------------
VEDRIVE.CONF.GetHexByte
				jsr VEDRIVE.GetCharPtr1
				bcs .9

				jsr VEDRIVE.IsHexDigit
				bcs .9

				asl
				asl
				asl
				asl
				sta int
				
				jsr VEDRIVE.GetNextCharPtr1
				bcs .9

				jsr VEDRIVE.IsHexDigit
				bcs .9

				ora int

*				clc

.9				rts
*--------------------------------------
VEDRIVE.CONF.GetShort
				jsr VEDRIVE.CONF.GetInt
				bcs .9

				lda int+1
				sec
				bne .9

				lda int
				clc

.9				rts
*--------------------------------------
VEDRIVE.CONF.GetInt
				stz int
				stz int+1
				
				jsr VEDRIVE.GetCharPtr1
				bcs .9

				jsr VEDRIVE.IsDigit
				bcs .9

.1				pha

				lda int+1
				pha
				lda int
				pha

				asl int
				rol int+1				x2
				asl int
				rol int+1				x4

				pla
				clc
				adc int
				sta int

				pla
				adc int+1
				sta int+1				x4+1 = x5

				asl int
				rol int+1				x10

				pla
				clc
				adc int
				sta int
				bcc .2

				inc int+1

.2				jsr VEDRIVE.GetNextCharPtr1
				bcs .8
				
				jsr VEDRIVE.IsDigit
				bcc .1

.8				clc
.9				rts
*--------------------------------------
VEDRIVE.GetNextCharPtr1
				inc ZPPtr1
				bne VEDRIVE.GetCharPtr1

				inc ZPPtr1+1
*--------------------------------------
VEDRIVE.GetCharPtr1
				lda (ZPPtr1)
				cmp #13
				beq .9

.8				clc
.9				rts
*--------------------------------------
VEDRIVE.IsHexDigit
				jsr VEDRIVE.IsDigit
				bcc .8

				cmp #'A'
				bcc .9

				cmp #'F'+1
				bcc .1

				cmp #'a'
				bcc .9

				cmp #'f'+1
				bcs .99

				eor #$20			

.1
*				clc
				sbc #'A'-11			cc so A->10 (11-CC)
				clc
.8				rts
				
.9				sec
.99				rts
*--------------------------------------
VEDRIVE.IsDigit	cmp #'0'
				bcc .9

				cmp #'9'+1
				bcs .99

				and #$0F
*				clc				
				rts

.9				sec
.99				rts
*--------------------------------------
MAN
SAVE usr/src/sys/pm.vedrive.s.cf
LOAD usr/src/sys/pm.vedrive.s
ASM
