Device names

This commit is contained in:
Joshua Bell 2018-12-20 09:33:52 -08:00
parent 81c65f7fff
commit 45cb968904
3 changed files with 146 additions and 67 deletions

View File

@ -14872,12 +14872,12 @@ end:
;; Does the directory exist?
MLI_RELAY_CALL GET_FILE_INFO, get_file_info_params
beq :+
jmp populate_volume_icons
jmp populate_volume_icons_and_device_names
: lda get_file_info_type
cmp #FT_DIRECTORY
beq open_dir
jmp populate_volume_icons
jmp populate_volume_icons_and_device_names
open_dir:
MLI_RELAY_CALL OPEN, open_params
@ -15037,7 +15037,9 @@ end:
;;; TODO: Dedupe with cmd_check_drives
.proc populate_volume_icons
.proc populate_volume_icons_and_device_names
devname_ptr := $08
ldy #0
sty desktop_main::pending_alert
sty volume_num
@ -15046,7 +15048,7 @@ process_volume:
lda volume_num
asl a
tay
copy16 slot_drive_string_table,y, $08
copy16 device_name_table,y, devname_ptr
ldy volume_num
lda DEVLST,y
@ -15085,13 +15087,31 @@ L0D64: cmp #ERR_DUPLICATE_VOLUME
lda #$F9 ; "... 2 volumes with the same name..."
sta desktop_main::pending_alert
;; This section populates slot_drive_string_table -
;; This section populates device_name_table -
;; it determines which device type string to use, and
;; fills in slot and drive as appropriate.
;;
;; This is for a "Check" menu present in MouseDesk 1.1
;; but which was removed in MouseDesk 2.0, which allowed
;; refreshing individual windows.
;; refreshing individual windows. It is also used in the
;; Format/Erase disk dialog.
;;
;; The code is particularly strange, as it attempts
;; device identification *three* times: once to figure
;; out the template string, again to figure out
;; where in the template to put the slot #, and again
;; to figure out where to put the drive number. This
;; leads to mis-matches e.g. in Virtual II where the
;; "Disk II" and "OmniDisk" devices end up with different
;; offsets for the same string.
;;
;; Five device types are assumed by analyzing the low
;; nibble of the unit number (per ProDOS 8 TRM, but
;; contrary to ProDOS Tech; Note #21):
;; * $0 = Disk II
;; * $4 = Fixed disk: determines ProFile or RAM disk
;; * $B = Removalble disk: assumes UniDisk
;; * "other"
.proc select_template
pla
@ -15100,12 +15120,17 @@ L0D64: cmp #ERR_DUPLICATE_VOLUME
sta unit_number_lo_nibble
cmp #DT_DISKII
bne :+
;; Disk II: Use default slot/drive template
addr_jump copy_template, str_slot_drive
: cmp #DT_REMOVABLE
beq is_removable
cmp #DT_PROFILE
bne L0DC2
bne skip_template ; unknown, use default
;; Fixed disk: either ProFile or RAM disk
pla
pha
and #$70 ; Compute $CnFB
@ -15119,28 +15144,41 @@ L0D64: cmp #ERR_DUPLICATE_VOLUME
lda $C7FB ; self-modified
and #$01 ; is RAM card?
bne :+
;; ProFile
addr_jump copy_template, str_profile_slot_x
;; RAM disk
: addr_jump copy_template, str_ramcard_slot_x
is_removable:
;; Removable (UniDisk)
ldax #str_unidisk_xy
.endproc
copy_template: stax $06
.proc copy_template
src := $06
stax src
ldy #$00
lda ($06),y
lda (src),y
sta @compare
: iny
lda ($06),y
sta ($08),y
lda (src),y
sta (devname_ptr),y
@compare := *+1
cpy #0
bne :-
tay
L0DC2: pla
.endproc
tay ; ???
skip_template:
pla
pha
.scope
;; Update string with Slot #
;; A has unit number
and #$70 ; slot (from DSSSxxxx)
lsr a
@ -15154,6 +15192,7 @@ L0DC2: pla
cmp #DT_PROFILE
bne check_removable
;; Fixed disk: either ProFile or RAM disk
;; A has unit number (again)
pla
pha
@ -15166,33 +15205,43 @@ L0DC2: pla
sta @msb
@msb := *+2
lda $C7FB ; self-modified
and #$01 ; bit 0 = is RAM disk?
and #%00000001 ; bit 0 = is RAM disk?
bne is_ram_disk
ldy #$0E
bne L0DFA ; always
;; ProFile
ldy #profile_slot_x_offset
bne write ; always
;; RAM disk
is_ram_disk:
ldy #$0E
bne L0DFA ; always
ldy #ramcard_slot_x_offset
bne write ; always
check_removable:
cmp #DT_REMOVABLE
bne :+
ldy #$0F
bne L0DFA ; always
;; Removable: UniDisk
ldy #unidisk_xy_x_offset
bne write ; always
: ldy #$06
;; Default (either Disk II or Unknown)
: ldy #slot_drive_x_offset
L0DFA: txa
sta ($08),y
write: txa
sta (devname_ptr),y
.endscope
.scope
;; Update string with Drive #
lda unit_number_lo_nibble
and #$0F
and #$0F ; low nibble of unit number (unnecessary!)
cmp #DT_PROFILE
beq L0E21
beq done_drive_num ; no drive # for fixed disk (ProFile or RAM disk)
pla
pha
;; Compute '1' or '2'
rol a ; set carry to drive - 1
lda #0
adc #1 ; drive = 1 or 2
@ -15200,15 +15249,23 @@ L0DFA: txa
pha
lda unit_number_lo_nibble
and #DT_RAM
bne L0E1C
ldy #$10
and #$0F ; low nibble of unit number (unnecessary!)
bne :+
;; Disk II
ldy #slot_drive_y_offset
pla
bne L0E1F ; always
L0E1C: ldy #$11
bne write ; always
;; Removable (Unidisk) or Otherwise
: ldy #unidisk_xy_y_offset ; Minor bug: off-by-one for unknown types
pla
write: sta (devname_ptr),y
.endscope
done_drive_num:
pla
L0E1F: sta ($08),y
L0E21: pla
inc volume_num
next: lda volume_num

View File

@ -862,9 +862,9 @@ file_to_delete_label:
;;; ============================================================
slot_drive_string_table:
.addr sd0s, sd1s, sd2s, sd3s, sd4s, sd5s, sd6s
.addr sd7s, sd8s, sd9s, sd10s, sd11s, sd12s, sd13s
device_name_table:
.addr dev0s, dev1s, dev2s, dev3s, dev4s, dev5s, dev6s
.addr dev7s, dev8s, dev9s, dev10s, dev11s, dev12s, dev13s
selector_menu_addr:
.addr selector_menu
@ -1026,24 +1026,25 @@ disable: .byte 0
LE26F: .byte $00
;;; Unused - present in MouseDesk 1.1 but not 2.0 or A2D
check_menu:
DEFINE_MENU 4
DEFINE_MENU_ITEM str_all
DEFINE_MENU_SEPARATOR
DEFINE_MENU_ITEM sd0s
DEFINE_MENU_ITEM sd1s
DEFINE_MENU_ITEM sd2s
DEFINE_MENU_ITEM sd3s
DEFINE_MENU_ITEM sd4s
DEFINE_MENU_ITEM sd5s
DEFINE_MENU_ITEM sd6s
DEFINE_MENU_ITEM sd7s
DEFINE_MENU_ITEM sd8s
DEFINE_MENU_ITEM sd9s
DEFINE_MENU_ITEM sd10s
DEFINE_MENU_ITEM sd11s
DEFINE_MENU_ITEM sd12s
DEFINE_MENU_ITEM sd13s
DEFINE_MENU_ITEM dev0s
DEFINE_MENU_ITEM dev1s
DEFINE_MENU_ITEM dev2s
DEFINE_MENU_ITEM dev3s
DEFINE_MENU_ITEM dev4s
DEFINE_MENU_ITEM dev5s
DEFINE_MENU_ITEM dev6s
DEFINE_MENU_ITEM dev7s
DEFINE_MENU_ITEM dev8s
DEFINE_MENU_ITEM dev9s
DEFINE_MENU_ITEM dev10s
DEFINE_MENU_ITEM dev11s
DEFINE_MENU_ITEM dev12s
DEFINE_MENU_ITEM dev13s
startup_menu:
DEFINE_MENU 7
@ -1057,20 +1058,23 @@ startup_menu:
str_all:PASCAL_STRING "All"
sd0: DEFINE_STRING "Slot drive ", sd0s
sd1: DEFINE_STRING "Slot drive ", sd1s
sd2: DEFINE_STRING "Slot drive ", sd2s
sd3: DEFINE_STRING "Slot drive ", sd3s
sd4: DEFINE_STRING "Slot drive ", sd4s
sd5: DEFINE_STRING "Slot drive ", sd5s
sd6: DEFINE_STRING "Slot drive ", sd6s
sd7: DEFINE_STRING "Slot drive ", sd7s
sd8: DEFINE_STRING "Slot drive ", sd8s
sd9: DEFINE_STRING "Slot drive ", sd9s
sd10: DEFINE_STRING "Slot drive ", sd10s
sd11: DEFINE_STRING "Slot drive ", sd11s
sd12: DEFINE_STRING "Slot drive ", sd12s
sd13: DEFINE_STRING "Slot drive ", sd13s
;;; ============================================================
;;; Device Names (populated at startup using templates below)
dev0: DEFINE_STRING "Slot drive ", dev0s
dev1: DEFINE_STRING "Slot drive ", dev1s
dev2: DEFINE_STRING "Slot drive ", dev2s
dev3: DEFINE_STRING "Slot drive ", dev3s
dev4: DEFINE_STRING "Slot drive ", dev4s
dev5: DEFINE_STRING "Slot drive ", dev5s
dev6: DEFINE_STRING "Slot drive ", dev6s
dev7: DEFINE_STRING "Slot drive ", dev7s
dev8: DEFINE_STRING "Slot drive ", dev8s
dev9: DEFINE_STRING "Slot drive ", dev9s
dev10: DEFINE_STRING "Slot drive ", dev10s
dev11: DEFINE_STRING "Slot drive ", dev11s
dev12: DEFINE_STRING "Slot drive ", dev12s
dev13: DEFINE_STRING "Slot drive ", dev13s
startup_menu_item_1: PASCAL_STRING "Slot 0 "
startup_menu_item_2: PASCAL_STRING "Slot 0 "
@ -1080,17 +1084,35 @@ startup_menu_item_5: PASCAL_STRING "Slot 0 "
startup_menu_item_6: PASCAL_STRING "Slot 0 "
startup_menu_item_7: PASCAL_STRING "Slot 0 "
.addr sd0, sd1, sd2, sd3, sd4, sd5, sd6, sd7
.addr sd8, sd9, sd10, sd11, sd12, sd13
;; Unused???
.addr dev0, dev1, dev2, dev3, dev4, dev5, dev6, dev7
.addr dev8, dev9, dev10, dev11, dev12, dev13
;;; Templates used for device names
;;; Fixed drives that aren't RAM disks
str_profile_slot_x:
PASCAL_STRING "ProFile Slot x "
profile_slot_x_offset = 14
;;; Removable drives
str_unidisk_xy:
PASCAL_STRING "UniDisk 3.5 Sx,y "
unidisk_xy_x_offset = 15
unidisk_xy_y_offset = 17
;;; RAM disks
str_ramcard_slot_x:
PASCAL_STRING "RAMCard Slot x "
ramcard_slot_x_offset = 14
;;; Disk II and unknown devices
str_slot_drive:
PASCAL_STRING "Slot drive "
slot_drive_x_offset = 6
slot_drive_y_offset = 16 ; off by 1 ???
;;; ============================================================
selector_menu:
DEFINE_MENU 5

View File

@ -450,9 +450,9 @@ L0D5A: stax dialog_label_pos
L0D60: lda L0D8C
asl a
tay
lda slot_drive_string_table+1,y
lda device_name_table+1,y
tax
lda slot_drive_string_table,y
lda device_name_table,y
pha
lda L0D8C
lsr a