switch to smartport protocol for reading the device

This commit is contained in:
Kelvin Sherlock 2021-07-21 00:31:33 -04:00
parent c096f7e37c
commit c855701ffe
2 changed files with 68 additions and 50 deletions

View File

@ -12,8 +12,7 @@
string asis
blanks on
; smartport doesn't currently work ($28 no drive error because the unit isn't setup correctly?)
__smartport__ set 0
__smartport__ set 1
zp record 0
slot ds.w 1
@ -26,16 +25,7 @@ extents ds.b 3*HFSExtentDescriptor.sizeof
endr
if __smartport__ then
sp record $20
ReadBlock equ $01
pcount ds.b 1
unit ds.b 1
buffer ds.w 1
block ds.l 1 ; actually 24-bit
endr
else
if not __smartport__ then
pro record $42
cmd ds.b 1
@ -63,9 +53,7 @@ boot proc
dc.b $01 ; prodos boot id :D
if __smartport__ then
stx sp.unit
else
if not __smartport__ then
stx pro.unit
endif
txa
@ -113,10 +101,7 @@ boot proc
noboot brk $ea
ok
if __smartport__ then
lda #3
sta sp.pcount
else
if not __smartport__ then
lda #1 ; prodos read block
sta pro.cmd
endif
@ -131,13 +116,9 @@ ok
stz offset
stz bnum
stz count
lda #data
if __smartport__ then
sta sp.buffer
; stz sp.block ; will overwrite
stz sp.block+2
else
if not __smartport__ then
lda #data
sta pro.buffer
endif
lda #2
@ -264,12 +245,13 @@ found
sta extents+2
; now load the blocks and
lda #$2000
if __smartport__ then
sta sp.buffer
else
sta pro.buffer
endif
; lda #$2000
; if __smartport__ then
; sta sp.buffer
; else
; sta pro.buffer
; endif
stz bnum
@loop
lda bnum
@ -278,8 +260,9 @@ found
lda #512
clc
if __smartport__ then
adc sp.buffer
sta sp.buffer
import sp_buffer
adc sp_buffer
sta sp_buffer
else
adc pro.buffer
sta pro.buffer
@ -287,20 +270,34 @@ found
dec count
bne @loop
ldx slot
ldy vector
if __smartport__ then
lda sp.unit
else
if not __smartport__ then
ldx slot
lda pro.unit
endif
and #$00ff
endif
jmp $2000 ; kiss of life.
endp
if __smartport__ then
sp record
entry sp_buffer, sp_block
ReadBlock equ $01
pcount dc.b 3
unit dc.b 1 ; hard-coded
sp_buffer
buffer dc.w $2000
sp_block
block dc.l 1 ; actually 24-bit
endr
endif
read_block proc
entry read_block_abs

View File

@ -16,7 +16,7 @@
blanks on
__smartport__ set 0
__smartport__ set 1
buffer equ $3000
@ -41,17 +41,9 @@ file_id ds.l 1
endr
if __smartport__ then
sp record $20
ReadBlock equ $01
pcount ds.b 1
unit ds.b 1
buffer ds.w 1
block ds.l 1 ; actually 24-bit
endr
else
if not __smartport__ then
pro record $42
cmd ds.b 1
unit ds.b 1
@ -113,6 +105,16 @@ cat_str dcb.b 32, 0
endr
if __smartport__ then
sp record
ReadBlock equ $01
pcount dc.b 3
unit dc.b 1
buffer dc.w $3000 ; name conflict...
block dc.l 0 ; actually 24-bit
endr
endif
getbootname proc
; getbootname(GSString *)
@ -132,8 +134,10 @@ getbootname proc
plb
; get the volume name from the HFS MDB....
if not __smartport__ then
lda #buffer
sta pro.buffer
endif
lda #2
jsr read_block_abs
bcs exit
@ -237,8 +241,10 @@ readfile proc
beq rdone
stz r0 ; block
if not __smartport__ then
lda #buffer
sta pro.buffer
endif
; need to re-set cmd/slot as well?
@rloop
@ -974,12 +980,14 @@ startup proc
txs
if not __smartport__ then
lda #buffer
sta pro.buffer
short m
lda #1
sta pro.cmd
long m
endif
with HFSMasterDirectoryBlock
lda #2
@ -1104,15 +1112,24 @@ read
beq bad
lda #$6800
if __smartport__ then
sta sp.buffer
else
sta pro.buffer
endif
@loop lda r0
jsr read_file_block
bcs bad
lda pro.buffer
; clc
adc #512
lda #512
if __smartport__ then
adc sp.buffer
sta sp.buffer
else
adc pro.buffer
sta pro.buffer
endif
inc r0
dec blocks
bne @loop
@ -1122,7 +1139,11 @@ read
sta auxtype
lda #buffer
if __smartport__ then
sta sp.buffer
else
sta pro.buffer ; kind of important...
endif
lda #0
jmp $6800