MicroDrive support

This commit is contained in:
Peter Ferrie 2019-10-10 22:50:32 -07:00
parent 2dcb7df162
commit 93eed754f6
3 changed files with 275 additions and 86 deletions

View File

@ -1,6 +1,6 @@
;license:BSD-3-Clause ;license:BSD-3-Clause
;extended open/read/write binary file in ProDOS filesystem, with random access ;extended open/read/write binary file in ProDOS filesystem, with random access
;copyright (c) Peter Ferrie 2013-18 ;copyright (c) Peter Ferrie 2013-19
ver_02 = 1 ver_02 = 1
@ -180,7 +180,6 @@ tmp = $8
init lda DEVNUM init lda DEVNUM
sta x80_parms + 1 sta x80_parms + 1
sta unrunit
and #$70 and #$70
pha pha
ldx #1 ldx #1
@ -277,21 +276,77 @@ ifoundname dex
++ lda sizelo ++ lda sizelo
bne readblock bne readblock
;unit to slot for SmartPort interface ;unit to slot for ProDOS interface
+++ pla +++ pla
lsr lsr
lsr lsr
lsr lsr
tax tay
lsr ldx DEVADR01HI, y
ora #$c0 cpx #$c8
ldy DEVADR01HI, x bcc set_slot
cpy #$c8
bcs set_slot ;find SmartPort device for basic MicroDrive support
tya
set_slot sta slot + 2 ldx #$c8
sta unrentry + 1 - dex
stx blokhi
ldy #0
sty bloklo
iny
lda (bloklo), y
cmp #$20
bne -
iny
iny
lda (bloklo), y
bne -
iny
iny
lda (bloklo), y
cmp #3
bne -
ldy #$ff
lda (bloklo), y
beq -
set_slot stx slot + 2
stx unrentry1 + 2
stx unrentry3 + 2
slot ldx $cfff
;use SmartPort entrypoint instead
inx
inx
inx
stx unrentry1 + 1
stx unrentry3 + 1
ldx #2
stx x80_parms + 4
lda #0
sta x80_parms + 5
jsr MLI
!byte $80
!word x80_parms
iterunit inc unrunit2
unrentry1 jsr $d1d1
!byte cmdread
!word unrpacket
bcs iterunit
ldy #$0f
- lda readbuff + 4, y
cmp readbuff + $204, y
bne iterunit
dey
bpl -
!if load_aux = 1 { !if load_aux = 1 {
sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP
} ;load_aux } ;load_aux
@ -330,8 +385,6 @@ yyy
;copy new RWTS and interpreter support routines ;copy new RWTS and interpreter support routines
slot lda $cfff
sta unrentry
ldy #0 ldy #0
- lda unrelochdd, y - lda unrelochdd, y
sta reloc, y sta reloc, y
@ -1554,22 +1607,32 @@ hddreaddirsect
sty adrhi sty adrhi
hddseekrd ldy #cmdread hddseekrd ldy #cmdread
!if (aligned_read + enable_write) > 1 { !if (aligned_read + enable_write) > 1 {
hddseekrdwr sty command hddseekrdwr sty pcommand
} else { ;not (aligned_read or enable_write) } else { ;not (aligned_read or enable_write)
sty command sty pcommand
hddseekrdwr hddseekrdwr
} ;aligned_read and enable_write } ;aligned_read and enable_write
stx bloklo stx pblock
sta blokhi sta pblock + 1
hddcallsp hddcallsp
unrunit = unrelochdd + (* + 1 - reloc) lda adrhi
lda #$d1 sta paddr + 1
sta unit lda adrlo
sta paddr
unrentry3 = unrelochdd + (* - reloc)
jsr $d1d1
pcommand !byte 0
!word packet
rts
unrentry = unrelochdd + (* + 1 - reloc) unrpacket = unrelochdd + (* - reloc)
jmp $d1d1 packet !byte 3
unrunit2 = unrelochdd + (* - reloc)
!byte 0
paddr !word readbuff + $200
pblock !byte 2, 0, 0
casemap casemap
ora #$80 ora #$80
@ -1734,7 +1797,7 @@ hddsavetreehi = * + 1
lda hdddirbuf, y lda hdddirbuf, y
ora hdddirbuf + 256, y ora hdddirbuf + 256, y
beq sparseblk beq sparseblk
inc command inc pcommand
copyblock ldy #0 copyblock ldy #0
- lda $900, y - lda $900, y
@ -1792,11 +1855,11 @@ sparseblk ldx #2
lda adrhi lda adrhi
cmp #(>hddencbuf) + 2 cmp #(>hddencbuf) + 2
bne -- bne --
ldx bloklo ldx pblock
inx inx
bne + bne +
inc blokhi inc pblock + 1
+ lda blokhi + lda pblock + 1
dec ldrhi dec ldrhi
bne --- bne ---
@ -1825,7 +1888,7 @@ foundbit lda (adrlo), y
jmp copyblock jmp copyblock
writeimm sta adrhi writeimm sta adrhi
inc command inc pcommand
jmp hddcallsp jmp hddcallsp
readpart lda istree readpart lda istree

