ProDOS protocol status values.

This commit is contained in:
Eric Smith
2018-03-06 11:49:24 -07:00
parent 86f8f8183d
commit ab08429603

View File

@@ -23,6 +23,13 @@ fcchz macro string
endm endm
; ProDOS protocol status
p_stat_io_err equ $27
p_stat_no_dev equ $28
p_stat_wprot equ $2b
p_stat_offline equ $2f
; SmartPort bus commands ; SmartPort bus commands
sp_cmd_status equ $00 sp_cmd_status equ $00
sp_cmd_readblk equ $01 ; block device only sp_cmd_readblk equ $01 ; block device only
@@ -76,13 +83,14 @@ Z5b equ $5b ; packet type
; per-slot screen holes (index by slot) ; per-slot screen holes (index by slot)
sh_prodos_flag equ $0478 ; MSB = 1 for ProDOS, 0 for SmartPort sh_prodos_flag equ $0478 ; MSB = 1 for ProDOS, 0 for SmartPort
sh_04f8 equ $04f8 sh_retry_cnt_l equ $04f8
sh_0578 equ $0578 sh_retry_cnt_h equ $0578
sh_status_save equ $0578 ; save status flag during return sequence
sh_05f8 equ $05f8 sh_05f8 equ $05f8
sh_0678 equ $0678 sh_0678 equ $0678
sh_magic1 equ $06f8 ; $a5 if firmware initialized sh_magic1 equ $06f8 ; $a5 if firmware initialized
sh_magic2 equ $0778 ; $5a if firmware initialized sh_magic2 equ $0778 ; $5a if firmware initialized
unit_count equ $07f8 sh_unit_count equ $07f8
; global screen holes - undocumented ; global screen holes - undocumented
@@ -724,9 +732,9 @@ Sca76: jsr Sca8a
Sca8a: lda #3000 & $ff ; retry 3000 times! Sca8a: lda #3000 & $ff ; retry 3000 times!
ldy #3000 >> 8 ldy #3000 >> 8
ldx slot ldx slot
sta sh_04f8,x sta sh_retry_cnt_l,x
tya tya
sta sh_0578,x sta sh_retry_cnt_h,x
Lca97: lda Z4d Lca97: lda Z4d
sta gh_06f8 sta gh_06f8
@@ -743,27 +751,29 @@ Lca97: lda Z4d
bcc Lcabc ; if no error, done bcc Lcabc ; if no error, done
ldx slot ; decrement retry count ldx slot ; decrement retry count
dec sh_04f8,x dec sh_retry_cnt_l,x
bne Lca97 bne Lca97
dec sh_0578,x dec sh_retry_cnt_h,x
bpl Lca97 bpl Lca97
Lcabc: rts Lcabc: rts
Scabd: ldy slot smartport_bus_read_packet_with_retries:
ldy slot
lda #$05 lda #$05
sta sh_04f8,y sta sh_retry_cnt_l,y
Lcac4: jsr smartport_bus_read_packet Lcac4: jsr smartport_bus_read_packet
bcc Lcad8 bcc Lcad8 ; good?
ldy #1 ldy #1
jsr delay_y_ms jsr delay_y_ms
jsr Sc93d jsr Sc93d
ldx slot ldx slot
dec sh_04f8,x dec sh_retry_cnt_l,x
bne Lcac4 bne Lcac4
Lcad8: rts Lcad8: rts
@@ -1071,7 +1081,7 @@ Lcc92: txa
Lcca0: sta (prodos_buffer),y Lcca0: sta (prodos_buffer),y
dey dey
bne Lcca0 bne Lcca0
lda unit_count,x lda sh_unit_count,x
sta (prodos_buffer),y sta (prodos_buffer),y
iny iny
lda #$00 lda #$00
@@ -1096,7 +1106,7 @@ Lcccb: lda #$1f
; ProDOS ; ProDOS
Lcccf: lda #$28 Lcccf: lda #$28
ldy slot ldy slot
ldx unit_count,y ldx sh_unit_count,y
cpx prodos_unit_num cpx prodos_unit_num
bcc Lccc5 bcc Lccc5
@@ -1178,16 +1188,20 @@ Lcd60: ldy slot
lda prodos_command lda prodos_command
bne Lcd73 bne Lcd73
lda #$45 lda #$45
ldx #$00 ldx #$00
sta Z54 sta Z54
stx Z54+1 stx Z54+1
Lcd73: jsr Scabd Lcd73: jsr smartport_bus_read_packet_with_retries
bcs Lcd5c bcs Lcd5c
jsr Scbbf jsr Scbbf
jsr Sce4f jsr Sce4f
lda prodos_command lda prodos_command
bne Lcd9d bne Lcd9d
ldx slot ldx slot
lda sh_prodos_flag,x ; ProDOS or SmartPort? lda sh_prodos_flag,x ; ProDOS or SmartPort?
bpl Lcd9d bpl Lcd9d
@@ -1207,7 +1221,7 @@ Lcd73: jsr Scabd
Lcd9d: lda Z4d Lcd9d: lda Z4d
Lcd9f: ldy slot Lcd9f: ldy slot
sta sh_04f8,y sta sh_retry_cnt_l,y ; not being used as retry count here?
tax tax
beq Lcdc1 beq Lcdc1
@@ -1218,19 +1232,19 @@ Lcd9f: ldy slot
cmp #$40 cmp #$40
bcs Lcdc0 bcs Lcdc0
ldx #$27 ldx #p_stat_io_err
cmp #$2b cmp #p_stat_wprot
beq Lcdc1 beq Lcdc1
cmp #$28 cmp #p_stat_no_dev
beq Lcdc1 beq Lcdc1
cmp #$2f cmp #p_stat_offline
beq Lcdc1 beq Lcdc1
Lcdc0: txa Lcdc0: txa
Lcdc1: ldy slot Lcdc1: ldy slot
sta sh_0578,y sta sh_status_save,y
; restore zero page $40..$5b from stack ; restore zero page $40..$5b from stack
ldx #$00 ldx #$00
@@ -1243,7 +1257,7 @@ Lcdc8: pla
plp plp
lda sh_05f8,y lda sh_05f8,y
tax tax
lda sh_0578,y lda sh_status_save,y
pha pha
lda sh_0678,y lda sh_0678,y
tay tay
@@ -1303,7 +1317,7 @@ Lce2d: jsr smartport_bus_read_packet
Lce34: lda Z5a Lce34: lda Z5a
ldy slot ldy slot
sta unit_count,y sta sh_unit_count,y
pla pla
sta prodos_block sta prodos_block
@@ -1382,7 +1396,7 @@ Lcea4: ldx #23 ; bottom line of display
sta mon_ch sta mon_ch
ldx #$00 ldx #$00
ldy slot ldy slot
lda sh_04f8,y lda sh_retry_cnt_l,y ; not being used as retry count here?
bne Lceba bne Lceba
ldx #msg_not_bootable - msg_tab ldx #msg_not_bootable - msg_tab
Lceba: cmp #$28 Lceba: cmp #$28