Compare commits

...

10 Commits
v1.6 ... main

Author SHA1 Message Date
Joshua Bell b63dabb7cd Actions: Rev a couple dependencies 2024-01-31 20:31:14 -08:00
Joshua Bell 0c01446574 PATH: Shave 9 bytes 2024-01-02 22:17:14 -08:00
Joshua Bell af1c8f1865 Shave 2 bytes from PATH 2024-01-01 21:43:55 -08:00
Joshua Bell 3360d44dd7 COPY: Preserve file modification time
Fixes #4
2024-01-01 19:35:14 -08:00
Joshua Bell 4bdb0808a2 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.
2023-05-11 09:37:00 -06:00
Joshua Bell 8cb8f98793 Workflows: bump ca65 action to v2 2023-03-02 20:02:32 -08:00
Joshua Bell e21c518a06 Workflows: Bump ncipollo/release-action version 2022-11-29 18:38:59 -08:00
Joshua Bell 2c8d464108 Add MEM command, inspired by A2osX's BASIC.FX 2022-08-04 19:29:52 -07:00
Joshua Bell e3f59575ed PATH: Fix missing relocation point
Oops - it's amazing anything worked.
2022-08-04 19:29:52 -07:00
Joshua Bell 6157963cc8 Workflow: use actions for cadius and ca65 2021-07-23 09:28:13 -07:00
9 changed files with 275 additions and 35 deletions

View File

@ -13,19 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build and install cc65 components
run: >
git clone https://github.com/cc65/cc65 /tmp/cc65 &&
sudo make -C /tmp/cc65 ca65 ld65 avail &&
ca65 --version
- name: build and install cadius
run: >
git clone https://github.com/mach-kernel/cadius /tmp/cadius &&
make -C /tmp/cadius &&
sudo make -C /tmp/cadius install
- uses: actions/checkout@v4
- uses: a2stuff/build-install-ca65-action@v2
- uses: a2stuff/build-install-cadius-action@v1
- name: build
env:
@ -35,7 +25,7 @@ jobs:
- name: deploy new version
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1.8.6
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "out/prodos-path.po"

View File

@ -7,6 +7,9 @@ copy
date
echo
hello
mem
online
type
touch
hide
unhide

View File

@ -36,12 +36,16 @@ Example:
Notes:
* `PATH` can be invoked as lower case (e.g. `path /hd/cmd`)
* Commands can be invoked as lower case (e.g. `hello`)
* A relative `PATH` (e.g. `path bin`) only works if an explicit prefix is set.
* Note that if no prefix has been set, or if you run `prefix /`, BASIC.SYSTEM will use the last accessed slot and drive and the `PREFIX` command will report that volume as a prefix even though it is empty.
Sample commands included:
* `HELLO` - shows a short message, for testing purposes
* `ECHO` - echoes back anything following the command
* `CD` - like `PREFIX` but accepts `..`, e.g. `cd ../dir`
* `ONLINE` - lists online volumes (volume name, slot and drive)
* `MEM` - show memory stats for the BASIC environment
* `COPY` - copy a single file, e.g. `copy /path/to/file,dstfile`
* `TYPE` - show file contents (TXT, BAS, or BIN/other), e.g. `type filename`
* `TOUCH` - apply current ProDOS date/time to a file's modification time, e.g. `touch filename`
@ -54,6 +58,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

View File

@ -197,6 +197,18 @@ read: lda FN1REF
finish: jsr CloseFiles
;; Apply FN1 info to FN2 to preserve modification date
ldx #$D - 3
: lda FN1INFO+3,x
sta SSGINFO+3,x
dex
bpl :-
lda #$7
sta SSGINFO
lda #SET_FILE_INFO
jsr GOSYSTEM
clc
rts

68
hide.cmd.s Normal file
View File

@ -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
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
;;; --------------------------------------------------

76
mem.cmd.s Normal file
View File

