diff --git a/Makefile b/Makefile index e6db890..d7bc619 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LDFLAGS = --config apple2-asm.cfg OUTDIR = out TARGETS = $(OUTDIR)/path.BIN \ - $(OUTDIR)/bell.CMD $(OUTDIR)/hello.CMD $(OUTDIR)/echo.CMD + $(OUTDIR)/bell.CMD $(OUTDIR)/hello.CMD $(OUTDIR)/echo.CMD $(OUTDIR)/vols.CMD .PHONY: clean all all: $(OUTDIR) $(TARGETS) diff --git a/README.md b/README.md index c1b19ef..7f594c4 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ 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 ``` Notes: @@ -43,3 +44,8 @@ Notes: * ProDOS BASIC.SYSTEM intrinsics (`CAT`, `PREFIX`, etc) * AppleSoft keywords (`LIST`, `PRINT`, etc) * CMD files in paths, in listed order + +Sample commands: +* `BELL` - beeps the speaker +* `HELLO` - shows a short message +* `VOLS` - lists online volumes (volume name, slot and drive) diff --git a/package.sh b/package.sh index c2e8a36..c75d77a 100755 --- a/package.sh +++ b/package.sh @@ -21,6 +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" rm -r "$PACKDIR" diff --git a/prodos.inc b/prodos.inc index 2bdee12..8825445 100644 --- a/prodos.inc +++ b/prodos.inc @@ -4,6 +4,7 @@ MLI := $BF00 GET_FILE_INFO = $C4 +ON_LINE = $C5 OPEN = $C8 READ = $CA CLOSE = $CC diff --git a/vols.cmd.s b/vols.cmd.s new file mode 100644 index 0000000..350593b --- /dev/null +++ b/vols.cmd.s @@ -0,0 +1,99 @@ + + .include "apple2.inc" + .include "prodos.inc" + +CROUT := $FD8E ; Issue a carriage return. +COUT := $FDED ; Output a character. + + .org $4000 + +;;; ============================================================ + + ptr := $06 + + jsr CROUT + + MLI_CALL ON_LINE, params + bcs exit + + lda #buf + sta ptr+1 + +loop: ldy #0 + lda (ptr),y + beq exit ; Done! + + ;; Crack drive/slot/name_len + and #%00001111 + beq next ; Error; TODO: if next byte is $57 show Duplicate Volume + sta len + lda (ptr),y + and #%11110000 + sta ds + + ;; Print name + lda #'/'|$80 ; Leading slash + jsr COUT +: iny + lda (ptr),y ; Name characters + ora #$80 + jsr COUT + cpy len + bne :- + + ;; Space + lda #20 + sta CH ; TODO: COUT spaces, instead of HTAB? + + ;; Slot + lda #'S'|$80 + jsr COUT + lda ds + and #%01110000 + lsr + lsr + lsr + lsr + ora #'0'|$80 + jsr COUT + + ;; Drive + lda #','|$80 + jsr COUT + lda #'D'|$80 + jsr COUT + lda #'1'|$80 + bit ds + bpl :+ + lda #'2'|$80 +: jsr COUT + jsr CROUT + +next: dec count + beq exit + + clc + lda ptr + adc #16 + sta ptr + lda ptr+1 + adc #0 + sta ptr+1 + jmp loop + +exit: rts + +;;; ============================================================ + +.proc params +param_count: .byte 2 +unit_num: .byte 0 +data_buffer: .addr buf +.endproc + +count: .byte 16 +buf: .res 256 +len: .byte 0 ; name length +ds: .byte 0 ; drive / slot