Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-04-23 08:02:25 +02:00
parent ed33c792e1
commit 1ebf41f488
10 changed files with 389 additions and 124 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -16,11 +16,11 @@ AUTO 4,1
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPPtrFD .BS 2
ZPPtrDevName .BS 2
Index .BS 1
hDevID .BS 1
hBuf .BS 1
hMem .BS 1
@ -246,8 +246,22 @@ CS.RUN.LL.DISKII
>LDYAI 4096
>SYSCALL GetMem
bcs .9
>STYA ZPPtr1
stx hMem
>STYA ZPPtr1
>STYA ZPPtr2
ldx #16
lda #0
tay
.10 sta (ZPPtr2),y
iny
bne .10
inc ZPPtr2+1
dex
bne .10
stz Index
@ -257,8 +271,11 @@ CS.RUN.LL.DISKII
>SYSCALL PrintF
bcs .9
>PUSHBI $E0 S6D2
>PUSHB Index
>PUSHW ZPPtr1
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2TrkWrite16s
bcs .9
inc Index
lda Index
@ -268,7 +285,14 @@ CS.RUN.LL.DISKII
>PUSHW L.MSG.CRLF
>PUSHBI 0
>SYSCALL PrintF
.9 rts
.9 php
pha
lda hMem
>SYSCALL freemem
pla
plp
rts
*--------------------------------------
CS.RUN.InitCat lda CatSize
bne .1

View File

@ -4,8 +4,9 @@ NEW
*--------------------------------------
LIBBLKDEV.GetProDOSCatSize .EQ 4
LIBBLKDEV.BuildProDOSCat .EQ 6
LIBBLKDEV.D2TrkRead16s .EQ 8
LIBBLKDEV.D2TrkWrite16s .EQ 10
LIBBLKDEV.D2Recalibrate .EQ 8
LIBBLKDEV.D2TrkRead16s .EQ 10
LIBBLKDEV.D2TrkWrite16s .EQ 12
*--------------------------------------
MAN
SAVE INC/LIBBLKDEV.I

View File

