NEW
  AUTO 3,1
*--------------------------------------
BS.ResetCSWKSW	pha
				lda	GP.VECTOUT
				sta	ZP.CSW
				lda	GP.VECTOUT+1
				sta	ZP.CSW+1
				lda	GP.VECTIN
				sta	ZP.KSW
				lda	GP.VECTIN+1
				sta	ZP.KSW+1
				pla
				rts

BS.SetState0	ldx	#$00
				jsr	BS.SetState
				lda	ZP.KSW+1
				cmp	GP.VDOSI+1
				bne	L9A26

				jmp	BS.SetCSWKSW2VDOS

L9A26			lda	ZP.CSW+1
				cmp	GP.VDOSO+1
				beq	BS.SetCSWKSW2VDOS

				bne	BS.SaveCSWKSW

BS.IO.OUT		cmp	X9F65
				bne	L9A54

				stx	GP.PREGX
				tsx
				lda	$103,x
				cmp	#$12
				bne	L9A6E

				lda	$104,x
				cmp	#$D8
				bne	L9A6E

				ldx	#$04
				jsr	BS.SetState
				lda	X9F65
				ldx	GP.PREGX
				jmp	BS.JMP.GP.VSYSO

L9A54			cmp	GP.CHRLAST
				sta	GP.CHRLAST
				bne	L9A74

				cmp	#$8D
				bne	L9A74

				lda	ZP.CH
				bne	L9A69

				lda	BS.CMDBUF
				cmp	#$3F

L9A69			lda	#$8D
				bcs	L9A74

				rts

L9A6E			ldx	GP.PREGX
				lda	X9F65

L9A74			jsr	BS.ResetCSWKSW
				jsr	MON.COUT
				cmp	#$8D
				bne	BS.SaveCSWKSW

				lda	AS.TRCFLG
				cmp	#$A5
				beq	L9A8B

				sta	GP.DTRACE
				lda	#$A5
				sta	AS.TRCFLG

L9A8B			lda	#$8D
BS.SaveCSWKSW	pha
				lda	ZP.KSW+1
				sta	GP.VECTIN+1
				lda	ZP.KSW
				sta	GP.VECTIN
				lda	ZP.CSW+1
				sta	GP.VECTOUT+1
				lda	ZP.CSW
				sta	GP.VECTOUT
				pla

BS.SetCSWKSW2VDOS
				pha
				lda	GP.VDOSO
				sta	ZP.CSW
				lda	GP.VDOSO+1
				sta	ZP.CSW+1
				lda	GP.VDOSI
				sta	ZP.KSW
				lda	GP.VDOSI+1
				sta	ZP.KSW+1
				pla
				rts

BS.IO.IN		bit	GP.EXECACTV
				bpl	L9AC5

				jsr	BS.SaveAXY
				jmp	BS.IO.IN.EXEC

L9AC5			jsr	BS.ResetCSWKSW
				jsr	MON.KEYIN0
				cmp	#$8D
				bne	L9AEB

				jsr	BS.SaveAXY
				sta	IO.LINEBUF,x

BS.CheckDOSCMD	jsr	BS.DOSCMD
				bit	GP.XCNUM
				bmi	L9AE8

				bcs	BS.ERROUT

				ldy	GP.PREGY
				lda	#$88
				ldx	#$00
				beq	L9AEB

L9AE8			jsr	BS.RestoreAXY
L9AEB			jmp	BS.SaveCSWKSW

BS.NODEVERR		lda	#$03

BS.ERROUT		sta	GP.ERRCODE
				sta	AS.ERRNUM
				lda	GP.STATE
				cmp	#$01
				php
				lda	#$0F
				sta	MLI.LEVEL
				lda	#$00
				sta	GP.IFILACTV
				sta	GP.OFILACTV
				sta	GP.PFXACTV
				sta	GP.MLICF.REFNUM
				lda	#MLI.C.CLOSE
				jsr	GP.GOSYSTEM
				bcs	L9B27

				jsr	LA004
				bcs	L9B27

				lda	#$00
				sta	MLI.LEVEL
				sta	GP.MLICF.REFNUM
				lda #MLI.C.FLUSH
				jsr GP.GOSYSTEM

L9B27			plp
				ldx	#$04
				bit	AS.ERRFLG
				bcs	L9B30

				ldx	#$00

