disasm: Check Drive logic

This commit is contained in:
Joshua Bell 2018-12-27 11:52:15 -08:00
parent 9d9363110b
commit 2e09f2b9cc

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 L59A0 jsr cmd_check_single_drive
copy #0, menu_click_params::item_num copy #0, menu_click_params::item_num
rts rts
@ -407,18 +407,18 @@ dispatch_table:
;; (6 is duplicated to 5) ;; (6 is duplicated to 5)
;; no menu 7 ?? ;; Check menu (7) - obsolete
menu7_start := * menu7_start := *
.addr cmd_check_drives ; duplicate??? .addr cmd_check_drives
.addr cmd_noop ; -------- .addr cmd_noop ; --------
.addr L59A0 ; ??? .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
.addr L59A0 .addr cmd_check_single_drive
;; Startup menu (8) ;; Startup menu (8)
menu8_start := * menu8_start := *
@ -2131,7 +2131,7 @@ L5077: iny
L5084: ldx L5098 L5084: ldx L5098
lda $1800,x lda $1800,x
sta unit_number_to_refresh sta unit_number_to_refresh
jsr L59A8 jsr cmd_check_single_drive_C0
dec L5098 dec L5098
bpl L5084 bpl L5084
jmp redraw_windows_and_desktop jmp redraw_windows_and_desktop
@ -2494,7 +2494,7 @@ unit_number_to_refresh:
bne :+ bne :+
stx unit_number_to_refresh stx unit_number_to_refresh
jsr redraw_windows_and_desktop jsr redraw_windows_and_desktop
jsr L59A4 jsr cmd_check_single_drive_80
: jmp redraw_windows_and_desktop : jmp redraw_windows_and_desktop
fail: rts fail: rts
@ -2513,7 +2513,7 @@ fail: rts
stx unit_number_to_refresh stx unit_number_to_refresh
jsr redraw_windows_and_desktop jsr redraw_windows_and_desktop
jsr L59A4 jsr cmd_check_single_drive_80
done: jmp redraw_windows_and_desktop done: jmp redraw_windows_and_desktop
.endproc .endproc
@ -2606,7 +2606,7 @@ L5403: jsr close_window
L540E: ldx L5427 L540E: ldx L5427
L5411: lda L5428,x L5411: lda L5428,x
sta unit_number_to_refresh sta unit_number_to_refresh
jsr L59A8 jsr cmd_check_single_drive_C0
ldx L5427 ldx L5427
dec L5427 dec L5427
dex dex
@ -3301,23 +3301,34 @@ pending_alert:
.byte 0 .byte 0
;;; ============================================================ ;;; ============================================================
;;; Check > [drive] command - obsolete, but core still used
;;; following Format (etc)
L59A0: lda #$00 .proc cmd_check_single_drive
beq L59AA ;; Check Drive command
lda #$00
beq start
L59A4: lda #$80 ;; After format/erase
bne L59AA flag_80:
lda #$80
bne start
L59A8: lda #$C0 ;; After open/eject/rename
flag_C0:
lda #$C0
.proc L59AA start: sta check_drive_flags
sta L5AD0
copy #0, cached_window_id copy #0, cached_window_id
jsr DESKTOP_COPY_TO_BUF jsr DESKTOP_COPY_TO_BUF
bit L5AD0 bit check_drive_flags
bpl L59EA bpl explicit_command
bvc L59D2 bvc after_format_erase
;;; --------------------------------------------------
;;; After an Open/Eject/Rename action
;; Map unit number to icon number
lda unit_number_to_refresh lda unit_number_to_refresh
ldy #15 ldy #15
: cmp device_to_icon_map,y : cmp device_to_icon_map,y
@ -3325,39 +3336,55 @@ L59A8: lda #$C0
dey dey
bpl :- bpl :-
: sty L5AC6 : sty icon_num_to_refresh
sty menu_click_params::item_num sty menu_click_params::item_num
jmp L59F3 jmp common
L59D2: ldy DEVCNT ;;; --------------------------------------------------
;;; After a Format/Erase action
after_format_erase:
;; Map unit number to device index (???)
ldy DEVCNT
lda unit_number_to_refresh lda unit_number_to_refresh
L59D8: cmp DEVLST,y : cmp DEVLST,y
beq L59E1 beq :+
dey dey
bpl L59D8 bpl :-
iny iny
L59E1: sty L5AC6 : sty icon_num_to_refresh ; misnamed ???
sty menu_click_params::item_num sty menu_click_params::item_num
jmp L59F3 jmp common
L59EA: lda menu_click_params::item_num ;;; --------------------------------------------------
;;; Check Drive command
explicit_command:
;; Map menu number to item number
lda menu_click_params::item_num
sec sec
sbc #$03 sbc #3
sta menu_click_params::item_num sta menu_click_params::item_num
L59F3: ldy menu_click_params::item_num
;;; --------------------------------------------------
common:
ldy menu_click_params::item_num
lda device_to_icon_map,y lda device_to_icon_map,y
bne L59FE bne L59FE
jmp L5A4C jmp L5A4C
L59FE: jsr icon_entry_lookup L59FE: jsr icon_entry_lookup
addax #9, $06 addax #IconEntry::len, $06
ldy #$00
ldy #0
lda ($06),y lda ($06),y
tay tay
L5A10: lda ($06),y : lda ($06),y
sta $1F00,y sta $1F00,y
dey dey
bpl L5A10 bpl :-
dec $1F00 dec $1F00
lda #'/' lda #'/'
sta $1F00+1 sta $1F00+1
@ -3395,15 +3422,17 @@ L5A4C: jsr redraw_windows_and_desktop
jsr reset_grafport3 jsr reset_grafport3
DESKTOP_RELAY_CALL DT_REMOVE_ICON, icon_param DESKTOP_RELAY_CALL DT_REMOVE_ICON, icon_param
L5A7F: lda cached_window_icon_count L5A7F: lda cached_window_icon_count
sta L5AC6 sta icon_num_to_refresh
inc cached_window_icon_count inc cached_window_icon_count
inc icon_count inc icon_count
pla pla
tay tay
lda DEVLST,y lda DEVLST,y
jsr create_volume_icon jsr create_volume_icon
bit L5AD0 bit check_drive_flags
bmi L5AA9 bmi L5AA9
;; Explicit command
and #$FF and #$FF
beq L5AA9 beq L5AA9
cmp #'/' cmp #'/'
@ -3415,21 +3444,33 @@ L5A7F: lda cached_window_icon_count
rts rts
L5AA9: lda cached_window_icon_count L5AA9: lda cached_window_icon_count
cmp L5AC6 cmp icon_num_to_refresh
beq L5AC0 beq :+
ldx cached_window_icon_count ldx cached_window_icon_count
dex dex
lda cached_window_icon_list,x lda cached_window_icon_list,x
jsr icon_entry_lookup jsr icon_entry_lookup
ldy #DT_ADD_ICON ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X jsr DESKTOP_RELAY ; icon entry addr in A,X
L5AC0: jsr DESKTOP_COPY_FROM_BUF : jsr DESKTOP_COPY_FROM_BUF
jmp redraw_windows_and_desktop jmp redraw_windows_and_desktop
L5AC6: .res 10, 0 ;; For format/erase, this is index in DEVLST ???
L5AD0: .byte 0 icon_num_to_refresh:
.byte 0
L5AC7: .res 9, 0 ; ???
;;; 0 = command, $80 = format/erase, $C0 = open/eject/rename
check_drive_flags:
.byte 0
.endproc .endproc
cmd_check_single_drive_80 := cmd_check_single_drive::flag_80
cmd_check_single_drive_C0 := cmd_check_single_drive::flag_C0
;;; ============================================================ ;;; ============================================================
.proc cmd_startup_item .proc cmd_startup_item
@ -5922,7 +5963,7 @@ L72A8: .word 0
bne :+ bne :+
lda icon_params2 lda icon_params2
sta unit_number_to_refresh sta unit_number_to_refresh
jsr L59A8 jsr cmd_check_single_drive_C0
: ldx saved_stack : ldx saved_stack
txs txs
done: rts done: rts
@ -14945,9 +14986,13 @@ trash_name: PASCAL_STRING " Trash "
;;; ============================================================ ;;; ============================================================
;;; This removes particular devices from the device list. ;;; This removes particular devices from the device list.
;;; TODO: Figure out what/why ??? ;;; * SmartPort devices
;;; * Mapped to Drive 2
;;; * Removable
;;; * With only one actual device present (per STATUS call)
;;; ... but why???
.proc filter_volumes .proc filter_devices
ptr := $06 ptr := $06
lda DEVCNT lda DEVCNT
@ -15387,14 +15432,14 @@ end:
ldy #0 ldy #0
sty desktop_main::pending_alert sty desktop_main::pending_alert
sty volume_num sty device_index
process_volume: process_volume:
lda volume_num lda device_index
asl a asl a
tay tay
copy16 device_name_table,y, devname_ptr copy16 device_name_table,y, devname_ptr
ldy volume_num ldy device_index
lda DEVLST,y lda DEVLST,y
pha ; save all registers pha ; save all registers
@ -15419,15 +15464,15 @@ process_volume:
pha pha
lda cvi_result lda cvi_result
cmp #ERR_DEVICE_NOT_CONNECTED cmp #ERR_DEVICE_NOT_CONNECTED
bne L0D64 bne :+
ldy volume_num ldy device_index
lda DEVLST,y lda DEVLST,y
and #$0F and #$0F
beq select_template beq select_template
ldx volume_num ldx device_index
jsr remove_device jsr remove_device
jmp next jmp next
L0D64: cmp #ERR_DUPLICATE_VOLUME : cmp #ERR_DUPLICATE_VOLUME
bne select_template bne select_template
lda #ERR_DUPLICATE_VOL_NAME lda #ERR_DUPLICATE_VOL_NAME
sta desktop_main::pending_alert sta desktop_main::pending_alert
@ -15611,8 +15656,8 @@ write: sta (devname_ptr),y
done_drive_num: done_drive_num:
pla pla
inc volume_num inc device_index
next: lda volume_num next: lda device_index
cmp DEVCNT ; done? cmp DEVCNT ; done?
beq :+ beq :+
@ -15621,7 +15666,7 @@ next: lda volume_num
unit_number_lo_nibble: unit_number_lo_nibble:
.byte 0 .byte 0
volume_num: device_index:
.byte 0 .byte 0
cvi_result: cvi_result:
.byte 0 .byte 0
@ -15632,12 +15677,12 @@ cvi_result:
;; Remove device num in X from devices list ;; Remove device num in X from devices list
.proc remove_device .proc remove_device
dex dex
L0E36: inx : inx
copy DEVLST+1,x, DEVLST,x copy DEVLST+1,x, DEVLST,x
lda device_to_icon_map+1,x lda device_to_icon_map+1,x
sta device_to_icon_map,x sta device_to_icon_map,x
cpx DEVCNT cpx DEVCNT
bne L0E36 bne :-
dec DEVCNT dec DEVCNT
rts rts
.endproc .endproc