@ -33,6 +33,7 @@ Status.seek .EQ $82 target drive seeking
ZPPtr1 .EQ ZPLIB
ZPPtr2 .EQ ZPLIB+2
ZPPtr3 .EQ ZPLIB+4
ZPPtr4 .EQ ZPLIB+6
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -52,9 +53,10 @@ CS.START cld
.DA LIB.UNLOAD
.DA GetProDOSCatSize
.DA BuildProDOSCat
.DA D2Recalibrate
.DA D2TrkRead16s
.DA D2TrkWrite16s
.DA D2TrkRreadNIB
.DA D2TrkReadNIB
.DA D2TrkWriteNIB
L.TrkWriter .DA TrkWriter
L.ProDOS.Boot .DA ProDOS.Boot
@ -287,6 +289,14 @@ BuildProDOSCat >PULLW ZPPtr1 DstBuf
bra .7
*/--------------------------------------
*\--------------------------------------
D2Recalibrate >PULLB DrvSlt
jsr CheckDiskII
bcs .9
.9 rts
*/--------------------------------------
*\--------------------------------------
D2TrkRead16s
*/--------------------------------------
* # D2TrkWrite16s
@ -304,34 +314,22 @@ D2TrkWrite16s >PULLW ZPPtr1
>PULLB TrkNum
>PULLB DrvSlt
>LDYAI TRACK16LEN+1
>SYSCALL getmem
>LDYAI TRACK16.LEN+1
>SYSCALL2 getmem
bcs .9
>STYA ZPPtr2
stx TrkBuf
lda #254
sta VolNum
stz SectNum
ldy #TRACK16.GAP1
lda #$7f
jsr PutSyncBytePtr2
.1 jsr PutBytePtr2
dey
bne .1
lda #$D5
jsr PutBytePtr2
lda #$AA
jsr PutBytePtr2
lda #$96
jsr PutBytePtr2
.1 jsr PutAddrHeadPtr2
jsr HeaderCheckSum
@ -342,6 +340,29 @@ D2TrkWrite16s >PULLW ZPPtr1
dey
bpl .2
jsr PutTailPtr2
ldy #TRACK16.GAP2
jsr PutSyncBytePtr2
jsr PutDataHeadPtr2
jsr PutData
jsr PutTailPtr2
ldy #TRACK16.GAP3
jsr PutSyncBytePtr2
inc ZPPtr1+1
inc SectNum
lda SectNum
cmp #16
bne .1
lda TrkBuf
>SYSCALL2 FreeMem
clc
.9 rts
*/--------------------------------------
@ -391,9 +412,10 @@ D2TrkWriteNIB >PULLB DrvSlt
lda DrvSlt
jsr DrvTrkSelect
bcs .9
ldy #TrkWriter.Size
clc
* clc
.9 rts
*--------------------------------------
SetStatusAndExit
@ -420,15 +442,21 @@ CheckDiskII and #$70 only 0SSS
ora #$C0 make Cn
sta .2+2
ldx #3 4 bytes to check
.1 ldy DiskII.OFS,x
.2 lda $C000,y Self Modified
cmp DiskII.SIG,x
bne .9
dex
bpl .1
clc all bytes match, Disk II
rts
.9 sec
.9 lda #MLI.E.NODEV
sec
rts
*--------------------------------------
* A=DSSS0000
@ -441,20 +469,15 @@ DrvSpinCheck jsr DrvSelect
bne .8 spinning
dey
bne .1
clc CC:not spinning
rts
.8 sec
rts
*--------------------------------------
* A=DSSS0000
*--------------------------------------
HeaderCheckSum lda VolNum
eor TrkNum
eor SectNum
sta Checksum
rts
*--------------------------------------
DrvSelect pha
and #$70
tax
@ -468,6 +491,117 @@ DrvSelect pha
lda IO.D2.ReadMode,x Make sure readmode
rts
*--------------------------------------
PutSyncBytePtr2 lda #$7f
.1 jsr PutBytePtr2
dey
bne .1
rts
*--------------------------------------
PutAddrHeadPtr2 ldy #2
.1 lda ADDR.Head,y
jsr PutBytePtr2
dey
bpl .1
rts
*--------------------------------------
PutDataHeadPtr2 ldy #2
.1 lda DATA.Head,y
jsr PutBytePtr2
dey
bpl .1
rts
*--------------------------------------
PutTailPtr2 ldy #2
.1 lda TAIL,y
jsr PutBytePtr2
dey
bpl .1
rts
*--------------------------------------
HeaderCheckSum lda VolNum
eor TrkNum
eor SectNum
sta Checksum
rts
*--------------------------------------
PutData stz Checksum
lda ZPPtr1
ldy ZPPtr1+1
clc
adc #86
bcc .1
iny
clc
.1 sta ZPPtr3
sty ZPPtr3+1
adc #86
bcc .2
iny
.2 sta ZPPtr4
sty ZPPtr4+1
ldy #85
.3 lda (ZPPtr1),y
and #3
tax
lda XRW.XX000000,x
pha
lda (ZPPtr3),y
and #3
tax
pla
ora XRW.00XX0000,x
pha
lda (ZPPtr4),y
and #3
tax
pla
ora XRW.0000XX00,x
eor Checksum
sta Checksum
tax
lda FC2Nib,x
jsr PutBytePtr2
dey
bpl .3
ldy #0
.4 lda (ZPPtr3),y
and #$FC
eor Checksum
sta Checksum
tax
lda FC2Nib,x
jsr PutBytePtr2
iny
bne .4
ldx Checksum
lda FC2Nib,x
jsr PutBytePtr2
rts
*--------------------------------------
PutByte44Ptr2 pha
rol
jsr .1
@ -476,11 +610,13 @@ PutByte44Ptr2 pha
.1 ora #$AA
*--------------------------------------
PutBytePtr2 sta ZPPtr2
PutBytePtr2 sta (ZPPtr2)
inc ZPPtr2
bne .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
*--------------------------------------
CS.END
*--------------------------------------
@ -549,6 +685,113 @@ TrkWriter.Start lda IO.D2.ReadMode,x
TrkWriter.Size .EQ *-TrkWriter.Start
.EP
*--------------------------------------
ADDR.Head .HS 96AAD5
DATA.Head .HS ADAAD5
TAIL .HS EBAADE
*--------------------------------------
Nib2FC .HS 0004
.HS FFFF
.HS 080C
.HS FF
.HS 101418
XRW.XX000000 .HS 008040C0FFFF used in fast prenib as lookup for 2-bit quantities.
.HS 1C20
.HS FFFFFF
.HS 24282C3034
.HS FFFF
.HS 383C4044484C
.HS FF
.HS 5054585C606468
XRW.00XX0000 .HS 00201030 used in fast prenib.
endmrks .HS DEAAEB table using 'unused' nibbles ($C4,$C5,$C6,$C7)
.HS FFFFFFFF
.HS 6C
.HS FF
.HS 707478
.HS FFFFFF
.HS 7C
.HS FFFF
.HS 8084
.HS FF
.HS 888C9094989CA0
XRW.0000XX00 .HS 0008040C used in fast prenib.
.HS FF
.HS A4A8AC
.HS FF
.HS B0B4B8BCC0C4C8
.HS FFFF
.HS CCD0D4D8DCE0
.HS FF
.HS E4E8ECF0F4F8FC
*--------------------------------------
dnibl2 .HS 00
dnibl3 .HS 00
dnibl4 .HS 00
FC2Nib .HS 96
.HS 02000097
.HS 0100009A
.HS 0300009B
.HS 0002009D
.HS 0202009E
.HS 0102009F
.HS 030200A6
.HS 000100A7
.HS 020100AB
.HS 010100AC
.HS 030100AD
.HS 000300AE
.HS 020300AF
.HS 010300B2
.HS 030300B3
.HS 000002B4
.HS 020002B5
.HS 010002B6
.HS 030002B7
.HS 000202B9
.HS 020202BA
.HS 010202BB
.HS 030202BC
.HS 000102BD
.HS 020102BE
.HS 010102BF
.HS 030102CB
.HS 000302CD
.HS 020302CE
.HS 010302CF
.HS 030302D3
.HS 000001D6
.HS 020001D7
.HS 010001D9
.HS 030001DA
.HS 000201DB
.HS 020201DC
.HS 010201DD
.HS 030201DE
.HS 000101DF
.HS 020101E5
.HS 010101E6
.HS 030101E7
.HS 000301E9
.HS 020301EA
.HS 010301EB
.HS 030301EC
.HS 000003ED
.HS 020003EE
.HS 010003EF
.HS 030003F2
.HS 000203F3
.HS 020203F4
.HS 010203F5
.HS 030203F6
.HS 000103F7
.HS 020103F9
.HS 010103FA
.HS 030103FB
.HS 000303FC
.HS 020303FD
.HS 010303FE
.HS 030303FF
*--------------------------------------
LC.BitMap .HS 80402010080402018040201008040201
*--------------------------------------
ProDOS.Boot .HS 01.38.b0.03.4c.32.a1.86.43.c9.03.08.8a.29.70.4a