L9B30			php
				jsr	BS.SetState
				jsr	BS.SetCSWKSW2VDOS
				lda	GP.ERRCODE
				plp
				bmi	L9B4D

				php
				jsr	GP.PRINTERR
				jsr	LB36B
				plp
				bcs	L9B53

				jsr	BS.CROUT
				jmp	AS.RESTART1

L9B4D			ldx	AS.REMSTK
				dex
				dex
				txs
				tax

L9B53			lda	#$03
				jmp	AS.BITERRFLG

L9B58			lda	#$00
				sta	AS.ERRNUM
				lda	#$A3
				sta	X9F65
				jsr	AS.NORMAL
				jsr	BS.ResetCSWKSW
				jsr	BS.WriteTBUF
				jsr	BS.SetState0
				jsr	BS.RestoreAXY
				jmp	BS.IO.IN

BS.IO.IN0		jsr	BS.SaveAXY
				bit	GP.PFXACTV
				bpl	L9B7E
				jmp	BS.IO.IN.CAT

L9B7E			bit	GP.IFILACTV
				bpl	L9B86
				jmp	BS.IO.IN.FILE

L9B86			bit	GP.EXECACTV
				bmi	BS.IO.IN.EXEC

				lda	ZP.PROMPT
				cmp	#$DD
				beq	L9B58

				jsr	BS.ResetCSWKSW

L9B94			lda	GP.PREGA
				ldy	GP.PREGY
				jsr	MON.KEYIN0
				cmp	#$88
				bne	L9BAC

				lda	ZP.PROMPT
				cmp	#$BE
				beq	L9BAA

				txa
				beq	L9B94

L9BAA			lda	#$88
L9BAC			jmp	BS.SaveCSWKSW

BS.IO.IN.EXEC	sta	(ZP.BASL),y
				lda	ZP.PROMPT
				cmp	#$BE
				beq	L9BF2

				lda	IO.KBD
				bpl	L9BCD

				cmp	#$83
				bne	L9BCD

				jsr	LB36B
				lda	GP.STATE
				bne	L9C01

				sta	IO.KSTROBE
				beq	L9C01

L9BCD			jsr	BS.Setup4readEFBytesAt200
				jsr	L9C6C
				bcs	L9BFA

				jsr	BS.SaveAXY
				bcc	L9BDE

L9BDA			dex
				lda	IO.LINEBUF,x

L9BDE			ora	#$80
				sta	IO.LINEBUF,x
				txa
				bne	L9BDA

				jsr	BS.ResetCSWKSW
				jsr	BS.CheckDOSCMD
				bit	GP.XCNUM
				bpl	L9BCD

L9BF1			rts

L9BF2			jsr	BS.Setup4readEFBytesAt200
				jsr	BS.ReadOneByte
				bcc	L9BF1

L9BFA			jsr	LB2B5
				cmp	#$05
				bne	L9C13

L9C01			ldx	#$00
				ldy	ZP.CH
				bne	L9C0E

				lda	#$DD
				sta	ZP.PROMPT
				lda	#$88
				rts

L9C0E			lda	(ZP.BASL),y
				jmp	(ZP.KSW)
L9C13			jmp	BS.ERROUT

BS.IO.IN.FILE	lda	ZP.PROMPT
				cmp	#$DD
				bne	L9C1F
				jmp	L9B58

L9C1F			lda	GP.PREGA
				sta	(ZP.BASL),y
				lda	IO.KBD
				bpl	L9C31

				cmp	#$83
				bne	L9C31

				bit	IO.KSTROBE
				rts

L9C31			lda	ZP.PROMPT
				bit	GP.DIRFLG
				bmi	L9C95

				cmp	#$BE
				beq	L9C42

				jsr	L9C67
				bcs	L9C13

				rts

L9C42			jsr	BS.ReadOneByte
				bcs	L9C13

				rts

BS.ReadOneByte	lda	GP.MLIRW.COUNT
				sta	GP.ParamL
				lda	#$01
				sta	GP.MLIRW.COUNT
				lda	#MLI.C.READ
				jsr	GP.GOSYSTEM
				bcs	L9C66

				lda	GP.ParamL
				sta	GP.MLIRW.COUNT
				ldx	GP.MLIRW.DATAPTR
				lda	IO.LINEBUF,x

L9C66			rts

L9C67			lda	GP.PREGA
				sta	(ZP.BASL),y

