mirror of
https://github.com/a2stuff/prodos-path.git
synced 2024-06-06 04:29:30 +00:00
wip
This commit is contained in:
parent
5590f2ff16
commit
42dc31e40e
5
Makefile
5
Makefile
|
@ -5,7 +5,7 @@ CCFLAGS = --config apple2-asm.cfg
|
||||||
|
|
||||||
OUTDIR = out
|
OUTDIR = out
|
||||||
|
|
||||||
TARGETS = $(OUTDIR)/chtype.BIN
|
TARGETS = $(OUTDIR)/path.BIN
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
all: $(OUTDIR) $(TARGETS)
|
all: $(OUTDIR) $(TARGETS)
|
||||||
|
@ -27,3 +27,6 @@ $(OUTDIR)/%.o: %.s $(HEADERS)
|
||||||
$(OUTDIR)/%.BIN $(OUTDIR)/%.SYS: $(OUTDIR)/%.o
|
$(OUTDIR)/%.BIN $(OUTDIR)/%.SYS: $(OUTDIR)/%.o
|
||||||
$(CC65)/ld65 $(CCFLAGS) -o $@ $<
|
$(CC65)/ld65 $(CCFLAGS) -o $@ $<
|
||||||
xattr -wx prodos.AuxType '00 20' $@
|
xattr -wx prodos.AuxType '00 20' $@
|
||||||
|
|
||||||
|
$(OUTDIR)/%.CMD: $(OUTDIR)/%.o
|
||||||
|
$(CC65)/ld65 $(CCFLAGS) -o $@ $<
|
||||||
|
|
32
README.md
32
README.md
|
@ -1,30 +1,28 @@
|
||||||
# chtype - change file type command for ProDOS
|
# path - CMD executable path command for ProDOS
|
||||||
|
|
||||||
Build with [ca65](https://cc65.github.io/doc/ca65.html)
|
Build with [ca65](https://cc65.github.io/doc/ca65.html)
|
||||||
|
|
||||||
Installation:
|
Installation:
|
||||||
* Copy target to ProDOS disk
|
* Copy target to ProDOS disk
|
||||||
* From BASIC.SYSTEM prompt, run: `-CHTYPE` from STARTUP (or by hand)
|
* From BASIC.SYSTEM prompt, run: `-PATH` from STARTUP (or by hand)
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
```
|
```
|
||||||
CHTYPE pathname[,Ttype][,Aauxtype][,S#][,D#]
|
PATH - view current search path
|
||||||
|
PATH prefix - set search path
|
||||||
```
|
```
|
||||||
|
|
||||||
Examples:
|
Once set, binary files of type `CMD` in the specified directory can be invoked by name. The command line will be present at $200 (GETLN input buffer).
|
||||||
* `CHTYPE` - show current type/auxtype
|
|
||||||
* `CHTYPE pic,T$08` - set just type
|
Example:
|
||||||
* `CHTYPE file,A$0640` - set just auxtype
|
```
|
||||||
* `CHTYPE now_basic,TBAS,A$801` - set both type and auxtype
|
] -/hd/path - install it
|
||||||
* `CHTYPE /root/was_bin,TSYS` - works with absolute paths
|
] PATH /hd/cmds - set PATH
|
||||||
* `CHTYPE as_text,TTXT,S6,D1` - can use slot/drive arguments too
|
] PATH - verify path
|
||||||
|
/hd/cmds
|
||||||
|
] BELL - will invoke /hd/cmds/BELL if present
|
||||||
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
* Allocates a 1 page buffer to store the code
|
* Allocates a 1 page buffer to store the code
|
||||||
* Relative or absolute paths can be used
|
* Can be invoked as lower case (e.g. `path ...`)
|
||||||
* Can be invoked as lower case (e.g. `chtype ...`)
|
|
||||||
|
|
||||||
Resources:
|
|
||||||
* [File Types Table](http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM#B-1T) - [ProDOS 8 Technical Reference Manual](http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM)
|
|
||||||
* [File Types](https://www.kreativekorp.com/miscpages/a2info/filetypes.shtml) - [Jon Relay's Apple II Info Archives](https://www.kreativekorp.com/miscpages/a2info/)
|
|
||||||
* [ProDOS File Types 2.0](https://macgui.com/kb/article/116) - [Mac GUI](https://macgui.com)
|
|
||||||
|
|
215
path.s
215
path.s
|
@ -1,17 +1,6 @@
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;;
|
;;;
|
||||||
;;; CHTYPE - File type changing command for ProDOS-8
|
;;; PATH
|
||||||
;;;
|
|
||||||
;;; Install:
|
|
||||||
;;; -CHTYPE (from BASIC.SYSTEM prompt)
|
|
||||||
;;; Usage:
|
|
||||||
;;; CHTYPE filename[,Ttype][,Aaux][,S#][,D#]
|
|
||||||
;;;
|
|
||||||
;;; * filename can be relative or absolute path
|
|
||||||
;;; * specify T$nn to set file type
|
|
||||||
;;; * specify A$nnnn to set aux type info
|
|
||||||
;;; * type can be BIN, SYS, TXT (etc) or $nn
|
|
||||||
;;; * with neither T nor A option, prints current values
|
|
||||||
;;;
|
;;;
|
||||||
;;; Build with: ca65 - https://cc65.github.io/doc/ca65.html
|
;;; Build with: ca65 - https://cc65.github.io/doc/ca65.html
|
||||||
;;;
|
;;;
|
||||||
|
@ -19,6 +8,8 @@
|
||||||
|
|
||||||
.org $2000
|
.org $2000
|
||||||
|
|
||||||
|
.include "prodos.inc"
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
INBUF := $200 ; GETLN input buffer
|
INBUF := $200 ; GETLN input buffer
|
||||||
|
@ -27,69 +18,8 @@ INBUF := $200 ; GETLN input buffer
|
||||||
;;; Monitor ROM routines
|
;;; Monitor ROM routines
|
||||||
|
|
||||||
CROUT := $FD8E
|
CROUT := $FD8E
|
||||||
PRBYTE := $FDDA
|
|
||||||
COUT := $FDED
|
COUT := $FDED
|
||||||
|
|
||||||
;;; ============================================================
|
|
||||||
;;; ProDOS MLI / Global Page
|
|
||||||
|
|
||||||
SET_FILE_INFO = $C3
|
|
||||||
GET_FILE_INFO = $C4
|
|
||||||
|
|
||||||
DATE := $BF90
|
|
||||||
|
|
||||||
;;; ============================================================
|
|
||||||
;;; BASIC.SYSTEM Global Page
|
|
||||||
|
|
||||||
EXTRNCMD := $BE06 ; External command jmp vector
|
|
||||||
ERROUT := $BE09 ; Error routine jmp vector
|
|
||||||
XTRNADDR := $BE50 ; Ext cmd implementation addr
|
|
||||||
|
|
||||||
XLEN := $BE52 ; Length of command string minus 1
|
|
||||||
XCNUM := $BE53 ; Command number (ext cmd = 0).
|
|
||||||
|
|
||||||
PBITS := $BE54 ; Command parameter bits
|
|
||||||
FBITS := $BE56 ; Found parameter bits
|
|
||||||
|
|
||||||
.enum PBitsFlags
|
|
||||||
;; PBITS
|
|
||||||
PFIX = $80 ; Prefix needs fetching
|
|
||||||
SLOT = $40 ; No parameters to be processed
|
|
||||||
RRUN = $20 ; Command only valid during program
|
|
||||||
FNOPT = $10 ; Filename is optional
|
|
||||||
CRFLG = $08 ; CREATE allowed
|
|
||||||
T = $04 ; File type
|
|
||||||
FN2 = $02 ; Filename '2' for RENAME
|
|
||||||
FN1 = $01 ; Filename expected
|
|
||||||
|
|
||||||
;; PBITS+1
|
|
||||||
AD = $80 ; Address
|
|
||||||
B = $40 ; Byte
|
|
||||||
E = $20 ; End address
|
|
||||||
L = $10 ; Length
|
|
||||||
LINE = $08 ; '@' line number
|
|
||||||
SD = $04 ; Slot and drive numbers
|
|
||||||
F = $02 ; Field
|
|
||||||
R = $01 ; Record
|
|
||||||
|
|
||||||
;; Setting SD in PBITS+1 enables desired automatic behavior: if
|
|
||||||
;; a relative path is given, an appropriate prefix is computed,
|
|
||||||
;; using S# and D# options if supplied. Without this, absolute
|
|
||||||
;; paths must be used if no prefix is set.
|
|
||||||
.endenum
|
|
||||||
|
|
||||||
VADDR := $BE58 ; Address parameter
|
|
||||||
VSLOT := $BE61 ; Slot parameter
|
|
||||||
VTYPE := $BE6A ; Type parameter
|
|
||||||
VPATH1 := $BE6C ; Pathname buffer
|
|
||||||
|
|
||||||
GOSYSTEM := $BE70 ; Use instead of MLI
|
|
||||||
|
|
||||||
SSGINFO := $BEB4 ; Get/Set Info Parameter block
|
|
||||||
FIFILID := $BEB8 ; (set size to set=7 or get=$A)
|
|
||||||
FIAUXID := $BEB9
|
|
||||||
FIMDATE := $BEBE
|
|
||||||
GETBUFR := $BEF5
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
;; Save previous external command address
|
;; Save previous external command address
|
||||||
|
@ -107,9 +37,11 @@ GETBUFR := $BEF5
|
||||||
:
|
:
|
||||||
;; A = MSB of new page - update absolute addresses
|
;; A = MSB of new page - update absolute addresses
|
||||||
;; (aligned to page boundary so only MSB changes)
|
;; (aligned to page boundary so only MSB changes)
|
||||||
sta page_num1
|
ldx relocation_table
|
||||||
sta page_num2
|
: ldy relocation_table+1,x
|
||||||
sta page_num3
|
sta handler,y
|
||||||
|
dex
|
||||||
|
bpl :-
|
||||||
|
|
||||||
;; Install new address in external command address
|
;; Install new address in external command address
|
||||||
sta EXTRNCMD+2
|
sta EXTRNCMD+2
|
||||||
|
@ -150,7 +82,7 @@ nxtchr: lda INBUF,x
|
||||||
|
|
||||||
page_num1 := *+2 ; address needing updating
|
page_num1 := *+2 ; address needing updating
|
||||||
: cmp command_string,x
|
: cmp command_string,x
|
||||||
bne not_ours
|
bne not_path
|
||||||
inx
|
inx
|
||||||
cpx #command_length
|
cpx #command_length
|
||||||
bne nxtchr
|
bne nxtchr
|
||||||
|
@ -170,12 +102,12 @@ nxtchr: lda INBUF,x
|
||||||
lda #0
|
lda #0
|
||||||
sta XCNUM
|
sta XCNUM
|
||||||
|
|
||||||
;; Set accepted parameter flags (Name, Type, Address)
|
;; Set accepted parameter flags (Name, Slot/Drive)
|
||||||
|
|
||||||
lda #PBitsFlags::T | PBitsFlags::FN1 ; Filename and Type
|
lda #PBitsFlags::FN1 ; Filename
|
||||||
sta PBITS
|
sta PBITS
|
||||||
|
|
||||||
lda #PBitsFlags::AD | PBitsFlags::SD ; Address, Slot & Drive handling
|
lda #PBitsFlags::SD ; Slot & Drive handling
|
||||||
sta PBITS+1
|
sta PBITS+1
|
||||||
|
|
||||||
clc ; Success (so far)
|
clc ; Success (so far)
|
||||||
|
@ -183,6 +115,10 @@ nxtchr: lda INBUF,x
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
|
not_path:
|
||||||
|
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
not_ours:
|
not_ours:
|
||||||
sec ; Signal failure...
|
sec ; Signal failure...
|
||||||
next_command := *+1
|
next_command := *+1
|
||||||
|
@ -195,89 +131,43 @@ execute:
|
||||||
|
|
||||||
lda FBITS
|
lda FBITS
|
||||||
and #PBitsFlags::FN1 ; Filename?
|
and #PBitsFlags::FN1 ; Filename?
|
||||||
bne :+
|
bne set_path
|
||||||
lda #$10 ; SYNTAX ERROR
|
|
||||||
sec
|
|
||||||
rts1: rts
|
|
||||||
:
|
|
||||||
|
|
||||||
;;; --------------------------------------------------
|
;;; --------------------------------------------------
|
||||||
|
;; Show current path
|
||||||
|
|
||||||
;; Get the existing file info
|
ldx #0
|
||||||
lda #$A
|
page_num3 := *+2
|
||||||
sta SSGINFO
|
: cpx path_buffer
|
||||||
lda #GET_FILE_INFO
|
beq done
|
||||||
jsr GOSYSTEM
|
page_num4 := *+2
|
||||||
bcs rts1
|
lda path_buffer+1,x
|
||||||
|
ora #$80
|
||||||
;;; --------------------------------------------------
|
jsr COUT
|
||||||
|
inx
|
||||||
;; Apply options
|
|
||||||
ldy #0 ; count number of options
|
|
||||||
|
|
||||||
;; Apply optional Type argument as new file type
|
|
||||||
lda FBITS
|
|
||||||
and #PBitsFlags::T ; Type set?
|
|
||||||
beq :+
|
|
||||||
iny
|
|
||||||
lda VTYPE
|
|
||||||
sta FIFILID
|
|
||||||
:
|
|
||||||
|
|
||||||
;; Apply optional Address argument as new aux type
|
|
||||||
lda FBITS+1
|
|
||||||
and #PBitsFlags::AD ; Address set?
|
|
||||||
beq :+
|
|
||||||
iny
|
|
||||||
lda VADDR
|
|
||||||
sta FIAUXID
|
|
||||||
lda VADDR+1
|
|
||||||
sta FIAUXID+1
|
|
||||||
:
|
|
||||||
|
|
||||||
;; If no options were used, show current details instead.
|
|
||||||
cpy #0
|
|
||||||
beq show
|
|
||||||
|
|
||||||
;; Apply current date/time
|
|
||||||
ldx #3
|
|
||||||
: lda DATE,x
|
|
||||||
sta FIMDATE,x
|
|
||||||
dex
|
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
;; Set new file info
|
jsr CROUT
|
||||||
lda #$7
|
done: clc
|
||||||
sta SSGINFO
|
rts
|
||||||
|
|
||||||
lda #SET_FILE_INFO
|
|
||||||
jmp GOSYSTEM
|
|
||||||
|
|
||||||
;;; --------------------------------------------------
|
;;; --------------------------------------------------
|
||||||
|
;; Set path
|
||||||
|
set_path:
|
||||||
|
ptr := $06
|
||||||
|
lda VPATH1
|
||||||
|
sta ptr
|
||||||
|
ldx VPATH1+1
|
||||||
|
sta ptr+1
|
||||||
|
|
||||||
show:
|
ldy #0
|
||||||
lda #'T'|$80
|
lda (ptr),y
|
||||||
jsr COUT
|
tay
|
||||||
lda #'='|$80
|
: lda (ptr),y
|
||||||
jsr COUT
|
page_num5 := *+2
|
||||||
lda #'$'|$80
|
sta path_buffer,y
|
||||||
jsr COUT
|
dey
|
||||||
lda VTYPE
|
bpl :-
|
||||||
jsr PRBYTE
|
|
||||||
jsr CROUT
|
|
||||||
|
|
||||||
lda #'A'|$80
|
|
||||||
jsr COUT
|
|
||||||
lda #'='|$80
|
|
||||||
jsr COUT
|
|
||||||
lda #'$'|$80
|
|
||||||
jsr COUT
|
|
||||||
lda VADDR+1
|
|
||||||
jsr PRBYTE
|
|
||||||
lda VADDR
|
|
||||||
jsr PRBYTE
|
|
||||||
jsr CROUT
|
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -285,11 +175,20 @@ show:
|
||||||
;;; Data
|
;;; Data
|
||||||
|
|
||||||
command_string:
|
command_string:
|
||||||
.byte "CHTYPE" ; Command string
|
.byte "PATH" ; Command string
|
||||||
command_length = *-command_string
|
command_length = *-command_string
|
||||||
|
|
||||||
|
path_buffer:
|
||||||
|
.res 65, 0
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
.assert .sizeof(handler) <= $100, error, "Must fit on one page"
|
.assert .sizeof(handler) <= $100, error, "Must fit on one page"
|
||||||
page_num1 := handler::page_num1
|
|
||||||
page_num2 := handler::page_num2
|
|
||||||
next_command := handler::next_command
|
next_command := handler::next_command
|
||||||
|
|
||||||
|
relocation_table:
|
||||||
|
.byte 5
|
||||||
|
.byte <handler::page_num1
|
||||||
|
.byte <handler::page_num2
|
||||||
|
.byte <handler::page_num3
|
||||||
|
.byte <handler::page_num4
|
||||||
|
.byte <handler::page_num5
|
||||||
|
|
53
prodos.inc
Normal file
53
prodos.inc
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
;;; ============================================================
|
||||||
|
;;; ProDOS MLI / Global Page
|
||||||
|
|
||||||
|
GET_FILE_INFO = $C4
|
||||||
|
|
||||||
|
;;; ============================================================
|
||||||
|
;;; BASIC.SYSTEM Global Page
|
||||||
|
|
||||||
|
EXTRNCMD := $BE06 ; External command jmp vector
|
||||||
|
ERROUT := $BE09 ; Error routine jmp vector
|
||||||
|
XTRNADDR := $BE50 ; Ext cmd implementation addr
|
||||||
|
|
||||||
|
XLEN := $BE52 ; Length of command string minus 1
|
||||||
|
XCNUM := $BE53 ; Command number (ext cmd = 0).
|
||||||
|
|
||||||
|
PBITS := $BE54 ; Command parameter bits
|
||||||
|
FBITS := $BE56 ; Found parameter bits
|
||||||
|
|
||||||
|
.enum PBitsFlags
|
||||||
|
;; PBITS
|
||||||
|
PFIX = $80 ; Prefix needs fetching
|
||||||
|
SLOT = $40 ; No parameters to be processed
|
||||||
|
RRUN = $20 ; Command only valid during program
|
||||||
|
FNOPT = $10 ; Filename is optional
|
||||||
|
CRFLG = $08 ; CREATE allowed
|
||||||
|
T = $04 ; File type
|
||||||
|
FN2 = $02 ; Filename '2' for RENAME
|
||||||
|
FN1 = $01 ; Filename expected
|
||||||
|
|
||||||
|
;; PBITS+1
|
||||||
|
AD = $80 ; Address
|
||||||
|
B = $40 ; Byte
|
||||||
|
E = $20 ; End address
|
||||||
|
L = $10 ; Length
|
||||||
|
LINE = $08 ; '@' line number
|
||||||
|
SD = $04 ; Slot and drive numbers
|
||||||
|
F = $02 ; Field
|
||||||
|
R = $01 ; Record
|
||||||
|
|
||||||
|
;; Setting SD in PBITS+1 enables desired automatic behavior: if
|
||||||
|
;; a relative path is given, an appropriate prefix is computed,
|
||||||
|
;; using S# and D# options if supplied. Without this, absolute
|
||||||
|
;; paths must be used if no prefix is set.
|
||||||
|
.endenum
|
||||||
|
|
||||||
|
VPATH1 := $BE6C ; Pathname buffer
|
||||||
|
|
||||||
|
GOSYSTEM := $BE70 ; Use instead of MLI
|
||||||
|
|
||||||
|
SSGINFO := $BEB4 ; Get Info Parameter block
|
||||||
|
FIFILID := $BEB8 ; (set size $A)
|
||||||
|
|
||||||
|
GETBUFR := $BEF5
|
Loading…
Reference in New Issue
Block a user