Allow prefixes which as BASIC tokens

This commit is contained in:
Joshua Bell 2020-06-07 08:02:08 -07:00
parent 3e918d3e5e
commit b81f7b3ecb
5 changed files with 29 additions and 22 deletions

View File

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

View File

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

View File

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

24
path.s
View File

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