A2osX/ProDOS.FX/ProDOS.S.LDR.txt
2023-11-12 14:20:15 +01:00

1442 lines
26 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
*--------------------------------------
idapple .EQ $0C model machine id
idxl .EQ $10 general use 16 bit index pointer
*--------------------------------------
auxsp .EQ $0101
*--------------------------------------
LDR.PBuf .EQ $0280
*--------------------------------------
.MA DEBUG
:1 bit $C000
bpl :1
sta $C010
.EM
*--------------------------------------
.MA DEBUGOA
bit $C061
bpl :1
>DEBUG
:1 .EQ *
.EM
*--------------------------------------
LDR.START jmp LDR.START8
jmp LDR.STARTATK
jmp LDR.START8
*--------------------------------------
LDR.MSG.PRODOS .AT "PRODOS FX 0.95"
LDR.MSG.UNSUPP .AT "UNSUPPORTED HARDWARE"
LDR.MSG.IIe .AT "//e"
LDR.MSG.IIc .AT "//c"
LDR.MSG.IIgs .AT "IIgs"
LDR.MSG.Unknown .AT "Unknown"
LDR.MSG.CLK .AT "?Clk"
LDR.MSG.RAM .AT "/RAM"
LDR.MSG.PFXERR .AT "ERR setting prefix"
*--------------------------------------
LDR.START16 inc LDR.BootFlag set = 2 for GQuit rts
LDR.STARTATK inc LDR.BootFlag set = 1 for appletalk rts
LDR.START8 lda ZP.UNITNUM
sta LDR.MLIOL.P+1
cld
bit IO.RROMBNK2
sta IO.CLR80DISP
sta IO.CLR80STORE
jsr ROM.INIT
jsr ROM.SETVID
jsr ROM.SETKBD
jsr ROM.HOME
lda #32
ldx #39
.1 sta $400,x
dex
bpl .1
ldx #LDR.MSG.PRODOS
jsr LDR.PrintX
sec
jsr ROM.IDROUTINE returns system info
bcs .2 taken if not a //gs
lda #$80
trb IO.GS.NEWVIDEO video mode select
* test for at least a 65c02
.2 sed
lda #$99
clc
adc #$01
cld
bmi LDR.UNSUPP.HW
stz auxsp
sta IO.SETALTZP
stz auxsp
lda auxsp
bne LDR.UNSUPP.HW
dec auxsp init aux sp to $FF
lda auxsp
beq LDR.UNSUPP.HW
sta IO.CLRALTZP
lda auxsp
bne LDR.UNSUPP.HW NO 128k
LDR.CheckROM ldx #LDR.MSG.IIE
lda #MACHID.T.IIe+MACHID.M.128+MACHID.COL80
ldy ROM.VERSION check hardware id
cpy #$06 apple //e?
beq .1 if yes
cpy #$EA apple //+ or ///?
beq LDR.UNSUPP.HW
ldx #LDR.MSG.UNKNOWN
bra m128k machine is unknown, Assume //e Enh 128k
.1 ldy ROM.ZIDBYTE //c ?
bne .2
ldy IO.KBD //c, check for keypress
cpy #$9B escape? (to disable accelerator)
bne .11
sta IO.KBDSTROBE clear keyboard
.11 lda #MACHID.T.IIc+MACHID.M.128+MACHID.COL80
ldx #LDR.MSG.IIC
bra m128k
.2 cpy #$EA
beq LDR.UNSUPP.HW //e UNenh....
cpy #$E0
beq .3
ldx #LDR.MSG.UNKNOWN
bra m128k not a //e Enh....
.3 sec
jsr ROM.IDROUTINE //gs ????
bcs m128k no.....
inc LDR.cortland
ldx #LDR.MSG.IIGS
lda #MACHID.T.IIe+MACHID.M.128+MACHID.COL80+MACHID.CLK
bra m128k
LDR.UNSUPP.HW ldx #LDR.MSG.UNSUPP
jsr LDR.PrintX
bne * no BRA !!! (6502)
*--------------------------------------
m128k sta idapple Save MACHID in temp location
lda #$20 "PRODOS" -> "ProDOS"
tsb LDR.MSG.PRODOS+1
tsb LDR.MSG.PRODOS+2
jsr LDR.Scr80Init X = LDR.MSG.machine type
ldx #$F
.2 lda LDR.3F0,x
sta $3F0,x
dex
bpl .2
lda #$01 patch for the gs rom
trb IO.GS.STATEREG to force off intcxrom
ldx #PAKME.GP.ID
ldy #GP
lda /GP
jsr X.Unpak.XatYA
jsr LDR.LCBNK1
ldx #PAKME.XRW.ID
ldy #XRW
lda /XRW
jsr X.Unpak.XatYAX
ldx #0
.1 stz XDOS.FCBs,x
stz XDOS.VCBs,x
inx
bne .1
ldx #PAKME.XDOS.ID
ldy #XDOS
lda /XDOS
jsr X.Unpak.XatYAX
ldx #XDOS.DATA.LEN
.3 stz XDOS.DATA-1,x
dex
bne .3
ldx #PAKME.IRQ.ID
ldy #IRQ
lda /IRQ
jsr X.Unpak.XatYAX
LDR.IRQ lda IO.RROMWRAMBNK2
ldy irqv interrupt vector
ldx irqv+1 x = high byte
jsr LDR.LCBNK1
sta IO.SETALTZP
sty irqv save irq vector in aux lc
stx irqv+1
sta IO.CLRALTZP
sty irqv
stx irqv+1 save irq vector in main lc
lda #XDOS.CallDisp
sta GP.DISPATCH+1 P8 system death vector
lda /XDOS.CallDisp
sta GP.DISPATCH+2
.DO LOWERCASE=0
lda GP.KVER
sta xdosver save current version for dir use
.FIN
lda idapple
sta GP.MACHID
lda LDR.cortland
beq LDR.II branch if // family
*--------------------------------------
LDR.IIGS sta XDOS.CortFlag
lda #XDOS.CallDisp
sta XDOS.CortDisp
lda /XDOS.CallDisp
sta XDOS.CortDisp+1
* lda IO.RROMWRAMBNK2
* stz ROM.MODE force setvid to reset cursor
* jsr setvid reset output to screen
* jsr LDR.LCBNK1
lda #'C'
ldx #PAKME.CCLK.ID
jsr LDR.SetupCLK
.DO M.SEL
* ldx #PAKME.SEL2.ID
* ldy #$1000
* lda /$1000
* jsr X.Unpak.XatYAX
ldx #PAKME.SEL2.ID
jsr LDR.SetupSEL
.FIN
*--------------------------------------
lda LDR.BootFlag
bne .1 branch if prodos 8 alone
* running from gs/os shell so zero out os_boot for appletalk
sta OS_BOOT indicates O/S initially booted.
jsr patch101 patch for gs/os - rev note #101
.1 bra LDR.Common
*--------------------------------------
LDR.II .DO M.SEL
ldx #PAKME.SEL1.ID
jsr LDR.SetupSEL
.FIN
jsr LDR.ClkDevScan
*--------------------------------------
LDR.Common jsr LDR.BlkDevScan
.DO M.RAM=1
jsr LDR.SetupRAM
.FIN
*--------------------------------------
lda LDR.MLIOL.P+1 Boot ZP.UNITNUM
sta GP.DEVNUM
ldx GP.DEVCNT
.1 lda GP.DEVLST,x
eor GP.DEVNUM
and #$f0
beq .2
dex
bpl .1
brk
.2 lda GP.DEVLST,x
pha
.3 lda GP.DEVLST+1,x
sta GP.DEVLST,x
cpx GP.DEVCNT
inx
bcc .3
pla
ldx GP.DEVCNT
sta GP.DEVLST,x
lda LDR.BootFlag get setup entry point flag
beq LDR.SetPrefix taken if normal boot.
bit IO.RROMBNK2
rts return to caller at setup entry point.
*--------------------------------------
LDR.SetPrefix jsr MLI
.DA #MLI.ONLINE
.DA LDR.MLIOL.P
bcs .9
lda LDR.PBuf+1 get volume name length.
and #$0F strip SDDDxxxx
beq .9
inc add 1 for leading '/'
sta LDR.PBuf save prefix length.
lda #'/' place leading '/' in prefix buffer
sta LDR.PBuf+1
jsr MLI
.DA #MLI.SETPREFIX
.DA LDR.MLISETP.P
bcs .9
jsr ROM.CROUT
ldx #PAKME.ILDR.ID
ldy #ILDR
lda /ILDR
jsr X.Unpak.XatYA
jmp ILDR
.9 ldx #LDR.MSG.PFXERR
jsr LDR.PrintX
bra *
*--------------------------------------
LDR.SetupSEL bit IO.RRAMWRAMBNK2 read/write RAM bank 2
bit IO.RRAMWRAMBNK2
ldy #$D100
lda /$D100
jsr X.Unpak.XatYAX
lda #$EE byte to distinguish LC bank 2
sta $D000
*--------------------------------------
LDR.LCBNK1 lda IO.RRAMWRAMBNK1 switch in LC bank 1
lda IO.RRAMWRAMBNK1
rts
*--------------------------------------
DS121x.DATA1 .EQ idxl
DS121x.DATA2 .EQ ZP.A1L
*--------------------------------------
LDR.ClkDevScan jsr LDR.IsIIc
bcc LDR.ClkDevNCLK //c only
LDR.ClkDevDCLK php
sei
lda $CFFF
lda $C400
ldx #8
stz $C0C0
stz $C0C1
stx $C0C2
lda $C0C3
pha
.1 lda DS121x.SIG-1,x
ldy #8
.2 sta $C0C3
stz $C0C0
lsr
dey
bne .2
dex
bne .1
ldx #8
.4 ldy #8
stz $C0C0
.5 lda $C0C3
lsr
ror DS121x.DATA1-1,x
dey
bne .5
dex
bne .4
stz $C0C0
pla
sta $C0C3
plp
sed
ldx #DS121x.ValidHI-DS121x.ValidLO
.6 lda DS121x.DATA1-1,x
cmp DS121x.ValidLO-1,x
bcc .9
cmp DS121x.ValidHI-1,x
bcc .7
bne .9
.7 dex
bne .6
cld
lda #'D'
ldx #PAKME.DCLK.ID
jmp LDR.SetupCLK
.9 cld
*--------------------------------------
NSC.IOBASE .EQ $C300
*--------------------------------------
LDR.ClkDevNCLK php
sei
lda IO.RDCXROM
php
sta IO.SETCXROM
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
ldx #8
.1 ldy #8
.2 lda NSC.IOBASE+4
lsr
ror DS121x.DATA1-1,x
dey
bne .2
dex
bne .1
*--------------------------------------
sta NSC.IOBASE
* lda $C00B Workaround for Ultrawarp bug
lda NSC.IOBASE+4 Reset DS1216E comparison register with READ A2=1
ldy #8 Read 8 bytes...
.3 lda DS121x.SIG-1,y
phy
ldy #8 ....of 8 bits
.4 ldx #0
lsr
bcc .5
inx
.5 bit NSC.IOBASE,x Write Pattern bit in A0, with A2=0
dey
bne .4
ply
dey
bne .3
*--------------------------------------
ldx #8
.6 ldy #8
.7 lda NSC.IOBASE+4
lsr
ror DS121x.DATA2-1,x
dey
bne .7
dex
bne .6
plp
bmi .8
sta IO.CLRCXROM
.8 plp
*--------------------------------------
ldx #8
.9 lda DS121x.DATA1-1,x
cmp DS121x.DATA2-1,x
bne .90
dex
bne .9
bra LDR.ClkDevTCLK
.90 lda #'N'
ldx #PAKME.NCLK.ID
bra LDR.SetupCLK
*--------------------------------------
LDR.ClkDevTCLK jsr LDR.IsIIc
bcs LDR.ClkDevXCLK
stz idxl
lda #$C1
sta idxl+1
lda #1
sta LDR.SlotIdx
.1 jsr LDR.CheckTClkID
bcs .7
stz $478,x
stz $7f8,x
lda idxl+1
asl
asl
asl
asl
tax
stz $c080,x
lda $c088,x
lda $c080,x
lda #'T'
ldx #PAKME.TCLK.ID
jsr LDR.SetupCLK
lda idxl+1
sta TCLK.Cx1+2
sta TCLK.Cx2+2
rts
.7 inc LDR.SlotIdx
inc idxl+1
lda idxl+1
cmp #$C8
bne .1
*--------------------------------------
LDR.ClkDevXCLK bit IO.RROMBNK2
sta $C070
bit $FACA
bit $FACA
bit $FAFE
lda $DFFE
cmp #$4A
bne .9
lda $DFFF
cmp #$CD
beq .1
.9 bit $F851
rts
.1 bit $F851
lda #'X'
ldx #PAKME.XCLK.ID
*--------------------------------------
LDR.SetupCLK sta LDR.MSG.CLK
phx
ldx #LDR.MSG.CLK
jsr LDR.PrintX
jsr LDR.LCBNK1
plx
ldy #CLK
lda /CLK
jsr X.Unpak.XatYAX
lda #$4C enable clock routine by putting a jmp
sta GP.CLOCK in front of clock vector
lda #MACHID.CLK
tsb GP.MACHID
LDR.SetupCLK.RTS
rts
*--------------------------------------
.DO M.RAM=1
LDR.SetupRAM lda GP.DEVCNT
cmp #13
bcs LDR.SetupCLK.RTS
jsr LDR.LCBNK1
ldx #PAKME.RAM.ID
ldy #RAM
lda /RAM
jsr X.Unpak.XatYAX
lda RAMX.PAK
bne .1
sta IO.SETWRITEAUX
ldx #PAKME.RAMX.ID
ldy #RAMX
lda /RAMX
jsr X.Unpak.XatYA
bra .7
.1 ldx #PAKME.RAMX.ID
ldy #$0800
lda /$0800
jsr X.Unpak.XatYA
sta IO.SETWRITEAUX
ldx #$FE
.2 lda $900,x
sta RAMX+$100,x
dex
txa
bne .2
.3 lda $800,x
sta RAMX,x
inx
bne .3
.7 sta IO.CLRWRITEAUX
lda #RAM put driver address into
sta GP.DEVPTRS3D2
lda /RAM
sta GP.DEVPTRS3D2+1
inc GP.DEVCNT count (-1) active devices
ldx GP.DEVCNT
lda #$BF unit num of /RAM
sta GP.DEVLST,x
ldx #LDR.MSG.RAM
jmp LDR.PrintX
.FIN
*--------------------------------------
* find all disk devices in system slots and set up address
* and device table in prodos global page.
*--------------------------------------
LDR.BlkDevScan bit IO.RROMBNK2 write protect lc ram.
stz idxl
lda #$C7 search slots from high to low
sta idxl+1
lda #7
sta LDR.SlotIdx
.1 ldx LDR.SlotIdx
stz LDR.SlotDevType-1,x
jsr LDR.CheckDiskID
bcs .4 if no ProDOS device in this slot.
ldy #$ff
lda (idxl),y check last byte of $Cn rom (y = $ff)
bne .2 branch if 16 sector disk II.
sta devid =0 since disk ii's have null attributes
lda #XRW
sta LDR.driveradr
lda /XRW
sta LDR.driveradr+1
sec 2 devices
jsr LDR.AddBlkDevs
bra .4
.2 cmp #$FF if = $FF then 13 sector disk II.
beq .4 ignore if 13 sector boot ROM
ldy #$07 check for a smartport device.
lda (idxl),y
bne .3 no smartport
jsr LDR.AddSPDevs
bra .4
.3 ldy #$FE BLK device...
lda (idxl),y get attributes.
and #$03 verify it provides read and status calls.
cmp #$03
bne .4 assume it's an off-brand disk
jsr LDR.SetDevID
and #$3 Device count minus 1
inc
ldx LDR.SlotIdx
sta LDR.SlotDevCnt-1,x
dec LDR.SlotDevType-1,x set as BlockDeb
tax
iny $CnFF
lda (idxl),y
sta LDR.driveradr
lda idxl+1 store hi entry addr (low already done)
sta LDR.driveradr+1
cpx #2 CS if 2 devs or more
jsr LDR.AddBlkDevs install 1 or 2 devices from this slot.
.4 dec idxl+1 next lower slot.
dec LDR.SlotIdx have all slots been checked ?
bne .1
*--------------------------------------
* stz idxl
lda #$C7
sta idxl+1
lda #7
sta LDR.SlotIdx
.5 ldx LDR.SlotIdx
lda LDR.SlotDevType-1,x
beq .8
lda LDR.SlotDevCnt-1,x
cmp #3
bcc .8
bit LDR.SlotDevType-1,x
bpl .6 type = smartport
jsr LDR.AddExtraBLKDevs
bra .8
.6 jsr LDR.AddExtraSPDevs
.8 dec idxl+1
dec LDR.SlotIdx
bne .5
LDR.AddExtraDevs.RTS
rts
*--------------------------------------
LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
iny #$ff
lda (idxl),y
sta LDR.driveradr
sta .1+1 modify operand
clc
adc #$03
sta LDR.SPVect+1
lda idxl+1
sta LDR.driveradr+1
sta LDR.SPVect+2
sta .1+2 modify operand
asl convert $Cn to $n0
asl
asl
asl
sta ZP.UNITNUM
stz ZP.CMDNUM force a prodos status call
stz ZP.BUFPTR dummy pointer
lda #$10
sta ZP.BUFPTR+1 dummy pointer should be <> 0
stz ZP.BLKNUM # of bytes to transfer
stz ZP.BLKNUM+1
.1 jsr $0000 SELF MODIFIED
ldy #$FB
lda (idxl),y check device id
and #$02 SCSI ?
beq .2 no, no need to init Cocoon
jsr LDR.SPStatusCall status of Cocoon : A = device = 2 for SCSI
lda #0 set unit# = 0
.2 jsr LDR.SPStatusCall
lda LDR.SPStatusBuf Device count
beq LDR.AddExtraDevs.RTS no devices, so done.
sta LDR.DevCnt
ldx LDR.SlotIdx
inc LDR.SlotDevType-1,x set as smartport
.3 inc LDR.SPStatus.U
jsr LDR.SPStatusCall.U call to get the device status
bcs .7
lda LDR.SPStatusBuf
bpl .7 not a block device
ldx LDR.SlotIdx
inc LDR.SlotDevCnt-1,x
.7 dec LDR.DevCnt
bne .3
ldx LDR.SlotIdx
lda LDR.SlotDevCnt-1,x
beq LDR.AddBlkDevs.RTS
sta LDR.SlotDevCnt-1,x
cmp #2 CC/CS, add 1 or 2 devs
*--------------------------------------
LDR.AddBlkDevs php how many drives (carry).
lda idxl+1 get index to global device table
and #$07 for this slot...
asl
tay into y reg.
asl
asl now form device # = slot #
asl in high nibble.
ora devid combine with attributes.
ldx GP.DEVCNT
inx put device # into device list.
sta GP.DEVLST,x
asl now form drive 2 device number, if any.
plp restore # of devices in carry.
ror if 2 drives, then bit 7=1.
bpl .1 branch if a 1 drive device (e.g. hard drive)
inx else presume that 2nd drive is present.
sta GP.DEVLST,x active device list.
.1 stx GP.DEVCNT save updated device count.
asl shift # of drives back into carry.
lda LDR.driveradr get high address of device driver.
sta GP.DEVPTRS,y device driver table 1.
bcc .2 branch if single drive.
sta GP.DEVPTRS+16,y device driver table 2.
.2 lda LDR.driveradr+1
sta GP.DEVPTRS+1,y
bcc .3
sta GP.DEVPTRS+17,y
.3
LDR.AddBlkDevs.RTS
rts
*--------------------------------------
LDR.AddExtraBLKDevs
dec
dec
sta LDR.DevCnt
jsr LDR.SetDevID set up device attributes
jsr LDR.FindFreeDevPtr
bcs .9
.1 cpy #$10
bcc .2 must be Drive 1
.10 jsr LDR.FindFreeDevPtrNext
bcc .1
rts
.2 lda LDR.DevCnt
dec
beq .4 only one to add
tya
ora #$10
tay
lda GP.DEVPTRS,y device driver table 1
cmp #XDOS.NoDevice
bne .10
lda GP.DEVPTRS+1,y
cmp /XDOS.NoDevice
bne .10 Drive 1 & 2 free
jsr LDR.AddY2DEVLST Y = index in GP.DEVPTRS
jsr .8
tya
and #$F
tay
.4 jsr LDR.AddY2DEVLST Y = index in GP.DEVPTRS
.8 phy
ldy #$ff
lda (idxl),y BLK entry point
ply
sta GP.DEVPTRS,y
lda idxl+1
sta GP.DEVPTRS+1,y
* clc
.9 rts
*--------------------------------------
LDR.AddExtraSPDevs
jsr LDR.SetDevID set up device attributes
iny ldy #$fe from SetDevID
* ldy #$FF
lda (idxl),y
clc
adc #$03 add 3 for smartport call
sta LDR.SPVect+1
lda idxl+1
sta LDR.SPVect+2
lda #0
jsr LDR.SPStatusCall do a status call on smartport itself
lda LDR.SPStatusBuf # of devices on smartport
cmp #$03
bcc .8 only 2 devices,skip to next one.
dec
dec
sta LDR.DevCnt
lda #3
sta LDR.SPStatus.U
.1 jsr LDR.SPStatusCall.U do status call
lda LDR.SPStatusBuf is this a block device?
bpl .2
jsr LDR.FindFreeDevPtr
bcs .8
jsr LDR.LCBNK1
tya divide index by 2
lsr
tax
lda LDR.SPStatus.U
sta XDOS.SPUnit-1,x store the smartport unit #
lda LDR.SPVect+1 and entry address.
sta XDOS.SPVectLo-1,x
lda LDR.SPVect+2
sta XDOS.SPVectHi-1,x
bit IO.RROMBNK2 write protect lc ram.
jsr LDR.AddY2DEVLST
lda #XDOS.SPREMAP
sta GP.DEVPTRS,y
lda /XDOS.SPREMAP
sta GP.DEVPTRS+1,y
.2 inc LDR.SPStatus.U
dec LDR.DevCnt
bne .1
.8 rts
*--------------------------------------
LDR.SPStatusCall
sta LDR.SPStatus.U
LDR.SPStatusCall.U
LDR.SPVect jsr $0000 self modifying
.HS 00
.DA LDR.SPStatus.P
rts
*--------------------------------------
LDR.CheckTClkID ldy #6
.HS 2C BIT ABS
LDR.CheckDiskID ldy #5
lda IO.CLRC8ROM switch out $C8 ROMs
.1 lda (idxl),y compare id bytes
cmp dskid,y
bne .3
dey
dey
bpl .1 loop until all 4 id bytes match.
clc
php
.8 ldx LDR.SlotIdx
lda sltbit-1,x
tsb GP.SLTBYT mark bit to flag rom present
.9 plp
rts
.3 sec
php
ldx #0
.4 cmp (idxl),y
bne .9
inx
bne .4
bra .8
*--------------------------------------
LDR.FindFreeDevPtr
ldx #LDR.DEVPTRS.CNT-1
LDR.FindFreeDevPtrNext
.1 ldy LDR.DEVPTRS.IDX,x
lda GP.DEVPTRS,y device driver table 1
cmp #XDOS.NoDevice
bne .2
lda GP.DEVPTRS+1,y
cmp /XDOS.NoDevice
beq .8
.2 dex
bpl .1
sec
rts
.8 clc
rts
*--------------------------------------
LDR.SetDevID ldy #$FE check attributes byte.
lda (idxl),y
lsr move hi nibble to lo nibble for
lsr device table entries.
lsr
lsr
sta devid
rts
*--------------------------------------
LDR.AddY2DEVLST inc GP.DEVCNT
ldx GP.DEVCNT
tya
asl convert to DSSS0000
asl
asl
ora devid include device attributes
sta GP.DEVLST,x in the active device list.
rts
*--------------------------------------
LDR.Scr80Init phx Save LDR.MSG
jsr LDR.IsIIc
bcs LDR.Scr80Init2
php
sei
sta IO.SETC3ROM
ldx #COL80IDX.Cnt-1
.1 ldy COL80IDX,x
lda $C300,y
cmp COL80VAL,x
bne .2
dex
bpl .1
lda $C30C is it an apple 80 col compatible card?
and #$F0
cmp #$80
beq .3
.2 sta IO.CLRC3ROM
.3 plp
*--------------------------------------
LDR.Scr80Init2 lda #$8C Reset 80 col screen ($0C:HOME)
jsr $C300
jsr ROM.SETNORM
jsr ROM.HOME
jsr ROM.SETINV
.DO LOGO=1
lda #20
sta ZP.CV
inc
sta ZP.WNDTOP
jsr ROM.TABV
lda #LOGO.PAKED
sta ZPInBufPtr
lda /LOGO.PAKED
sta ZPInBufPtr+1
stz ZPOutBufPtr
lda #$A0
sta ZPOutBufPtr+1
jsr X.Unpak
sta IO.CLRHIRES
sta IO.SETMIXED
bit IO.RDIOUDIS
sta IO.SETIOUDIS
sta IO.SETDHIRES
bmi .10
sta IO.CLRIOUDIS
.10 sta IO.CLRTEXT
stz ZPPtr1
lda #$A0
sta ZPPtr1+1
lda #0
.1 pha
jsr ROM.GBSCALC
ldy #0
.2 lda (ZPPtr1),y
pha
and #$f
tax
lda PALETTE.AUX,x
sta IO.SETPAGE2
sta (ZP.GBASL),y
pla
lsr
lsr
lsr
lsr
tax
lda PALETTE.MAIN,x
sta IO.CLRPAGE2
sta (ZP.GBASL),y
iny
cpy #40
bne .2
lda ZPPtr1
clc
adc #40
sta ZPPtr1
bcc .3
inc ZPPtr1+1
.3 ldy #0
.4 lda (ZPPtr1),y
pha
and #$f
tax
lda PALETTE.AUX,x
asl
asl
asl
asl
sta IO.SETPAGE2
ora (ZP.GBASL),y
sta (ZP.GBASL),y
pla
lsr
lsr
lsr
lsr
tax
lda PALETTE.MAIN,x
asl
asl
asl
asl
sta IO.CLRPAGE2
ora (ZP.GBASL),y
sta (ZP.GBASL),y
iny
cpy #40
bne .4
lda ZPPtr1
clc
adc #40
sta ZPPtr1
bcc .7
inc ZPPtr1+1
.7 pla
inc
cmp #20
bne .1
.FIN
jsr ROM.CLREOL
jsr ROM.SETNORM
ldx #LDR.MSG.PRODOS
jsr LDR.PrintX
plx get back LDR.MSG.machine type
*--------------------------------------
LDR.PrintX bit IO.RROMBNK2
lda ZP.INVFLG
pha
jsr ROM.SETINV
.1 lda $2000,x
pha
ora #$80
jsr ROM.COUT
inx
pla
bpl .1
lda #$A0
jsr ROM.COUT
pla
sta ZP.INVFLG
sta IO.CLRPAGE2 for screen holes proper access
rts
*--------------------------------------
LDR.IsIIc lda GP.MACHID
and #MACHID.T
cmp #MACHID.T.IIc
beq .9
clc
.9 rts
*--------------------------------------
PALETTE.MAIN .HS 00.02.04.06.08.0A.0C.0E
.HS 01.03.05.07.09.0B.0D.0F
PALETTE.AUX .HS 00.01.02.03.04.05.06.07
.HS 08.09.0A.0B.0C.0D.0E.0F
*--------------------------------------
* 16 bytes moved to $03F0 vectors
*--------------------------------------
LDR.3F0 .DA ROM.BREAKV
.DA ROM.OLDRST
.DA #$5A powerup byte
jmp ROM.OLDRST '&' vector
jmp ROM.OLDRST ctrl-y vector
.HS 004000
.DA GP.IRQV global page interrupt vector
*--------------------------------------
* patch to gsos vectors so error is returned for os calls - rev note #101
*--------------------------------------
patch101 php
sei disable interrupts
clc
xce full native mode
>LONGMX
phb save DBR
pha
pha
pea $0000 length of patch
pea $0010 0000/0010 = 16 bytes
pea $3101 user id for prodos 8
pea $8018 attributes (locked/nospec/nocross)
pha
pha
>IIGS NewHandle
lda $01,s retrieve handle
tax
lda $03,s
tay
pea $0000 copy the code into the handle
pea L2C4D
phy
phx
pea $0000 length of patch = 0000/0010
pea $0010
>IIGS PtrToHand
plx low word of handle
plb set DBR to handle's bank
lda >1,x get upper 16 bits of 24 bit address
tay save in y
lda >0,x get low 8 bits of address
and ##$00FF clear high byte
xba put address in high byte
ora ##$005C include JML opcode
sta GSOS2 store in gsos vectors
clc
adc ##$000B
sta GSOS
tya store upper 16 bits too
sta GSOS2+2
adc ##$0000 adj for possible page crossing
sta GSOS+2
plb remove garbage byte from stack
plb restore DBR.
sec
xce back to emulation mode
plp
rts
*--------------------------------------
* copy of the code that goes in the handle
*--------------------------------------
L2C4D lda 1,s
sta 7,s
lda 2,s
sta 8,s
pla
pla
pla
lda ##$00FF #NoOS
sec
rtl
*--------------------------------------
DS121x.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
DS121x.ValidLO .HS 00010101 Y,M,D,DoW
DS121x.ValidHI .HS 990C1F07
*--------------------------------------
* id bytes: evens for clock, odds for disk
dskid .HS 08.20.28.00.58.03.70
sltbit .HS 02040810204080
*--------------------------------------
COL80IDX .HS 05070BFA + $C30C and $80 = $80
COL80IDX.Cnt .EQ *-COL80IDX
COL80VAL .HS 3818012C
*--------------------------------------
LDR.MLIOL.P .DA #2
.DA #$60
.DA LDR.PBuf+1
LDR.MLISETP.P .DA #1
.DA LDR.PBuf
LDR.SPStatus.P .DA #$03 # of parms
LDR.SPStatus.U .DA #$00 unit number (code for smartport stat)
.DA LDR.SPStatusBuf
.DA #00 status code (0 = general status)
LDR.DEVPTRS.CNT .EQ 14
LDR.DEVPTRS.IDX .DA #$16 S3D2 /RAM
.DA #$06 S3D1
.DA #$12 S1D2
.DA #$02 S1D1
.DA #$14 S2D2
.DA #$04 S2D1
.DA #$18 S4D2
.DA #$08 S4D1
.DA #$1A S5D2
.DA #$0A S5D1
.DA #$1C S6D2
.DA #$0C S6D1
.DA #$1E S7D2
.DA #$0E S7D1
*--------------------------------------
LDR.cortland .DA #0 cortland loader flag (1 = Cortland)
LDR.BootFlag .DA #0 0 = normal boot, <>0 = return
*--------------------------------------
LDR.SPStatusBuf .BS 8 8 bytes for smartport call
LDR.driveradr .BS 2
LDR.SlotIdx .BS 1
LDR.DevCnt .BS 1
LDR.SlotDevType .BS 7
LDR.SlotDevCnt .BS 7
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.ldr
LOAD usr/src/prodos.fx/pdos8m.s
ASM