mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-08 17:37:52 +00:00
Kernel 0.94
This commit is contained in:
parent
548facfad6
commit
b037d5d042
BIN
.Floppies/A2OSX.BLANK.REF.woz
Normal file
BIN
.Floppies/A2OSX.BLANK.REF.woz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
161
BIN/FORMAT.S.txt
161
BIN/FORMAT.S.txt
@ -22,9 +22,11 @@ ZPPtrDevName .BS 2
|
||||
|
||||
Index .BS 1
|
||||
hDevID .BS 1
|
||||
DrvSlt0 .BS 1
|
||||
hCatBuf .BS 1
|
||||
hMem .BS 1
|
||||
hTrackBuf .BS 1
|
||||
DSSS0000 .BS 1
|
||||
CurTrack .BS 1
|
||||
CurQTrack .BS 1
|
||||
|
||||
bLL .BS 1
|
||||
bCustomBlkSize .BS 1
|
||||
@ -229,23 +231,8 @@ CS.RUN.GetDevStatus
|
||||
*--------------------------------------
|
||||
CS.RUN.LL >LDA.G DIB+S.DIB.T
|
||||
cmp #S.DIB.T.DISKII
|
||||
beq CS.RUN.LL.DISKII
|
||||
|
||||
>PUSHW L.MSG.LL
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>PUSHB hDevID
|
||||
>PUSHBI IOCTL.FORMAT
|
||||
>PUSHEA.G IOCTL
|
||||
|
||||
>SYSCALL IOCTL
|
||||
|
||||
.9
|
||||
CS.RUN.LL.RTS rts
|
||||
*--------------------------------------
|
||||
CS.RUN.LL.DISKII
|
||||
bne .1
|
||||
|
||||
ldy #S.FD.DEV.BUSID
|
||||
lda (ZPPtrFD),y 00000SSS
|
||||
|
||||
@ -262,24 +249,109 @@ CS.RUN.LL.DISKII
|
||||
ror in C
|
||||
pla
|
||||
ror
|
||||
sta DrvSlt0 DSSS0000
|
||||
sta DSSS0000
|
||||
|
||||
bra CS.RUN.LL.DISKII
|
||||
|
||||
.1 >PUSHW L.MSG.LL
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>PUSHB hDevID
|
||||
>PUSHBI IOCTL.FORMAT
|
||||
>PUSHEA.G IOCTL
|
||||
|
||||
>SYSCALL IOCTL
|
||||
|
||||
.9
|
||||
CS.RUN.LL.RTS rts
|
||||
*--------------------------------------
|
||||
CS.RUN.LL.DISKII
|
||||
>LDYAI 4096
|
||||
>SYSCALL GetMem
|
||||
bcs CS.RUN.LL.RTS
|
||||
|
||||
stx hMem
|
||||
stx hTrackBuf
|
||||
>STYA ZPPtr1
|
||||
>STYA ZPPtr2
|
||||
>STYA.G IOCTL+S.IOCTL.BUFPTR
|
||||
|
||||
>PUSHB hDevID
|
||||
>PUSHBI IOCTL.READBLOCK
|
||||
>PUSHEA.G IOCTL
|
||||
jsr CS.RUN.MotorOn
|
||||
bcs .9
|
||||
|
||||
>SYSCALL IOCTL Read Block 0 to recalibrate
|
||||
>SLEEP
|
||||
|
||||
ldx #16
|
||||
jsr CS.RUN.ZeroPtr1 16 sectors filled with 0, give some time to spin up
|
||||
|
||||
stz CurTrack
|
||||
|
||||
lda #160
|
||||
sta CurQTrack
|
||||
|
||||
ldx #0
|
||||
jsr CS.RUN.SeekToX
|
||||
|
||||
.1 >SLEEP
|
||||
|
||||
>PUSHW L.MSG.LLDISK2
|
||||
>PUSHB CurTrack
|
||||
>PUSHBI 1
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>PUSHB DSSS0000
|
||||
>PUSHBI 254 VOL
|
||||
>PUSHB CurTrack
|
||||
>PUSHW ZPPtr1
|
||||
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2TrkWrite16s
|
||||
bcs .9
|
||||
|
||||
inc CurTrack
|
||||
|
||||
lda CurQTrack
|
||||
* clc
|
||||
adc #4
|
||||
cmp #140
|
||||
beq .8
|
||||
|
||||
tax
|
||||
|
||||
jsr CS.RUN.SeekToX
|
||||
bcc .1
|
||||
|
||||
.9 rts
|
||||
|
||||
.8 ldx #0
|
||||
jsr CS.RUN.SeekToX
|
||||
|
||||
jsr CS.RUN.MotorOff
|
||||
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.MotorOn sec
|
||||
.HS 90 BCC
|
||||
CS.RUN.MotorOff clc
|
||||
>PUSHB DSSS0000
|
||||
ror
|
||||
>PUSHA
|
||||
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2MotorControl
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.SeekToX >PUSHB DSSS0000
|
||||
>PUSHB CurQTrack
|
||||
txa
|
||||
sta CurQTrack
|
||||
>PUSHA
|
||||
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2MoveHead
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ZeroPtr1 >LDYA ZPPtr1
|
||||
>STYA ZPPtr2
|
||||
|
||||
lda #0
|
||||
tay
|
||||
|
||||
@ -291,36 +363,7 @@ CS.RUN.LL.DISKII
|
||||
dex
|
||||
bne .10
|
||||
|
||||
stz Index
|
||||
|
||||
.1 >PUSHW L.MSG.LLDISK2
|
||||
>PUSHB Index
|
||||
>PUSHBI 1
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>PUSHB DrvSlt0
|
||||
>PUSHB Index
|
||||
>PUSHW ZPPtr1
|
||||
>LIBCALL hLIBBLKDEV,LIBBLKDEV.D2TrkWrite16s
|
||||
bcs .9
|
||||
|
||||
inc Index
|
||||
lda Index
|
||||
cmp #35
|
||||
bne .1
|
||||
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
.9 php
|
||||
pha
|
||||
lda hMem
|
||||
>SYSCALL freemem
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.InitCat lda CatSize
|
||||
bne .1
|
||||
@ -418,7 +461,7 @@ CS.QUIT lda hCatBuf
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.1 lda hMem
|
||||
.1 lda hTrackBuf
|
||||
beq .2
|
||||
|
||||
>SYSCALL FreeMem
|
||||
@ -463,7 +506,7 @@ MSG.ERR .AS "[%h]"
|
||||
MSG.CRLF .AZ "\r\n"
|
||||
MSG.NOSIZE .AZ "Unable to get media size."
|
||||
MSG.INIT .AZ "Formatting %s (%D Blks), Volname:%s\r\n"
|
||||
MSG.LLDISK2 .AZ "\rTrack %02d..."
|
||||
MSG.LLDISK2 .AZ "\rWriting Track %02d..."
|
||||
MSG.LL .AZ "\rLow Level Format..."
|
||||
MSG.WRITECAT .AZ "Writing Catalog..."
|
||||
FMT.BLANK .AZ "BLANK%H%H"
|
||||
|
@ -18,9 +18,9 @@ IO.D2.DrvSel1 .EQ $C08A
|
||||
IO.D2.DrvSel2 .EQ $C08B
|
||||
|
||||
IO.D2.WShift .EQ $C08C R
|
||||
IO.D2.WLoad .EQ $C08D W
|
||||
|
||||
IO.D2.RData .EQ $C08C R
|
||||
|
||||
IO.D2.WLoad .EQ $C08D W
|
||||
IO.D2.ReadProt .EQ $C08D R
|
||||
|
||||
IO.D2.ReadMode .EQ $C08E R
|
||||
|
@ -4,9 +4,10 @@ NEW
|
||||
*--------------------------------------
|
||||
LIBBLKDEV.GetProDOSCatSize .EQ 4
|
||||
LIBBLKDEV.BuildProDOSCat .EQ 6
|
||||
LIBBLKDEV.D2MoveHead .EQ 8
|
||||
LIBBLKDEV.D2TrkRead16s .EQ 10
|
||||
LIBBLKDEV.D2TrkWrite16s .EQ 12
|
||||
LIBBLKDEV.D2MotorControl .EQ 8
|
||||
LIBBLKDEV.D2MoveHead .EQ 10
|
||||
LIBBLKDEV.D2TrkRead16s .EQ 12
|
||||
LIBBLKDEV.D2TrkWrite16s .EQ 14
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE INC/LIBBLKDEV.I
|
||||
|
@ -8,27 +8,32 @@ NEW
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
.INB INC/MLI.I
|
||||
.INB INC/MLI.E.I
|
||||
.INB INC/IO.D2.I
|
||||
*--------------------------------------
|
||||
TRACK16.LEN .EQ $19F8 (6648) bytes
|
||||
TRACK16.LEN .EQ 6400
|
||||
*--------------------------------------
|
||||
TRACK16.GAP1 .EQ 64+8
|
||||
*Address field = D5AA96 + 4x2 + DEAAEB = 14
|
||||
TRACK16.GAP2 .EQ 6
|
||||
*Data field = D5AAAD + 342 + CS + DEAAEB = 349
|
||||
TRACK16.GAP3 .EQ 42
|
||||
TRACK16.GAP1 .EQ 64 640 bits
|
||||
* 16 * (
|
||||
*Address field = D5AA96 + 4x2 + DEAAEB = 14 112 bits
|
||||
TRACK16.GAP2 .EQ 6 60 bits
|
||||
*Data field = D5AAAD + 342 + CS + DEAAEB = 349 2792 bits
|
||||
*TRACK16.GAP3 .EQ 27 270 bits
|
||||
TRACK16.GAP3 .EQ 26 270 bits
|
||||
* )
|
||||
* 64 + 16 * (14 + 6 + 349 + 27) = 6400 52384 bits (6548)
|
||||
*--------------------------------------
|
||||
TRACK9.LEN .EQ $19F8 (6648) bytes
|
||||
TRACK9.LEN .EQ 6511
|
||||
*--------------------------------------
|
||||
TRACK9.GAP1 .EQ 51
|
||||
*Address field = D5AA96 + 4x2 + DEAAEB = 14
|
||||
TRACK9.GAP2 .EQ 6
|
||||
*Data field = D5AAAD + 342 + 342 + CS + DEAAEB = 691
|
||||
TRACK9.GAP3 .EQ 42
|
||||
*--------------------------------------
|
||||
Status.PrvDrvOff .EQ $80 Waiting old drive stop spinning
|
||||
Status.DrvOn .EQ $81 Waiting target drive spin
|
||||
Status.seek .EQ $82 target drive seeking
|
||||
TRACK9.GAP1 .EQ 8+14 220 bits
|
||||
* 9 * (
|
||||
*Address field = D5AA96 + 4x2 + DEAAEB = 14 112 bits
|
||||
TRACK9.GAP2 .EQ 5 50 bits
|
||||
*Data field = D5AAAD + 342 + 342 + CS = 688 5504 bits
|
||||
TRACK9.GAP3 .EQ 14 140 bits
|
||||
* )
|
||||
* 9 * (14 + 5 + 688) = 6363 50904 bits (1480 free = 148 sync bytes)
|
||||
* 22 + 9 * (14 + 5 + 688 + 14) = 6511 52384 bits (6548)
|
||||
*--------------------------------------
|
||||
ZPPtr1 .EQ ZPLIB
|
||||
ZPPtr2 .EQ ZPLIB+2
|
||||
@ -53,6 +58,7 @@ CS.START cld
|
||||
.DA LIB.UNLOAD
|
||||
.DA GetProDOSCatSize
|
||||
.DA BuildProDOSCat
|
||||
.DA D2MotorControl
|
||||
.DA D2MoveHead
|
||||
.DA D2TrkRead16s
|
||||
.DA D2TrkWrite16s
|
||||
@ -289,14 +295,111 @@ BuildProDOSCat >PULLW ZPPtr1 DstBuf
|
||||
bra .7
|
||||
*/--------------------------------------
|
||||
*\--------------------------------------
|
||||
D2MotorControl >PULLB MotorOn
|
||||
>PULLB DrvSlt
|
||||
jsr CheckDiskII
|
||||
bcs .9
|
||||
|
||||
lda MotorOn
|
||||
asl
|
||||
|
||||
lda #0
|
||||
adc #IO.D2.DrvOff
|
||||
adc Slotn0
|
||||
tax
|
||||
lda $C000,x
|
||||
|
||||
* clc
|
||||
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
*\--------------------------------------
|
||||
D2MoveHead >PULLB MoveTo
|
||||
>PULLB MoveFrom
|
||||
>PULLB DrvSlt
|
||||
jsr CheckDiskII
|
||||
bcs .9
|
||||
|
||||
.1 lda MoveTo
|
||||
|
||||
sec
|
||||
sbc MoveFrom
|
||||
beq .8
|
||||
|
||||
bcc .2
|
||||
|
||||
cmp #2 A>curtrk, must move in
|
||||
bcc .3
|
||||
|
||||
lda #2
|
||||
bra .3
|
||||
|
||||
.2 cmp #$fe A<curtrk, must move out
|
||||
bcs .3
|
||||
|
||||
lda #$fe
|
||||
|
||||
.3 bit #1 remember 1/4 or 2/4
|
||||
php
|
||||
clc
|
||||
adc MoveFrom
|
||||
sta MoveFrom
|
||||
|
||||
jsr XRW.PhaseOn
|
||||
|
||||
lda #28
|
||||
plp
|
||||
beq .4
|
||||
|
||||
lsr only 1/4
|
||||
|
||||
.4 jsr XRW.Wait100msA Trash X
|
||||
|
||||
jsr XRW.AllPhaseOff
|
||||
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
XRW.PhaseOn pha
|
||||
jsr .7
|
||||
pla
|
||||
|
||||
bit #1 1,3,5,7 ?
|
||||
beq .8
|
||||
|
||||
inc
|
||||
|
||||
.7 and #6 mask for 0,2,4,6
|
||||
ora Slotn0
|
||||
tax
|
||||
lda IO.D2.Ph0On,x turn on one phase
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
XRW.AllPhaseOff ldx Slotn0
|
||||
lda IO.D2.Ph0Off,x make sure all motor phases are off.
|
||||
lda IO.D2.Ph1Off,x
|
||||
lda IO.D2.Ph2Off,x
|
||||
lda IO.D2.Ph3Off,x
|
||||
rts
|
||||
*--------------------------------------
|
||||
XRW.Wait100msA
|
||||
.1 ldx #$11 delay 86 usec
|
||||
|
||||
.2 dex
|
||||
bne .2
|
||||
|
||||
inc montimel
|
||||
bne .3
|
||||
|
||||
inc montimeh
|
||||
|
||||
.3 sec
|
||||
sbc #$01
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*/--------------------------------------
|
||||
*\--------------------------------------
|
||||
D2TrkRead16s
|
||||
@ -314,17 +417,18 @@ D2TrkRead16s
|
||||
*\--------------------------------------
|
||||
D2TrkWrite16s >PULLW ZPPtr1
|
||||
>PULLB TrkNum
|
||||
>PULLB VolNum
|
||||
>PULLB DrvSlt
|
||||
|
||||
jsr CheckDiskII
|
||||
bcs .9
|
||||
|
||||
>LDYAI TRACK16.LEN+1
|
||||
>SYSCALL2 getmem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr2
|
||||
stx TrkBuf
|
||||
|
||||
lda #254
|
||||
sta VolNum
|
||||
stx hTrkBuf
|
||||
|
||||
stz SectNum
|
||||
|
||||
@ -336,7 +440,7 @@ D2TrkWrite16s >PULLW ZPPtr1
|
||||
jsr HeaderCheckSum
|
||||
|
||||
ldy #3
|
||||
|
||||
|
||||
.2 lda Checksum,y
|
||||
jsr PutByte44Ptr2
|
||||
dey
|
||||
@ -362,10 +466,17 @@ D2TrkWrite16s >PULLW ZPPtr1
|
||||
cmp #16
|
||||
bne .1
|
||||
|
||||
lda TrkBuf
|
||||
>SYSCALL2 FreeMem
|
||||
lda #0
|
||||
sta (ZPPtr2)
|
||||
|
||||
clc
|
||||
jsr D2WriteTrackPtr2
|
||||
php
|
||||
pha
|
||||
lda hTrkBuf
|
||||
>SYSCALL2 FreeMem
|
||||
pla
|
||||
plp
|
||||
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
*\--------------------------------------
|
||||
@ -374,97 +485,64 @@ D2TrkReadNIB
|
||||
* # D2TrkWriteNIB
|
||||
* Write a track (NIBBLE)
|
||||
* **In:**
|
||||
* PUSHW = Ptr to NIBBLE buffer (0 ended)
|
||||
* PUSHB = TrackNum * 4 : 0->140+
|
||||
* PUSHB = DSSS0000
|
||||
* PUSHW = Ptr to NIBBLE buffer (0 ended)
|
||||
* ## RETURN VALUE
|
||||
* CC : success
|
||||
* CS : A = Error
|
||||
* A=0, currently starting/seeking...
|
||||
*\--------------------------------------
|
||||
D2TrkWriteNIB >PULLB DrvSlt
|
||||
>PULLB TrkNum
|
||||
>PULLW ZPPtr1
|
||||
|
||||
lda Status Lib is busy....?
|
||||
beq .10
|
||||
|
||||
lda DrvSlt
|
||||
cmp DrvSltInUse resume previous access ?
|
||||
|
||||
.10 lda DEVNUM last drive accessed by ProDOS
|
||||
and #$F0 only DSSS
|
||||
pha
|
||||
D2TrkWriteNIB >PULLW ZPPtr1
|
||||
>PULLB DrvSlt
|
||||
|
||||
jsr CheckDiskII was it a DISK II ?
|
||||
bcs .1 no, no need to check if spinning
|
||||
|
||||
pla
|
||||
pha
|
||||
jsr DrvSpinCheck
|
||||
bcc .1 not spinning....continue
|
||||
|
||||
pla
|
||||
sta IO.D2.DrvOff,x
|
||||
lda #Status.PrvDrvOff
|
||||
jmp SetStatusAndExit
|
||||
|
||||
.1 pla
|
||||
cmp DrvSlt
|
||||
* beq
|
||||
lda DrvSlt
|
||||
jsr DrvTrkSelect
|
||||
bcs .9
|
||||
|
||||
ldy #TrkWriter.Size
|
||||
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
SetStatusAndExit
|
||||
sta Status
|
||||
ldy DrvSlt
|
||||
sty DrvSltInUse
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* A=DSSS0000
|
||||
* Y=target Track Number * 4
|
||||
*--------------------------------------
|
||||
DrvTrkSelect jsr DrvSelect
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* A=DSSS0000
|
||||
*--------------------------------------
|
||||
CheckDiskII and #$70 only 0SSS
|
||||
CheckDiskII pha
|
||||
and #$70 only 0SSS
|
||||
sta Slotn0
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$C0 make Cn
|
||||
sta .2+2
|
||||
sta ZPPtr3+1
|
||||
stz ZPPtr3
|
||||
|
||||
ldx #3 4 bytes to check
|
||||
|
||||
.1 ldy DiskII.OFS,x
|
||||
|
||||
.2 lda $C000,y Self Modified
|
||||
.2 lda (ZPPtr3),y
|
||||
cmp DiskII.SIG,x
|
||||
bne .9
|
||||
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
clc all bytes match, Disk II
|
||||
|
||||
pla all bytes match, Disk II
|
||||
asl
|
||||
lda #0
|
||||
adc #IO.D2.DrvSel1
|
||||
adc Slotn0
|
||||
tax
|
||||
lda $C000,x
|
||||
|
||||
* clc
|
||||
rts
|
||||
|
||||
.9 lda #MLI.E.NODEV
|
||||
.9 pla
|
||||
lda #MLI.E.NODEV
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* A=DSSS0000
|
||||
*--------------------------------------
|
||||
DrvSpinCheck jsr DrvSelect
|
||||
ldy #0
|
||||
DrvSpinCheck ldy #0
|
||||
|
||||
lda IO.D2.RData,x
|
||||
.1 cmp IO.D2.RData,x
|
||||
@ -478,21 +556,6 @@ DrvSpinCheck jsr DrvSelect
|
||||
.8 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* A=DSSS0000
|
||||
*--------------------------------------
|
||||
DrvSelect pha
|
||||
and #$70
|
||||
tax
|
||||
pla
|
||||
asl
|
||||
adc #IO.D2.DrvSel1
|
||||
sta .1+1
|
||||
|
||||
.1 lda IO.D2.DrvSel1,x Drv 1/2 select
|
||||
|
||||
lda IO.D2.ReadMode,x Make sure readmode
|
||||
rts
|
||||
*--------------------------------------
|
||||
PutSyncBytePtr2 lda #$7f
|
||||
|
||||
.1 jsr PutBytePtr2
|
||||
@ -605,7 +668,7 @@ PutData stz Checksum
|
||||
rts
|
||||
*--------------------------------------
|
||||
PutByte44Ptr2 pha
|
||||
rol
|
||||
ror
|
||||
jsr .1
|
||||
|
||||
pla
|
||||
@ -618,7 +681,25 @@ PutBytePtr2 sta (ZPPtr2)
|
||||
inc ZPPtr2+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
D2WriteTrackPtr2
|
||||
sei
|
||||
|
||||
ldy #TrkWriter.Size
|
||||
|
||||
.1 lda TrkWriter-1,y
|
||||
sta $1ff,y
|
||||
dey
|
||||
bne .1
|
||||
|
||||
lda hTrkBuf
|
||||
>SYSCALL2 GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
ldx Slotn0
|
||||
|
||||
jsr $200
|
||||
|
||||
cli
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
@ -628,14 +709,29 @@ CS.END
|
||||
*--------------------------------------
|
||||
TrkWriter .PH $200
|
||||
|
||||
TrkWriter.Start lda IO.D2.ReadMode,x
|
||||
lda IO.D2.ReadProt,x
|
||||
TrkWriter.Start lda IO.D2.ReadProt,x
|
||||
lda IO.D2.ReadMode,x
|
||||
bmi .9 Write protected
|
||||
|
||||
php
|
||||
sei
|
||||
ldy ZPPtr1
|
||||
stz ZPPtr1
|
||||
|
||||
lda (ZPPtr1),y
|
||||
|
||||
iny
|
||||
bne .10 no chance this happens because mem blocks are $FFF0 aligned....
|
||||
|
||||
inc ZPPtr1+1
|
||||
|
||||
.10 cmp #$80 if CC, it is a sync byte
|
||||
ora #$80 make sure Bit7 high
|
||||
|
||||
sta IO.D2.WriteMode,x (5) goto write mode
|
||||
ora IO.D2.WShift,x (4)
|
||||
|
||||
ldy #0
|
||||
nop (2)
|
||||
|
||||
bra .2 (3)
|
||||
|
||||
.1 lda (ZPPtr1),y (5) as NibbleBuf is page aligned, no page crossing
|
||||
beq .8 (2)(3 if Z) END OF TRACK
|
||||
@ -643,44 +739,43 @@ TrkWriter.Start lda IO.D2.ReadMode,x
|
||||
|
||||
cmp #$80 (2) if CC, it is a sync byte
|
||||
ora #$80 (2) make sure Bit7 high
|
||||
sta IO.D2.WriteMode,x (5)
|
||||
sta IO.D2.WLoad,x (5)
|
||||
ora IO.D2.WShift,x (4) keep C unmodified
|
||||
iny (2)
|
||||
bne .2 (2)(3 if nz)
|
||||
|
||||
* 32us Byte,next page : 2 (beq failed)+5 +2+2+5+4+2+2 (bne failed) + 5 + 3 (bcs succeeded) = 32
|
||||
inc ZPPtr1+1 (5)
|
||||
|
||||
bcs .1 (2)(3 if cs) regular 32us byte
|
||||
|
||||
* 32us Byte,next page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 3 (bcs succeeded) = 32
|
||||
* 40us Byte,next page : 2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
|
||||
nop (2) Sync 40us byte : add 8 cycles
|
||||
nop (2)
|
||||
nop (2)
|
||||
bra .1 (3)
|
||||
|
||||
* 40us Byte,next page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
|
||||
* 32us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+3 (bne succeeded) + 2 +2 + 3 (bcs succeeded) = 32
|
||||
.2 nop (2)
|
||||
nop (2)
|
||||
|
||||
bcs .1 (2)(3 if cs) regular 32us byte
|
||||
|
||||
* 32us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+3 (bne succeeded) + 2 +2 + 3 (bcs succeeded) = 32
|
||||
|
||||
* 40us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
|
||||
nop (2) Sync 40us byte : add 8 cycles
|
||||
nop (2)
|
||||
nop (2)
|
||||
bra .1 (3)
|
||||
|
||||
* 40us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
|
||||
|
||||
.8 pha (3) make sure 32us elapsed before switching to read mode (beq(3)+pha(3)=beq(2)+cmp(2)+ora(2))
|
||||
lda IO.D2.ReadMode,x close write mode
|
||||
lda IO.D2.RData,x
|
||||
pla from pha (3)
|
||||
plp
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #$2B Write Protected
|
||||
.9 lda #MLI.E.WRTPROT
|
||||
sec
|
||||
rts
|
||||
|
||||
@ -852,7 +947,8 @@ DiskII.OFS .HS 010305FF
|
||||
DiskII.SIG .HS 20000300
|
||||
*--------------------------------------
|
||||
DrvSlt .BS 1
|
||||
TrkBuf .BS 1
|
||||
Slotn0 .BS 1
|
||||
hTrkBuf .BS 1
|
||||
|
||||
MoveFrom .BS 1
|
||||
MoveTo .BS 1
|
||||
@ -862,9 +958,10 @@ SectNum .BS 1
|
||||
TrkNum .BS 1
|
||||
VolNum .BS 1
|
||||
|
||||
*--------------------------------------
|
||||
Status .BS 1
|
||||
DrvSltInUse .BS 1
|
||||
MotorOn .BS 1
|
||||
montimel .BS 1
|
||||
montimeh .BS 1
|
||||
|
||||
Count .BS 2
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -125,11 +125,9 @@ L5362 lda IO.D2.DrvSel1,x
|
||||
|
||||
plp indicate drive off by setting z-flag.
|
||||
|
||||
ldy #6 6x256 -> 1500ms delay before stepping.
|
||||
lda #6 6x256 -> 1500ms delay before stepping.
|
||||
|
||||
L536B jsr XRW.Wait100ms
|
||||
dey
|
||||
bne L536B
|
||||
jsr XRW.Wait100msA
|
||||
|
||||
php now zero flag set.
|
||||
|
||||
@ -872,7 +870,7 @@ XRW.Seek asl transform into 1/4 tracks
|
||||
|
||||
jsr XRW.PhaseOn
|
||||
|
||||
lda #18
|
||||
lda #28
|
||||
plp
|
||||
beq .4
|
||||
|
||||
@ -904,10 +902,15 @@ XRW.PhaseOn pha
|
||||
.8 rts
|
||||
|
||||
XRW.AllPhaseOff ldx A2L
|
||||
lda IO.D2.Ph0Off,x make sure all motor phases are off.
|
||||
lda IO.D2.Ph1Off,x
|
||||
lda IO.D2.Ph2Off,x
|
||||
lda IO.D2.Ph3Off,x
|
||||
|
||||
lda #4
|
||||
|
||||
.1 bit IO.D2.Ph0Off,x
|
||||
inx
|
||||
inx
|
||||
dec
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
|
Loading…
x
Reference in New Issue
Block a user