From 4bdb0808a22bc2b220b9abd0c9aa8e59287665f9 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 11 May 2023 09:37:00 -0600 Subject: [PATCH] Add HIDE / UNHIDE commands, to toggle the access "invisible" bit This is used by the GS/OS Finder to conceal FINDER.DATA files. Documented in "Exploring GS/OS and ProDOS 8" by Gary B. Little. BASIC.SYSTEM's CAT/CATALOG are unaware of this, so the files are still listed. Note that the command is named "UNHIDE" rather than "SHOW" as that sounds like a command to display file contents or something. --- COMMANDS | 2 ++ README.md | 1 + hide.cmd.s | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ prodos.inc | 7 ++++++ unhide.cmd.s | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+) create mode 100644 hide.cmd.s create mode 100644 unhide.cmd.s diff --git a/COMMANDS b/COMMANDS index 425556b..e7e8866 100644 --- a/COMMANDS +++ b/COMMANDS @@ -11,3 +11,5 @@ mem online type touch +hide +unhide diff --git a/README.md b/README.md index bab39e2..ba49b70 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Sample commands included: * `S` and `D` arguments can be used to specify slot and drive. * `BELL` - emits the standard Apple II beep * `BUZZ` - emits the ProDOS "nice little tone" +* `HIDE` / `UNHIDE` - sets / clears the "invisible" bit on a file, used in GS/OS Finder ## Instructions For Developers diff --git a/hide.cmd.s b/hide.cmd.s new file mode 100644 index 0000000..77bed1e --- /dev/null +++ b/hide.cmd.s @@ -0,0 +1,68 @@ +;;; ============================================================ +;;; +;;; HIDE - Mark a file as invisible +;;; +;;; Usage: HIDE filename[,S#][,D#] +;;; +;;; * filename can be relative or absolute path +;;; +;;; ============================================================ + + .include "apple2.inc" + .include "more_apple2.inc" + .include "prodos.inc" + +;;; ============================================================ + + .org $4000 + + ;; NOTE: Assumes XLEN is set by PATH + + ;; Point BI's parser at the command execution routine. + lda #execute + sta XTRNADDR+1 + + ;; Mark command as external (zero). + lda #0 + sta XCNUM + + ;; Set accepted parameter flags + + ;; Filename + lda #PBitsFlags::FN1 + sta PBITS + + ;; Slot & Drive handling + lda #PBitsFlags::SD + sta PBITS+1 + + clc ; Success (so far) +rts1: rts ; Return to BASIC.SYSTEM + +;;; ============================================================ + +execute: + ;; Get the existing file info + lda #$A + sta SSGINFO + lda #GET_FILE_INFO + jsr GOSYSTEM + bcs rts1 + +;;; -------------------------------------------------- + + ;; Clear invisible bit + lda FIACESS + ora #ACCESS_I + sta FIACESS + + ;; Set new file info + lda #$7 + sta SSGINFO + + lda #SET_FILE_INFO + jmp GOSYSTEM + +;;; -------------------------------------------------- diff --git a/prodos.inc b/prodos.inc index 109574c..2fa8c2d 100644 --- a/prodos.inc +++ b/prodos.inc @@ -33,6 +33,13 @@ FT_DIR = $0F FT_CMD = $F0 FT_BAS = $FC +ACCESS_D = %10000000 ; Access: Destroy-Enable +ACCESS_RN = %01000000 ; Access: Rename-Enable +ACCESS_B = %00100000 ; Access: Backup +ACCESS_I = %00000100 ; Access: Invisible +ACCESS_W = %00000010 ; Access: Write-Enable +ACCESS_R = %00000001 ; Access: Read-Enable + ;;; ============================================================ ;;; BASIC.SYSTEM Global Page diff --git a/unhide.cmd.s b/unhide.cmd.s new file mode 100644 index 0000000..b91ff48 --- /dev/null +++ b/unhide.cmd.s @@ -0,0 +1,68 @@ +;;; ============================================================ +;;; +;;; UNHIDE - Mark a file as not invisible +;;; +;;; Usage: UNHIDE filename[,S#][,D#] +;;; +;;; * filename can be relative or absolute path +;;; +;;; ============================================================ + + .include "apple2.inc" + .include "more_apple2.inc" + .include "prodos.inc" + +;;; ============================================================ + + .org $4000 + + ;; NOTE: Assumes XLEN is set by PATH + + ;; Point BI's parser at the command execution routine. + lda #execute + sta XTRNADDR+1 + + ;; Mark command as external (zero). + lda #0 + sta XCNUM + + ;; Set accepted parameter flags + + ;; Filename + lda #PBitsFlags::FN1 + sta PBITS + + ;; Slot & Drive handling + lda #PBitsFlags::SD + sta PBITS+1 + + clc ; Success (so far) +rts1: rts ; Return to BASIC.SYSTEM + +;;; ============================================================ + +execute: + ;; Get the existing file info + lda #$A + sta SSGINFO + lda #GET_FILE_INFO + jsr GOSYSTEM + bcs rts1 + +;;; -------------------------------------------------- + + ;; Set invisible bit + lda FIACESS + and #<(~ACCESS_I) + sta FIACESS + + ;; Set new file info + lda #$7 + sta SSGINFO + + lda #SET_FILE_INFO + jmp GOSYSTEM + +;;; --------------------------------------------------