L9C6C			lda	#MLI.C.READ
				jsr	GP.GOSYSTEM
				bcs	L9C66

				lda	GP.MLIRW.TRANS
				beq	L9C8E

				clc
				adc	GP.MLIRW.DATAPTR
				tax
				lda	IO.LINEBUF-1,x
				and	#$7F
				cmp	#$0D
				bne	L9C8E

				lda	GP.FoundBITS+1
				and	#$10
				bne	L9C8E

				dex

L9C8E			lda	#$8D
				ldy	GP.PREGY
				clc
				rts

L9C95			cmp	#$BE
				beq	L9C8E

				lda	GP.PREGA
				sta	(ZP.BASL),y
				lda	#$4F
				sta	BS.CATWIDTH
				lda	#MLI.C.GETMARK
				jsr	GP.GOSYSTEM
				bcs	L9D1F

				lda	GP.SBUFADR
				ora	GP.SBUFADR+1
				bne	L9CDF

				lda	#$02
				sta	GP.CATFLAG
				jsr	BS.ReadDirEnt
				bcs	L9D1F

				lda	GP.MLIRW.REFNUM
				lsr
				ror
				ror
				ror
				tax
				lda	XBC12
				sta	XBC5A,x
				lda	XBC13
				sta	XBC5B,x
				jsr	LB128

L9CD3			lda	#$A2
				sta	IO.LINEBUF
				lda	#$8D
				sta	IO.LINEBUF,x
				clc
				rts

L9CDF			lda	GP.CATFLAG
				beq	L9D22
				bmi	L9CF9
				ldx	#$00
				dec	GP.CATFLAG
				beq	L9CD3
				jsr	BS.LINEBUFCLR80
				ldx	#$10
				jsr	BS.PRINTERRMSGX

L9CF5			ldx	#$50
				bne	L9CD3

L9CF9			cmp	#$FF
				bne	L9D1C

				dec	GP.CATFLAG
				lda	#$00
				sta	GP.MLIRW.COUNT
				sta	GP.MLIRW.COUNT+1
				lda	#MLI.C.READ
				jsr	GP.GOSYSTEM
				jsr	LB157
				pha
				lda	GP.MLIRW.REFNUM
				sta	GP.MLIMRKEOFBUF.REFNUM
				pla
				bcc	L9CF5

				bcs	L9D1F

L9D1C			lda	#$05
				sec

L9D1F			jmp	BS.ERROUT

L9D22			lda	#$FF
				sta	XBC16
				lda	GP.MLIRW.REFNUM
				lsr
				ror
				ror
				ror
				tax
				lda	XBC5A,x
				sta	XBC12
				lda	XBC5B,x
				sta	XBC13
				lda	GP.SBUFADR+1
				and	#$01
				tax
				lda	GP.SBUFADR
				sec

L9D45			inc XBC16
				sbc	XBC12
				bcs	L9D45

				dex
				beq	L9D45

				jsr	LB241
				bcc	L9D65

				cmp	#$02
				beq	L9D5D

				cmp	#$05
				bne	L9D1F

L9D5D			dec GP.CATFLAG
				ldx	#$00
				jmp	L9CD3

L9D65			jsr	LA4D2
				jmp	L9CF5

BS.IO.IN.CAT	cmp	#$DD
				bne	L9D72

				jmp	L9B58

L9D72			lda	GP.PREGA
				sta	(ZP.BASL),y
				lda	#$00
				sta	GP.PFXACTV
				ldx	BS.CMDBUF.LEN

L9D7F			lda	BS.CMDBUF.LEN,x
				sta	IO.LINEBUF-1,x
				dex
				bne	L9D7F

				ldx	BS.CMDBUF.LEN
				lda	#$8D
				rts

BS.Setup4readEFBytesAt200
				lda	XBBFE
				sta	GP.MLIRW.REFNUM
				lda	#$02
				sta	GP.MLIRW.DATAPTR+1
				lda	#$EF
				sta	GP.MLIRW.COUNT
				lda	#$00
				sta	GP.MLIRW.COUNT+1
				sta	GP.MLIRW.DATAPTR
				rts

BS.VSYSO		jsr	BS.SaveAXY
				cmp	#$84
				bne	L9DC5

				jsr	BS.WriteTBUF
				sta	GP.INPTR
				sta	GP.IFILACTV
				sta	GP.OFILACTV
				sta	GP.PFXACTV
				ldx	#$08
				jsr	BS.SetState
				jmp	BS.RestoreAXY

