A2osX/A2osX.S.txt

437 lines
8.4 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
PREFIX /A2OSX.BUILD
2015-03-14 21:48:35 +00:00
NEW
INC 1
2016-06-07 06:10:18 +00:00
AUTO 8
2015-03-14 21:48:35 +00:00
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BUILD/A2OSX.SYSTEM,TSYS
2015-03-14 21:48:35 +00:00
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/IO.I
.INB /A2OSX.BUILD/INC/MONITOR.I
.INB /A2OSX.BUILD/INC/PRODOS.I
.INB /A2OSX.BUILD/INC/MLI.ERR.I
2015-03-14 21:48:35 +00:00
*--------------------------------------
TmpPtr1 .EQ $0 main & aux ZP
TmpPtr2 .EQ $2 main & aux ZP
*--------------------------------------
2015-03-15 22:00:40 +00:00
A2osX.KMLOAD .EQ $2000
A2osX.KMMAXLEN .EQ $4000
A2osX.OpenBuff1 .EQ $6000 1024 Buffer for MLIOPEN01
A2osX.OpenBuff2 .EQ $6400 1024 Buffer for MLIOPEN02
A2osX.ReadBuff .EQ $6800 512 Buffer for MLIREAD01
Boot.Prefix .EQ $6A00 MLI.MAXPATH
KM.Filename .EQ $6A80 MLI.MAXPATH
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
* Kernel Stage 0
*--------------------------------------
.PH $1000
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
A2osX.Init0 >LDYAI $2000
2015-03-15 22:00:40 +00:00
>STYA TmpPtr1
2016-06-07 06:10:18 +00:00
>LDYAI $1000
2015-03-15 22:00:40 +00:00
>STYA TmpPtr2
ldx #$10 reloc $2000-$2FFF to $1000-$1FFF
ldy #0
2015-03-14 21:48:35 +00:00
2015-03-15 22:00:40 +00:00
.1 lda (TmpPtr1),y
sta (TmpPtr2),y
iny
bne .1
inc TmpPtr1+1
inc TmpPtr2+1
dex
bne .1
2015-06-03 18:30:57 +00:00
2015-03-15 22:00:40 +00:00
jmp A2osX.Init1
*--------------------------------------
2016-06-07 06:10:18 +00:00
A2osX.Init1 ldx #$FF init 6502 stack to highest
txs
bit RROMBNK1
2015-06-03 18:30:57 +00:00
jsr HOME
2016-06-07 06:10:18 +00:00
>LDAXI MSG.INIT0
jsr PrintFAX
2015-03-14 21:48:35 +00:00
>LDAXI MSG.SYSMEM
jsr PrintFAX
2015-03-14 21:48:35 +00:00
lda MACHID
2017-10-27 14:56:46 +00:00
and #MACHID.M
cmp #MACHID.M.128
2015-03-14 21:48:35 +00:00
beq .1
>LDAXI MSG.SYSMEM.KO
jsr PrintFAX
2015-03-14 21:48:35 +00:00
bra *
2016-06-07 06:10:18 +00:00
.1 lda #$8C Reset 80 col screen ($0C:HOME)
jsr $C300
2016-06-07 06:10:18 +00:00
>LDAXI MSG.INIT0
jsr PrintFAX
>LDAXI MSG.SYSMEM
jsr PrintFAX
>LDAXI MSG.SYSMEM.OK
jsr PrintFAX
2015-06-03 18:30:57 +00:00
2016-06-07 06:10:18 +00:00
>LDAXI MSG.CPU
jsr PrintFAX
2016-06-07 06:10:18 +00:00
sed Test 6502 BCD bug
lda #$99
clc
adc #$01
cld
bpl .2 if minus, BUG!, we have 6502
2015-03-14 21:48:35 +00:00
>LDAXI MSG.CPU.KO
jsr PrintFAX
2015-03-14 21:48:35 +00:00
bra *
2016-03-13 21:55:47 +00:00
2016-06-07 06:10:18 +00:00
.2 >LDAXI MSG.CPU.OK
jsr PrintFAX
2016-03-13 21:55:47 +00:00
*--------------------------------------
A2osX.CloseAll stz LEVEL Back To FILE LEVEL 0
jsr MLI Make sure all files are closed
.DA #MLICLOSE
.DA MLICLOSE01
bcs *
*--------------------------------------
2015-03-14 21:48:35 +00:00
A2osX.Prefix >LDAXI MSG.BOOTPREFIX
jsr PrintFAX
2015-03-14 21:48:35 +00:00
jsr MLI
.DA #MLIGETPREFIX
.DA MLIGETPREFIX01
bcs *
ldx Boot.Prefix
stx A2osX.QC.B.Start+4
ldy #1
.1 lda Boot.Prefix,y
sta A2osX.QC.B.Start+4,y
ora #$80
jsr COUT
iny
dex
bne .1
jsr CROUT
*--------------------------------------
A2osX.RamDrv >LDAXI MSG.RAMDRV
jsr PrintFAX
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
jsr DisableRamDRV
bcc .2
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
tax
2015-06-03 18:30:57 +00:00
bne .1
>LDAXI MSG.RAMDRV.KO0
jsr PrintFAX
2016-06-07 06:10:18 +00:00
bra A2osX.SetupQC
2015-03-14 21:48:35 +00:00
2015-06-03 18:30:57 +00:00
.1 >LDAXI MSG.RAMDRV.KO1
jsr PrintFAX
2016-06-07 06:10:18 +00:00
bra A2osX.SetupQC
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
.2 >LDAXI MSG.RAMDRV.OK
jsr PrintFAX
2015-03-14 21:48:35 +00:00
*--------------------------------------
A2osX.SetupQC lda RRAMWRAMBNK2
lda RRAMWRAMBNK2
ldx #0
2016-06-07 06:10:18 +00:00
.1 lda A2osX.QC.B.Start,x
sta $D100,x
lda A2osX.QC.B.Start+$100,x
sta $D200,x
2016-06-07 06:10:18 +00:00
lda A2osX.QC.B.Start+$200,x
sta $D300,x
inx
bne .1
lda RROMBNK1
*--------------------------------------
2015-03-15 22:00:40 +00:00
A2osX.EnumKM >LDAXI MSG.KMENUM
jsr PrintFAX
2015-03-15 22:00:40 +00:00
jsr EnumKM
*--------------------------------------
2016-06-07 06:10:18 +00:00
A2osX.MLIQuit >LDAXI MSG.INIT0OK
jsr PrintFAX
2015-03-14 21:48:35 +00:00
>DEBUGOA
2015-03-14 21:48:35 +00:00
jsr MLI
.DA #MLIQUIT
.DA MLIQUIT01
bra *
*--------------------------------------
DisableRamDRV php
sei
lda DEVPTRS3D2
cmp DEVPTRS S0D1=NOVEV
2015-03-14 21:48:35 +00:00
bne .1
lda DEVPTRS3D2+1
cmp DEVPTRS+1 S0D1=NODEV
2015-03-14 21:48:35 +00:00
beq .9 S3D2=NODEV, nothing to do
.1 ldx DEVCNT
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
.2 lda DEVLST,x LOOKING FOR $BF, $BB, $B7, $B3
and #$F3
cmp #$B3
beq .3
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
dex
bpl .2
2015-06-03 18:30:57 +00:00
2015-03-14 21:48:35 +00:00
plp
lda #1 No device found, exit with error
sec
rts
2015-06-03 18:30:57 +00:00
.3 cpx DEVCNT
beq .5
2015-03-14 21:48:35 +00:00
.4 lda DEVLST+1,x
sta DEVLST,x
inx
cpx DEVCNT
bne .4
2015-06-03 18:30:57 +00:00
.5 ldx DEVCNT
2015-03-14 21:48:35 +00:00
stz DEVLST,x
dec DEVCNT
lda DEVPTRS
2015-03-14 21:48:35 +00:00
sta DEVPTRS3D2
lda DEVPTRS+1
2015-03-14 21:48:35 +00:00
sta DEVPTRS3D2+1
plp
2015-06-03 18:30:57 +00:00
jsr MLI
.DA #MLIONLINE
.DA MLIONLINE01
2015-03-14 21:48:35 +00:00
clc Success!!
rts
.9 plp
lda #0 Not detected
sec
rts
*--------------------------------------
2016-06-07 06:10:18 +00:00
EnumKM.EPB .EQ $0D
EnumKM.EL .EQ $27
2015-03-14 21:48:35 +00:00
*--------------------------------------
2016-06-07 06:10:18 +00:00
EnumKM ldx #0
ldy Boot.Prefix
.1 inx
lda SYS,x
sta Boot.Prefix+1,y
iny
cpx SYS
2015-03-14 21:48:35 +00:00
bne .1
2016-06-07 06:10:18 +00:00
sty Boot.Prefix
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
jsr MLI
.DA #MLIOPEN
.DA MLIOPEN01
bcs .99
lda MLIOPEN01+5
sta MLIREAD01+1
sta MLICLOSE01+1
.2 jsr MLI
.DA #MLIREAD
.DA MLIREAD01
bcs .98
lda #EnumKM.EPB
sta EnumKM.EC
>LDYAI A2osX.ReadBuff+4
>STYA EnumKM.BPTR
.3 >LDYA EnumKM.BPTR
>STYA TmpPtr1
lda (TmpPtr1)
and #$F0 Empty ?
beq .5 yes, skip
and #$C0 anything out of type 1,2 or 3 ?
bne .5 yes, skip
lda (TmpPtr1)
and #$0F
cmp KM.PREFIX at least enough chars for KM.*?
bcc .5 no, skip
ldy #$10 file type
lda (TmpPtr1),y
cmp #$06 'BIN'?
bne .5 skip
ldy KM.PREFIX
.4 lda (TmpPtr1),y
cmp KM.PREFIX,y
bne .5
dey
bne .4
jsr LoadKM
.5 lda EnumKM.BPTR
clc
adc #EnumKM.EL
sta EnumKM.BPTR
bcc .6
inc EnumKM.BPTR+1
.6 dec EnumKM.EC
bne .3
2015-03-15 22:00:40 +00:00
bra .2
2015-03-14 21:48:35 +00:00
2016-06-07 06:10:18 +00:00
.8 jsr MLI
.DA #MLICLOSE
.DA MLICLOSE01
rts
.98 cmp #MLI.E.EOF
2016-06-07 06:10:18 +00:00
beq .8
pha
jsr .8
pla
.99 sec
rts
*--------------------------------------
EnumKM.EC .BS 1
EnumKM.BPTR .BS 2
*--------------------------------------
LoadKM ldx Boot.Prefix
.1 lda Boot.Prefix,x
sta KM.Filename,x
dex
bne .1
ldx Boot.Prefix
lda (TmpPtr1)
2015-03-15 22:00:40 +00:00
and #$0F
2016-06-07 06:10:18 +00:00
tay
2015-03-15 22:00:40 +00:00
clc
2016-06-07 06:10:18 +00:00
adc Boot.Prefix
sta KM.Filename
tax
.2 lda (TmpPtr1),y
sta KM.Filename,x
dex
dey
bne .2
2015-03-15 22:00:40 +00:00
lda #KM.Filename
pha
lda /KM.Filename
pha
2016-06-07 06:10:18 +00:00
>LDAXI MSG.KMLOAD
jsr PrintFAX
2016-06-07 06:10:18 +00:00
jsr MLI
.DA #MLIOPEN
.DA MLIOPEN02
bcs .99
lda MLIOPEN02+5
sta MLIREAD02+1
sta MLICLOSE02+1
jsr MLI
.DA #MLIREAD
.DA MLIREAD02
bcs .98
jsr .9
jsr A2osX.KMLOAD
.98 pha
jsr .9
pla
2015-03-15 22:00:40 +00:00
sec
rts
2016-06-07 06:10:18 +00:00
.9 jsr MLI
.DA #MLICLOSE
.DA MLICLOSE02
.99 rts
2015-03-15 22:00:40 +00:00
*--------------------------------------
.INB /A2OSX.SRC/X.PRINTF.S
2015-03-14 21:48:35 +00:00
*--------------------------------------
MSG.INIT0 .AZ "A2osX[Stage0]:Init\n"
MSG.SYSMEM .AZ "Checking System Memory..."
MSG.SYSMEM.OK .AZ "128k Detected.\n"
MSG.SYSMEM.KO .AZ "A2osX Requires At Least 128k Memory.\n"
2016-06-07 06:10:18 +00:00
MSG.CPU .AZ "Checking CPU..."
MSG.CPU.OK .AZ "65C02 CPU (or higher) Detected.\n"
MSG.CPU.KO .AZ "A2osX Requires At Least A 65C02 CPU.\n"
2016-06-07 06:10:18 +00:00
MSG.RAMDRV .AZ "Checking ProDOS RamDrive..."
MSG.RAMDRV.OK .AZ "Successfully Disabled.\n"
MSG.RAMDRV.KO0 .AZ "Not Detected.\n"
MSG.RAMDRV.KO1 .AZ "Uninstall Failed !!!\n"
2016-06-07 06:10:18 +00:00
MSG.BOOTPREFIX .AZ "Boot Prefix:"
2016-06-07 06:10:18 +00:00
MSG.KMENUM .AZ "Looking For Kernel Modules...\n"
MSG.KMLOAD .AZ "***Loading KM : %S\n"
MSG.INIT0OK .AZ "A2osX[Stage0]:Complete.\n"
2015-03-14 21:48:35 +00:00
*--------------------------------------
MLIGETPREFIX01 .DA #1
.DA Boot.Prefix
2015-06-03 18:30:57 +00:00
MLIONLINE01 .DA #2
.DA #0
.DA MLIONLINE01BUF
MLIONLINE01BUF .BS 256
2015-03-15 22:00:40 +00:00
MLIOPEN01 .DA #3 For DIR listing
.DA Boot.Prefix
.DA A2osX.OpenBuff1
.BS 1
MLIREAD01 .DA #4
.BS 1
.DA A2osX.ReadBuff Load address Dir Blocks
.DA $200 Maxlen of Dir Blocks (512)
.BS 2
MLICLOSE01 .DA #1
.BS 1
MLIOPEN02 .DA #3
.DA KM.Filename
.DA A2osX.OpenBuff2
.BS 1
MLIREAD02 .DA #4
.BS 1
.DA A2osX.KMLOAD Load address for KMs
.DA A2osX.KMMAXLEN Maxlen of KM
.BS 2
MLICLOSE02 .DA #1
.BS 1
2015-03-14 21:48:35 +00:00
MLIQUIT01 .DA #4
.DA #0
.DA 0
.DA #0
.DA 0
*--------------------------------------
SYS >PSTR "SYS/"
KM.PREFIX >PSTR "KM."
*--------------------------------------
2015-03-15 22:00:40 +00:00
.EP
*--------------------------------------
2016-06-07 06:10:18 +00:00
A2osX.QC.B.Start
.INB /A2OSX.SRC/A2OSX.S.QC
*--------------------------------------
2015-03-14 21:48:35 +00:00
MAN
SAVE /A2OSX.SRC/A2OSX.S
2015-03-14 21:48:35 +00:00
ASM