A2osX/BASIC.FX/BASIC.S.LDR.txt

429 lines
7.2 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
LDR.START jmp LDR.START1
LDR.SIG .DA $EEEE
.DA #MLI.MAXPATH+1
LDR.STARTUP .DA #7
.AS "STARTUP"
.BS MLI.MAXPATH-7
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.START1 ldx #$FF
txs
sta IO.SETALTZP
stx $100
stx $101
sta IO.CLRALTZP
sta IO.CLR80DISP
sta IO.CLR80STORE
bit IO.RROMBNK1
jsr MON.INIT
jsr MON.SETVID
jsr MON.SETKBD
jsr MON.SETNORM
jsr MON.HOME
lda MLI.MACHID
and #$30
cmp #$30 128k Only
bne .3
jsr LDR.ShrinkRAM
bcs .3
2022-04-03 21:25:00 +00:00
lda #%11001111 pages 0,1,...,4,5,6,7 protected
2022-04-03 11:55:03 +00:00
sta MLI.MEMTABL
2022-04-03 21:25:00 +00:00
ldx #19
2022-03-15 19:33:19 +00:00
.1 stz MLI.MEMTABL,x
dex
2022-03-15 19:33:19 +00:00
bne .1
2022-03-13 12:52:24 +00:00
lda #$FF
2022-04-03 21:25:00 +00:00
sta MLI.MEMTABL+20 HIMEM=$A000
sta MLI.MEMTABL+21
sta MLI.MEMTABL+22
2022-04-03 21:25:00 +00:00
lda #%11000011 pages $B8,$B9,...,$BE,$BF protected
sta MLI.MEMTABL+23
2022-03-27 12:59:32 +00:00
2022-05-25 18:46:02 +00:00
ldx #PAKME.MAIN-PAKME.Table
ldy #LDR.MAIN.DST
lda /LDR.MAIN.DST
jsr X.Unpak.XatYA
ldx #PAKME.GP-PAKME.Table
ldy #LDR.GP.DST
lda /LDR.GP.DST
jsr X.Unpak.XatYA
lda bRAMFlag
sta GP.CISPARE1
2022-03-27 12:59:32 +00:00
bit IO.RRAMWRAMBNK2
bit IO.RRAMWRAMBNK2
2022-05-25 18:46:02 +00:00
2022-03-27 12:59:32 +00:00
sta IO.SETALTZP
2022-05-25 18:46:02 +00:00
ldx #PAKME.AUX-PAKME.Table
ldy #LDR.AUX.DST
2022-03-27 12:59:32 +00:00
lda /LDR.AUX.DST
2022-05-25 18:46:02 +00:00
jsr X.Unpak.XatYA
2022-03-27 12:59:32 +00:00
sta IO.CLRALTZP
bit IO.RROMBNK2
ldx #$03
2022-03-15 19:33:19 +00:00
.2 lda LDR.CSWVECT,x
sta ZP.CSW,x
dex
2022-03-15 19:33:19 +00:00
bpl .2
jmp AS.COLDBOOT
2022-03-27 12:59:32 +00:00
*--------------------------------------
.3 ldx #LDR.UNABLE.L-1
2022-03-15 19:33:19 +00:00
.4 lda LDR.UNABLE,x
sta $628,x
dex
2022-03-15 19:33:19 +00:00
bpl .4
sta MON.POWERUPBYTE
sta MON.POWERUP+1
2022-05-25 18:46:02 +00:00
bra *
2022-03-15 19:33:19 +00:00
*--------------------------------------
L20D3 rts
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.CSW cmp #$DD
bne L20D3
2022-03-13 12:52:24 +00:00
lda GP.OUTVECT0
sta ZP.CSW
2022-03-13 12:52:24 +00:00
lda GP.OUTVECT0+1
sta ZP.CSW+1
2022-03-13 12:52:24 +00:00
lda MLI.DEVNUM
sta LDR.ONLINE.P+1
ldx #$01
asl
bcc L20EE
inx
L20EE stx GP.VDEFDRV
asl
rol
rol
rol
and #$07
sta GP.VDEFSLT
ldx #$C1
ldy #$02
2022-03-13 12:52:24 +00:00
lda MLI.SLTBYT
lsr
L2102 lsr
pha
bcc L2115
2022-03-13 12:52:24 +00:00
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 /HIMEM-$400
sta AS.HIMEM+1
sta AS.STRINGSTART+1
sta GP.RSHIMEM
2022-03-27 12:59:32 +00:00
2022-03-13 12:52:24 +00:00
lda MLI.PFIXPTR
beq L214E
jsr MLI
.DA #MLI.C.GETPREFIX
.DA LDR.GETSETPFX.P
bne L218B
ldx MLI.PATHBUF
2022-03-27 12:59:32 +00:00
lda #'/'
L2136 cmp MLI.PATHBUF,x
bne L213E
inc LDR.PFX.LEN
L213E dex
bne L2136
lda LDR.PFX.LEN
cmp #$03
bcs L216F
jsr MLI
.DA #MLI.C.SETPREFIX
.DA LDR.SETPFXSLASH.P
L214E jsr MLI
.DA #MLI.C.ONLINE
.DA LDR.ONLINE.P
bne L218B
2022-03-27 12:59:32 +00:00
2022-03-13 12:52:24 +00:00
lda MLI.PATHBUF+1
and #$0F
beq L218B
tax
inx
stx MLI.PATHBUF
lda #'/'
sta MLI.PATHBUF+1
jsr MLI
.DA #MLI.C.SETPREFIX
.DA LDR.GETSETPFX.P
bne L218B
L216F ldy #LDR.STARTUP
lda /LDR.STARTUP
jsr LDR.GFInfoYA
bcs L218B
ldx LDR.STARTUP
stx LDR.STARTUP.LEN
L217D lda LDR.STARTUP,x
sta IO.LINEBUF,x
dex
bne L217D
2022-03-13 12:52:24 +00:00
lda #$AD
sta IO.LINEBUF
L218B lda LDR.PFX.LEN
cmp #$03
bcs L2198
jsr MLI
.DA #MLI.C.SETPREFIX
.DA LDR.SETPFXSLASH.P
L2198 lda LDR.STARTUP.LEN
bne L21C1
jsr LDR.KSW
2022-03-27 12:59:32 +00:00
ldx #LDR.PRODOSBASIC.L-1
2022-03-13 12:52:24 +00:00
L21A2 lda LDR.PRODOSBASIC,x
2022-03-27 12:59:32 +00:00
sta $400+12,x
dex
bpl L21A2
2022-03-27 12:59:32 +00:00
ldx #LDR.COPYRIGHT.L-1
2022-03-13 12:52:24 +00:00
L21AD lda LDR.COPYRIGHT,x
2022-03-27 12:59:32 +00:00
sta $480+9,x
dex
bpl L21AD
2022-03-13 12:52:24 +00:00
lda #$8D
jsr MON.COUT1
jsr MON.COUT1
jsr MON.COUT1
L21C1 ldx #$02
2022-03-27 12:59:32 +00:00
2022-03-13 12:52:24 +00:00
L21C3 lda LDR.JMP.GP.ENTRY,x
sta DOS.WARMSTART,x
sta DOS.COLDSTART,x
sta MON.USRJMP,x
2022-03-13 12:52:24 +00:00
lda LDR.AMPERSANDJMP,x
sta MON.AMPERSANDJMP,x
dex
bpl L21C3
2022-03-27 12:59:32 +00:00
lda #MON.BREAKV
sta MON.BRKVECT
2022-03-27 12:59:32 +00:00
lda /MON.BREAKV
sta MON.BRKVECT+1
2022-03-27 12:59:32 +00:00
lda #GP.ENTRY
sta MON.POWERUP
2022-03-27 12:59:32 +00:00
lda /GP.ENTRY
sta MON.POWERUP+1
eor #$A5
sta MON.POWERUPBYTE
2022-03-27 12:59:32 +00:00
2022-03-13 12:52:24 +00:00
lda #$A5
sta AS.TRCFLG
2022-03-27 12:59:32 +00:00
* lda BS.IVERSION
lda #5
sta MLI.IVERSION
LDR.JMP.GP.ENTRY
jmp GP.ENTRY
LDR.AMPERSANDJMP
jmp GP.DOSCMD
2022-03-27 12:59:32 +00:00
*--------------------------------------
2022-03-13 12:52:24 +00:00
LDR.KSW lda GP.INVECT0
sta ZP.KSW
2022-03-13 12:52:24 +00:00
lda GP.INVECT0+1
sta ZP.KSW+1
ldx LDR.STARTUP
inx
2022-03-13 12:52:24 +00:00
lda #$8D
rts
2022-03-27 12:59:32 +00:00
*--------------------------------------
2022-04-03 21:25:00 +00:00
LDR.ShrinkRAM stz bRAMFlag
lda MLI.DEVPTRS3D2
2022-03-27 12:59:32 +00:00
ldx MLI.DEVPTRS3D2+1
cmp MLI.DEVPTRS S0D1=NOVEV
bne .1
cpx MLI.DEVPTRS+1 S0D1=NODEV
beq .8 S3D2=NODEV, nothing to do
.1 tay $FF00 = ProDOS /RAM driver
2022-03-27 12:59:32 +00:00
bne .8
cpx #$FF
bne .8
ldx MLI.DEVCNT
.2 lda MLI.DEVLST,x LOOKING FOR $BF
cmp #$BF
beq .3
dex
bpl .2
.8 clc No $BF device found
2022-03-27 12:59:32 +00:00
rts
.9 sec
.99 rts
.3 jsr LDR.GFInfoRAM
bcs .99
2022-03-27 12:59:32 +00:00
ldx #LDR.ZPCODE.L-1
.6 lda LDR.ZPCODE,x
sta ZPCode,x
dex
bpl .6
ldx #LDR.RAMSIG.L-1
.7 jsr ZPCode
cmp LDR.RAMSIG,x
bne .9 Bad signature !!!!
2022-03-27 12:59:32 +00:00
dex
bpl .7
php
sei
sta IO.SETWRITEAUX
stz AUX.RAMSIG
stz AUX.RAMSIG+1 Set $E000-$FFFF as BLOCK USED
sta IO.CLRWRITEAUX
plp
2022-05-25 18:46:02 +00:00
dec bRAMFlag Tell BYE to reset that...
LDR.GFInfoRAM ldy #LDR.RAM
lda /LDR.RAM
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.GFInfoYA sty LDR.GFINFO.P+1
sta LDR.GFINFO.P+2
lda MLI.DEVNUM
pha
2022-03-27 12:59:32 +00:00
jsr MLI
.DA #MLI.C.GETFILEINFO
.DA LDR.GFINFO.P
plx
stx MLI.DEVNUM
rts
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.ZPCODE sta IO.SETREADAUX
lda AUX.RAMSIG,x
sta IO.CLRREADAUX
rts
LDR.ZPCODE.L .EQ *-LDR.ZPCODE
*--------------------------------------
LDR.RAMSIG .HS FFFE BITMAP for Blocks $70-$7F (LC $D000-FFFF)
.HS F3 storage type = F, name length = 3
.AS "RAM"
LDR.RAMSIG.L .EQ *-LDR.RAMSIG
*--------------------------------------
LDR.RAM .DA #4
.AS "/RAM"
*--------------------------------------
LDR.CSWVECT .DA LDR.CSW
LDR.KSWVECT .DA LDR.KSW
*--------------------------------------
LDR.GFINFO.P .DA #10
.BS 2 Filename
.BS 16
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.SETPFXSLASH.P
2022-03-13 12:52:24 +00:00
.DA #1
.DA .1
.1 .DA #1
.AS "/"
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.ONLINE.P .DA #2
.DA #$70 DEVNUM
.DA MLI.PATHBUF+1
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.GETSETPFX.P .DA #1
.DA MLI.PATHBUF
*--------------------------------------
LDR.STARTUP.LEN .DA #0
LDR.PFX.LEN .DA #0
2022-03-27 12:59:32 +00:00
*--------------------------------------
LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***"
2022-03-27 12:59:32 +00:00
LDR.UNABLE.L .EQ *-LDR.UNABLE
LDR.PRODOSBASIC .AS -"PRODOS BASIC FX"
LDR.PRODOSBASIC.L .EQ *-LDR.PRODOSBASIC
LDR.COPYRIGHT .AS -"COPYRIGHT APPLE 1983-92"
LDR.COPYRIGHT.L .EQ *-LDR.COPYRIGHT
.LIST ON
LDR.SIZE .EQ *-LDR.START
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/basic.fx/basic.s.ldr
LOAD usr/src/basic.fx/basic.s
ASM