View File

@ -131,14 +131,15 @@ XDOS.devmgr php do not allow interrupts.
inx else account for 3-page straddle
.2 jsr vldbuf1 make sure user buffer is not
bcs dvmgrerr conflicting with protected ram.
bcs .9 conflicting with protected ram.
jsr dmgr call internal entry for device dispatch
bcs dvmgrerr branch if error
bcs .9 branch if error
plp
clc no error
rts
dvmgrerr plp restore interrupt status
.9 plp restore interrupt status
gosyserr jsr GP.P8errv
*--------------------------------------
dmgr lda unitnum get device # and
@ -148,7 +149,7 @@ dmgr lda unitnum get device # and
lsr
lsr
tax
gocmd jmp (DEVPTRS,x) goto driver (or error if no driver)
jmp (DEVPTRS,x) goto driver (or error if no driver)
*--------------------------------------
* ProDOS interrupt manager
*--------------------------------------

View File

@ -4,6 +4,17 @@ NEW
XRW.START cld $D8 to flag language card bank 1 (main)
lda unitnum get unit number.
pha
lsr
lsr
lsr
lsr
sta XRW.UnitIndex
pla
and #$7F mask off high bit.
sta A2L 0SSS0000 for IO indexing
@ -88,7 +99,7 @@ L59BD jsr XRW.AllPhaseOff make sure all motor phases are off.
* read/write a track/sector
regrwts ldy #$01 retry count
sty seekcnt only one recalibrate per call
sty XRW.Recalibrate only one recalibrate per call
sta XRW.ReqSector
* now check if the motor is on, then start it
@ -156,46 +167,46 @@ L538E lda A4L get command #
jsr XRW.PreNibble
L5398 ldy #$40 64 retries
sty retrycnt
L5398 ldy #64
sty XRW.RetryCnt
L539D jsr XRW.ReadAddr read next address field.
bcc L53BE branch if read ok.
L53A4 dec retrycnt one less chance.
L53A4 dec XRW.RetryCnt one less chance.
bpl L539D branch to retry.
lda #MLI.E.IO anticipate a bad drive error.
dec seekcnt can only recalibrate once.
dec XRW.Recalibrate can only recalibrate once.
bne hndlerr
lda curtrk
lda XRW.CurrentTrack
pha save track
asl
asl
adc #32 pretend track is 8 > curtrk
ldy #$40
sty retrycnt reset retries to 64 max.
ldy #64
sty XRW.RetryCnt reset retries to 64 max.
bra L53CC always.
* have now read an address field. make sure this is
* the correct track, sector and volume.
L53BE ldy XRW.AddrField.T
cpy curtrk
cpy XRW.CurrentTrack
beq L53D5 ok
* recalibrating from this track
lda curtrk preserve destination track
lda XRW.CurrentTrack preserve destination track
pha
tya
asl
asl
L53CC jsr XRW.GetUnitIdx get index to drive #
sta XRW.LastTrackPos,y set the slot dependent track location
L53CC ldy XRW.UnitIndex get index to drive #
sta XDOS.SPUnit-1,y set the slot dependent track location
pla
jsr XRW.Seek
@ -235,16 +246,6 @@ L53FD ldx A2L
lda IO.D2.RData,x keep in read mode
bra statdne
*--------------------------------------
XRW.GetUnitIdx pha preserve acc across call
lda unitnum DSSS0000
lsr
lsr
lsr
lsr
tay 0000DSSS index to table.
pla restore acc
rts
*--------------------------------------
* determine if motor is stopped
*
* if stopped, controller's shift register will not be changing.
@ -315,21 +316,21 @@ L5912 sta prn1+1 self mod 1
prn1 lda $1000,y warning: self modified. get byte from lowest group.
and #$03 strip high 6 bits.
tax index to 2 bit equivalent.
lda twobit1,x
lda XRW.0000XX00,x
pha save pattern
prn2 lda $1056,y warning: self modified. get byte from middle group.
and #$03
tax
pla restore pattern.
ora twobit2,x combine 2nd group with 1st.
ora XRW.00XX0000,x combine 2nd group with 1st.
pha save new pattern.
prn3 lda $10AC,y warning: self modified. get byte from highest group.
and #$03
tax
pla restore new pattern
ora twobit3,x and form final nibl.
ora XRW.XX000000,x and form final nibl.
pha
tya
@ -533,7 +534,7 @@ wrefd5 ldx #$60 (2) restore slot. warning: modified by prenib
nop (2)
nop (2)
L58D3 lda endmrks,y (4) dm4, dm5, dm6 and turn off byte.
L58D3 lda XRW.EndDataMark,y (4) dm4, dm5, dm6 and turn off byte.
jsr wnibl (15,6) write it
iny (2)
cpy #$04 (2) have all end marks been written ?
@ -739,15 +740,15 @@ L57CD pla place last byte into user buffer
* observe 'no page cross' warnings on some branches !!!
*--------------------------------------
XRW.ReadAddr ldy #$FC
sty countn 'must find' count
sty XRW.CheckSum init nibble counter to $FCFC
ldx A2L get slot #
L569D iny
bne L56A5 low order of count.
bne L56A5 counter LO
inc countn (2k nibles to find address mark
beq rderr else error)
inc XRW.CheckSum counter HI
beq rderr
L56A5 lda IO.D2.RData,x read nibl
bpl L56A5 *** no page cross ***
@ -771,23 +772,23 @@ L56BA lda IO.D2.RData,x
cmp #$96 address mark 3 ?
bne L56AA if not, is it address mark 1
sei no interrupts until address is tested.
sei ???ALREADY DONE by XDOS.devmgr??? no interrupts until address is tested.
lda #$00 init checksum
L56C6 sta csum
L56C6 sta XRW.CheckSum
L56C9 lda IO.D2.RData,x read 'odd bit' nibl
bpl L56C9 *** no page cross ***
rol align odd bits, '1' into lsb.
sta last save them.
sta XRW.Temp4x4 save them.
L56D2 lda IO.D2.RData,x read 'even bit' nibl
bpl L56D2 *** no page cross ***
and last merge odd and even bits.
sta XRW.AddrField,y store data byte.
eor csum
and XRW.Temp4x4 merge odd and even bits.
sta XRW.AddrField.C,y store data byte.
eor XRW.CheckSum
dey
bpl L56C6 loop on 4 data bytes.
@ -819,43 +820,43 @@ XRW.FREE1 .EQ $D4AA-* (2.0.3 = $02)
.LIST OFF
.BS $D4AA-*
*--------------------------------------
* nibl buffer 'nbuf2' must be at $xxAA
* nibl buffer 'nbuf2' must fit in a page
*--------------------------------------
nbuf2 .BS $56 nibl buffer for read/write of low 2-bits of each byte.
*--------------------------------------
* fast seek subroutine
* A = desired track
* curtrk = current 1/4 track
* XRW.CurrentTrack = current 1/4 track
*
* montimel,h are incremented by the # of 100us quantums required by seek for motor on time overlap.
* variables used: curtrk, A2L, montimel, montimeh
* variables used: XRW.CurrentTrack, A2L, montimel, montimeh
*--------------------------------------
XRW.Seek asl transform into 1/4 tracks
asl
pha
jsr XRW.GetUnitIdx get index to previous track
lda XRW.LastTrackPos,y for current drive.
ldy XRW.UnitIndex get index to previous track
lda XDOS.SPUnit-1,y for current drive.
sta curtrk current position.
sta XRW.CurrentTrack current position.
pla
sta XRW.LastTrackPos,y
sta XDOS.SPUnit-1,y
.1 lda XRW.LastTrackPos,y
.1 lda XDOS.SPUnit-1,y
sec
sbc curtrk
sbc XRW.CurrentTrack
beq .8
bcc .2
cmp #3 A>curtrk, must move in
cmp #2 A>curtrk, must move in
bcc .3
lda #3
lda #2
bra .3
.2 cmp #$fe A<curtrk, must move out
@ -868,8 +869,8 @@ XRW.Seek asl transform into 1/4 tracks
.3 tax save move direction
clc
adc curtrk
sta curtrk
adc XRW.CurrentTrack
sta XRW.CurrentTrack
jsr XRW.PhaseOn
@ -880,8 +881,8 @@ XRW.Seek asl transform into 1/4 tracks
bra .1
.8 lsr curtrk convert back to track#
lsr curtrk
.8 lsr XRW.CurrentTrack convert back to track#
lsr XRW.CurrentTrack
rts
XRW.PhaseOn dex
@ -917,28 +918,6 @@ XRW.AllPhaseOff ldx A2L
lda IO.D2.Ph2Off,x
lda IO.D2.Ph3Off,x
rts
*--------------------------------------
XRW.LastTrackPos .EQ *
curtrk .HS 00 (D0S0)
.HS 00000000000000 for slots 1 thru 7 drive 1
csum .HS 00 (D1S0) used for address header cksum
.HS 00000000000000 for slots 1 thru 7 drive 2
*--------------------------------------
XRW.ReqTrack .HS 00
XRW.ReqSector .HS 00
ibstat .HS 00
XRW.LastUnitUsed .HS 00
retrycnt .HS 00
seekcnt .HS 00
countn .EQ * 'must find' count.
last .HS 00 'odd bit' nibls.
XRW.AddrField .HS 00 AddrField Checksum
XRW.AddrField.S .HS 00 AddrField Sector
XRW.AddrField.T .EQ * AddrField Track
montimel .HS 00
XRW.AddrField.V .EQ * AddrField Volume
montimeh .HS 00
*--------------------------------------
.LIST ON
XRW.FREE2 .EQ $D596-*
@ -955,31 +934,48 @@ XRW.FREE2 .EQ $D596-*
* aligned to page boundary + $96
*--------------------------------------
XRW.Nib2FC .HS 0004
.HS FFFF
* .HS FFFF
XRW.UnitIndex .HS 00
XRW.LastUnitUsed .HS 00
.HS 080C
.HS FF
* .HS FF
XRW.Recalibrate .HS 00
.HS 101418
twobit3 .HS 008040C0FFFF used in fast prenib as lookup for 2-bit quantities.
XRW.XX000000 .HS 008040C0 used in fast prenib as lookup for 2-bit quantities.
* .HS FFFF
montimel .HS 00
montimeh .HS 00
.HS 1C20
.HS FFFFFF
.HS 24282C3034
.HS FFFF
* .HS FFFF
XRW.ReqTrack .HS 00
XRW.ReqSector .HS 00
.HS 383C4044484C
.HS FF
* .HS FF
XRW.CurrentTrack .HS 00
.HS 5054585C606468
twobit2 .HS 00201030 used in fast prenib.
endmrks .HS DEAAEB table using 'unused' nibbles ($C4,$C5,$C6,$C7)
.HS FFFFFFFF
XRW.00XX0000 .HS 00201030 used in fast prenib.
XRW.EndDataMark .HS DEAAEB table using 'unused' nibbles ($C4,$C5,$C6,$C7)
* .HS FFFFFFFF
XRW.AddrField.C .HS 00 AddrField Checksum
XRW.AddrField.S .HS 00 AddrField Sector
XRW.AddrField.T .HS 00 AddrField Track
XRW.AddrField.V .HS 00 AddrField Volume
.HS 6C
.HS FF
* .HS FF
ibstat .HS 00
.HS 707478
.HS FFFFFF
.HS 7C
.HS FFFF
* .HS FFFF
XRW.Temp4x4 .HS 00
XRW.CheckSum .HS 00 used for address header cksum
.HS 8084
.HS FF
* .HS FF
XRW.RetryCnt .HS 00
.HS 888C9094989CA0
twobit1 .HS 0008040C used in fast prenib.
XRW.0000XX00 .HS 0008040C used in fast prenib.
.HS FF
.HS A4A8AC
.HS FF