@ -0,0 +1,76 @@
;;; ============================================================
;;;
;;; MEM - Print memory stats
;;;
;;; Usage: MEM
;;;
;;; Inspiration from A2osX
;;;
;;; ============================================================
.include "apple2.inc"
.include "more_apple2.inc"
;;; ============================================================
.org $4000
jsr CROUT
jsr CROUT
.macro SHOW suffix
lda #<.ident(.concat("str_", .string(suffix)))
ldx #>.ident(.concat("str_", .string(suffix)))
ldy #.ident(.concat("addr_", .string(suffix)))
jsr Print
.endmacro
SHOW pgm_start
SHOW lomem
SHOW array_start
SHOW array_end
SHOW string_start
SHOW himem
clc
rts
addr_pgm_start := $67
str_pgm_start: .byte "Program start: $", 0
addr_lomem := $69
str_lomem: .byte "LOMEM: $", 0
addr_array_start := $6B
str_array_start: .byte "Array start: $", 0
addr_array_end := $6D
str_array_end: .byte "Array end: $", 0
addr_string_start := $6F
str_string_start: .byte "String start: $", 0
addr_himem := $73
str_himem: .byte "HIMEM: $", 0
.proc Print
sta msg_addr
stx msg_addr+1
iny ; MSB first
sty zp_addr
ldx #0
msg_addr := *+1
loop: lda $1234,x ; self-modified
beq :+
ora #$80
jsr COUT
inx
bne loop ; always
:
jsr getb
jsr PRBYTE
jsr getb
jsr PRBYTE
jmp CROUT
zp_addr := *+1
getb: lda $12 ; self-modified
dec zp_addr
rts
.endproc

53
path.s
View File

@ -171,16 +171,15 @@ nxtchr: jsr ToUpperASCII
lda #>execute
sta XTRNADDR+1
;; Mark command as external (zero).
lda #0
sta XCNUM
;; Set accepted parameter flags (optional name)
lda #PBitsFlags::FNOPT | PBitsFlags::FN1
sta PBITS
lda #0
sta PBITS+1
;; Mark command as external (zero).
sta XCNUM ; A=0 from above
clc ; Success (so far)
rts ; Return to BASIC.SYSTEM
@ -238,6 +237,7 @@ next_char:
;; without preventing 'RUN100' from being typed.
inx
reloc_point *+2
jsr ToUpperASCII
cmp #'A'
bcc not_ours
@ -330,7 +330,7 @@ notok: dey
;; Indicate end of command string for BI's parser (if command uses it)
dex
stx XLEN
stx xlen ; assigned to `XLEN` later
;; Check to see if path exists.
lda #$A ; param length
@ -345,14 +345,11 @@ notok: dey
bne compose ; wrong type - try next path directory
;; Tell BASIC.SYSTEM it was handled.
lda #0
sta XCNUM
sta PBITS
sta PBITS+1
lda #<XRETURN
sta XTRNADDR
lda #>XRETURN
sta XTRNADDR+1
ldx #xtrnaddr_len - 1
: lda xtrnaddr,x
sta XTRNADDR,x
dex
bpl :-
;; MLI/BI trashes part of INBUF (clock driver?), so stash it in upper half.
ldx #$7F
@ -374,14 +371,12 @@ notok: dey
sta RWREFNUM
sta CFREFNUM
lda #<cmd_load_addr
sta RWDATA
lda #>cmd_load_addr
sta RWDATA+1
lda #<max_cmd_size
sta RWCOUNT
lda #>max_cmd_size
sta RWCOUNT+1
;; Assign `RWDATA` and `RWCOUNT`
ldx #rwdata_len - 1
: lda rwdata,x
sta RWDATA,x
dex
bpl :-
lda #READ
jsr GOSYSTEM
@ -407,6 +402,22 @@ notok: dey
fail_load:
rts
;;; Assigned to `XTRNADDR`, `XLEN`, `XCNUM`, and `PBITS`
xtrnaddr:
.addr XRETURN ; assigned to `XTRNADDR`
xlen: .byte 0 ; assigned to `XLEN`
.byte 0 ; assigned to `XCNUM`
.word 0 ; assigned to `PBITS`
xtrnaddr_len = * - xtrnaddr
;;; Assigned to `RWDATA` and `RWCOUNT`
rwdata:
.addr cmd_load_addr ; assigned to `RWDATA`
.word max_cmd_size ; assigned to `RWCOUNT`
rwdata_len = * - rwdata
;;; ============================================================
execute:

View File

@ -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

68
unhide.cmd.s Normal file
View File

@ -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
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
;;; --------------------------------------------------