Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-11-09 13:19:41 +01:00
parent 851f76d9e9
commit 0c85d576b9
10 changed files with 199 additions and 183 deletions

Binary file not shown.

View File

@ -86,7 +86,7 @@ DEVPTRS3D2 .EQ $BF26
*DEVPTRS6D2 .EQ $BF2C
*DEVPTRS7D2 .EQ $BF2E
DEVNUM .EQ $BF30
DEVCNT .EQ $BF31
DEVCNT .EQ $BF31 0 -> 13
DEVLST .EQ $BF32 -> $BF3F
*DEVLST0END .EQ $BF40 A 0 was added to ensure list ended with 0 if 14 devices in list
*PRODOSCOPYRIGHT .EQ $BF41 ;free->$BF4B

View File

@ -4,11 +4,10 @@ NEW
GP.START jmp GP.MLIENTRY $2E00-2EFF moved to $BF00
jspare jmp * will be changed to point to dispatcher.
clockv rts changed to jmp ($4C) if clock present.
.DA tclk_in clock routine entry address.
.DA $D742 clock routine entry address.
GP.P8errv jmp XDOS.syserr error reporting hook.
sysdeath jmp sysdeath1 system failure hook.
p8error .DA #0
drivertbl1 .DA nodevice
.DA nodevice
.DA nodevice
.DA nodevice
@ -16,7 +15,6 @@ drivertbl1 .DA nodevice
.DA nodevice
.DA nodevice
.DA nodevice
drivertbl2 .DA nodevice
.DA nodevice
.DA nodevice
.DA nodevice
@ -24,9 +22,11 @@ drivertbl2 .DA nodevice
.DA nodevice
.DA nodevice
.DA nodevice
.DA #0 devnum
GP.numdevs .DA #$ff count (-1) active devices
devlist .HS 00000000000000 up to 14 units may be active
.DA nodevice
.DA nodevice
.DA #0 DEVNUM
.DA #$ff DEVCNT : count (-1) active devices
.HS 00000000000000 DEVLST : up to 14 units may be active
.HS 00000000000000
.DA #0
*--------------------------------------
@ -50,7 +50,7 @@ GP.FREE1 .EQ $BF58-*
* protected pages = 1, unprotected = 0
*--------------------------------------
memmap .HS C000000000000000
.HS C000000000000000 MEMTABL
.HS 0000000000000000
.HS 0000000000000001
*--------------------------------------

View File

