Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-11-08 08:35:08 +01:00
parent 8f0ef5bbd2
commit bb6916c347
4 changed files with 215 additions and 349 deletions

Binary file not shown.

Binary file not shown.

View File

@ -21,8 +21,7 @@ LDR.MSG.IIgs .AT "IIgs"
LDR.MSG.Unknown .AT "Unknown"
LDR.MSG.CLK .AT "Clk"
LDR.MSG.RAM .AT "/RAM"
LDR.MSG.ROOTERR .AS -"Unable To read ROOT dir."
LDR.MSG.ROOTERR.LEN .EQ *-LDR.MSG.ROOTERR
LDR.MSG.ROOTERR .AT "ERR reading CATALOG"
*--------------------------------------
p16start inc LDR.BootFlag set = 2 for GQuit rts
atalkset inc LDR.BootFlag set = 1 for appletalk rts
@ -87,8 +86,7 @@ prostart lda unitnum
lda auxsp
bne LDR.UNSUPP.HW NO 128k
LDR.CheckROM stz cortland
ldx #LDR.MSG.IIE
LDR.CheckROM ldx #LDR.MSG.IIE
lda #MACHID.T.IIe+MACHID.M.128+MACHID.COL80
ldy $FBB3 check hardware id
@ -126,15 +124,15 @@ LDR.CheckROM stz cortland
jsr $FE1F //gs ????
bcs m128k no.....
inc cortland
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
bmi *
bra *
*--------------------------------------
m128k sta idapple Save MACHID in temp location
sta SETALTCHAR
@ -248,23 +246,21 @@ LDR.IRQ lda RROMWRAMBNK2
lda idapple
sta MACHID
lda cortland
lda LDR.cortland
beq LDR.II branch if // family
LDR.IIGS
* lda RROMWRAMBNK2
* stz vmode force setvid to reset cursor
* jsr setvid reset output to screen
*--------------------------------------
LDR.IIGS sta cortflag
lda #calldisp
sta cortdisp
lda /calldisp
sta cortdisp+1
lda #1
sta cortflag
* lda RROMWRAMBNK2
* stz vmode force setvid to reset cursor
* jsr setvid reset output to screen
* jsr lc1in set language card bank 1 to r/w
lda #'C'
@ -286,135 +282,32 @@ LDR.IIGS
ldx PAKME.SEL2
ldy PAKME.SEL2+1
jsr LDR.SetupQC
*--------------------------------------
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.
stz OS_BOOT indicates O/S initially booted.
jsr patch101 patch for gs/os - rev note #101
.1 jmp BLKDEV.Install
.1 bra LDR.Common
*--------------------------------------
LDR.II ldx PAKME.SEL1
ldy PAKME.SEL1+1
jsr LDR.SetupQC
* check for a rom in slot 3. if no rom, use internal $C300 firmware
sta CLRC3ROM
lda rommap slot ROM bit map
and #$08 mask all but slot 3
bne isromin3 taken if rom in slot 3
bra CLK.Install else continue booting
* found a rom in slot 3. is it an external, identifiable 80 col card
* with interrupt routines? if so, enable it else use internal $C300 firmware.
isromin3 sta SETC3ROM
lda $C305 check card id bytes
cmp #$38
bne hitswtch not terminal card
lda $C307
cmp #$18
bne hitswtch
lda $C30B
cmp #$01
bne hitswtch
lda $C30C is it an apple 80 col compatible card?
and #$F0
cmp #$80
bne hitswtch if not.
lda $C3FA
cmp #$2C does card have an interrupt handler?
beq docard yes
hitswtch sta CLRC3ROM
* verify that the card in aux slot is actually present
sta SET80STORE
sta SETPAGE2
lda #$EE
sta txtp2
asl
asl txtp2
cmp txtp2
bne .1
lsr
lsr txtp2
cmp txtp2
.1 sta CLRPAGE2
sta CLR80STORE
beq docard branch if card is there
lda #MACHID.COL80
lda machid machine ID byte
trb MACHID clear 80-col bit 2 (no card)
bra CLK.Install
docard lda #MACHID.COL80
tsb MACHID turn bit 2 on (80-col card is present)
jsr LDR.ClkDevScan
*--------------------------------------
CLK.Install jsr LDR.ClkDevScan
*--------------------------------------
BLKDEV.Install jsr LDR.BlkDevScan
*--------------------------------------
jsr lc1in
LDR.Common jsr LDR.BlkDevScan
ldx PAKME.RAM
ldy PAKME.RAM+1
stx ZPInBufPtr
sty ZPInBufPtr+1
lda #$FF00
sta ZPOutBufPtr
lda /$FF00
sta ZPOutBufPtr+1
jsr X.Unpak
sta SETWRITEAUX
ldx PAKME.RAMX
ldy PAKME.RAMX+1
stx ZPInBufPtr
sty ZPInBufPtr+1
lda #$0200
sta ZPOutBufPtr
lda /$0200
sta ZPOutBufPtr+1
jsr X.Unpak
sta CLRWRITEAUX
lda #RAMDRV put driver address into
sta drivertbl2+6 slot 3, drive 2.
lda /RAMDRV
sta drivertbl2+7
inc GP.numdevs count (-1) active devices
ldx GP.numdevs
lda #$BF unit num of /RAM
sta devlist,x
ldx #LDR.MSG.RAM
jsr LDR.PrintX
jsr LDR.SetupRAM
*--------------------------------------
lda LDR.BootFlag get setup entry point flag
beq LDR.ReadRoot taken if normal boot.
lda RROMBNK2
rts return to caller at setup entry point.
LDR.BootFlag .DA #$00 0 = normal boot, <>0 = return
* set prefix to boot device
*--------------------------------------
LDR.ReadRoot lda LDR.MLIOL.P+1 place boot devnum in globals
sta devnum last device used
@ -426,6 +319,7 @@ LDR.ReadRoot lda LDR.MLIOL.P+1 place boot devnum in globals
lda pbuf+1 get volume name length.
and #$0F strip devnum
beq .9
inc add 1 for leading '/'
sta pbuf save prefix length.
lda #'/' place leading '/' in prefix buffer
@ -469,64 +363,10 @@ LDR.ReadRoot lda LDR.MLIOL.P+1 place boot devnum in globals
.8 jmp $800 jmp to "load interpreter" code
.9 sta RROMBNK2
jsr home
ldy #LDR.MSG.ROOTERR-1
.91 lda LDR.MSG.ROOTERR,y
sta vline12+4,y
dey
bpl .91
.9 ldx #LDR.MSG.ROOTERR
jsr LDR.PrintX
bmi *
*--------------------------------------
LDR.PrintA ldy LDR.Print.CX
and #$7F
cmp #$60
bcs .2
and #$3F
.2 sta $400,y
inc LDR.Print.CX
rts
*--------------------------------------
LDR.PrintX ldy LDR.Print.CX
.1 lda $2000,x
pha
and #$7F
cmp #$60
bcs .2
and #$3F
.2 sta $400,y
inx
iny
pla
bpl .1
* lda #$20
* sta $400,y
iny Add a Space
sty LDR.Print.CX
rts
LDR.Print.CX .HS 00
*--------------------------------------
LDR.MLIOL.P .DA #2
.DA #$60
.DA pbuf+1
LDR.MLISETP.P .DA #1
.DA pbuf
.DO READCAT=1
LDR.MLIRB.P .DA #3
.DA #0 unit number
.DA 0 2 byte data buffer
.DA 0 2 byte block number
.FIN
cortland .BS 1 cortland loader flag (1 = Cortland)
*--------------------------------------
LDR.SetupQC bit RRAMWRAMBNK2 read/write RAM bank 2
bit RRAMWRAMBNK2
@ -544,7 +384,6 @@ LDR.SetupQC bit RRAMWRAMBNK2 read/write RAM bank 2
*--------------------------------------
DS1216E.DATA1 .EQ $10
DS1216E.DATA2 .EQ A1L
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
LDR.ClkDevScan php
sei
@ -620,8 +459,8 @@ LDR.ClkDevScan php
lda #'N'
ldx PAKME.NCLK
ldy PAKME.NCLK+1
jmp LDR.SetupCLK
bra LDR.SetupCLK
*--------------------------------------
LDR.ClkDevTCLK lda CLRC8ROM switch out $C8 ROMs
stz idxl
@ -674,87 +513,106 @@ LDR.SetupCLK stx ZPInBufPtr
LDR.SetupCLK.RTS
rts
*--------------------------------------
* find all disk devices in system slots and set up address
* and device table in prodos global page. if there is a disk
* card in slot 2 then limit the # of devices in slot 5
* smartport to only 2
LDR.SetupRAM jsr lc1in
ldx PAKME.RAM
ldy PAKME.RAM+1
stx ZPInBufPtr
sty ZPInBufPtr+1
lda #$FF00
sta ZPOutBufPtr
lda /$FF00
sta ZPOutBufPtr+1
jsr X.Unpak
sta SETWRITEAUX
ldx PAKME.RAMX
ldy PAKME.RAMX+1
stx ZPInBufPtr
sty ZPInBufPtr+1
lda #$0200
sta ZPOutBufPtr
lda /$0200
sta ZPOutBufPtr+1
jsr X.Unpak
sta CLRWRITEAUX
lda #RAMDRV put driver address into
sta drivertbl2+6 slot 3, drive 2.
lda /RAMDRV
sta drivertbl2+7
inc GP.numdevs count (-1) active devices
ldx GP.numdevs
lda #$BF unit num of /RAM
sta devlist,x
ldx #LDR.MSG.RAM
jmp LDR.PrintX
*--------------------------------------
LDR.BlkDevScan stz dst
stz dst+1
stz idxl
ldx #$FF init to no active devices.
stx GP.numdevs count (-1) active devices.
lda #$0E start disk // area at end of devlist.
sta d2idx
* check slot 2. if there is a disk card then clear the msb of diskins2. this
* will limit the # of devices in any slot 5 spartport card to 2.
lda #$C2
sta idxl+1 check slot 2
jsr cmpid is there a disk in slot 2 ?
ror diskins2 if so, clear msb else set it.
* find all disk devices in system slots and set up address
* and device table in prodos global page.
*--------------------------------------
LDR.BlkDevScan stz idxl
lda #$C7 search slots from high to low
sta idxl+1
H26AB jsr cmpid
bcs H270C if no ProDOS device in this slot.
.1 jsr cmpid
bcs .8 if no ProDOS device in this slot.
ldy #$ff
lda (idxl),y check last byte of $Cn rom (y = $ff)
beq diskii branch if 16 sector disk II.
cmp #$FF if = $FF then 13 sector disk II.
bcs H270C ignore if 13 sector boot ROM
sta driveradr else assume it's an intelligent disk.
ldy #$07 check for a smartport device.
lda (idxl),y
bne H26C4 no smartport
jmp smartprt
bne .2 branch if 16 sector disk II.
H26C4 ldy #$FE
lda (idxl),y get attributes.
and #$03 verify it provides read and status calls.
cmp #$03
sec assume it's an off-brand disk
bne H270C
jsr setdevid set up the devid byte from attributes
clc
php remember that it's not a disk //.
lsr move # of units (0=1, 1=2) to carry.
lda idxl+1 store hi entry addr (low already done)
bne H26E6 branch always.
diskii sta devid =0 since disk ii's have null attributes
sec
php remember it's a disk //
sta devid =0 since disk ii's have null attributes
lda #RWTS
sta driveradr
lda /RWTS
sec 2 devices
jsr installdev
bra .8
.2 cmp #$FF if = $FF then 13 sector disk II.
beq .8 ignore if 13 sector boot ROM
ldy #$07 check for a smartport device.
lda (idxl),y
bne .2 no smartport
jsr smartprt
bra .8
.2 ldy #$FE BLK device...
lda (idxl),y get attributes.
and #$03 verify it provides read and status calls.
cmp #$03
bne .7 assume it's an off-brand disk
jsr setdevid set up the devid byte from attributes
clc
php remember that it's not a disk //.
lsr move # of units (0=1, 1=2) to carry.
lda idxl+1 store hi entry addr (low already done)
sta driveradr+1
H26E6 sta driveradr+1
jsr installdev install 1 or 2 devices from this slot.
plp get back if it's a disk // (carry).
bcc nxtdsk2 if not disk //.
dex move the list pointer back by 2 devices
dex
stx GP.numdevs count (-1) active devices
dec d2idx increase the disk two index
dec d2idx
ldy d2idx
inx adj since device count starts with $FF.
lda devlist+1,x get entries for disk //
sta devlist,y move then toward the end of the list
lda devlist,x
sta devlist+1,y
dex back to GP.numdevs again
nxtdsk2 clc
H270C jsr sltrom test for ROM in given slot and set flags
dec idxl+1 next lower slot.
.7 lda idxl+1 mark a bit in slot byte
and #$07 to indicate rom present.
tax
lda sltbit,x
tsb rommap mark bit to flag rom present
.8 dec idxl+1 next lower slot.
lda idxl+1
and #$07 have all slots been checked ?
bne H26AB no.
bne .1
* perform the new device search, mapping unmounted smartport devices
* to empty slots in the device table.
@ -765,10 +623,6 @@ H270C jsr sltrom test for ROM in given slot and set flags
* start by making the device count include disk //'s
ldx GP.numdevs current device count - 1
lda #$0E
sec
sbc d2idx
beq H2747 if there were no disk //'s then done.
clc
adc GP.numdevs sum of disk //'s and others.
@ -782,11 +636,6 @@ H272F lda devlist,y
sta devlist,y
pla
sta devlist,x
inx
dey
sty d2idx use as a temp
cpx d2idx
bcc H272F continue until indexes cross
H2747 ldy #$00
ldx GP.numdevs now change the device order so that
@ -799,6 +648,7 @@ H274C lda devlist,x the boot device will have highest
bne H275A
pla
iny
H275A dex
bpl H274C
@ -829,45 +679,22 @@ stadrv ora devid combine with attributes.
sta devlist,x
asl now form drive 2 device number, if any.
rts
sltrom bcc H27F3 branch if disk drive
* test for any other rom
H27E4 ldx #$00
lda (idxl)
cmp #$FF apple /// non-slot?
beq H2801 invalid rom
H27EC cmp (idxl) look for floating bus
bne H2801 no rom
inx
bne H27EC
H27F3 lda idxl+1 mark a bit in slot byte
and #$07 to indicate rom present.
tax
lda sltbit,x
ora rommap mark bit to flag rom present
sta rommap slot ROM bit map
H2801 rts
* id bytes: evens for clock, odds for disk
dskid .HS 082028005803703C
* slot bits
sltbit .HS 0002040810204080
*--------------------------------------
installdev 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.
jsr stadrv OR in low nibble, store in dev list.
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 devlist,x active device list.
@ -884,11 +711,11 @@ installdev php how many drives (carry).
sta drivertbl2+1,y
.3 rts
*--------------------------------------
* query smartport status to determine # of devices
* and install up to 4 units in table if card is in slot 5
* otherwise only 2 units. this includes a patch #74
*--------------------------------------
smartprt jsr setdevid setup the devid byte from attributes
lda idxl+1
sta driveradr+1
@ -912,18 +739,13 @@ smartprt jsr setdevid setup the devid byte from attributes
lda #$10
sta buf+1 dummy pointer should be <> 0
* do a prodos status call patched in from above
pscall jsr $0000 self modifying code
ldy #$FB
lda (idxl),y check device id
and #$02 SCSI?
beq .1 no, no need to init Cocoon
beq .1 no, no need to init Cocoon
sta statunit device = 2 for SCSI
* initialize SCSI Cocoon to build internal device tables
* and report true # of devices attached
jsr spvect status of Cocoon
.HS 00
.DA spcparms ignore any errors.
@ -941,13 +763,6 @@ pscall jsr $0000 self modifying code
cmp #$C5
bne donesp if not slot 5
* for slot 5, if there is a disk card in slot 2
* then only install 2 devices otherwise map
* extra devices as slot 2
bit diskins2 disk in slot 2 ?
bpl donesp yes - so done
lda numdev2
cmp #$03 carry set if 3,4,...
bcc donesp
@ -959,8 +774,8 @@ pscall jsr $0000 self modifying code
lda #$C5
sta idxl+1
donesp jmp nxtdsk2 it's a disk device.
donesp rts
*--------------------------------------
setdevid ldy #$FE check attributes byte.
lda (idxl),y
@ -970,48 +785,27 @@ setdevid ldy #$FE check attributes byte.
lsr
sta devid
rts
* check unknown card to see if disk id = $Cn00:nn 20 nn 00 nn 03
*--------------------------------------
cmpid lda CLRC8ROM switch out $C8 ROMs
ldy #$05
.1 lda (idxl),y compare id bytes
cmp dskid,y
sec set if no disk card
bne .2
dey
dey
bpl .1 loop until all 4 id bytes match.
bpl .1 loop until all 4 id bytes match.
clc clear if disk card
.2 rts
* smartport call parameters
spcparms .DA #$03 # of parms
statunit .DA #$00 unit number (code for smartport stat)
.DA numdev2
.DA #00 status code (0 = general status)
* indexes into driver table
driveridx .DA #$06
.DA #$1E
.DA #$0E
.DA #$1C
.DA #$0C
.DA #$1A
.DA #$0A
.DA #$14
.DA #$04
.DA #$12
.DA #$02
.DA #$18
.DA #$08
*--------------------------------------
* self modifying jmp = smartport entry address
*--------------------------------------
spvect jmp $0000 self modifying
*--------------------------------------
newmount stz idxl
lda #$C7 start with slot 7 ($C700)
sta idxl+1
@ -1040,15 +834,6 @@ H291F jsr H29EB is there a smartport device here?
inc add 1 for comparisons.
sta driveradr # of devices + 1.
lda #$03 start at unit #3 (non-slot 5)
ldx spvect+2
cpx #$C5 is this slot 5?
bne H295B no, start at 3.
bit diskins2 disk controller in slot 2?
bpl H295B yes, so allow remapping of s5 devices
lda #$05 else start looking at unit #5
* find block devices on this smartport
H295B cmp driveradr have we done all units in this slot?
@ -1070,7 +855,7 @@ H2974 dec idxl+1
cmp #$C0 searched down to slot 0?
bne H291F if not.
rts
*--------------------------------------
mount ldx #$0C
.1 ldy driveridx,x
@ -1138,11 +923,83 @@ H29EB jsr cmpid is it a disk controller?
bne .9 if not.
clc smartport found
.9 rts
*--------------------------------------
LDR.PrintA ldy LDR.Print.CX
and #$7F
cmp #$60
bcs .2
and #$3F
.2 sta $400,y
inc LDR.Print.CX
rts
*--------------------------------------
LDR.PrintX ldy LDR.Print.CX
numdev2 .HS 0000000000000000 8 bytes for smartport call
.1 lda $2000,x
pha
and #$7F
cmp #$60
bcs .2
and #$3F
.2 sta $400,y
inx
iny
pla
bpl .1
* lda #$20
* sta $400,y
iny Add a Space
sty LDR.Print.CX
rts
*--------------------------------------
DS1216E.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
* id bytes: evens for clock, odds for disk
dskid .HS 082028005803703C
sltbit .HS 0002040810204080
*--------------------------------------
LDR.MLIOL.P .DA #2
.DA #$60
.DA pbuf+1
LDR.MLISETP.P .DA #1
.DA pbuf
.DO READCAT=1
LDR.MLIRB.P .DA #3
.DA #0 unit number
.DA 0 2 byte data buffer
.DA 0 2 byte block number
.FIN
spcparms .DA #$03 # of parms
statunit .DA #$00 unit number (code for smartport stat)
.DA numdev2
.DA #00 status code (0 = general status)
driveridx .DA #$06
.DA #$1E
.DA #$0E
.DA #$1C
.DA #$0C
.DA #$1A
.DA #$0A
.DA #$14
.DA #$04
.DA #$12
.DA #$02
.DA #$18
.DA #$08
*--------------------------------------
LDR.Print.CX .BS 1
numdev2 .BS 8 8 bytes for smartport call
driveradr .DA 0
d2idx .DA #0
diskins2 .DA #0 msb clear if drive in slot 2
LDR.cortland .DA #0 cortland loader flag (1 = Cortland)
LDR.BootFlag .DA #0 0 = normal boot, <>0 = return
*--------------------------------------
* 16 bytes moved to $03F0 vectors
*--------------------------------------

View File

@ -169,26 +169,35 @@ cmvauxid iny move auxillary identification bytes
lda d_stor storage type.
and #$E0 is it a directory?
beq cralcblk branch if seed file.
ldx #$1E move header to data block
cmvheadr lda d_stor,x
sta gbuf+4,x
dex
bpl cmvheadr
eor #$30
sta gbuf+4 make it a directory header mark.
ldx #$07 overwrite password area and other
cmvpass lda pass,x header info.
sta gbuf+20,x
lda xdosver,x
sta gbuf+32,x
dex
bpl cmvpass
ldx #$02 and include info about parent directory
stx d_eof+1
cmvparnt lda d_entblk,x
sta gbuf+39,x
dex
bpl cmvparnt
lda h_entln lastly, the length of parent's
sta gbuf+42 directory entries.
cralcblk jsr alc1blk get address of file's data block