L9DC5			ldx	#$04
				jsr	BS.SetState
				jsr	BS.RestoreAXY
				jmp	BS.JMP.GP.VSYSO

BS.IO.OUT.CAT	jsr	BS.SaveAXY
				ldx	GP.INPTR
				sta	IO.LINEBUF,x
				cmp	#$8D
				beq	L9DEB

				inc	GP.INPTR
				bne	L9DE7

				lda	#$10

L9DE4			jmp	BS.ERROUT

L9DE7			ldx	GP.PREGX
				rts

L9DEB			inx
				dex
				beq	L9DFA

				jsr	BS.ResetCSWKSW
				jsr	BS.DOSCMD
				bcs	L9DE4

				jsr	BS.SaveCSWKSW

L9DFA			ldx	#$04
				jsr	BS.SetState
				jmp	BS.RestoreAXY

L9E02			sty	GP.PREGY
				ldy	ZP.PROMPT
				beq	L9E15

				dey
				beq	L9E15

				dey
				beq	L9E15

				ldy	GP.PREGY
				jmp	L9A74

L9E15			ldy	GP.TBUFPTR
				and	#$7F
				sta	(AS.HIMEM),y
				ldy	GP.PREGY
				inc	GP.TBUFPTR
				bne	L9E2F

				jsr	BS.SaveAXY
				jsr	BS.WriteTBUF256
				bcs	L9DE4

				jsr	BS.RestoreAXY

L9E2F			rts

BS.IO.OUT.TRACE	pha
				stx	GP.PREGX
				tsx
				lda	$104,x
				cmp	#$12
				bne	L9E46

				lda	$105,x
				cmp	#$D8
				bne	L9E46

				pla
				bcs	L9EBA

L9E46			pla
				nop
				nop
				nop
				ldx	GP.PREGX
				bit	GP.OFILACTV
				bpl	L9E70

				cmp	#$DD
				bne	L9E5A

				cmp	ZP.PROMPT
				beq	L9E8A

L9E5A			cmp	#$8D
				bne	L9E02

				lda	ZP.PROMPT
				cmp	#$FF
				lda	#$8D
				bcc	L9E02

				jsr	BS.WriteTBUF
				sta	GP.OFILACTV
				lda	#$8D
				bne	L9EA3

L9E70			pha
				lda	GP.IFILACTV
				ora	GP.PFXACTV
				bpl	L9E81

				lda	ZP.PROMPT
				ora	#$04
				cmp	#$84
				beq	L9EA6

L9E81			pla
				cmp	#$DD
				bne	L9EA3

				cmp	ZP.PROMPT
				bne	L9EA3

L9E8A			jsr	BS.SaveAXY
				lda	GP.OPENCNT
				beq	L9EA0

				jsr	BS.WriteTBUF
				sta	GP.OFILACTV
				jsr	BS.ResetCSWKSW
				lda	#$15
				jsr	GP.PRINTERR

L9EA0			jsr	BS.RestoreAXY
L9EA3			jmp	L9A74

L9EA6			pla
				cmp	#$8D
				bne	L9EAE

				cmp	GP.CHRLAST

L9EAE			sta	GP.CHRLAST
				bne	L9EB5

				sta	ZP.PROMPT

L9EB5			rts

L9EB6			inc AS.TXTPTR+1
				bne	L9EBE

L9EBA			inc AS.TXTPTR
				beq	L9EB6

L9EBE			ldx	#$FF
				stx	ZP.PROMPT
				ldx	AS.REMSTK
				txs
				bit	GP.DTRACE
				bmi	L9F3D

L9ECA			ldy	#$00
				lda	(AS.TXTPTR),y
				bmi	L9EF5

				beq	L9EF2

L9ED2			dec GP.STRINGS
				bne	L9EF0

				lda	AS.STRINGSTART+1
				sbc	AS.ARRAYEND+1
				cmp	#$03
				bcs	L9EE9

				jsr	BS.WriteTBUF
				jsr	BS.KW.01
				lda	AS.STRINGSTART+1
				sbc	AS.ARRAYEND+1

L9EE9			sta	GP.STRINGS
				ldy	#$00
				lda	(AS.TXTPTR),y

L9EF0			cmp	#$3A
L9EF2			jmp	AS.EXECSTMT

