mirror of
https://github.com/a2stuff/chtype.git
synced 2025-01-13 23:33:02 +00:00
Make T optional, with neither arg shows current
This commit is contained in:
parent
0ced59be0d
commit
7f32a13269
14
README.md
14
README.md
@ -8,14 +8,16 @@ Installation:
|
||||
|
||||
Usage:
|
||||
```
|
||||
CHTYPE pathname,Ttype[,Aauxtype][,S#][,D#]
|
||||
CHTYPE pathname[,Ttype][,Aauxtype][,S#][,D#]
|
||||
```
|
||||
|
||||
Examples:
|
||||
* `CHTYPE pic,T$08`
|
||||
* `CHTYPE /root/was_bin,TSYS`
|
||||
* `CHTYPE now_basic,TBAS,A$801`
|
||||
* `CHTYPE as_text,TTXT,S6,D1`
|
||||
* `CHTYPE` - show current type/auxtype
|
||||
* `CHTYPE pic,T$08` - set just type
|
||||
* `CHTYPE file,A$0640` - set just auxtype
|
||||
* `CHTYPE now_basic,TBAS,A$801` - set both type and auxtype
|
||||
* `CHTYPE /root/was_bin,TSYS` - works with absolute paths
|
||||
* `CHTYPE as_text,TTXT,S6,D1` - can use slot/drive arguments too
|
||||
|
||||
Notes:
|
||||
* Allocates a 1 page buffer to store the code
|
||||
@ -23,6 +25,6 @@ Notes:
|
||||
* 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 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)
|
||||
|
74
chtype.s
74
chtype.s
@ -5,11 +5,13 @@
|
||||
;;; Install:
|
||||
;;; -CHTYPE (from BASIC.SYSTEM prompt)
|
||||
;;; Usage:
|
||||
;;; CHTYPE filename,Ttype[,Aaux][,S#][,D#]
|
||||
;;; 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
|
||||
;;; * optional A$1234 sets aux type info
|
||||
;;; * with neither T nor A option, prints current values
|
||||
;;;
|
||||
;;; Build with: ca65 - https://cc65.github.io/doc/ca65.html
|
||||
;;;
|
||||
@ -21,6 +23,13 @@
|
||||
|
||||
INBUF := $200 ; GETLN input buffer
|
||||
|
||||
;;; ============================================================
|
||||
;;; Monitor ROM routines
|
||||
|
||||
CROUT := $FD8E
|
||||
PRBYTE := $FDDA
|
||||
COUT := $FDED
|
||||
|
||||
;;; ============================================================
|
||||
;;; ProDOS MLI / Global Page
|
||||
|
||||
@ -189,16 +198,6 @@ execute:
|
||||
bne :+
|
||||
lda #$10 ; SYNTAX ERROR
|
||||
sec
|
||||
rts
|
||||
:
|
||||
|
||||
;;; --------------------------------------------------
|
||||
|
||||
lda FBITS
|
||||
and #PBitsFlags::T ; Type?
|
||||
bne :+
|
||||
lda #$B ; INVALID PARAMETER
|
||||
sec
|
||||
rts1: rts
|
||||
:
|
||||
|
||||
@ -213,24 +212,33 @@ rts1: rts
|
||||
|
||||
;;; --------------------------------------------------
|
||||
|
||||
;; Set new file info
|
||||
lda #$7
|
||||
sta SSGINFO
|
||||
;; Apply options
|
||||
ldy #0 ; count number of options
|
||||
|
||||
;; Apply new file type
|
||||
;; 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 #%10000000
|
||||
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
|
||||
@ -238,9 +246,41 @@ rts1: rts
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
;; Set new file info
|
||||
lda #$7
|
||||
sta SSGINFO
|
||||
|
||||
lda #SET_FILE_INFO
|
||||
jmp GOSYSTEM
|
||||
|
||||
;;; --------------------------------------------------
|
||||
|
||||
show:
|
||||
lda #'T'|$80
|
||||
jsr COUT
|
||||
lda #'='|$80
|
||||
jsr COUT
|
||||
lda #'$'|$80
|
||||
jsr COUT
|
||||
lda VTYPE
|
||||
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
|
||||
rts
|
||||
|
||||
;;; ============================================================
|
||||
;;; Data
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user