2020-05-08 19:02:27 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
2020-05-12 15:17:25 +00:00
|
|
|
|
dcmd .EQ $42 disk command (=1 for read)
|
|
|
|
|
unit .EQ $43 (16*slot)+(128*(drive-1))
|
|
|
|
|
buff .EQ $44 ram address
|
|
|
|
|
blok .EQ $46 disk address
|
|
|
|
|
dent .EQ $48 device call entry address
|
|
|
|
|
idxl .EQ $4a pointer to low page of index block
|
|
|
|
|
idxh .EQ $4c pointer to high page of index block
|
|
|
|
|
idxp .EQ $4e index byte pointer
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
iobuff .EQ $60
|
|
|
|
|
* the following are for disk ii only
|
|
|
|
|
dbuf .EQ $26
|
2020-06-13 19:27:06 +00:00
|
|
|
|
BB.Slotn0 .EQ $2b
|
2020-05-12 15:17:25 +00:00
|
|
|
|
oddbits .EQ $3c
|
|
|
|
|
sector .EQ $3d
|
|
|
|
|
|
2020-05-13 17:00:37 +00:00
|
|
|
|
BB.RetryCnt .EQ $40
|
2020-05-12 15:17:25 +00:00
|
|
|
|
BB.TargetTrk .EQ $41
|
|
|
|
|
|
2020-06-07 08:06:51 +00:00
|
|
|
|
BB.CurrentQTrack .EQ $50
|
|
|
|
|
BB.TargetQTrack .EQ $51
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
|
|
|
|
BB.HdrPtr .EQ $52
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
|
|
|
|
BB.Hdr .EQ $54
|
|
|
|
|
BB.HdrTrk .EQ $55
|
|
|
|
|
BB.HdrVol .EQ $56
|
|
|
|
|
BB.Hdr96 .EQ $57
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
nbuf1 .EQ $300
|
|
|
|
|
dnib .EQ $2d6
|
|
|
|
|
|
|
|
|
|
clrscrn .EQ $fc58
|
|
|
|
|
scrn .EQ $5b6
|
|
|
|
|
sosid .EQ $c00
|
|
|
|
|
entlen .EQ sosid+$23
|
|
|
|
|
kernel .EQ $2000
|
2020-05-08 19:02:27 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.PH $800
|
|
|
|
|
xboot .DA #1
|
2020-05-13 17:00:37 +00:00
|
|
|
|
sec apple iii enters xboot 'ora $38'
|
2020-06-07 08:06:51 +00:00
|
|
|
|
* bcs BB.AppleII branch if not apple iii native mode
|
|
|
|
|
bcc *
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-07 08:06:51 +00:00
|
|
|
|
*BB.AppleIII lda #$9f make apple iii boot using block 1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
* pha the return address is $a000
|
|
|
|
|
* lda #$ff
|
|
|
|
|
* pha
|
|
|
|
|
|
|
|
|
|
* inc
|
|
|
|
|
* tax ldx #0
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
* inc lda #1 (read block 1)
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
* jmp $f479
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-05-13 17:00:37 +00:00
|
|
|
|
BB.AppleII stx unit save unit number
|
2020-05-12 15:17:25 +00:00
|
|
|
|
cmp #$03 for disk ii
|
|
|
|
|
php save result, it may be irrelevant
|
|
|
|
|
txa find out if disk ii
|
|
|
|
|
and #$70 strip drive # if any
|
|
|
|
|
lsr
|
|
|
|
|
lsr get slot address
|
|
|
|
|
lsr
|
2020-05-08 19:02:27 +00:00
|
|
|
|
lsr
|
|
|
|
|
ora #$c0
|
2020-05-12 15:17:25 +00:00
|
|
|
|
sta dent+1
|
|
|
|
|
ldy #$ff look at last byte
|
2020-05-08 19:02:27 +00:00
|
|
|
|
sty dent
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
plp restore carry (if disk ii & sect 0&2 read)
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
iny make y=0
|
|
|
|
|
lda (dent),y get device entry addr
|
|
|
|
|
bne ndsk2 branch if not disk ii (16 sector)
|
|
|
|
|
|
|
|
|
|
bcs isdsk2 branch if it is disk ii, but block 0 read
|
|
|
|
|
|
|
|
|
|
lda #3 make rom read only sector 2
|
|
|
|
|
sta xboot to complete block 0
|
2020-05-08 19:02:27 +00:00
|
|
|
|
inc sector was = 1
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
lda dent+1 do rts to re-enter rom
|
|
|
|
|
pha
|
2020-05-08 19:02:27 +00:00
|
|
|
|
lda #$5b
|
|
|
|
|
pha
|
|
|
|
|
rts go read sector 2 into $900
|
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
isdsk2 sta BB.HdrTrk A=0, make sure previous track =0
|
|
|
|
|
sta dent and dent points at beginning of slot
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
ldy #$63 move code from card to ram
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
mvboot lda (dent),y
|
2020-05-08 19:02:27 +00:00
|
|
|
|
sta zzstart-$5e,y
|
2020-06-22 05:59:53 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #$eb have we moved enough?
|
2020-05-08 19:02:27 +00:00
|
|
|
|
bne mvboot
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-06-11 21:04:56 +00:00
|
|
|
|
ldx #mods.cnt now modify code to handle errors.
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-06-11 21:04:56 +00:00
|
|
|
|
modboot ldy mods-1,x
|
|
|
|
|
lda chgs-1,x
|
|
|
|
|
sta zzstart,y
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-11 21:04:56 +00:00
|
|
|
|
cpx #8
|
|
|
|
|
bcs .1
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
lda endcode-1,x
|
|
|
|
|
sta zzzend-1,x
|
|
|
|
|
|
2020-06-11 21:04:56 +00:00
|
|
|
|
.1 dex
|
|
|
|
|
bne modboot
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
lda #BB.Hdr
|
|
|
|
|
sta BB.HdrPtr
|
2020-05-13 17:00:37 +00:00
|
|
|
|
stx BB.HdrPtr+1 X=0
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
lda /BB.ReadBlock reset device entry
|
|
|
|
|
sta dent+1 to point at disk ii routines.
|
|
|
|
|
lda #BB.ReadBlock get low addr (must be <$80)
|
2020-05-13 17:00:37 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-20 18:35:54 +00:00
|
|
|
|
ndsk2 sta dent save low adr of device call entry.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
sty iobuff y=0
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sty idxl
|
2020-09-20 18:35:54 +00:00
|
|
|
|
sty idxh
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sty idxp
|
|
|
|
|
sty blok+1
|
2020-09-20 18:35:54 +00:00
|
|
|
|
|
|
|
|
|
iny y=1
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sty dcmd set read command.
|
2020-09-20 18:35:54 +00:00
|
|
|
|
|
|
|
|
|
iny y=2
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sty blok to read directory blocks
|
2020-09-20 18:35:54 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda #$c 2-5 at $c00
|
|
|
|
|
sta iobuff+1
|
|
|
|
|
sta idxl+1
|
|
|
|
|
|
|
|
|
|
rddir jsr goread call read block routine.
|
|
|
|
|
bcs bterr2 give up on error.
|
|
|
|
|
|
|
|
|
|
inc iobuff+1
|
|
|
|
|
inc iobuff+1
|
|
|
|
|
inc blok
|
|
|
|
|
lda blok have all directory blocks been read?
|
|
|
|
|
cmp #6
|
|
|
|
|
bcc rddir loop if not.
|
2020-06-07 08:06:51 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda #4 begin look-up with first entry past header.
|
2020-06-07 08:06:51 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2020-06-22 05:59:53 +00:00
|
|
|
|
nxdent lda idxl
|
|
|
|
|
|
|
|
|
|
nxdent1 clc
|
|
|
|
|
adc entlen bump to next directory entry.
|
|
|
|
|
tay save in y for now.
|
|
|
|
|
bcc nxdent2 branch if not a page cross.
|
|
|
|
|
|
|
|
|
|
inc idxl+1
|
|
|
|
|
lda idxl+1 check for new block.
|
|
|
|
|
lsr if even then new block.
|
|
|
|
|
bcs nxdent2
|
|
|
|
|
|
|
|
|
|
cmp #$a have all file names been compared?
|
2020-05-12 15:17:25 +00:00
|
|
|
|
beq booterr branch if no pro.kernel.
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
ldy #4 else, begin at block beginning.
|
|
|
|
|
|
2020-06-07 08:06:51 +00:00
|
|
|
|
nxdent2 sty idxl
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
ldy #6
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
lookpro lda (idxl),y look for matching name.
|
|
|
|
|
cmp BB.ProDOS,y
|
|
|
|
|
bne nxdent branch if no match.
|
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl lookpro
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
* ldy #$10 get file type & index block addr.
|
|
|
|
|
* lda (idxl),y
|
|
|
|
|
* cmp #S.FI.T.SYS is it a system file?
|
|
|
|
|
* bne booterr
|
|
|
|
|
* iny
|
2020-06-13 19:27:06 +00:00
|
|
|
|
|
|
|
|
|
ldy #$11
|
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda (idxl),y
|
|
|
|
|
sta blok
|
|
|
|
|
iny
|
|
|
|
|
lda (idxl),y
|
|
|
|
|
sta blok+1
|
|
|
|
|
|
|
|
|
|
lda #0 now set up to read kernel.
|
|
|
|
|
sta idxl
|
|
|
|
|
|
|
|
|
|
ldy #$1e read index block at $1e00 and
|
|
|
|
|
sty idxl+1 kernel at $2000
|
|
|
|
|
sty iobuff+1
|
|
|
|
|
iny
|
|
|
|
|
sty idxh+1
|
2020-09-22 05:56:28 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rdkernl jsr goread read index block.
|
|
|
|
|
bterr2 bcs booterr
|
|
|
|
|
|
|
|
|
|
inc iobuff+1
|
|
|
|
|
inc iobuff+1
|
|
|
|
|
|
|
|
|
|
ldy idxp get index pointer
|
|
|
|
|
inc idxp bump for next time.
|
|
|
|
|
lda (idxl),y
|
|
|
|
|
sta blok
|
|
|
|
|
lda (idxh),y high disk addr.
|
|
|
|
|
sta blok+1
|
|
|
|
|
ora (idxl),y if both=0 then done.
|
|
|
|
|
bne rdkernl branch if more to read.
|
|
|
|
|
|
|
|
|
|
jmp kernel go execute kernel code.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-22 05:56:28 +00:00
|
|
|
|
booterr jsr clrscrn clear video
|
2020-06-29 05:49:24 +00:00
|
|
|
|
ldy #BB.MSG.ERR.Len-1
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
.1 lda BB.MSG.ERR,y
|
|
|
|
|
sta scrn,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-14 11:47:46 +00:00
|
|
|
|
jmp $ff69
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
goread lda iobuff
|
|
|
|
|
sta buff
|
|
|
|
|
lda iobuff+1
|
|
|
|
|
sta buff+1
|
|
|
|
|
jmp (dent)
|
2020-05-08 19:02:27 +00:00
|
|
|
|
*--------------------------------------
|
2020-05-12 15:17:25 +00:00
|
|
|
|
mods .DA #mod1,#mod2,#mod3,#mod4,#mod5,#mod6,#mod7,#mod8,#mod8+1,#mod9
|
2020-05-13 17:00:37 +00:00
|
|
|
|
mods.cnt .EQ *-mods
|
2020-05-12 15:17:25 +00:00
|
|
|
|
chgs .DA #chg1,#chg2,#chg3,#chg4,#chg5,#chg6,#chg7,#$91,#BB.HdrPtr,#BB.HdrTrk
|
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
endcode ldx BB.Slotn0
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
jmp BB.Seek
|
2020-05-08 19:02:27 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-29 05:49:24 +00:00
|
|
|
|
BB.MSG.ERR .AS -"BOOT ERROR"
|
|
|
|
|
BB.MSG.ERR.Len .EQ *-BB.MSG.ERR
|
2020-05-13 17:00:37 +00:00
|
|
|
|
BB.ProDOS .DA #$26 $20 = storage type + 6 = "PRODOS" len
|
|
|
|
|
.AS "PRODOS"
|
2020-05-08 19:02:27 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
BB.ReadBlock lda blok figure out track & sector.
|
|
|
|
|
and #7 strip track for now.
|
|
|
|
|
cmp #4
|
|
|
|
|
and #3
|
|
|
|
|
php
|
2020-05-08 19:02:27 +00:00
|
|
|
|
asl
|
2020-06-22 05:59:53 +00:00
|
|
|
|
plp
|
|
|
|
|
rol now we have the first sector of block.
|
|
|
|
|
sta sector
|
|
|
|
|
|
|
|
|
|
lda blok+1 get high block #
|
|
|
|
|
lsr shift hi addr to carry.
|
|
|
|
|
lda blok now figure track #
|
|
|
|
|
ror
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2020-05-12 15:17:25 +00:00
|
|
|
|
sta BB.TargetTrk
|
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda buff+1
|
2020-05-12 15:17:25 +00:00
|
|
|
|
sta dbuf+1
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
ldx BB.Slotn0
|
|
|
|
|
lda IO.D2.DrvOn,x
|
2020-06-29 05:49:24 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
jsr BB.Seek go read sector.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
inc dbuf+1 bump address
|
|
|
|
|
inc sector
|
|
|
|
|
inc sector and sector #
|
|
|
|
|
bcs .9 branch if error.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-07 08:06:51 +00:00
|
|
|
|
jsr BB.Seek
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
.9 ldy IO.D2.DrvOff,x
|
|
|
|
|
rts return error status in carry.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-07 08:06:51 +00:00
|
|
|
|
BB.Seek lda BB.HdrTrk get track we're on
|
2020-05-12 15:17:25 +00:00
|
|
|
|
jsr BB.Trk2Qtrk
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sta BB.CurrentQTrack
|
|
|
|
|
|
2020-06-07 08:06:51 +00:00
|
|
|
|
lda BB.TargetTrk
|
|
|
|
|
jsr BB.Trk2Qtrk
|
|
|
|
|
sta BB.TargetQTrack
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
lda BB.CurrentQTrack
|
2020-07-25 07:05:25 +00:00
|
|
|
|
cmp BB.TargetQTrack
|
2020-09-11 18:43:24 +00:00
|
|
|
|
beq BB.Read
|
2020-07-25 07:05:25 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
ldx BB.Slotn0 will do a ph0 off
|
|
|
|
|
ldy BB.Slotn0
|
|
|
|
|
|
|
|
|
|
.1 jsr BB.PhasesOff
|
2020-06-29 05:49:24 +00:00
|
|
|
|
|
2020-07-25 07:05:25 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
* Current < Target, must move in
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
|
|
|
|
|
.HS B0 BCS
|
|
|
|
|
|
|
|
|
|
* Current > Target, must move out
|
|
|
|
|
|
|
|
|
|
.2 dec
|
|
|
|
|
|
|
|
|
|
sta BB.CurrentQTrack
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
and #6
|
|
|
|
|
ora BB.Slotn0
|
2020-09-22 05:56:28 +00:00
|
|
|
|
tax
|
2020-07-25 07:05:25 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
pla
|
|
|
|
|
|
2020-07-25 07:05:25 +00:00
|
|
|
|
bcs .3
|
2020-06-07 08:06:51 +00:00
|
|
|
|
|
|
|
|
|
* Current < Target, must move in
|
|
|
|
|
|
|
|
|
|
inc
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
.HS B0 BCS
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
* Current > Target, must move out
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2020-07-25 07:05:25 +00:00
|
|
|
|
.3 dec
|
2020-06-07 08:06:51 +00:00
|
|
|
|
|
2020-07-25 07:05:25 +00:00
|
|
|
|
and #6
|
2020-09-22 05:56:28 +00:00
|
|
|
|
ora BB.Slotn0
|
2020-09-28 15:43:38 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
bcc .4
|
|
|
|
|
|
|
|
|
|
* move out : invert 2 phases
|
|
|
|
|
|
|
|
|
|
phx
|
2020-07-26 19:16:13 +00:00
|
|
|
|
tax
|
2020-09-20 18:35:54 +00:00
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.4 tay
|
2020-07-25 07:05:25 +00:00
|
|
|
|
|
2020-09-11 18:43:24 +00:00
|
|
|
|
lda IO.D2.Ph0On,x
|
2020-09-07 20:40:50 +00:00
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-09-20 18:35:54 +00:00
|
|
|
|
|
2020-09-11 18:43:24 +00:00
|
|
|
|
lda IO.D2.Ph0On,y
|
2020-09-20 18:35:54 +00:00
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-07-25 07:05:25 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
lda #IO.D2.SeekTimeB
|
|
|
|
|
jsr BB.Wait
|
|
|
|
|
|
2020-09-11 18:43:24 +00:00
|
|
|
|
lda BB.CurrentQTrack
|
|
|
|
|
cmp BB.TargetQTrack
|
2020-09-22 05:56:28 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
jsr BB.Wait
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
jsr BB.PhasesOff
|
2020-06-29 05:49:24 +00:00
|
|
|
|
bcs BB.Read ALWAYS
|
|
|
|
|
*--------------------------------------
|
2020-09-20 18:35:54 +00:00
|
|
|
|
BB.PhasesOff bit IO.D2.Ph0Off,x
|
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-09-11 18:43:24 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
ldx IO.D2.Ph0Off,y
|
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-09-11 18:43:24 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
rts
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-20 18:35:54 +00:00
|
|
|
|
BB.Wait phx (3)
|
2020-07-06 12:03:05 +00:00
|
|
|
|
|
|
|
|
|
.1 ldx #18 (2)
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
.2 dex (2) delay 86 usec.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
bne .2 (2+) 2 + 5x16 + 2 + 2
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
ldx BB.Slotn0 (3)
|
|
|
|
|
bit IO.D2.DrvOn,x (4) Slow down ACC boards
|
2020-06-07 08:06:51 +00:00
|
|
|
|
|
2020-09-11 18:43:24 +00:00
|
|
|
|
sec (2)
|
2020-06-07 08:06:51 +00:00
|
|
|
|
sbc #1 (2)
|
|
|
|
|
bne .1 (2+)
|
2020-07-06 12:03:05 +00:00
|
|
|
|
|
|
|
|
|
plx (4)
|
2020-06-29 05:49:24 +00:00
|
|
|
|
|
2020-06-05 19:26:34 +00:00
|
|
|
|
rts (6)
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
BB.Trk2Qtrk asl x2
|
|
|
|
|
sta .1+1
|
|
|
|
|
|
|
|
|
|
bit BB.HdrVol
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bpl .1 x4
|
2020-09-15 06:12:52 +00:00
|
|
|
|
bvs .1 > $C0 ? (VOL=254)
|
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
lsr x3
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
.1 adc #$ff SELF MODIFIED
|
2020-05-28 21:13:52 +00:00
|
|
|
|
BB.Trk2Qtrk.RTS rts
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-13 19:27:06 +00:00
|
|
|
|
BB.Read ldx BB.Slotn0
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
stz BB.RetryCnt
|
2020-06-22 05:59:53 +00:00
|
|
|
|
php
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
tryread plp fix stack.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rdhead sec anticipate error.
|
2020-09-20 18:35:54 +00:00
|
|
|
|
inc BB.RetryCnt if = 0 then give up!
|
|
|
|
|
bmi BB.Trk2Qtrk.RTS branch if can't fine/read sector.
|
2020-06-13 19:27:06 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
clc indicate reading header.
|
2020-10-06 06:27:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #0 Retry cnt waiting D5
|
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rddata php carry set if reading sector.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rd0 dey every time y=0 decrement find count.
|
|
|
|
|
beq tryread
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
* from zzstart to zzend code is moved from rom and modified to match this code...
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
zzstart .EQ *
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rd1 lda IO.D2.RData,x read a byte from the state machine.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
bpl rd1 loop until ready.
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
.DUMMY
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rd1a eor #$d5 mark 1?
|
|
|
|
|
mod1 .EQ *-zzstart+1
|
|
|
|
|
bne rd0 branch if not.
|
|
|
|
|
|
|
|
|
|
chg1 .EQ rd0-*
|
|
|
|
|
rd2 lda IO.D2.RData,x
|
|
|
|
|
bpl rd2
|
|
|
|
|
|
|
|
|
|
cmp #$aa mark 2?
|
|
|
|
|
bne rd1a
|
|
|
|
|
nop waste a little time.
|
|
|
|
|
|
|
|
|
|
rd3 lda IO.D2.RData,x
|
|
|
|
|
bpl rd3
|
|
|
|
|
|
|
|
|
|
cmp #$96 header mark 3?
|
|
|
|
|
beq rdhd1 branch if it is.
|
|
|
|
|
|
|
|
|
|
plp were we looking for data mark 3?
|
|
|
|
|
mod2 .EQ *-zzstart+1
|
|
|
|
|
bcc rdhead branch if not.
|
|
|
|
|
|
|
|
|
|
chg2 .EQ rdhead-*
|
|
|
|
|
eor #$ad data mark 3?
|
|
|
|
|
beq rddt1 go read data field if true...
|
|
|
|
|
|
|
|
|
|
mod3 .EQ *-zzstart+1
|
|
|
|
|
rdhd0 bne rdhead otherwise, start over.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
chg3 .EQ rdhead-*
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
|
|
|
|
rdhd1 ldy #3 read in trk,sect,&volume #.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
mod8 .EQ *-zzstart
|
|
|
|
|
rdhd2 sta (BB.HdrPtr),y save last result in .. , BB.HdrTrk , BB.HdrVol , ..
|
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
rdhd3 lda IO.D2.RData,x
|
2020-06-22 05:59:53 +00:00
|
|
|
|
bpl rdhd3
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
|
|
|
|
rol
|
2020-06-22 05:59:53 +00:00
|
|
|
|
sta oddbits save odd bits (7,5,3,1)
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
rdhd4 lda IO.D2.RData,x
|
2020-06-22 05:59:53 +00:00
|
|
|
|
bpl rdhd4
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
and oddbits combine even and odd to form value.
|
|
|
|
|
dey
|
|
|
|
|
bne rdhd2 read in next pair.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
plp
|
|
|
|
|
cmp sector last byte formed is sector#
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
mod4 .EQ *-zzstart+1
|
|
|
|
|
bne rdhead branch if target sector not found.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
chg4 .EQ rdhead-*
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
mod9 .EQ *-zzstart+1
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda BB.HdrTrk previous result is track #
|
|
|
|
|
cmp BB.TargetTrk is desired track found?
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
mod5 .EQ *-zzstart+1
|
|
|
|
|
bne goseek re-seek if mismatch.
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
chg5a .EQ *
|
|
|
|
|
mod6 .EQ *-zzstart+1
|
|
|
|
|
bcs rddata branch if proper track always.
|
|
|
|
|
chg6 .EQ rddata-*
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rddt1 ldy #$56 read 2 bit groupings first.
|
|
|
|
|
rddt1a sty oddbits
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rddt2 ldy IO.D2.RData,x
|
|
|
|
|
bpl rddt2
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
eor dnib,y denibblize using table left from boot rom.
|
|
|
|
|
ldy oddbits save in nbuf1
|
|
|
|
|
dey
|
|
|
|
|
sta nbuf1,y
|
|
|
|
|
bne rddt1a loop until all 86 groups are read.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rddt3 sty oddbits now count up for 6-bit groups.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rddt4 ldy IO.D2.RData,x
|
|
|
|
|
bpl rddt4
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
eor dnib,y
|
|
|
|
|
ldy oddbits save result to specified buffer.
|
|
|
|
|
sta (dbuf),y
|
|
|
|
|
iny
|
|
|
|
|
bne rddt3 loop for 256 bytes.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
rdchk ldy IO.D2.RData,x now verify checksum...
|
|
|
|
|
bpl rdchk
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
eor dnib,y must be equal...
|
|
|
|
|
mod7 .EQ *-zzstart+1
|
|
|
|
|
bne rdhd0 branch if error.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
chg7 .EQ rdhd0-*
|
|
|
|
|
ldy #0 make y=0
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
nxttwo ldx #$56 now combine 2-bit group with 6 bit group
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
twobit dex all done with this group?
|
|
|
|
|
bmi nxttwo branch if so.
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
lda (dbuf),y
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lsr nbuf1,x
|
|
|
|
|
rol
|
|
|
|
|
lsr nbuf1,x
|
|
|
|
|
rol
|
2020-05-12 15:17:25 +00:00
|
|
|
|
sta (dbuf),y
|
2020-06-22 05:59:53 +00:00
|
|
|
|
iny
|
|
|
|
|
bne twobit
|
2020-05-12 15:17:25 +00:00
|
|
|
|
*--------------------------------------
|
2020-06-13 19:27:06 +00:00
|
|
|
|
zzzend ldx BB.Slotn0
|
2020-06-22 05:59:53 +00:00
|
|
|
|
clc indicate good read.
|
|
|
|
|
rts
|
2020-05-08 19:02:27 +00:00
|
|
|
|
|
2020-05-12 15:17:25 +00:00
|
|
|
|
chg5 .EQ *-chg5a
|
2020-06-07 08:06:51 +00:00
|
|
|
|
goseek jmp BB.Seek
|
2020-05-12 15:17:25 +00:00
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.LIST ON
|
2020-06-22 05:59:53 +00:00
|
|
|
|
BB.End .EQ *
|
2020-05-12 15:17:25 +00:00
|
|
|
|
BB.Free .EQ $a00-*
|
|
|
|
|
.BS BB.Free
|
|
|
|
|
.LIST OFF
|
2020-05-08 19:02:27 +00:00
|
|
|
|
.EP
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-05-26 14:23:09 +00:00
|
|
|
|
SAVE usr/src/lib/libblkdev.s.bb
|
|
|
|
|
LOAD usr/src/lib/libblkdev.s
|
2020-05-08 19:02:27 +00:00
|
|
|
|
ASM
|