View File

@ -1,6 +1,6 @@
;license:BSD-3-Clause ;license:BSD-3-Clause
;extended open/read/write binary file in ProDOS filesystem, with random access ;extended open/read/write binary file in ProDOS filesystem, with random access
;copyright (c) Peter Ferrie 2013-18 ;copyright (c) Peter Ferrie 2013-19
ver_02 = 1 ver_02 = 1
@ -180,7 +180,6 @@ tmp = $8
init lda DEVNUM init lda DEVNUM
sta x80_parms + 1 sta x80_parms + 1
sta unrunit
and #$70 and #$70
pha pha
ldx #1 ldx #1
@ -277,21 +276,77 @@ ifoundname dex
++ lda sizelo ++ lda sizelo
bne readblock bne readblock
;unit to slot for SmartPort interface ;unit to slot for ProDOS interface
+++ pla +++ pla
lsr lsr
lsr lsr
lsr lsr
tax tay
lsr ldx DEVADR01HI, y
ora #$c0 cpx #$c8
ldy DEVADR01HI, x bcc set_slot
cpy #$c8
bcs set_slot ;find SmartPort device for basic MicroDrive support
tya
set_slot sta slot + 2 ldx #$c8
sta unrentry + 1 - dex
stx blokhi
ldy #0
sty bloklo
iny
lda (bloklo), y
cmp #$20
bne -
iny
iny
lda (bloklo), y
bne -
iny
iny
lda (bloklo), y
cmp #3
bne -
ldy #$ff
lda (bloklo), y
beq -
set_slot stx slot + 2
stx unrentry1 + 2
stx unrentry3 + 2
slot ldx $cfff
;use SmartPort entrypoint instead
inx
inx
inx
stx unrentry1 + 1
stx unrentry3 + 1
ldx #2
stx x80_parms + 4
lda #0
sta x80_parms + 5
jsr MLI
!byte $80
!word x80_parms
iterunit inc unrunit2
unrentry1 jsr $d1d1
!byte cmdread
!word unrpacket
bcs iterunit
ldy #$0f
- lda readbuff + 4, y
cmp readbuff + $204, y
bne iterunit
dey
bpl -
!if load_aux = 1 { !if load_aux = 1 {
sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP
} ;load_aux } ;load_aux
@ -319,8 +374,6 @@ set_slot sta slot + 2
;copy new RWTS and interpreter support routines ;copy new RWTS and interpreter support routines
slot lda $cfff
sta unrentry
ldy #0 ldy #0
- lda unrelochdd, y - lda unrelochdd, y
sta reloc, y sta reloc, y
@ -1560,22 +1613,32 @@ hddreaddirsect
sty adrhi sty adrhi
hddseekrd ldy #cmdread hddseekrd ldy #cmdread
!if (aligned_read + enable_write) > 1 { !if (aligned_read + enable_write) > 1 {
hddseekrdwr sty command hddseekrdwr sty pcommand
} else { ;not (aligned_read or enable_write) } else { ;not (aligned_read or enable_write)
sty command sty pcommand
hddseekrdwr hddseekrdwr
} ;aligned_read and enable_write } ;aligned_read and enable_write
stx bloklo stx pblock
sta blokhi sta pblock + 1
hddcallsp hddcallsp
unrunit = unrelochdd + (* + 1 - reloc) lda adrhi
lda #$d1 sta paddr + 1
sta unit lda adrlo
sta paddr
unrentry3 = unrelochdd + (* - reloc)
jsr $d1d1
pcommand !byte 0
!word packet
rts
unrentry = unrelochdd + (* + 1 - reloc) unrpacket = unrelochdd + (* - reloc)
jmp $d1d1 packet !byte 3
unrunit2 = unrelochdd + (* - reloc)
!byte 0
paddr !word readbuff + $200
pblock !byte 2, 0, 0
hddcodeend hddcodeend
!if swap_zp = 1 { !if swap_zp = 1 {
@ -1746,7 +1809,7 @@ hddsavetreehi = * + 1
lda hdddirbuf, y lda hdddirbuf, y
ora hdddirbuf + 256, y ora hdddirbuf + 256, y
beq sparseblk beq sparseblk
inc command inc pcommand
copyblock ldy #0 copyblock ldy #0
- lda $a00, y - lda $a00, y
@ -1804,11 +1867,11 @@ sparseblk ldx #2
lda adrhi lda adrhi
cmp #(>hddencbuf) + 2 cmp #(>hddencbuf) + 2
bne -- bne --
ldx bloklo ldx pblock
inx inx
bne + bne +
inc blokhi inc pblock + 1
+ lda blokhi + lda pblock + 1
dec ldrhi dec ldrhi
bne --- bne ---
@ -1837,7 +1900,7 @@ foundbit lda (adrlo), y
jmp copyblock jmp copyblock
writeimm sta adrhi writeimm sta adrhi
inc command inc pcommand
jmp hddcallsp jmp hddcallsp
readpart lda istree readpart lda istree

View File

@ -1,6 +1,6 @@
;license:BSD-3-Clause ;license:BSD-3-Clause
;extended open/read/write binary file in ProDOS filesystem, with random access ;extended open/read/write binary file in ProDOS filesystem, with random access
;copyright (c) Peter Ferrie 2013-18 ;copyright (c) Peter Ferrie 2013-19
ver_02 = 1 ver_02 = 1
@ -180,7 +180,6 @@ tmp = $8
init lda DEVNUM init lda DEVNUM
sta x80_parms + 1 sta x80_parms + 1
sta unrunit
and #$70 and #$70
pha pha
ldx #1 ldx #1
@ -277,21 +276,77 @@ ifoundname dex
++ lda sizelo ++ lda sizelo
bne readblock bne readblock
;unit to slot for SmartPort interface ;unit to slot for ProDOS interface
+++ pla +++ pla
lsr lsr
lsr lsr
lsr lsr
tax tay
lsr ldx DEVADR01HI, y
ora #$c0 cpx #$c8
ldy DEVADR01HI, x bcc set_slot
cpy #$c8
bcs set_slot ;find SmartPort device for basic MicroDrive support
tya
set_slot sta slot + 2 ldx #$c8
sta unrentry + 1 - dex
stx blokhi
ldy #0
sty bloklo
iny
lda (bloklo), y
cmp #$20
bne -
iny
iny
lda (bloklo), y
bne -
iny
iny
lda (bloklo), y
cmp #3
bne -
ldy #$ff
lda (bloklo), y
beq -
set_slot stx slot + 2
stx unrentry1 + 2
stx unrentry3 + 2
slot ldx $cfff
;use SmartPort entrypoint instead
inx
inx
inx
stx unrentry1 + 1
stx unrentry3 + 1
ldx #2
stx x80_parms + 4
lda #0
sta x80_parms + 5
jsr MLI
!byte $80
!word x80_parms
iterunit inc unrunit2
unrentry1 jsr $d1d1
!byte cmdread
!word unrpacket
bcs iterunit
ldy #$0f
- lda readbuff + 4, y
cmp readbuff + $204, y
bne iterunit
dey
bpl -
!if load_aux = 1 { !if load_aux = 1 {
sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP
} ;load_aux } ;load_aux
@ -319,8 +374,6 @@ set_slot sta slot + 2
;copy new RWTS and interpreter support routines ;copy new RWTS and interpreter support routines
slot lda $cfff
sta unrentry
ldy #0 ldy #0
- lda unrelochdd, y - lda unrelochdd, y
sta reloc, y sta reloc, y
@ -1560,22 +1613,32 @@ hddreaddirsect
sty adrhi sty adrhi
hddseekrd ldy #cmdread hddseekrd ldy #cmdread
!if (aligned_read + enable_write) > 1 { !if (aligned_read + enable_write) > 1 {
hddseekrdwr sty command hddseekrdwr sty pcommand
} else { ;not (aligned_read or enable_write) } else { ;not (aligned_read or enable_write)
sty command sty pcommand
hddseekrdwr hddseekrdwr
} ;aligned_read and enable_write } ;aligned_read and enable_write
stx bloklo stx pblock
sta blokhi sta pblock + 1
hddcallsp hddcallsp
unrunit = unrelochdd + (* + 1 - reloc) lda adrhi
lda #$d1 sta paddr + 1
sta unit lda adrlo
sta paddr
unrentry3 = unrelochdd + (* - reloc)
jsr $d1d1
pcommand !byte 0
!word packet
rts
unrentry = unrelochdd + (* + 1 - reloc) unrpacket = unrelochdd + (* - reloc)
jmp $d1d1 packet !byte 3
unrunit2 = unrelochdd + (* - reloc)
!byte 0
paddr !word readbuff + $200
pblock !byte 2, 0, 0
hddcodeend hddcodeend
!if swap_zp = 1 { !if swap_zp = 1 {
@ -1746,7 +1809,7 @@ hddsavetreehi = * + 1
lda hdddirbuf, y lda hdddirbuf, y
ora hdddirbuf + 256, y ora hdddirbuf + 256, y
beq sparseblk beq sparseblk
inc command inc pcommand
copyblock ldy #0 copyblock ldy #0
- lda $a00, y - lda $a00, y
@ -1804,11 +1867,11 @@ sparseblk ldx #2
lda adrhi lda adrhi
cmp #(>hddencbuf) + 2 cmp #(>hddencbuf) + 2
bne -- bne --
ldx bloklo ldx pblock
inx inx
bne + bne +
inc blokhi inc pblock + 1
+ lda blokhi + lda pblock + 1
dec ldrhi dec ldrhi
bne --- bne ---
@ -1837,7 +1900,7 @@ foundbit lda (adrlo), y
jmp copyblock jmp copyblock
writeimm sta adrhi writeimm sta adrhi
inc command inc pcommand
jmp hddcallsp jmp hddcallsp
readpart lda istree readpart lda istree
@ -1859,11 +1922,11 @@ readpart lda istree
sta istree sta istree
ldy lastblk ldy lastblk
rts rts
} -}
save_end save_end
hookkbd hookkbd
!pseudopc $2b5 {;;-(callback_e-callback1) { !pseudopc $2a7 {;;-(callback_e-callback1) {
callback1 callback1
ldx #<callback2 ldx #<callback2
lda #$8d lda #$8d