diff --git a/COMMANDS b/COMMANDS index 639854d..7769cd0 100644 --- a/COMMANDS +++ b/COMMANDS @@ -9,3 +9,4 @@ echo hello online type +touch diff --git a/README.md b/README.md index 930cd6f..3a116ff 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Sample commands included: * `ONLINE` - lists online volumes (volume name, slot and drive) * `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` * `DATE` - prints the current ProDOS date and time * `CHTYPE` - change the type/auxtype of a file, e.g. `chtype file,T$F1,A$1234` * `T` (type) and `A` (auxtype) are optional. If neither is specified, current types are shown. diff --git a/cd.cmd.s b/cd.cmd.s index 6922d09..c2f02a1 100644 --- a/cd.cmd.s +++ b/cd.cmd.s @@ -27,7 +27,6 @@ ;; Point BI's parser at the command execution routine. lda #execute sta XTRNADDR+1 diff --git a/chtime.cmd.s b/chtime.cmd.s index df6c290..3a8432e 100644 --- a/chtime.cmd.s +++ b/chtime.cmd.s @@ -24,7 +24,6 @@ ;; Point BI's parser at the command execution routine. lda #execute sta XTRNADDR+1 diff --git a/chtype.cmd.s b/chtype.cmd.s index ce485fb..e541bbc 100644 --- a/chtype.cmd.s +++ b/chtype.cmd.s @@ -25,7 +25,6 @@ ;; Point BI's parser at the command execution routine. lda #execute sta XTRNADDR+1 diff --git a/copy.cmd.s b/copy.cmd.s index 9a585e6..363d8ec 100644 --- a/copy.cmd.s +++ b/copy.cmd.s @@ -21,7 +21,6 @@ ;; Point BI's parser at the command execution routine. lda #execute sta XTRNADDR+1 diff --git a/touch.cmd.s b/touch.cmd.s new file mode 100644 index 0000000..d23b365 --- /dev/null +++ b/touch.cmd.s @@ -0,0 +1,63 @@ +;;; ============================================================ +;;; +;;; TOUCH - Apply current ProDOS date/time stamp to file +;;; +;;; Usage: TOUCH filename[,S#][,D#] +;;; +;;; * filename can be relative or absolute path +;;; +;;; ============================================================ + + .include "apple2.inc" + .include "more_apple2.inc" + .include "prodos.inc" + +;;; ============================================================ + + .org $4000 + + ;; 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 + + ;; Apply time/date stamp + ldx #3 +: lda DATE,x + sta FIMDATE,x + dex + bpl :- + + ;; Set new file info + lda #$7 + sta SSGINFO + lda #SET_FILE_INFO + jmp GOSYSTEM diff --git a/type.cmd.s b/type.cmd.s index 45d995a..d28ca56 100644 --- a/type.cmd.s +++ b/type.cmd.s @@ -21,7 +21,6 @@ ;; Point BI's parser at the command execution routine. lda #execute sta XTRNADDR+1