NEW
  AUTO 3,1
*--------------------------------------
STRVX.StrVFree	jsr K.FreeMem

				clc
				rts
*--------------------------------------
STRVX.StrVNew	jsr K.GetMem
				bcs .9

				>STYA ZPPtr1			strV

				lda #0
				sta (ZPPtr1)

				txa

*				clc

.9				rts
*--------------------------------------
STRVX.StrVSet	jsr STRVX.GetID
				bcs .7

				ldy #$ff

.1				iny
				jsr SHARED.FORPNTgY
				bne .1

				tya

*				clc
				adc #4					LEN+IDlo+IDhi+\0
				bcs .9

				cmp (ZPPtr1)
				bne .4

				lda ZPPtr1				Same Length, replace
				clc
				adc #3
				sta ZPPtr1
				bcc .2

				inc ZPPtr1+1

.2				ldy #$ff

.3				iny
				jsr SHARED.FORPNTgY
				sta (ZPPtr1),y
				bne .3

				clc
.9				rts
*--------------------------------------
.4				>LDYA ZPPtr1
				>STYA ZPPtr2

				jsr STRVX.Next

.40 			lda (ZPPtr1)
				beq .6

				tax

				ldy #0

.5				lda (ZPPtr1),y
				sta (ZPPtr2),y
				iny
				dex
				bne .5

				jsr SHARED.AddY2P1
				jsr SHARED.AddY2P2
				bra .40

.6				>LDYA ZPPtr2
				>STYA ZPPtr1
*--------------------------------------
.7				ldy #$ff

.8				iny
				jsr SHARED.FORPNTgY
				bne .8

				tya

				clc
				adc #4
				bcs .99

				sta (ZPPtr1)
				ldy #1
				lda TXTPTR
				sta (ZPPtr1),y
				iny
				lda TXTPTR+1
				sta (ZPPtr1),y

				lda ZPPtr1
				clc
				adc #3
				sta ZPPtr1
				bcc .10

				inc ZPPtr1+1

.10				ldy #$ff

.11				iny
				jsr SHARED.FORPNTgY
				sta (ZPPtr1),y
				bne .11

				iny
				sta (ZPPtr1),y			StrV Ending \0

				clc
				rts

.99				lda #E.OOM
				sec
				rts
*--------------------------------------
STRVX.StrVGet	jsr STRVX.GetID
				bcs .9

				lda ZPPtr1
*				clc
				adc #3
				sta ZPPtr1
				bcc .1

				inc ZPPtr1+1

.1				ldy #$ff

.5				iny
				lda (ZPPtr1),y
				jsr SHARED.FORPNTpY
				bne .5

				>LDYA FORPNT
				clc
				rts

.8				>LDYA ZPPtr1
				clc
.9				rts
*--------------------------------------
STRVX.GetID		jsr K.GetMemPtr
				>STYA ZPPtr1			strV

.1				lda (ZPPtr1)
				beq .9

				ldy #1

				lda (ZPPtr1),y
				cmp TXTPTR
				bne .2

				iny
				lda (ZPPtr1),y
				cmp TXTPTR+1
				beq .8

.2				jsr STRVX.Next
				bra .1

.8				clc
				rts

.9				lda #E.NOKEY
				sec
				rts
*--------------------------------------
STRVX.Next		lda (ZPPtr1)
				clc
				adc ZPPtr1
				sta ZPPtr1
				bcc .8

				inc ZPPtr1+1

.8				rts
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.strvx
LOAD usr/src/sys/kernel.s
ASM
