LLX > Neil Parker > Apple II > External Commands for BASIC.SYSTEM
Here are a few external commands for BASIC.SYSTEM under ProDOS, which I occasionally find useful.
BRUN TYPE.CMD
: Installs a TYPE
command for
viewing text files.
Syntax:
TYPE <pathname> [,S#] [,D#] [,T<type>] TYPE ?
The first form displays the text file named by
<pathname>
(optionally qualfied by a slot and drive
number) on the current output device. The file is normally required to
be a text file, but any other type of file may be displayed by specifying
the T<type>
paramater.
The display may be paused by pressing any key on the keyboard (except control-C), and then resumed by pressing any key (except control-C). Pressing control-C cancels the display.
The high bit of each character is forced to "1" for display. Control characters are replaced by ".", except for carriage return (control-M, which performs its normal function).
The second form of the command does nothing, and returns with no error.
This is intended for testing whether or not the TYPE command has already
been installed: If "TYPE?
" produces no error, you don't
need to load it again. For example, an Applesoft program might do
something like this:
10 ONERR GOTO 30 20 PRINT CHR$ (4);"TYPE?": POKE 216, 0: GOTO 40 30 CALL 62248: POKE 216,0: PRINT CHR$ (4);"BRUN TYPE.CMD" 40 REM Program continues here
The TYPE
command uses 256 bytes of memory (located above
BASIC.SYSTEM's file buffers).
BRUN CHTYPE.CMD
: Installs a CHTYPE
command for
changing file types.
Syntax:
CHTYPE <pathname> [,S#] [,D#] [,T<type>] [,A<auxtype>] CHTYPE ?
The first form of the command changes the file type of
<pathname>
to the type
indicated by the T<type>
paramater, and/or the
auxiliary type as indicated by the A<auxtype>
paramater. At least one of T<type>
and
A<auxtype>
must be specified; omitting both of them
is a syntax error.
The second form of the command does nothing, and returns with no error.
This is intended for testing whether or not the CHTYPE
command has already been installed: If "CHTYPE?
" produces
no error, you don't need to load it again.
The CHTYPE
command uses 256 bytes of memory (located above
BASIC.SYSTEM's file buffers).
BRUN HEXDUMP.CMD
: Installs HEXDUMP
and
HDUMP
commands, for displaying the contents of a file in
hexadecimal.
Syntax:
HEXDUMP <pathname> [,S#] [,D#] [,B<offset>] HDUMP <pathname> [,S#] [,D#] [,B<offset>] HEXDUMP ? HDUMP ?
The first and second forms display the contents of
<pathname>
as hexadecimal bytes, and as ASCII
characters. HEXDUMP
displays sixteen bytes per line
(requiring a display that can handle at least 71 characters per line),
and HDUMP
displays eight bytes per line (requiring only 39
characters per line on the output device).
The B<offset>
paramater can be used to
start someplace other than the first byte of the file. The
<offset>
can be any decimal or hexadecimal number
less than the length of the file.
The display may be paused by pressing any key on the keyboard (except control-C), and then resumed by pressing any key (except control-C). Pressing control-C cancels the display.
Each line of output starts with the file position (in hexadecimal), followed by eight or sixteen hexadecimal bytes, followed by eight or sixteen ASCII characters. The ASCII characters all have their high bits forced to "1", and control characters are replaced by ".".
The third and fourth forms of the command do nothing, and return no
error. These are intended for testing whether or not HEXUMP
is already installed: If "HEXDUMP?
" or "HDUMP?
"
produces no error, you don't need to load it again.
HEXDUMP
/HDUMP
uses 768 byes of memory (located
above BASIC.SYSTEM's file buffers).
License: These commands, and their source code, may be used by anybody for any purpose without restriction. Though I would appreciate an acknowledgement if you include any of them in your own project, it's not required. There is, of course, no warranty.
Source code is for the EDASM assembler. This shouldn't be too hard
to translate for other assemblers, but beware that unlike most other
assemblers, "#>
" means the LOW byte of a constant, and
"#<
" means the HIGH byte.
I apologize for the lack of comments in the source code.
What's inside:
TYPE
)TYPE.CMD
)CHTYPE
)CHTYPE.CMD
)HEXDUMP
and
HDUMP
)HEXDUMP.CMD
)LLX > Neil Parker > Apple II > External Commands for BASIC.SYSTEM
Original: June 26, 2016
Modified: April 8, 2018--Added zipped disk image