Kernel 0.94

This commit is contained in:
Rémy GIBERT
2020-09-17 17:29:41 +02:00
parent 9f6b280b9f
commit e552a07365
8 changed files with 98 additions and 115 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -118,10 +118,7 @@ scperr lda #MLI.E.BADCNT
*-------------------------------------- *--------------------------------------
* ProDOS Device Manager * ProDOS Device Manager
*-------------------------------------- *--------------------------------------
XDOS.devmgr php do not allow interrupts. XDOS.devmgr ldy #$05 the call spec for devices must
sei the call spec for devices must
ldy #$05
.1 lda (A3L),y be passed to drivers in page zero: .1 lda (A3L),y be passed to drivers in page zero:
sta A4L,y sta A4L,y
@@ -138,24 +135,38 @@ XDOS.devmgr php do not allow interrupts.
inx else account for 3-page straddle inx else account for 3-page straddle
.2 jsr vldbuf1 make sure user buffer is not .2 jsr vldbuf1 make sure user buffer is not
bcs .9 conflicting with protected ram. bcs gosyserr conflicting with protected ram.
jsr dmgr call internal entry for device dispatch jsr XDOS.DevCall call internal entry for device dispatch
bcs .9 branch if error bcc XDOS.DevCall.RTS
plp
clc no error
rts
.9 plp restore interrupt status
gosyserr jsr GP.P8errv gosyserr jsr GP.P8errv
*-------------------------------------- *--------------------------------------
dmgr lda unitnum get device # and XDOS.DevCall php do not allow interrupts.
sei
lda unitnum get device # and
and #$F0 strip misc lower nibble and #$F0 strip misc lower nibble
sta unitnum then save it. sta unitnum then save it.
lsr use as index to device table lsr use as index to device table
lsr lsr
lsr lsr
tax tax
jsr XDOS.DevCall.Jmp
bcs .9
plp
clc
rts
.9 plp
sec
XDOS.DevCall.RTS
rts
XDOS.DevCall.Jmp
jmp (DEVPTRS,x) goto driver (or error if no driver) jmp (DEVPTRS,x) goto driver (or error if no driver)
*-------------------------------------- *--------------------------------------
* ProDOS interrupt manager * ProDOS interrupt manager
@@ -751,11 +762,11 @@ swpbloks lda bloknml,x prepare new directory block
sta bloknml,x and save new block as next to be written sta bloknml,x and save new block as next to be written
dex dex
bpl swpbloks bpl swpbloks
inx
txa x and a = 0
clrdir sta gbuf+2,x inx x = 0
sta gbuf+$100,x
clrdir stz gbuf+2,x
stz gbuf+$100,x
inx inx
bne clrdir bne clrdir
@@ -768,11 +779,13 @@ clrdir sta gbuf+2,x
lda own_blk lda own_blk
ldx own_blk+1 ldx own_blk+1
.DO LOWERCASE=1 .DO LOWERCASE=1
jsr XDOS.ReadGBufAXDir jsr XDOS.ReadGBufAXDir
.ELSE .ELSE
jsr XDOS.ReadGBufAX read in parent directory block jsr XDOS.ReadGBufAX read in parent directory block
.FIN .FIN
ldx own_ent and calc entry address. ldx own_ent and calc entry address.
lda /gbuf lda /gbuf
sta zpt+1 sta zpt+1

View File

@@ -460,6 +460,7 @@ L39F4 cmp loklst,x of prospective devices.
dex look until found. dex look until found.
bpl L39F4 always taken (usually) unless bpl L39F4 always taken (usually) unless
bmi L39ED if dev was removed from devlst (/RAM). bmi L39ED if dev was removed from devlst (/RAM).
L39FE sta devnum preserve device to be checked next. L39FE sta devnum preserve device to be checked next.

View File

