NEW
  AUTO 3,1
*--------------------------------------
LDR.START		jmp	LDR.START1
LDR.SIG			.DA $EEEE
				.DA	#MLI.MAXPATH+1
LDR.STARTUP.LEN	.DA #7
LDR.STARTUP		.AS "STARTUP"
				.BS MLI.MAXPATH-7
LDR.START1		lda	#$9A
				sta	Ptr2+1
				lda	#$24
				sta	Ptr1+1
				lda	#$00
				sta	Ptr1
				sta	Ptr2
				ldx	#$23
				tay
				jsr	LDR.MoveXpages
				ldx	#$01
				lda	#$BE
				sta	Ptr2+1
				jsr	LDR.MoveXpages
				lda	#$15
				jsr	MON.COUT
				jsr	MON.SETNORM
				jsr	MON.INIT
				jsr	MON.MON
				ldx	#$17
				lda	#$00

L2076			sta	MLI.MEMTABL,x
				dex
				bne	L2076

				lda	#$CF
				sta	MLI.MEMTABL
				lda	#$3F
				sta	MLI.MEMTABL+19
				lda	#$FF
				sta	MLI.MEMTABL+20
				sta	MLI.MEMTABL+21
				sta	MLI.MEMTABL+22
				lda	#$C3
				sta	MLI.MEMTABL+23
				lda	AS.COLDBOOT
				cmp	#$4C
				bne	L20B1

				lda	MLI.MACHID
				and	#$20
				beq	L20B1

				ldx	#$03

L20A6			lda	LDR.CSWVECT,x
				sta	ZP.CSW,x
				dex
				bpl	L20A6

				jmp	AS.COLDBOOT

L20B1			ldx	#$27

L20B3			lda	LDR.UNABLE,x
				sta	$628,x
				dex
				bpl	L20B3

				sta	MON.POWERUPBYTE
				sta	MON.POWERUP+1

L20C2			bmi	L20C2

LDR.MoveXpages	dey
				lda	(Ptr1),y
				sta	(Ptr2),y
				tya
				bne	LDR.MoveXpages

				inc	Ptr1+1
				inc	Ptr2+1
				dex
				bne	LDR.MoveXpages

L20D3			rts

LDR.CSW			cmp	#$DD
				bne	L20D3

				lda	GP.OUTVECT0
				sta	ZP.CSW
				lda	GP.OUTVECT0+1
				sta	ZP.CSW+1
				lda	MLI.DEVNUM
				sta	LDR.ONLINE.P.DEVNUM
				ldx	#$01
				asl
				bcc	L20EE

				inx

L20EE			stx	GP.VDEFDRV
				asl
				rol
				rol
				rol
				and	#$07
				sta	GP.VDEFSLT
				ldx	#$C1
				ldy	#$02
				lda	MLI.SLTBYT
				lsr

L2102			lsr
				pha
				bcc	L2115

				lda	#$00
				sta	GP.OUTVECT0,y
				sta	GP.INVECT0,y
				txa
				sta	GP.OUTVECT0+1,y
				sta	GP.INVECT0+1,y

L2115			iny
				iny
				inx
				pla
				bne	L2102

				lda	#$96
				sta	AS.HIMEM+1
				sta	AS.STRINGSTART+1
				sta	GP.RSHIMEM
				lda	MLI.PFIXPTR
				beq	L214E

				jsr	MLI
				.DA #MLI.C.GETPREFIX
				.DA	LDR.GETSETPFX2.P
				bne	L218B

				ldx	MLI.PATHBUF
				lda	#$2F

L2136			cmp	MLI.PATHBUF,x
				bne	L213E

				inc	LDR.PFXLEN

L213E			dex
				bne	L2136

				lda	LDR.PFXLEN
				cmp	#$03
				bcs	L216F

				jsr	MLI
				.DA #MLI.C.SETPREFIX
				.DA	LDR.GETSETPFX1.P

L214E			jsr	MLI
				.DA #MLI.C.ONLINE
				.DA	LDR.ONLINE.P
				bne	L218B
				
				lda	MLI.PATHBUF+1
				and	#$0F
				beq	L218B

				tax
				inx
				stx	MLI.PATHBUF
				lda	#$2F
				sta	MLI.PATHBUF+1
				jsr	MLI
				.DA #MLI.C.SETPREFIX
				.DA	LDR.GETSETPFX2.P
				bne	L218B