L9EF5			sta	ZP.PROMPT
				tay
				lda	BS.BYTES-$80,y
				bmi	L9EF2

				sta	X9F00+1

X9F00			bne	L9F02				SELF MODIFIED

L9F02			sta	ZP.PROMPT
				sta	GP.CHRLAST
				lda	BS.VSYSO.LO
				sta	GP.VSYSO
				lda	BS.VSYSO.HI
				sta	GP.VSYSO+1
				bne	L9F32

				lda	#$01
				sta	ZP.PROMPT
				bne	L9F32

				lda	#$02
				sta	ZP.PROMPT
				bne	L9F32

				tya
				jmp	L9ED2

				sty	GP.DTRACE
				bne	L9F2E

				sta	GP.DTRACE
				dey

L9F2E			lda	#$4A
				sta	AS.TRCFLG

L9F32			tya
				jmp	AS.EXECSTMT

				lda	#$00
				sta	AS.ERRNUM
				tya
				bne	L9EF0

L9F3D			jsr	BS.ResetCSWKSW
				lda	#$A3
				jsr	MON.COUT
				ldx	AS.CURLINE
				lda	AS.CURLINE+1
				jsr	AS.INTPRINTAX
				lda	#$A0
				jsr	MON.COUT
				jsr	BS.SaveCSWKSW
				sec
				jmp	L9ECA

				lda	#$E3
				bne	L9F5E

				lda	#$A3

L9F5E			sta	X9F65
				tya
				bne	L9EF0

				brk

X9F65			.DA #$A3

BS.SaveAXY		sta	GP.PREGA
				stx	GP.PREGX
				sty	GP.PREGY
				rts

BS.RestoreAXY	lda	GP.PREGA
				ldx	GP.PREGX
				ldy	GP.PREGY
				rts

BS.SetState		stx	GP.STATE
				ldy	#$00

L9F7F			lda	BS.SYSIOVECTS,x
				sta	GP.VSYSO,y
				inx
				iny
				cpy	#$04
				bne	L9F7F

				rts

BS.PRINTERR		tay
				ldx	BS.ERRCODES-1,y

BS.PRINTERRX	jsr	BS.PRINTERRMSGX
				ldx	GP.INPTR
				stx	BS.CATWIDTH
				jsr	BS.CROUT
				lda	#$87
				jsr	BS.COUT

BS.LINEBUFOUT	ldx	#$00

L9FA3			lda	IO.LINEBUF+1,x
				jsr	BS.COUT
				inx
				cpx	BS.CATWIDTH
				bcc	L9FA3

BS.CROUT		lda	#$8D
BS.COUT			jmp	MON.COUT

BS.PRINTERRMSGX	ldy	#$00
				clc
				sty	GP.INPTR

L9FBA			jsr	L9FD6
				bne	L9FC4

				jsr	L9FD6
				ora	#$10

L9FC4			tay
				lda	BS.TBL6,y
				beq	L9FD5

				ldy	GP.INPTR
				sta	IO.LINEBUF+1,y
				inc	GP.INPTR
				bne	L9FBA

L9FD5			rts

L9FD6			lda	BS.TBL7,x
				bcs	L9FED

				beq	L9FE3

				lsr
				lsr
				lsr
				lsr
				sec
				rts

L9FE3			inx
				lda	BS.TBL7,x
				sta	GP.INPTR
				inx
				bne	L9FD6

L9FED			inx
				and	#$0F
				clc
				rts

BS.WriteTBUF256	lda	#$00
				ldy	#$01
				bne	LA00B

BS.WriteTBUF	jsr	LA004
				bcc	LA020

				tay
				pla
				pla
				tya
				jmp	BS.ERROUT

LA004			ldy	#$00
				lda	GP.TBUFPTR
				beq	LA01F

LA00B			sta	GP.MLIRW.COUNT
				sty	GP.MLIRW.COUNT+1
				lda	#MLI.C.WRITE
				jsr	GP.GOSYSTEM
				pha
				lda	#$00
				sta	GP.TBUFPTR
				pla
				bcs	LA020

LA01F			clc
LA020			rts

LA021			jsr	BS.KW.01
				bcs	LA047

				lda	AS.PGRMSTART+1
				sta	BS.TXTTAB+1
				lda	AS.PGRMSTART
				sta	BS.TXTTAB
				lda	AS.HIMEM+1
				sta	XBBD8
				lda	#$03
				sta	XBBD9
				lda	AS.STRINGSTART+1
				sta	BS.MEMSIZE+1
				lda	#$00
				sta	BS.MEMSIZE
				jsr	LA089

