NEW
PREFIX
AUTO 4,1
				.LIST OFF
*--------------------------------------
* ****** START OF MLI QUIT CODE ******
* Load Address :$1000-$12FF
*--------------------------------------
				.PH $1000
*--------------------------------------
* Kernel Stage 1
*--------------------------------------
A2osX.QC.Start	.EQ *
A2osX.QC		cld
				jmp A2osX.QC.Start1
				
A2osX.QC.Prefix	.BS 64				
				
A2osX.QC.Start1	sei
				ldx #$FF
				txs
				cli
				
				bit RROMBNK1
				>LDYAI A2osX.QC
				>STYA POWERUP
				jsr SETPWRC

				lda #$01
				sta	MEMTABL+$17			protect ProDOS MLI Page
				
				
				ldx #$16
				
.1				stz MEMTABL,x			Reset ProDOS memory bitmap
				dex
				bne .1
				
				lda	#$CF				protect zero page, stack and page 1
				sta	MEMTABL

				lda #$8C				Reset 80 col screen ($0C=FF=HOME)
				jsr $C300

				>LDYAI MSG.INIT1
				jsr A2osX.QC.PrintYA

.3				jsr MLI
				.DA #MLISETPREFIX
				.DA MLISETPREFIX00
				bcc .4
				
				>LDYAI MSG.SETPREFIXKO
				jsr A2osX.QC.PrintYA
				>LDYAI A2osX.QC.Prefix
				jsr A2osX.QC.PrintYA

				>DEBUG

				bra .3
				
.4				>LDYAI MSG.SETPREFIXOK
				jsr A2osX.QC.PrintYA
				
				jsr A2osX.QC.KLoad
				bcs *
				
*				>LDYAI GO.Reset
*				>STYA POWERUP
*				bit RROMBNK1
*				jsr SETPWRC
				
.8				>LDYAI MSG.INIT1OK
				jsr A2osX.QC.PrintYA

				>DEBUGOA
				jmp $2000
*--------------------------------------
A2osX.QC.KLoad	>LDYAI MSG.KLOAD
				jsr A2osX.QC.PrintYA
				
				ldx A2osX.QC.Prefix

				ldy #0
				
.2				inx
				iny
				lda SYSKERNEL,y
				sta A2osX.QC.Prefix,x
				cpy SYSKERNEL
				bne .2
				
				stx A2osX.QC.Prefix
				
				>LDYAI A2osX.QC.Prefix
				jsr A2osX.QC.PrintYA				
				
				jsr MLI
				.DA #MLIOPEN
				.DA MLIOPENK
				bcs .9
				
				lda MLIOPENK+5
				sta MLIREADK+1
				sta MLICLOSEK+1

				jsr MLI
				.DA #MLIREAD
				.DA MLIREADK

				php
				pha
				
				jsr MLI
				.DA #MLICLOSE
				.DA MLICLOSEK

				pla
				plp
				bcc .8
				
.9				pha
				>LDYAI MSG.KLOAD.KO
				jsr A2osX.QC.PrintYA
				pla
				jsr PRBYTE

.8				rts		
*--------------------------------------
A2osX.QC.PrintYA
				>STYA TmpPtr1
				lda (TmpPtr1)
				tax
				beq .9

				ldy #1
				
.1				lda (TmpPtr1),y
				ora #$80
				jsr COUT
				iny
				dex
				bne .1
				
.9				jsr CROUT
				rts				
*--------------------------------------
MLISETPREFIX00	.DA #1
				.DA A2osX.QC.Prefix
*--------------------------------------
MLIOPENK		.DA #3
				.DA A2osX.QC.Prefix
				.DA $C00
				.BS 1
*--------------------------------------
MLIREADK		.DA #4
				.BS 1
				.DA $2000
				.DA $8000
				.BS 2
*--------------------------------------
MLICLOSEK		.DA #1
				.BS 1
*--------------------------------------
SYSKERNEL		>PSTR "SYS/KERNEL"
*--------------------------------------
MSG.INIT1		>PSTR "A2osX[Stage1]:Init"
MSG.SETPREFIXOK >PSTR "Set Prefix OK"
MSG.SETPREFIXKO >PSTR "Insert Vol:"
MSG.KLOAD		>PSTR "Loading Kernel..."
MSG.KLOAD.KO	>PSTR "Error While Loading Kernel."
MSG.INIT1OK		>PSTR "A2osX[Stage1]:Complete."
*--------------------------------------
				.BS $1300-*
				.EP
*--------------------------------------
MAN
SAVE USR/SRC/A2OSX.S.QC
LOAD USR/SRC/A2OSX.S
ASM