L216F			jsr	MLI
				.DA #MLI.C.GETFILEINFO
				.DA	LDR.GFINFO.P
				bne	L218B

				ldx	LDR.STARTUP.LEN
				stx	LDR.STARTUP.LEN1

L217D			lda	LDR.STARTUP.LEN,x
				sta	IO.LINEBUF,x
				dex
				bne	L217D

				lda	#$AD
				sta	IO.LINEBUF

L218B			lda	LDR.PFXLEN
				cmp	#$03
				bcs	L2198

				jsr	MLI
				.DA #MLI.C.SETPREFIX
				.DA	LDR.GETSETPFX1.P

L2198			lda	LDR.STARTUP.LEN1
				bne	L21C1

				jsr	LDR.KSW
				ldx	#$1C

L21A2			lda	LDR.PRODOSBASIC,x
				sta	$400,x
				dex
				bpl	L21A2

				ldx	#$1F

L21AD			lda	LDR.COPYRIGHT,x
				sta	$480,x
				dex
				bpl	L21AD

				lda	#$8D
				jsr	MON.COUT1
				jsr	MON.COUT1
				jsr	MON.COUT1

L21C1			ldx	#$02
L21C3			lda	LDR.JMP.GP.ENTRY,x
				sta	DOS.WARMSTART,x
				sta	DOS.COLDSTART,x
				sta	MON.USRJMP,x
				lda	LDR.AMPERSANDJMP,x
				sta	MON.AMPERSANDJMP,x
				dex
				bpl	L21C3

				lda	LDR.BRKVECT
				sta	MON.BRKVECT
				lda	LDR.BRKVECT+1
				sta	MON.BRKVECT+1
				lda	LDR.POWERUP
				sta	MON.POWERUP
				lda	LDR.POWERUP+1
				sta	MON.POWERUP+1
				eor	#$A5
				sta	MON.POWERUPBYTE
				lda	#$A5
				sta	AS.TRCFLG
				lda	BS.IVERSION
				sta	MLI.IVERSION

LDR.JMP.GP.ENTRY
				jmp	GP.ENTRY

LDR.BRKVECT		.DA	MON.BREAKV
LDR.POWERUP		.DA GP.ENTRY

LDR.AMPERSANDJMP
				jmp	GP.DOSCMD

LDR.KSW			lda	GP.INVECT0
				sta	ZP.KSW
				lda	GP.INVECT0+1
				sta	ZP.KSW+1
				ldx	LDR.STARTUP.LEN
				inx
				lda	#$8D
				rts

LDR.CSWVECT		.DA	LDR.CSW
LDR.KSWVECT		.DA	LDR.KSW
LDR.GFINFO.P	.DA #10
LDR.GFINFO.P.PATHBUF
				.DA	LDR.STARTUP.LEN

				.BS 16

LDR.GETSETPFX1.P
				.DA #1
LDR.GETSETPFX1.P.BUF
				.DA	LDR.GETSETPFX1.SLASHLEN
LDR.GETSETPFX1.SLASHLEN
				.DA #1
LDR.GETSETPFX1.SLASH
				.AS "/"
LDR.STARTUP.LEN1
				.DA #0
LDR.ONLINE.P
				.DA #2
LDR.ONLINE.P.DEVNUM
				.DA #$70
LDR.ONLINE.P.BUF
				.DA MLI.PATHBUF+1
LDR.GETSETPFX2.P
				.DA #1
LDR.GETSETPFX2.P.BUF
				.DA	MLI.PATHBUF
LDR.PFXLEN		.DA	#0

LDR.UNABLE		.AS -"***  UNABLE TO EXECUTE BASIC SYSTEM  ***"
LDR.PRODOSBASIC	.AS -"            PRODOS BASIC 1.5 "
LDR.COPYRIGHT	.AS -"        COPYRIGHT APPLE  1983-92"
				.BS $2400-*
*--------------------------------------
MAN
SAVE usr/src/basic.15/basic.s.ldr
LOAD usr/src/basic.15/basic.s
ASM