LA047			rts

BS.KW.01		lda	#$00
				sta	BS.TXTTAB
				lda	#$03
				sta	XBBD9
				lda	AS.HIMEM+1
				sta	XBBD8
				lda	AS.STRINGSTART+1
				sta	BS.TXTTAB+1
				sec
				sbc	AS.ARRAYEND+1
				cmp	#$07
				bcc	LA07D

				sbc	#$03
				sta	XBBD9
				lda	AS.ARRAYEND+1
				adc	#$00
				sta	XBBD8
				lda	AS.HIMEM+1
				sbc	AS.STRINGSTART+1
				adc	#$01
				cmp	XBBD9
				bcs	LA07D

				sta	XBBD9

LA07D			lda	AS.HIMEM+1
				sta	BS.MEMSIZE+1
				lda	AS.HIMEM
				sta	BS.MEMSIZE
				sta	AS.STRINGSTART

LA089			clc
				beq	LA08D

				sec

LA08D			lda	BS.MEMSIZE+1
				sta	AS.STRINGSTART+1
				sbc	#$00
				sta	XBBDA
				adc	#$00
				sta	XBBDB
				lda	AS.ARRAYEND+1
				adc	#$01
				sta	XBBDD

LA0A3			lda	AS.VARSTART
				sbc	#$06
				sta	ZP.A2L
				lda	AS.VARSTART+1
				sbc	#$00
				sta	ZP.A2H
				lda	AS.ARRAYSTART
				sta	XBBDC
				lda	XBBDA
				cmp	BS.TXTTAB+1
				bcc	LA0FA

				sbc	XBBD9
				sta	XBBD7
				lda	AS.STRINGSTART+1
				sbc	XBBDA
				sbc	XBBD7
				eor	#$FF
				adc	#$02
				cmp	XBBD7
				bcc	LA0D6

				lda	XBBD7

LA0D6			cmp	BS.TXTTAB+1
				bcs	LA0E0

				lda	BS.TXTTAB+1
				sbc	#$00

LA0E0			sta	XBBDA
				jsr	LA199
				ldx	AS.ARRAYSTART+1
				jsr	LA0FB
				bcs	LA0F8

				jsr	LA131
				lda	XBBDA
				sta	XBBDB
				bcc	LA0A3

LA0F8			lda	#$0C
LA0FA			rts

LA0FB			clc

LA0FC			lda	ZP.A2L
				adc	#$07
				sta	ZP.A2L
				bcc	LA106

				inc	ZP.A2H

LA106			eor	AS.ARRAYSTART
				bne	LA10E

				cpx	ZP.A2H
				beq	LA12F

LA10E			ldy	#$00
				lda	(ZP.A2L),y
				iny
				eor	(ZP.A2L),y
				bpl	LA0FB

				lda	(ZP.A2L),y
				bpl	LA0FB

				ldy	#$04
				lda	(ZP.A2L),y
				cmp	XBBDA
				bcc	LA0FC

				cmp	XBBDB
				bcs	LA0FB

				jsr	LA1BC
				bcc	LA0FC

				rts

LA12F			clc
				rts

LA131			jsr	LA160
				bcs	LA12F

LA136			ldy	#$02
				lda	(ZP.A2L),y
				cmp	XBBDA
				bcc	LA14A

				cmp	XBBDB
				bcs	LA14A

				jsr	LA1BC
				bcc	LA14B

				rts

LA14A			clc
LA14B			lda	#$03
				adc	ZP.A2L
				sta	ZP.A2L
				bcc	LA155

				inc	ZP.A2H

LA155			cmp	XBBDC
				bne	LA136

				cpx	ZP.A2H
				bne	LA136

				beq	LA131

LA160			clc
				lda	XBBDC
				sta	ZP.A2L
				stx	ZP.A2H
				eor	AS.ARRAYEND
				bne	LA170

				cpx	AS.ARRAYEND+1
				beq	LA198

LA170			ldy	#$02
				lda	(ZP.A2L),y
				adc	ZP.A2L
				sta	XBBDC
				iny
				lda	(ZP.A2L),y
				adc	ZP.A2H
				tax
				ldy	#$00
				lda	(ZP.A2L),y
				iny
				eor	(ZP.A2L),y
				bpl	LA160

				ldy	#$04
				lda	(ZP.A2L),y
				asl
				adc	#$05
				adc	ZP.A2L
				sta	ZP.A2L
				bcc	LA198

				inc	ZP.A2H

				clc
