Show Apple icon for Desk Accessory files, allow running (Fixes #101. Fixes #116.)

This commit is contained in:
Joshua Bell 2019-01-21 20:58:49 -08:00
parent 18f6a07216
commit b6bcb03a04
8 changed files with 130 additions and 66 deletions

View File

@ -18,12 +18,13 @@ https://github.com/inexorabletash/a2d/issues
* Add Special > Check Drive command to refresh a single drive. (#97)
* Show Text File DA: Keyboard support. Escape quits, arrows scroll. (#4)
* Reorganized/renamed several menu items. (#13)
* New icons for graphics, AppleWorks, relocatable, command, and IIgs-specific file types. (#105)
* New icons for graphics, AppleWorks, relocatable, command, IIgs-specific file types, and DAs. (#105)
* Desktop icon shown for AppleTalk file shares. (#88)
* Improvements to several existing icon bitmaps. (#74)
* DAs with high bit in aux-type set are skipped. (#102)
* Desk accessory files with high bit in aux-type set are hidden in Apple menu. (#102)
* Icons for volumes positioned more predictably and sensibly. (#94)
* GS/OS filenames (supported by ProDOS 2.5) are shown with correct case. (#64)
* Desk accessory files can be executed directly. (#101)
### Additional Desk Accessories

View File

@ -14,27 +14,14 @@
;;; ============================================================
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HideCursor, 0
jsr hilite_menu
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
jsr dump_screen
jsr hilite_menu
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::ShowCursor, 0
rts
;;; ============================================================
.proc hilite_menu
;; Use zero page, which is visible from MGTK
menu_click_menu_id := $6
lda #1 ; ID of Apple menu
sta menu_click_menu_id
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, menu_click_menu_id
rts
.endproc
;;; ============================================================
.proc dump_screen
SLOT1 := $C100

View File

@ -12,6 +12,7 @@ VERSION_MINOR = 2
.define VERSION_SUFFIX "-alpha1"
DA_FILE_TYPE = $F1
DA_AUX_TYPE = $640 ; High bit set = don't show in Apple menu
max_desk_acc_count = 12
@ -168,6 +169,8 @@ path_table := $DFB3 ; window address table
selected_file_list := $DF22 ; indexes of selected file (global, not w/in window, up to 127)
file_table := $DD9F ; file address table
last_menu_click_params := $E23D
;;; Icon (file/volume) entries - length 27 bytes, maximum of 127
;;; .byte icon icon index
;;; .byte state $80 = highlighted, 0 = otherwise
@ -296,5 +299,5 @@ GLYPH_SAPPLE = $1E
modification_time .word ; 25 $19
access .byte ; 27 $1B
header_pointer .word ; 28 $1C
reserved .word ; ???
aux_type .word ; 30 $1E
.endstruct

View File

@ -150,6 +150,61 @@ rel_file_icon:
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
;; shares binary_mask
a2d_file_icon:
.byte px(%0111111),px(%1111111),px(%1111111),px(%0000000)
.byte px(%0100000),px(%0000000),px(%0000100),px(%1100000)
.byte px(%0100000),px(%0000000),px(%0000100),px(%0011000)
.byte px(%0100000),px(%0000000),px(%0000100),px(%0000110)
.byte px(%0100000),px(%0000000),px(%0000111),px(%1111110)
.byte px(%0100000),px(%0000000),px(%1100000),px(%0000010)
.byte px(%0100000),px(%0000001),px(%1000000),px(%0000010)
.byte px(%0100000),px(%0011100),px(%0111000),px(%0000010)
.byte px(%0100000),px(%1111111),px(%1111110),px(%0000010)
.byte px(%0100001),px(%1111111),px(%1110000),px(%0000010)
.byte px(%0100001),px(%1111111),px(%1110000),px(%0000010)
.byte px(%0100001),px(%1111111),px(%1111110),px(%0000010)
.byte px(%0100000),px(%1111111),px(%1111100),px(%0000010)
.byte px(%0100000),px(%0111100),px(%1111000),px(%0000010)
.byte px(%0100000),px(%0000000),px(%0000000),px(%0000010)
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111110)
;; shares generic_mask
;;; Basic
basic_icon:
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000110),px(%0110000),px(%0000000)
.byte px(%0000000),px(%0011000),px(%0001100),px(%0000000)
.byte px(%0000000),px(%1100000),px(%0000011),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0111110),px(%0111000),px(%1111010),px(%0111100)
.byte px(%0100010),px(%1000100),px(%1000010),px(%1000110)
.byte px(%0111100),px(%1111100),px(%1111010),px(%1000000)
.byte px(%0100010),px(%1000100),px(%0001010),px(%1000110)
.byte px(%0111110),px(%1000100),px(%1111010),px(%0111100)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%1100000),px(%0000011),px(%0000000)
.byte px(%0000000),px(%0011000),px(%0001100),px(%0000000)
.byte px(%0000000),px(%0000110),px(%0110000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
basic_mask:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000111),px(%1110000),px(%0000000)
.byte px(%0000000),px(%0011111),px(%1111100),px(%0000000)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%0000000),px(%0011111),px(%1111100),px(%0000000)
.byte px(%0000000),px(%0000111),px(%1110000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
PAD_TO $8800
;;; ============================================================

View File

@ -942,6 +942,10 @@ begin:
bne :+
addr_jump invoke_desk_acc, str_preview_txt
: cmp #DA_FILE_TYPE
bne :+
addr_jump invoke_desk_acc, path
: lda #ERR_FILE_NOT_OPENABLE
jsr show_alert_and_fail
@ -5966,6 +5970,16 @@ L7223: iny
iny
lda (entry_ptr),y
sta record,x
inx
;; aux type
ldy #FileEntry::aux_type
lda (entry_ptr),y
sta record,x
inx
iny
lda (entry_ptr),y
sta record,x
;; Copy entry composed at $1F00 to buffer in Aux LC Bank 2
lda LCBANK2
@ -6529,8 +6543,8 @@ L7767: .byte $14
lda LCBANK2
;; Copy the name (offset by 2 for count and leading space)
ldy #FileEntry::storage_type_name_length
lda (file_entry),y ; assumes storage type is 0 ???
ldy #FileRecord::name
lda (file_entry),y
sta name_tmp
iny
ldx #0
@ -6549,7 +6563,7 @@ L7767: .byte $14
sta name_tmp,x ; trailing space
;; Check file type
ldy #FileEntry::file_type
ldy #FileRecord::file_type
lda (file_entry),y
cmp #FT_S16 ; IIgs System?
@ -6568,16 +6582,30 @@ L7767: .byte $14
beq is_iigs
txa
;; FT_BAD is overloaded, so use generic
cmp #FT_BAD ; T$01 is overloaded below for "apps", so
bne :+ ; treat as generic
lda #FT_TYPELESS
beq is_generic ; treat as generic
;; DA_FILE_TYPE also requires correct AUX type
cmp #DA_FILE_TYPE ; Apple Menu item?
bne :+
ldy #FileRecord::aux_type
lda (file_entry),y ; Must have correct aux type, otherwise
cmp #<DA_AUX_TYPE ; treat as generic
bne is_generic
iny
lda (file_entry),y
and #%01111111 ; ignore high bit (set = don't show in menu)
cmp #>DA_AUX_TYPE
bne is_generic
lda #DA_FILE_TYPE
: cmp #FT_SYSTEM ; Other system?
bne got_type ; nope
;; Distinguish *.SYSTEM files as apps (use $01) from other
;; type=SYS files (use $FF).
ldy #FileEntry::storage_type_name_length
ldy #FileRecord::name
lda (file_entry),y
tay
ldx str_sys_suffix
@ -6594,15 +6622,20 @@ is_app:
lda #FT_BAD ; overloaded meaning in icon tables
bne got_type ; always
is_generic:
lda #FT_TYPELESS
beq got_type ; always
is_iigs:
lda #FT_SRC
bne got_type
bne got_type ; always
str_sys_suffix:
PASCAL_STRING ".SYSTEM"
not_app:
lda #$FF
;; fall through
got_type:
tay

View File

@ -1004,6 +1004,7 @@ tmp_rect:
saved_stack:
.byte 0
.assert * = last_menu_click_params, error, "Entry point mismatch"
.proc menu_click_params
menu_id:.byte 0
item_num:.byte 0
@ -1377,7 +1378,7 @@ icon_entries:
.org $FB00
num_file_types = 14
num_file_types = 15
type_table:
.byte FT_TYPELESS ; typeless
@ -1393,6 +1394,7 @@ type_table:
.byte FT_ADB ; appleworks db
.byte FT_AWP ; appleworks wp
.byte FT_ASP ; appleworks sp
.byte DA_FILE_TYPE ; desk accessory
.byte FT_BAD ; bad block
type_names_table:
@ -1409,6 +1411,7 @@ type_names_table:
.byte " ADB" ; appleworks db
.byte " AWP" ; appleworks wp
.byte " ASP" ; appleworks sp
.byte " $F1" ; desk accessory
.byte " BAD" ; bad block
;;; The icon-related tables (below) use a distinguishing icon
@ -1433,6 +1436,7 @@ icon_type_table:
.byte icon_entry_type_generic ; appleworks db
.byte icon_entry_type_generic ; appleworks wp
.byte icon_entry_type_generic ; appleworks sp
.byte icon_entry_type_generic ; desk accessory
.byte icon_entry_type_system ; system (see below)
type_icons_table: ; map into definitions below
@ -1449,6 +1453,7 @@ type_icons_table: ; map into definitions below
.addr adb ; appleworks db
.addr awp ; appleworks wp
.addr asp ; appleworks sp
.addr a2d ; desk accessory
.addr app ; system (see below)
gen: DEFICON generic_icon, 4, 27, 15, generic_mask
@ -1459,11 +1464,12 @@ txt: DEFICON text_icon, 4, 27, 15, generic_mask
bin: DEFICON binary_icon, 4, 27, 14, binary_mask
dir: DEFICON folder_icon, 4, 27, 11, folder_mask
sys: DEFICON sys_icon, 4, 27, 17, sys_mask
bas: DEFICON basic_icon, 4, 27, 14, basic_mask
bas: DEFICON desktop_aux::basic_icon, 4, 27, 14, desktop_aux::basic_mask
fot: DEFICON desktop_aux::graphics_icon, 4, 27, 12, desktop_aux::graphics_mask
adb: DEFICON desktop_aux::adb_icon, 4, 27, 15, generic_mask
awp: DEFICON desktop_aux::awp_icon, 4, 27, 15, generic_mask
asp: DEFICON desktop_aux::asp_icon, 4, 27, 15, generic_mask
a2d: DEFICON desktop_aux::a2d_file_icon, 4, 27, 15, generic_mask
app: DEFICON app_icon, 5, 34, 16, app_mask
;;; Generic
@ -1633,41 +1639,6 @@ sys_mask:
.byte px(%0011111),px(%1111111),px(%1111111),px(%1111100)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
;;; Basic
basic_icon:
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000110),px(%0110000),px(%0000000)
.byte px(%0000000),px(%0011000),px(%0001100),px(%0000000)
.byte px(%0000000),px(%1100000),px(%0000011),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0111110),px(%0111000),px(%1111010),px(%0111100)
.byte px(%0100010),px(%1000100),px(%1000010),px(%1000110)
.byte px(%0111100),px(%1111100),px(%1111010),px(%1000000)
.byte px(%0100010),px(%1000100),px(%0001010),px(%1000110)
.byte px(%0111110),px(%1000100),px(%1111010),px(%0111100)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%1100000),px(%0000011),px(%0000000)
.byte px(%0000000),px(%0011000),px(%0001100),px(%0000000)
.byte px(%0000000),px(%0000110),px(%0110000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
basic_mask:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000111),px(%1110000),px(%0000000)
.byte px(%0000000),px(%0011111),px(%1111100),px(%0000000)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%1111111),px(%1111111),px(%1111111),px(%1111111)
.byte px(%0000000),px(%0011111),px(%1111100),px(%0000000)
.byte px(%0000000),px(%0000111),px(%1110000),px(%0000000)
.byte px(%0000000),px(%0000001),px(%1000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
;;; System (with .SYSTEM suffix)

View File

@ -7,8 +7,8 @@
* When dragging a selection of files to a destination on the same volume, the files will be moved by default. Hold down **△** before letting go of the mouse button to force a copy instead. Files dragged to a different volume will always be copied.
* Hold down **△** when launching `DESKTOP.SYSTEM` to prevent DeskTop from being copied to a RAM card.
* Desk Accessory files with high bit set in the aux type field will not appear in the menu.
* You can't run a Binary file by double-clicking, but you can run it with the **-O** shortcut or holding down **△** or **▲** key while selecting **File > Open**.
* Desk Accessory files with high bit set in the aux type field will not appear in the Apple menu.
* You can't run a Binary file by double-clicking, but you can run it with the **△O** shortcut or holding down **△** or **▲** while selecting **File > Open**.
* The Sort Directory desk accessory has two modes:
* If any files are selected, these are moved to the start of the directory listing, in selection order; other files appear after, order unchanged.
* If no files are selected, all files are sorted by type: DIR, then TXT, then SYS, then others in descending numeric order.

View File

@ -7,7 +7,20 @@ source "res/util.sh"
mkdir -p mount/desk.acc || (cecho red "permission denied"; exit 1)
# Mount file xxx.built as $F1 file
function mount_f1 {
srcdir="$2"
dstdir="$3"
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
src="$srcdir/out/$1.built"
dst="$dstdir/$uppercase.\$F1"
cp "$src" "$dst" \
&& (cecho green "mounted $dst" ) \
|| (cecho red "failed to mount $dst" ; return 1)
}
# Mount file xxx.built as $F1 file, with DA auxtype
function mount_da {
srcdir="$2"
dstdir="$3"
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
@ -19,6 +32,7 @@ function mount_f1 {
|| (cecho red "failed to mount $dst" ; return 1)
}
# Mount file xxx.SYS as SYS file
function mount_sys {
srcdir="$2"
dstdir="$3"
@ -39,10 +53,10 @@ mount_sys "ram.system" "ram.system" "mount"
mkdir -p mount/desk.acc
for file in $(cat desk.acc/TARGETS); do
mount_f1 "$file" "desk.acc" "mount/desk.acc"
mount_da "$file" "desk.acc" "mount/desk.acc"
done
mkdir -p mount/preview
for file in $(cat preview/TARGETS); do
mount_f1 "$file" "preview" "mount/preview"
mount_da "$file" "preview" "mount/preview"
done