Added VOLS command

This commit is contained in:
Joshua Bell 2020-06-06 19:03:15 -07:00
parent 42e92fb6f2
commit 3e918d3e5e
5 changed files with 108 additions and 1 deletions

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@
MLI := $BF00
GET_FILE_INFO = $C4
ON_LINE = $C5
OPEN = $C8
READ = $CA
CLOSE = $CC

99
vols.cmd.s Normal file
View File

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