@ -185,7 +185,8 @@ m128k sta idapple Save MACHID in temp location
ldx #0
.1 stz $D700,x
.1
* stz $D700,x
stz $D800,x
stz $D900,x
stz $DA00,x
@ -205,8 +206,8 @@ m128k sta idapple Save MACHID in temp location
sta ZPOutBufPtr+1
jsr X.Unpak
ldx #XDOS.DATA.LEN
ldx #XDOS.DATA.LEN0
.3 stz XDOS.DATA-1,x
dex
bne .3
@ -513,7 +514,7 @@ LDR.SetupCLK stx ZPInBufPtr
LDR.SetupCLK.RTS
rts
*--------------------------------------
LDR.SetupRAM lda GP.numdevs
LDR.SetupRAM lda DEVCNT
cmp #13
bcs LDR.SetupCLK.RTS
@ -550,10 +551,10 @@ LDR.SetupRAM lda GP.numdevs
lda /RAMDRV
sta DEVPTRS3D2+1
inc GP.numdevs count (-1) active devices
ldx GP.numdevs
inc DEVCNT count (-1) active devices
ldx DEVCNT
lda #$BF unit num of /RAM
sta devlist,x
sta DEVLST,x
ldx #LDR.MSG.RAM
jmp LDR.PrintX
@ -568,7 +569,8 @@ LDR.BlkDevScan stz idxl
lda #7
sta LDR.SlotIdx
.1 jsr LDR.CheckDiskID
.1 lda LDR.SlotIdx
jsr LDR.CheckDiskID
bcs .8 if no ProDOS device in this slot.
ldy #$ff
@ -610,7 +612,7 @@ LDR.BlkDevScan stz idxl
and #$3 Device count minus 1
inc
ldx LDR.SlotIdx
sta LDR.DevCnt-1,x
sta LDR.SlotDevCnt-1,x
tax
iny $CnFF
@ -631,25 +633,29 @@ LDR.BlkDevScan stz idxl
bne .1
*--------------------------------------
LDR.AddExtraDevs
stz idxl
lda #$C7
sta idxl+1
lda #7
sta LDR.SlotIdx
.1 ldx LDR.SlotIdx
lda LDR.DevCnt-1,x
lda LDR.SlotDevCnt-1,x
cmp #3
bcc .8
ldy LDR.DevType-1,x
ldy LDR.SlotDevType-1,x
bne .2
jsr LDR.AddExtraBlkDev
jsr LDR.AddExtraBlkDevs
bra .8
.2 jsr LDR.AddExtraSPDevs
.8 dec LDR.SlotIdx
bne .1
LDR.AddExtraDevs.RTS
rts
*--------------------------------------
LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
@ -658,7 +664,7 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
lda (idxl),y
sta driveradr
sta pscall+1 modify operand
sta .1+1 modify operand
clc
adc #$03
sta spvect+1
@ -666,7 +672,7 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
lda idxl+1
sta driveradr+1
sta spvect+2
sta pscall+2 modify operand
sta .1+2 modify operand
asl convert $Cn to $n0
asl
@ -683,12 +689,12 @@ LDR.AddSPDevs jsr LDR.SetDevID setup the devid byte from attributes
stz bloknml # of bytes to transfer
stz bloknml+1
pscall jsr $0000 self modifying code
.1 jsr $0000 SELF MODIFIED
ldy #$FB
lda (idxl),y check device id
and #$02 SCSI?
beq .1 no, no need to init Cocoon
beq .2 no, no need to init Cocoon
sta LDR.SPStatus.U device = 2 for SCSI
@ -696,39 +702,39 @@ pscall jsr $0000 self modifying code
.HS 00
.DA LDR.SPStatus.P ignore any errors.
.1 stz LDR.SPStatus.U set unit# = 0
.2 stz LDR.SPStatus.U set unit# = 0
jsr spvect call to get the device count.
.HS 00 this is a status call
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf
beq .8 no devices, so done.
beq LDR.AddExtraDevs.RTS no devices, so done.
ldx LDR.SlotIdx
inc LDR.DevType-1,x set as smartport
sta LDR.DevCnt
.2 inc LDR.SPStatus.U
ldx LDR.SlotIdx
inc LDR.SlotDevType-1,x set as smartport
.3 inc LDR.SPStatus.U
jsr spvect call to get the device status
.HS 00 this is a status call
.DA LDR.SPStatus.P
bcs .7 no more device
bcs .7
lda LDR.SPStatus.Buf
bpl .2 not a block device
bpl .7 not a block device
ldx LDR.SlotIdx
inc LDR.DevCnt-1,x
bra .2
inc LDR.SlotDevCnt-1,x
.7 ldx LDR.SlotIdx
lda LDR.DevCnt-1,x
beq .8
cmp #2 add 1 or 2 devs
jmp LDR.AddBlkDevs
.7 dec LDR.DevCnt
bne .3
.8 rts
ldx LDR.SlotIdx
lda LDR.SlotDevCnt-1,x
beq LDR.AddBlkDevs.RTS
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
@ -741,9 +747,9 @@ LDR.AddBlkDevs php how many drives (carry).
asl in high nibble.
ora devid combine with attributes.
ldx GP.numdevs
ldx DEVCNT
inx put device # into device list.
sta devlist,x
sta DEVLST,x
asl now form drive 2 device number, if any.
plp restore # of devices in carry.
@ -751,29 +757,28 @@ LDR.AddBlkDevs php how many drives (carry).
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.
sta DEVLST,x active device list.
.1 stx GP.numdevs save updated device count.
.1 stx DEVCNT save updated device count.
asl shift # of drives back into carry.
lda driveradr get high address of device driver.
sta drivertbl1,y device driver table 1.
sta DEVPTRS,y device driver table 1.
bcc .2 branch if single drive.
sta drivertbl2,y device driver table 2.
sta DEVPTRS+16,y device driver table 2.
.2 lda driveradr+1
sta drivertbl1+1,y
sta DEVPTRS+1,y
bcc .3
sta drivertbl2+1,y
sta DEVPTRS+17,y
.3 rts
.3
LDR.AddBlkDevs.RTS
rts
*--------------------------------------
LDR.AddExtraBlkDev
LDR.AddExtraBlkDevs
rts
*--------------------------------------
LDR.AddExtraSPDevs
rts
ldy #$FF get smartport address.
lda (idxl),y
clc
@ -790,59 +795,55 @@ LDR.AddExtraSPDevs
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf # of devices on smartport
cmp #$03
bcc .8 only 2 devices,skip to next one.
inc add 1 for comparisons.
sta driveradr # of devices + 1.
* find block devices on this smartport
dec
dec
sta LDR.DevCnt
.1 cmp driveradr have we done all units in this slot?
bcs .8 yes, skip to next slot.
lda #3
sta LDR.SPStatus.U
sta LDR.SPStatus.U store the unit#.
jsr spvect do status call
.1 jsr spvect do status call
.HS 00
.DA LDR.SPStatus.P
lda LDR.SPStatus.Buf is this a block device?
bpl .2
jsr LDR.MountSPDevs
bcs .8
.2 lda LDR.SPStatus.U go check the next unit#
inc
bra .1
.2 inc LDR.SPStatus.U
dec LDR.DevCnt
bne .1
.8 rts
*--------------------------------------
LDR.FindFree dec Drive 0-1
asl
asl
asl
tay
LDR.MountSPDevs ldx #LDR.DEVPTRS.CNT-1
ldx #$0C
.1 ldy driveridx,x
lda drivertbl1,y device driver table 1
.1 ldy LDR.DEVPTRS.IDX,x
lda DEVPTRS,y device driver table 1
cmp #nodevice
bne .2
lda drivertbl1+1,y
lda DEVPTRS+1,y
cmp /nodevice
beq .8
beq .3
.2 dex
bpl .1
clc
.8 rts ran out of space for devices, exit.
*--------------------------------------
LDR.MountSPDevs jsr lc1in write enable LC ram bank 1.
tya divide index by 2
sec
rts
.3 jsr lc1in write enable LC ram bank 1.
tya divide index by 2
lsr
tax
lda LDR.SPStatus.U
sta spunit-1,x store the smartport unit #
@ -854,28 +855,22 @@ LDR.MountSPDevs jsr lc1in write enable LC ram bank 1.
lda RROMBNK2 write protect lc ram.
inc GP.numdevs
ldx GP.numdevs
inc DEVCNT
ldx DEVCNT
tya
lsr
cmp #$08
bcc .4 drive 2 mount
sbc #$08
ora #$08
.4 asl
asl
asl convert to DSSS0000
asl
asl
ora devid include device attributes
sta devlist,x in the active device list.
sta DEVLST,x in the active device list.
lda #remap_sp
sta drivertbl1,y device driver table 1
lda /remap_sp
sta drivertbl1+1,y
lda #XDOS.SPREMAP
sta DEVPTRS,y device driver table 1
lda /XDOS.SPREMAP
sta DEVPTRS+1,y
clc
rts
*--------------------------------------
* self modifying jmp = smartport entry address
@ -963,27 +958,31 @@ LDR.SPStatus.U .DA #$00 unit number (code for smartport stat)
.DA LDR.SPStatus.Buf
.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.DEVPTRS.CNT .EQ 14
LDR.DEVPTRS.IDX .DA #$16 S3D2
.DA #$06 S3D1
.DA #$1E S7D2
.DA #$0E S7D1
.DA #$1C S6D2
.DA #$0C S6D1
.DA #$1A S5D2
.DA #$0A S5D1
.DA #$14 S2D2
.DA #$04 S2D1
.DA #$12 S1D2
.DA #$02 S1D1
.DA #$18 S4D2
.DA #$08 S4D1
*--------------------------------------
LDR.Print.CX .BS 1
*--------------------------------------
LDR.SPStatus.Buf .BS 8 8 bytes for smartport call
driveradr .BS 2
LDR.SlotIdx .BS 1
LDR.DevCnt .BS 7
LDR.DevType .BS 7
LDR.DevCnt .BS 1
LDR.SlotDevCnt .BS 7
LDR.SlotDevType .BS 7
LDR.cortland .DA #0 cortland loader flag (1 = Cortland)
LDR.BootFlag .DA #0 0 = normal boot, <>0 = return
*--------------------------------------