@@ -264,9 +264,7 @@ XDOS.WriteGBuf lda #$02 write command
sta A4L pass to device handler. sta A4L pass to device handler.
lda /gbuf general buffer. lda /gbuf general buffer.
XDOS.RWBlock php no interrupts XDOS.RWBlock sta buf+1 buffer high.
sei
sta buf+1 buffer high.
stz buf buffer low (always on page boundary) stz buf buffer low (always on page boundary)
stz p8error clear global error code. stz p8error clear global error code.
@@ -276,16 +274,7 @@ XDOS.RWBlock php no interrupts
lda devnum transfer dev # for dispatcher to lda devnum transfer dev # for dispatcher to
sta unitnum convert to unit #. sta unitnum convert to unit #.
jsr dmgr call the driver. jmp XDOS.DevCall call the driver.
bcs .9 if error.
plp restore interrupts.
clc
rts
.9 plp file i/o error. restore interrupts.
sec
rts
*-------------------------------------- *--------------------------------------
.DO LOWERCASE=1 .DO LOWERCASE=1
@@ -489,7 +478,7 @@ L3E50 ldy #$A4 clear illegal filetype entry in fcb
L3E59 lda FCBs+FCB.STYPE,y use storage type as # of index levels L3E59 lda FCBs+FCB.STYPE,y use storage type as # of index levels
sta levels since 1=seed, 2=sapling, 3=tree. sta levels since 1=seed, 2=sapling, 3=tree.
lda FCBs+FCB.F,y lda FCBs+FCB.F,y
and #$40 if previous data was modified then and #FCB.F.DBLKMOD if previous data was modified then
beq L3E6B disk must be updated. beq L3E6B disk must be updated.
jsr wfcbdat jsr wfcbdat
@@ -671,13 +660,13 @@ L3F68 lda FCBs+FCB.MARK,y save old mark in case calling routine
adc datptr+1 adc datptr+1
sta sos+1 sta sos+1
L3F86 rts carry set if error L3F86 rts carry set if error
*--------------------------------------
clrstats ldy fcbptr clear allocation states for data block clrstats ldy fcbptr clear allocation states for data block
lda FCBs+FCB.F,y and both levels of indexes/ lda FCBs+FCB.F,y and both levels of indexes/
and #$F8 and #$F8
sta FCBs+FCB.F,y indicates that either they exist now sta FCBs+FCB.F,y indicates that either they exist now
rts or unnecessary for current position. rts or unnecessary for current position.
*--------------------------------------
dirmark cmp #$0D is it a directory ? dirmark cmp #$0D is it a directory ?
beq L3F9C yes... beq L3F9C yes...
@@ -754,7 +743,7 @@ rfcbidx lda #$01 prepare to read index block : read command
* clc * clc
L400C rts L400C rts
*--------------------------------------
wfcbfst jsr upbmap update the bitmap and write file's 1st block. wfcbfst jsr upbmap update the bitmap and write file's 1st block.
lda #$02 write command lda #$02 write command
@@ -783,10 +772,7 @@ dofileio sta A4L command
L4031 lda FCBs+FCB.DEVID,y high address of disk block L4031 lda FCBs+FCB.DEVID,y high address of disk block
sta bloknml+1 sta bloknml+1
fileio1 php no interrupts fileio1 lda $00,x get memory address of buffer from
sei
lda $00,x get memory address of buffer from
sta buf page zero pointed to by x register sta buf page zero pointed to by x register
lda $01,x lda $01,x
sta buf+1 and pass address to device handler sta buf+1 and pass address to device handler
@@ -798,17 +784,8 @@ fileio1 php no interrupts
lda devnum transfer device # for dispatcher lda devnum transfer device # for dispatcher
sta unitnum to convert to unit #. sta unitnum to convert to unit #.
stz p8error clear global error code. stz p8error clear global error code.
jsr dmgr call the driver. jmp XDOS.DevCall call the driver.
bcs L405E if error. *--------------------------------------
plp restore interrupts
clc
rts
L405E plp restore interrupts
sec
rts
wfcbdat ldx #datptr point at memory address with x and wfcbdat ldx #datptr point at memory address with x and
lda #$10 disk address with y. lda #$10 disk address with y.
ora fcbptr add offset to fcbptr ora fcbptr add offset to fcbptr
@@ -938,15 +915,15 @@ L413C sta tposll,y
bcc L4163 if successful. bcc L4163 if successful.
L4147 pha save error code. L4147 pha save error code.
ldy fcbptr free buffer space.
lda FCBs+FCB.BUFID,y ldx fcbptr free buffer space.
lda FCBs+FCB.BUFID,x
beq L4156 if no bufnum, ok because never alloc'd. beq L4156 if no bufnum, ok because never alloc'd.
jsr relbuffr go release buffer. jsr relbuffr go release buffer.
ldy fcbptr since error was before file was ldx fcbptr
L4156 lda #$00 successfully opened, then it is L4156 stz FCBs,x necessary to release fcb also.
sta FCBs,y necessary to release fcb also.
pla error code. pla error code.
sec sec
rts rts

View File

