From b81f7b3ecb4638a645d2fdbabf6a7cf3edb25730 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 7 Jun 2020 08:02:08 -0700 Subject: [PATCH] Allow prefixes which as BASIC tokens --- Makefile | 6 ++++-- README.md | 19 +++++++++---------- vols.cmd.s => online.cmd.s | 0 package.sh | 2 +- path.s | 24 +++++++++++++++--------- 5 files changed, 29 insertions(+), 22 deletions(-) rename vols.cmd.s => online.cmd.s (100%) diff --git a/Makefile b/Makefile index d7bc619..4470e6f 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,9 @@ LDFLAGS = --config apple2-asm.cfg OUTDIR = out TARGETS = $(OUTDIR)/path.BIN \ - $(OUTDIR)/bell.CMD $(OUTDIR)/hello.CMD $(OUTDIR)/echo.CMD $(OUTDIR)/vols.CMD + $(OUTDIR)/bell.CMD $(OUTDIR)/hello.CMD $(OUTDIR)/echo.CMD $(OUTDIR)/online.CMD -.PHONY: clean all +.PHONY: clean all package all: $(OUTDIR) $(TARGETS) $(OUTDIR): @@ -20,6 +20,8 @@ clean: rm -f $(OUTDIR)/*.list rm -f $(TARGETS) +package: + ./package.sh $(OUTDIR)/%.o: %.s $(HEADERS) ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $< diff --git a/README.md b/README.md index 7f594c4..6be3dd4 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,8 @@ [![Build Status](https://travis-ci.org/a2stuff/prodos-path.svg?branch=master)](https://travis-ci.org/a2stuff/prodos-path) - 💾 Disk images can be found on the [Releases](https://github.com/a2stuff/prodos-path/releases) page 💾 - - Build with [ca65](https://cc65.github.io/doc/ca65.html) Installation: @@ -33,19 +30,21 @@ Example: /hd/cmds ] BELL - will invoke /hd/cmds/BELL if present ] HELLO - will invoke /hd/cmds/HELLO if present -] VOLS - will invoke /hd/cmds/VOLS if present +] ONLINE - will invoke /hd/cmds/ONLINE if present ``` Notes: -* Allocates a permanent buffer to store the code and path (2 pages) -* Can be invoked as lower case (e.g. `path ...`) -* Applesoft BASIC commands are unaffected (but can't be CMD names) * Search order when a command is typed: * ProDOS BASIC.SYSTEM intrinsics (`CAT`, `PREFIX`, etc) - * AppleSoft keywords (`LIST`, `PRINT`, etc) + * BASIC keywords (`LIST`, `PRINT`, etc) * CMD files in paths, in listed order +* Allocates a permanent buffer to store the code and path (2 pages) +* `PATH` can be invoked as lower case (e.g. `path /DISK/CMDS`) +* Commands can be invoked as lower case (e.g. `hello`) +* Applesoft BASIC commands are unaffected (but can't be CMD names) + * Commands with BASIC keywords as _prefixes_ are allowed as long as the command continues with an alphabetic character. For example, `ONLINE` is allowed despite conflicting with the valid BASIC statement `ONLINE GOTO10` which is short for `ON LINE GOTO 10`. -Sample commands: +Sample commands included: * `BELL` - beeps the speaker * `HELLO` - shows a short message -* `VOLS` - lists online volumes (volume name, slot and drive) +* `ONLINE` - lists online volumes (volume name, slot and drive) diff --git a/vols.cmd.s b/online.cmd.s similarity index 100% rename from vols.cmd.s rename to online.cmd.s diff --git a/package.sh b/package.sh index c75d77a..3757c6c 100755 --- a/package.sh +++ b/package.sh @@ -21,7 +21,7 @@ add_file "out/path.BIN" "path#062000" add_file "out/bell.CMD" "bell#F04000" add_file "out/echo.CMD" "echo#F04000" add_file "out/hello.CMD" "hello#F04000" -add_file "out/vols.CMD" "vols#F04000" +add_file "out/online.CMD" "online#F04000" rm -r "$PACKDIR" diff --git a/path.s b/path.s index ea82bf8..21a057e 100644 --- a/path.s +++ b/path.s @@ -245,7 +245,18 @@ next_char: sbc (tptr),Y beq mloop cmp #$80 ; If only difference was the high bit - beq not_ours ; then it's end-of-token -- and a match! + bne next_token ; then it's end-of-token -- and a match! + + ;; Only if next command char is not alpha. + ;; This allows 'ON' as a prefix (e.g. 'ONLINE'), + ;; without preventing 'RUN100' from being typed. + + inx + jsr to_upper_ascii + cmp #'A' + bcc not_ours + cmp #'Z'+1 + bcs not_ours ;; Otherwise, advance to next token next_token: @@ -262,6 +273,7 @@ sloop: lda (tptr),y ; Scan table looking for a high bit set beq maybe_invoke not_ours: +fail_invoke: sec ; Signal failure... next_command := *+1 jmp $ffff ; Execute next command in chain @@ -269,11 +281,6 @@ not_ours: ;;; ============================================================ -fail_invoke: - sec - rts - - maybe_invoke: ppos := $D6 ; position into path_buffer @@ -409,9 +416,8 @@ notok: dey fail_load: jsr FREEBUFR - lda #8 ; I/O ERROR - TODO: is this used??? - sec - rts + reloc_point *+2 + jmp fail_invoke ;;; ============================================================ ;;; ============================================================