View File

@ -16,27 +16,27 @@ birdbye cld
* set up memory bitmap in global page
L5D16 stz memmap,x P8 memory bitmap
L5D16 stz MEMTABL,x P8 memory bitmap
dex
bpl L5D16
inc memmap+$17 protect global page
inc MEMTABL+$17 protect global page
lda #$CF protect zero page, stack and page 1
sta memmap
sta MEMTABL
lda #$02
sta smparms init set mark parms pcount.
* drive selector
ldx GP.numdevs get device count and
ldx DEVCNT get device count and
stx lstpntr store in zero page.
lda devnum get last slot/drive
bne volname
ds2 ldx lstpntr get device list pointer.
lda devlist,x get unit number from list.
lda DEVLST,x get unit number from list.
cpx #$01 make sure it's real.
bcs L5D3F if so, change list pointer.
ldx GP.numdevs get device count.
ldx DEVCNT get device count.
inx
L5D3F dex decrement list pointer and restore.
stx lstpntr

View File

@ -146,7 +146,7 @@ dmgr lda unitnum get device # and
lsr
lsr
tax
gocmd jmp (drivertbl1,x) goto driver (or error if no driver)
gocmd jmp (DEVPTRS,x) goto driver (or error if no driver)
*--------------------------------------
* ProDOS interrupt manager
*--------------------------------------