@@ -119,17 +119,11 @@ L429C dec zpt+1
lda ioaccess has 1st call gone to device yet ? lda ioaccess has 1st call gone to device yet ?
beq L4249 no, go thru normal route beq L4249 no, go thru normal route
php interrupts can't occur during dmgr call
sei
lda datptr+1 reset hi buffer address for dev handler lda datptr+1 reset hi buffer address for dev handler
sta buf+1 sta buf+1
jsr dmgr jsr XDOS.DevCall
bcs L42B6 if error bcc L424E no errors, branch always.
plp
bra L424E no errors, branch always.
L42B6 plp restore interrupts.
L42B7 pha save error code. L42B7 pha save error code.
jsr fxdatptr go restore data pointers, etc. jsr fxdatptr go restore data pointers, etc.
pla pla
@@ -166,6 +160,7 @@ L42E9 lda FCBs+FCB.NLMASK,y test for new line enabled.
sta nlmask sta nlmask
lda FCBs+FCB.NLBYTE,y move newline character to more lda FCBs+FCB.NLBYTE,y move newline character to more
sta nlchar accesible spot. sta nlchar accesible spot.
L42F9 ldy tposll index to 1st data. L42F9 ldy tposll index to 1st data.
lda datptr reset low order of position pointer to lda datptr reset low order of position pointer to
sta sos beginning of page. sta sos beginning of page.
@@ -231,6 +226,7 @@ L4350 iny adjust position.
inc tposhi inc tposhi
L435D bit setvflg (sets v flag) L435D bit setvflg (sets v flag)
L4360 sty tposll save low position L4360 sty tposll save low position
bvs L4366 bvs L4366
@@ -536,13 +532,16 @@ L4539 iny and position
bne L4546 bne L4546
inc tposhi inc tposhi
L4546 bit setvflg set v flag L4546 bit setvflg set v flag
L4549 sty tposll save low position L4549 sty tposll save low position
stx rwreql and remainder of request count. stx rwreql and remainder of request count.
php save statuses php save statuses
jsr gfcbstat
ora #$50 lda #$50
sta FCBs+FCB.F,y jsr XDOS.SetFCBStatus
clc adjust user's low buffer address clc adjust user's low buffer address
lda tposll lda tposll
adc usrbuf adc usrbuf
@@ -600,9 +599,9 @@ sapdown jsr gfcbstyp find out if dealing with a tree.
bcc L457A if no error. bcc L457A if no error.
L45B1 rts return errors. L45B1 rts return errors.
*--------------------------------------
swapdown jsr alcwblk make current seed into a sapling, allocate a block before swap. swapdown jsr alcwblk make current seed into a sapling, allocate a block before swap.
bcs L45F6 return errors. bcs .9 return errors.
ldy fcbptr get previous first block ldy fcbptr get previous first block
lda FCBs+FCB.1stBLK,y address into index block. lda FCBs+FCB.1stBLK,y address into index block.
@@ -624,47 +623,38 @@ swapdown jsr alcwblk make current seed into a sapling, allocate a block befo
pla pla
sta (zpt) sta (zpt)
jsr wfcbfst save new file top. jsr wfcbfst save new file top.
bcs L45F6 if error. bcs .9 if error.
jsr gfcbstyp now adjust storage type by adding 1 lda #FCB.F.STMOD
* adc #$01 (seed becomes sapling becomes tree) jsr XDOS.SetFCBStatus
inc
sta FCBs+FCB.STYPE,y
lda FCBs+FCB.F,y mark storage type modified
ora #FCB.F.STMOD
sta FCBs+FCB.F,y
clc no error inc FCBs+FCB.STYPE,x
L45F6 rts
* clc no error
.9 rts
*--------------------------------------
alcwblk jsr alc1blk alcwblk jsr alc1blk
bcs L4616 bcs .9
jsr gfcbstat mark usage as modified lda #FCB.F.UMOD
jsr XDOS.SetFCBStatus
ora #FCB.F.UMOD inc FCBs+FCB.UBLK,x
sta FCBs+FCB.F,y bne .9
lda FCBs+FCB.UBLK,y inc current usage count by 1
inc
sta FCBs+FCB.UBLK,y
bne L4615
lda FCBs+FCB.UBLK+1,y inc FCBs+FCB.UBLK+1,x
inc
sta FCBs+FCB.UBLK+1,y
L4615 clc no error
L4616 rts
.9 rts
*--------------------------------------
tstwprot jsr gfcbstat check for 'never been modified' condition tstwprot jsr gfcbstat check for 'never been modified' condition
and #$F0 and #$F0
bne L4615 ordinary rts if known write ok. bne tstwprot.8 ordinary rts if known write ok.
lda FCBs+FCB.DEVID,y get file's dev #. lda FCBs+FCB.DEVID,y get file's dev #.
sta devnum get current status of block device. sta devnum get current status of block device.
twrprot1 sta unitnum make the device status call twrprot1 sta unitnum make the device status call
lda bloknml+1 lda bloknml+1
pha pha
lda bloknml save the current block values lda bloknml save the current block values
@@ -673,26 +663,20 @@ twrprot1 sta unitnum make the device status call
stz bloknml zero the block # stz bloknml zero the block #
stz bloknml+1 stz bloknml+1
php jsr XDOS.DevCall
sei
jsr dmgr
bcs .1 branch if write protect error bcs .1 branch if write protect error
lda #$00 otherwise, assume no errors. lda #$00 otherwise, assume no errors.
.1 plp restore interrupt status .1 plx
clc stx bloknml restore the block #
tax save error. plx
beq .2 branch if no error stx bloknml+1
sec else, set carry to show error. rts
.2 pla tstwprot.8 clc
sta bloknml restore the block # rts
pla
sta bloknml+1
txa
rts carry is indeterminate.
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE usr/src/prodos.fx/prodos.s.xdos.d SAVE usr/src/prodos.fx/prodos.s.xdos.d

