disasm: Check Drive logic

This commit is contained in:
Joshua Bell 2018-12-27 18:40:56 -08:00
parent 37db92bd47
commit 59a9b2e16c

View File

@ -159,7 +159,7 @@ loop_counter:
L40E0: tsx L40E0: tsx
stx saved_stack stx saved_stack
sta menu_click_params::item_num sta menu_click_params::item_num
jsr cmd_check_single_drive jsr cmd_check_single_drive_by_menu
copy #0, menu_click_params::item_num copy #0, menu_click_params::item_num
rts rts
@ -414,14 +414,14 @@ dispatch_table:
menu7_start := * menu7_start := *
.addr cmd_check_drives .addr cmd_check_drives
.addr cmd_noop ; -------- .addr cmd_noop ; --------
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
.addr cmd_check_single_drive .addr cmd_check_single_drive_by_menu
;; Startup menu (8) ;; Startup menu (8)
menu8_start := * menu8_start := *
@ -2133,8 +2133,8 @@ L5077: iny
jsr jt_eject jsr jt_eject
L5084: ldx L5098 L5084: ldx L5098
lda $1800,x lda $1800,x
sta unit_number_to_refresh sta drive_to_refresh ; icon number
jsr cmd_check_single_drive_C0 jsr cmd_check_single_drive_by_icon_number
dec L5098 dec L5098
bpl L5084 bpl L5084
jmp redraw_windows_and_desktop jmp redraw_windows_and_desktop
@ -2481,8 +2481,10 @@ done: jsr DESKTOP_COPY_FROM_BUF
;;; ============================================================ ;;; ============================================================
;; Set after format, erase, failed open, etc. ;;; Set after format, erase, failed open, etc.
unit_number_to_refresh: ;;; Used by 'cmd_check_single_drive_by_XXX'; may be unit number
;;; or device index depending on call site.
drive_to_refresh:
.byte 0 .byte 0
;;; ============================================================ ;;; ============================================================
@ -2495,9 +2497,9 @@ unit_number_to_refresh:
lda #$04 lda #$04
jsr dynamic_routine_800 jsr dynamic_routine_800
bne :+ bne :+
stx unit_number_to_refresh stx drive_to_refresh ; unit number
jsr redraw_windows_and_desktop jsr redraw_windows_and_desktop
jsr cmd_check_single_drive_80 jsr cmd_check_single_drive_by_unit_number
: jmp redraw_windows_and_desktop : jmp redraw_windows_and_desktop
fail: rts fail: rts
@ -2514,9 +2516,9 @@ fail: rts
jsr dynamic_routine_800 jsr dynamic_routine_800
bne done bne done
stx unit_number_to_refresh stx drive_to_refresh ; unit number
jsr redraw_windows_and_desktop jsr redraw_windows_and_desktop
jsr cmd_check_single_drive_80 jsr cmd_check_single_drive_by_unit_number
done: jmp redraw_windows_and_desktop done: jmp redraw_windows_and_desktop
.endproc .endproc
@ -2572,7 +2574,7 @@ loop: lda selected_icon_list,x
sta selected_vol_icon_list,y sta selected_vol_icon_list,y
iny iny
: inx : inx
cpx selected_icon_list cpx selected_icon_list ; BUG: Should be selected_icon_count
bne loop bne loop
sty selected_vol_icon_count sty selected_vol_icon_count
@ -2619,9 +2621,9 @@ L5403: jsr close_window
finish_with_vols: finish_with_vols:
ldx selected_vol_icon_count ldx selected_vol_icon_count
: lda selected_vol_icon_list,x : lda selected_vol_icon_list,x ; BUG: off by one?
sta unit_number_to_refresh sta drive_to_refresh ; icon number
jsr cmd_check_single_drive_C0 jsr cmd_check_single_drive_by_icon_number
ldx selected_vol_icon_count ldx selected_vol_icon_count
dec selected_vol_icon_count dec selected_vol_icon_count
dex dex
@ -3323,19 +3325,22 @@ pending_alert:
;;; ============================================================ ;;; ============================================================
;;; Check > [drive] command - obsolete, but core still used ;;; Check > [drive] command - obsolete, but core still used
;;; following Format (etc) ;;; following Format (etc)
;;;
.proc cmd_check_single_drive .proc cmd_check_single_drive
;; Check Drive command ;; Check Drive command
by_menu:
lda #$00 lda #$00
beq start beq start
;; After format/erase ;; After format/erase
flag_80: by_unit_number:
lda #$80 lda #$80
bne start bne start
;; After open/eject/rename ;; After open/eject/rename
flag_C0: by_icon_number:
lda #$C0 lda #$C0
start: sta check_drive_flags start: sta check_drive_flags
@ -3348,8 +3353,8 @@ start: sta check_drive_flags
;;; -------------------------------------------------- ;;; --------------------------------------------------
;;; After an Open/Eject/Rename action ;;; After an Open/Eject/Rename action
;; Map unit number to icon number ;; Map icon number to index in DEVLST
lda unit_number_to_refresh lda drive_to_refresh
ldy #15 ldy #15
: cmp device_to_icon_map,y : cmp device_to_icon_map,y
beq :+ beq :+
@ -3364,9 +3369,9 @@ start: sta check_drive_flags
;;; After a Format/Erase action ;;; After a Format/Erase action
after_format_erase: after_format_erase:
;; Map unit number to device index (???) ;; Map unit number to index in DEVLST
ldy DEVCNT ldy DEVCNT
lda unit_number_to_refresh lda drive_to_refresh
: cmp DEVLST,y : cmp DEVLST,y
beq :+ beq :+
dey dey
@ -3487,8 +3492,9 @@ check_drive_flags:
.endproc .endproc
cmd_check_single_drive_80 := cmd_check_single_drive::flag_80 cmd_check_single_drive_by_menu := cmd_check_single_drive::by_menu
cmd_check_single_drive_C0 := cmd_check_single_drive::flag_C0 cmd_check_single_drive_by_unit_number := cmd_check_single_drive::by_unit_number
cmd_check_single_drive_by_icon_number := cmd_check_single_drive::by_icon_number
;;; ============================================================ ;;; ============================================================
@ -5982,8 +5988,8 @@ L72A8: .word 0
lda selected_window_index lda selected_window_index
bne :+ bne :+
lda icon_params2 lda icon_params2
sta unit_number_to_refresh sta drive_to_refresh ; icon number
jsr cmd_check_single_drive_C0 jsr cmd_check_single_drive_by_icon_number
: ldx saved_stack : ldx saved_stack
txs txs
done: rts done: rts