A2osX/BASIC.FX/BASIC.S.LDR.txt
2024-01-09 22:52:03 +01:00

430 lines
7.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
*--------------------------------------
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
lda #%11001111 pages 0,1,...,4,5,6,7 protected
sta MLI.MEMTABL
ldx #19
.1 stz MLI.MEMTABL,x
dex
bne .1
lda #$FF
sta MLI.MEMTABL+20 HIMEM=$A000
sta MLI.MEMTABL+21
sta MLI.MEMTABL+22
lda #%11000011 pages $B8,$B9,...,$BE,$BF protected
sta MLI.MEMTABL+23
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
bit IO.RRAMWRAMBNK2
bit IO.RRAMWRAMBNK2
sta IO.SETALTZP
ldx #PAKME.AUX-PAKME.Table
ldy #LDR.AUX.DST
lda /LDR.AUX.DST
jsr X.Unpak.XatYA
sta IO.CLRALTZP
bit IO.RROMBNK2
ldx #$03
.2 lda LDR.CSWVECT,x
sta ZP.CSW,x
dex
bpl .2
jmp AS.COLDBOOT
*--------------------------------------
.3 ldx #LDR.UNABLE.L-1
.4 lda LDR.UNABLE,x
sta $628,x
dex
bpl .4
sta MON.POWERUPBYTE
sta MON.POWERUP+1
bra *
*--------------------------------------
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+1
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 /HIMEM-$400
sta AS.HIMEM+1
sta AS.STRINGSTART+1
sta GP.RSHIMEM
lda MLI.PFIXPTR
beq L214E
jsr MLI
.DA #MLI.GETPREFIX
.DA LDR.GETSETPFX.P
bne L218B
ldx MLI.PATHBUF
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.SETPREFIX
.DA LDR.SETPFXSLASH.P
L214E jsr MLI
.DA #MLI.ONLINE
.DA LDR.ONLINE.P
bne L218B
lda MLI.PATHBUF+1
and #$0F
beq L218B
inc
sta MLI.PATHBUF
lda #'/'
sta MLI.PATHBUF+1
jsr MLI
.DA #MLI.SETPREFIX
.DA LDR.GETSETPFX.P
bne L218B
L216F ldx #BSX.InitPath.X
jsr BS.ToAUX
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
lda #$AD
sta IO.LINEBUF
L218B lda LDR.PFX.LEN
cmp #$03
bcs L2198
jsr MLI
.DA #MLI.SETPREFIX
.DA LDR.SETPFXSLASH.P
L2198 lda LDR.STARTUP.LEN
bne L21C1
jsr LDR.KSW
ldx #LDR.PRODOSBASIC.L-1
L21A2 lda LDR.PRODOSBASIC,x
sta $400+12,x
dex
bpl L21A2
ldx #LDR.COPYRIGHT.L-1
L21AD lda LDR.COPYRIGHT,x
sta $480+9,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.AMPJMP,x
sta MON.AMPJMP,x
dex
bpl L21C3
lda #MON.BREAKV
sta MON.BRKVECT
lda /MON.BREAKV
sta MON.BRKVECT+1
lda #GP.ENTRY
sta MON.POWERUP
lda /GP.ENTRY
sta MON.POWERUP+1
eor #$A5
sta MON.POWERUPBYTE
lda #$A5
sta AS.TRCFLG
* lda BS.IVERSION
lda #5
sta MLI.IVERSION
LDR.JMP.GP.ENTRY
jmp GP.ENTRY
LDR.AMPJMP jmp GP.DOSCMD
*--------------------------------------
LDR.KSW lda GP.INVECT0
sta ZP.KSW
lda GP.INVECT0+1
sta ZP.KSW+1
ldx LDR.STARTUP
inx
lda #$8D
rts
*--------------------------------------
LDR.ShrinkRAM stz bRAMFlag
lda MLI.DEVPTRS3D2
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
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
rts
.9 sec
.99 rts
.3 jsr LDR.GFInfoRAM
bcs .99
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 !!!!
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
dec bRAMFlag Tell BYE to reset that...
LDR.GFInfoRAM ldy #LDR.RAM
lda /LDR.RAM
*--------------------------------------
LDR.GFInfoYA sty LDR.GFINFO.P+1
sta LDR.GFINFO.P+2
lda MLI.DEVNUM
pha
jsr MLI
.DA #MLI.GFINFO
.DA LDR.GFINFO.P
plx
stx MLI.DEVNUM
rts
*--------------------------------------
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
*--------------------------------------
LDR.SETPFXSLASH.P
.DA #1
.DA .1
.1 .DA #1
.AS "/"
*--------------------------------------
LDR.ONLINE.P .DA #2
.DA #$70 DEVNUM
.DA MLI.PATHBUF+1
*--------------------------------------
LDR.GETSETPFX.P .DA #1
.DA MLI.PATHBUF
*--------------------------------------
LDR.STARTUP.LEN .DA #0
LDR.PFX.LEN .DA #0
*--------------------------------------
LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***"
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