LA198			rts

LA199			lda	XBBD7
				sta	ZP.PCH
				lda	XBBD8
				sta	ZP.A1H
				ldy	#$00
				sty	ZP.PCL
				sty	ZP.A1L
				ldx	XBBD9
				inx

LA1AD			lda	(ZP.PCL),y
				sta	(ZP.A1L),y
				iny
				bne	LA1AD

				inc	ZP.A1H
				inc	ZP.PCH
				dex
				bne	LA1AD

				rts

LA1BC			cmp	XBBD7
				bcc	LA1C8

				sbc	XBBD7
				clc
				adc	XBBD8

LA1C8			sta	ZP.PCH
				dey
				lda	(ZP.A2L),y
				sta	ZP.PCL
				dey
				sec
				lda	AS.STRINGSTART
				sbc	(ZP.A2L),y
				sta	AS.STRINGSTART
				iny
				sta	(ZP.A2L),y
				lda	AS.STRINGSTART+1
				sbc	#$00
				sta	AS.STRINGSTART+1
				iny
				sta	(ZP.A2L),y
				dey
				dey
				lda	(ZP.A2L),y
				beq	LA1F2

				tay

LA1EA			dey
				lda	(ZP.PCL),y
				sta	(AS.STRINGSTART),y
				tya
				bne	LA1EA

LA1F2			clc
				lda	XBBDD
				sbc	AS.STRINGSTART+1
				rts

LA1F9			lda	#$04
LA1FB			sta	XBBB5
				jsr	BS.KW.01
				bcs	LA24E

				lda	AS.STRINGSTART+1
				sbc	AS.ARRAYEND+1
				cmp	XBBB5
				lda	#$0C
				bcc	LA24E

				lda	AS.STRINGSTART+1
				sta	ZP.PCH
				sbc	XBBB5
				sta	ZP.A1H
				sta	AS.STRINGSTART+1
				lda	AS.STRINGSTART
				sta	ZP.PCL
				sta	ZP.A1L
				lda	AS.HIMEM
				sbc	ZP.PCL
				sta	XBBED
				lda	AS.HIMEM+1
				sbc	ZP.PCH
				sta	XBBEE
				jsr	LA35F
				lda	#$00
				sec
				sbc	XBBB5
				sta	XBBE2
				jsr	LA3A3
				lda	AS.HIMEM+1
				sta	XBBB7
				sec
				sbc	XBBB5
				sta	AS.HIMEM+1
				clc
				adc	#$04
				sta	XBBE3
				rts

LA24E			sec
				rts

LA250			jsr	BS.KW.01
				bcs	LA29D

				lda	AS.HIMEM+1
				sbc	#$00
				sta	ZP.PCH
				adc	#$03
				sta	ZP.A1H
				lda	AS.STRINGSTART
				sta	ZP.PCL
				sta	ZP.A1L
				lda	AS.HIMEM
				sec
				sbc	AS.STRINGSTART
				sta	XBBED
				lda	AS.HIMEM+1
				sbc	AS.STRINGSTART+1
				sta	XBBEE
				jsr	LA383
				lda	#$04
				sta	XBBE2
				clc
				adc	AS.HIMEM+1
				sta	AS.HIMEM+1
				jsr	LA3A3
				lda	XBBE3
				cmp	AS.HIMEM+1
				beq	LA2B7

				pha
				ldx	GP.OPENCNT
				beq	LA29B

				lda	AS.HIMEM+1

LA293			cmp	XBBEE,x
				beq	LA29E

				dex
				bne	LA293

LA29B			pla
				sec
LA29D			rts

LA29E			pla
LA29F			sta	GP.SBUFADR+1
				sta	XBBEE,x
				lda	#$00
				sta	GP.SBUFADR
				lda	XBBF6,x
				sta	GP.MLIMRKEOFBUF.REFNUM
				lda	#MLI.C.SETBUF
				jsr	GP.GOSYSTEM
				bcs	LA29D

LA2B7			clc
				rts
*--------------------------------------
MAN
SAVE usr/src/basic.15/basic.s.a
LOAD usr/src/basic.15/basic.s
ASM