View File

@@ -45,9 +45,10 @@ close2 ldy fcbptr
bcs L46B6 bcs L46B6
lda #$00 lda #$00
ldy fcbptr ldx fcbptr
sta FCBs,y free fcb too stz FCBs,x free fcb too
lda FCBs+FCB.DEVID,y
lda FCBs+FCB.DEVID,x
sta devnum go look for associated vcb sta devnum go look for associated vcb
jsr XDOS.FindVCBForDevNum get vcb pointer. jsr XDOS.FindVCBForDevNum get vcb pointer.
@@ -190,10 +191,9 @@ L4780 lda FCBs+FCB.STYPE-2,y the last thing to update is storage
jsr drevise go update directory. jsr drevise go update directory.
bcs glberr error. bcs glberr error.
ldy fcbptr mark ldx fcbptr mark
lda FCBs+FCB.DIRTY,y fcb/directory stz FCBs+FCB.DIRTY,x fcb/directory as undirty.
and #$7F as
sta FCBs+FCB.DIRTY,y undirty.
lda d_dev see if bitmap should be written. lda d_dev see if bitmap should be written.
cmp bmadev is it in same as current file ? cmp bmadev is it in same as current file ?
bne L47B2 yes, put it on the disk if necessary. bne L47B2 yes, put it on the disk if necessary.
@@ -228,6 +228,12 @@ L47CA lda #MLI.E.LOCKED access error
sec sec
L47CD rts L47CD rts
*-------------------------------------- *--------------------------------------
XDOS.SetFCBStatus
ldx fcbptr
ora FCBs+FCB.F,x
sta FCBs+FCB.F,x
rts
*--------------------------------------
XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed. XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed.
cmp #$04 tree type ? cmp #$04 tree type ?
bcs L47CA if not then access error bcs L47CA if not then access error
@@ -363,6 +369,7 @@ L48A2 ldy fcbptr also must pass file's 1st block address.
jsr detree deallocate blocks from tree. jsr detree deallocate blocks from tree.
php save any error status until fcb php save any error status until fcb
pha is cleaned up. pha is cleaned up.
sec sec
ldy fcbptr ldy fcbptr
ldx #$00 ldx #$00

View File

@@ -147,8 +147,8 @@ fcbused pha mark fcb as dirty so the directory will be flushed on 'flush
tya save regs. tya save regs.
pha pha
ldy fcbptr ldy fcbptr
lda FCBs+FCB.DIRTY,y fetch current fcb dirty byte.
ora #$80 mark fcb as dirty. lda #$80 mark fcb as dirty.
sta FCBs+FCB.DIRTY,y save it back sta FCBs+FCB.DIRTY,y save it back
pla and restore regs. pla and restore regs.
tay tay
@@ -513,6 +513,7 @@ freebuf ldx bufaddrh get hi buffer address
inx inx
inx inx
inx inx
L4E43 dex drop to next lower page. L4E43 dex drop to next lower page.
jsr cmembit get bit and position to memtable of jsr cmembit get bit and position to memtable of
eor #$FF this page. invert mask. eor #$FF this page. invert mask.