View File

@ -621,7 +621,7 @@ L39D4 lda vnptr make path ptr same as volume ptr
jsr mvdevnums copy all device #'s to be examined.
lda devnum log current device 1st before searching
bne L39F1 others.
L39E2 ldx GP.numdevs scan look list for devices we need
L39E2 ldx DEVCNT scan look list for devices we need
L39E5 lda loklst,x to search for the requested volume.
bne L39F4 branch if we've a device to look at.
dex
@ -630,7 +630,7 @@ L39ED lda #MLI.E.VNOTFND no mounted volume
sec error
L39F0 rts
L39F1 ldx GP.numdevs now remove the device from the list
L39F1 ldx DEVCNT now remove the device from the list
L39F4 cmp loklst,x of prospective devices.
beq L39FE branch if match.
dex look until found.
@ -654,13 +654,13 @@ L3A16 lda #$02 go read root dir into gbuf
jsr cmppnam is this the volume ?
bcs L39E2 if not
L3A29 rts
mvdevnums ldx GP.numdevs copy all dev #'s to be checked.
L3A2D lda devlist,x active device list.
mvdevnums ldx DEVCNT copy all dev #'s to be checked.
L3A2D lda DEVLST,x active device list.
and #$F0 strip device type info.
sta loklst,x copy them to a temp workspace
dex
bpl L3A2D
ldx GP.numdevs
ldx DEVCNT
rts
fnddvcb lda #$00 look for vcb with this device#
ldy #$FF

View File

@ -362,7 +362,7 @@ alcbufr1 lda (A3L),y this buffer must be on a page boundary.
inx
L4DED dex test for conflicts.
jsr cmembit test for free buffer space
and memmap,y P8 memory bitmap
and MEMTABL,y P8 memory bitmap
bne L4E1E report memory conflict, if any.
cpx datptr+1 test all 4 pages.
bne L4DED
@ -372,8 +372,8 @@ L4DED dex test for conflicts.
inx
L4DFE dex set proper bits to 1
jsr cmembit
ora memmap,y to mark it's allocation.
sta memmap,y
ora MEMTABL,y to mark it's allocation.
sta MEMTABL,y
cpx datptr+1 set all 4 pages
bne L4DFE
ldy fcbptr calculate buffer number
@ -409,8 +409,8 @@ freebuf ldx bufaddrh get hi buffer address
L4E43 dex drop to next lower page.
jsr cmembit get bit and position to memtable of
eor #$FF this page. invert mask.
and memmap,y mark address as free space.
sta memmap,y
and MEMTABL,y mark address as free space.
sta MEMTABL,y
cpx bufaddrh all pages freed ?
bne L4E43 no.
L4E54 clc no error.
@ -450,7 +450,7 @@ L4E76 clc
inx loop thru all affected pages.
vldbuf1 dex check next lower page.
jsr cmembit
and memmap,y if 0 then no conflict.
and MEMTABL,y if 0 then no conflict.
bne L4E1E branch if conflict.
cpx usrbuf+1 was that the last (lowest) page ?
bne vldbuf1 if not.
@ -486,11 +486,10 @@ L4EB8 lda (usrbuf),y move all 4 pages of the buffer to
bpl L4EB8
clc no errors
L4EC7 rts
*--------------------------------------
* move 3 pages of dispatcher from 'displc2' to 'dispadr'
* this move routine must be resident above $E000 at all times
*--------------------------------------
calldisp lda RRAMWRAMBNK2 read/write RAM bank 2
lda RRAMWRAMBNK2
@ -527,14 +526,11 @@ calldisp lda RRAMWRAMBNK2 read/write RAM bank 2
sta pwredup power up byte
jmp $1000
* translate a prodos call into a smartport call
* to access unseen smartport devices
remap_sp ldx #$03 assume 3 parameters.
*--------------------------------------
XDOS.SPREMAP ldx #$03 assume 3 parameters.
lda A4L command number
sta cmdnum
bne L4F1B taken if not status call
bne .1 taken if not status call
ldy #spstatlist set up memory for the status list buffer
sty buf fake up the prodos parameters
@ -542,55 +538,66 @@ remap_sp ldx #$03 assume 3 parameters.
sty buf+1
stz bloknml set statcode = 0 for simple status call
L4F1B cmp #$03 format command ?
bne L4F21 no.
.1 cmp #$03 format command ?
bne .2 no.
ldx #$01 format has only 1 parameter.
L4F21 stx statparms set # of parms.
lda unitnum
.2 stx statparms set # of parms.
lda unitnum DSSS0000
lsr turn unit number into an index
lsr
lsr
lsr
tax
tax range = 1-15
lda spunit-1,x get the smartport unit number and
sta sp_unitnum store into smartport parm list.
lda spvectlo-1,x
sta sp_vector+1 copy smartport entry address
lda spvecthi-1,x
sta sp_vector+2
ldx #$04 copy buffer pointer and block #
L4F3F lda buf-1,x from prodos parameters
.3 lda buf-1,x from prodos parameters
sta sp_bufptr-1,x to smartport parameter block
dex
bne L4F3F
bne .3
sp_vector jsr $0000 smartport call (entry address gets modified)
cmdnum .HS 00 command #
.DA statparms
bcs L4F6E
bcs .9
ldx cmdnum status call ?
bne L4F6E no...
bne .9 no...
ldx spstatlist+1 else get the block count
ldy spstatlist+2
lda spstatlist get the returned status.
bit #$10 is there a disk present ?
bne L4F65 yes, check for write protected.
lda #$2F return offline error.
bra L4F6D
L4F65 and #$44 mask all but write allowed and write
eor #$40 protected bits. if allowed and not
beq L4F6E protected, exit with carry clear
lda #$2B else return write protected error.
L4F6D sec
L4F6E rts
beq .8
and #$44 mask all but write allowed and write
eor #$40 protected bits. if allowed and not
* clc
beq .9 protected, exit with carry clear
lda #MLI.E.WRTPROT else return write protected error.
.HS 2C BIT ABS
.8 lda #MLI.E.OFFLINE return offline error.
sec
.9 rts
*--------------------------------------
statparms .HS 03 # of parms (always 3 except format)
sp_unitnum .HS 00 unit number
sp_bufptr .HS 0000 data buffer
.HS 000000 block number (3 bytes)
*--------------------------------------
* data tables
*--------------------------------------
scnums .HS D3000000 table of valid mli command numbers.
.HS 40410000808182
.HS 65C0C1C2C3C4C5C6
@ -601,9 +608,6 @@ pcntbl .HS 02FFFFFF parameter counts for the calls
.HS 04070102070A0201
.HS 0103030404010102
.HS 02FF020202
* command table
cmdtable .DA create
.DA destroy
.DA rename
@ -646,7 +650,7 @@ inftabl .HS 1E101F2080939421
deathmsg .HS 20
.AS -"RESTART SYSTEM-$01"
.HS 20
*--------------------------------------
XDOS.DATA .DUMMY
* note: this area is accessed by code that depends on the order of these
@ -669,8 +673,9 @@ d_dev .HS 00 device number of this directory entry
d_head .HS 0000 address of <sub> directory header
d_entblk .HS 0000 address of block which contains entry
d_entnum .HS 00 entry number within block
d_stor .HS 0000000000000000 file name
.HS 0000000000000000
d_stor .BS 16 file name
d_filid .HS 00 user's identification byte
d_frst .HS 0000 first block of file
d_usage .HS 0000 # of blocks allocated to this file
@ -757,24 +762,36 @@ bufaddrl .HS 00
bufaddrh .HS 00
delflag .HS 00 used by 'detree' to know if called from delete (destroy).
pathbuf .BS 64+2
.LIST ON
XDOS.DATA.LEN0 .EQ *-XDOS.DATA
.LIST OFF
* variables used by mli for smartport interface
spstatlist .HS 00000000
spunit .HS 0000000000000000
.HS 0000000000000000
spunit .HS 00000000000000 14+1 for S0D2
.HS 00
.HS 00000000000000
spvectlo .HS 00000000000000 storage for low byte of smartport entry.
.HS 00
.HS 00000000000000
spvecthi .HS 00000000000000 storage for high byte of smartport entry.
.HS 00
.HS 00000000000000
spvectlo .HS 0000000000000000 storage for low byte of smartport entry.
.HS 00000000000000
spvecthi .HS 0000000000000000 storage for high byte of smartport entry.
.HS 00000000000000
.LIST ON
XDOS.DATA.LEN .EQ *-XDOS.DATA
.LIST OFF
.ED
* zero fill to page boundary - 3 ($FEFD). so that cortland flag stays within page boundary.
.LIST ON
XDOS.FREE .EQ $FEFD-*-XDOS.DATA.LEN (ProDOS 2.0.3 = $0C)
XDOS.FREE .EQ $FEFD-*-XDOS.DATA.LEN (2.0.3 = $0C)
.LIST OFF
cortdisp .EQ $FEFD
cortflag .EQ $FEFF cortland flag. 1 = Cortland system (must stay within page boundary)

View File

@ -954,9 +954,12 @@ docheck lda A4L command #.
rts end of obj xrw_0
.LIST ON
XRW.FREE .EQ $D700-* (ProDOS 2.0.3 = $02)
XRW.FREE1 .EQ $D742-* (2.0.3 = $02)
.LIST OFF
.LIST ON
XRW.FREE2 .EQ $d800-$D742-125
.LIST OFF
.BS XRW.FREE
*--------------------------------------
XRW.LEN .EQ *-XRW.START
MAN

View File

@ -140,12 +140,9 @@ q6h .EQ $C08D disk port
q7l .EQ $C08E disk port
q7h .EQ $C08F disk port
auxmove .EQ $C311 move (3C)-(3E) to (42)
xfer .EQ $C314
rwts .EQ $D000 disk ii driver in bank 1
pathbuf .EQ $D700 pathname buffer
tclk_in .EQ $D742 clock driver in bank 2
fcbbuf .EQ $D800 fcb buffer
vcbbuf .EQ $D900 vcb buffer
bmbuf .EQ $DA00 512 byte bitmap buffer