💾 Archived View for mirrors.apple2.org.za › archive › apple.cabi.net › System › GSOS.P8.Anatomy › SY… captured on 2023-01-29 at 08:32:16.

View Raw

More Information

-=-=-=-=-=-=-

TableS-I BASIC.SYSTEM command line parameters

Parameter Standard Meaning

pathname The active file
snum Active 1/0 slot
,A#a Starting address
,B# Byte number
,D# Disk drive number
,E# Ending address
,F# Field number
,L# Length
Line number

,R# Record number
,S# Disk slot number
,T# File type code
,V# Volume number

Permitted Values

See rules in Chapter 2
07b

$OOOO-$FFFF
$OOOO-$FFFFF
12c

$OOOO-$FFFF
$OOOO-$FFFF
$OOOO-$FFFF
$OOOO-$FFFF
$OOOO-$FFFF
17c

$OO$FFd
$OO-$FF

NoTEs:

aThe "#" in the parameter name represents the parameter's value. The value can he specified in
hexadecimal or decimal format. (Hexadecimal numhers must he preceded hy ~).
bHexadecimal values are not allowed for snum.

In a command line that includes a pathname, the 5 and D parameters specified must correspond to an
installed disk drive, or a "no device connected" error will occur.

dA three-character file tvpe mnemonic corresponding to a value can he specified with the T parameter
instead. Tahle 2-5 in Chapter 2 shows the mnemonics availahle.

CAT command are displayed. (If no such parameter is specified, the currently active
directory is used.) CAT also displays the type of each file (as a three-character
mnemonic such as BAS, BIN, TXT, and SYS; see Table 2-4), the number of blocks it
occupies, and the date it was last modified. After the names of all files have been
listed, the number of blocks free and blocks used on the disk are displayed.

CATALOG. This command is similar to CAT. It displays the very same information for
each file as well as its time of last modification, creation date and time, size (in bytes), and
"subtype" entry (the file's auxiliary type code; the entries displayed are the default loading

The BASIC. SYSTEM Interpreter 229

Table 5-2 The syntax for each BASIC.SYSTEM command

BLOAD
BRUN
BSAVE
BYE
CAT

CATALOG
CHAIN
CLOSE
CREATE
DELETE
EXEC
FLUSH
FRE
IN#
LOAD
LOCK
NOMON
OPEN

POSITION
PR#

PREFIX
READ

RENAME
RESTORE
RUN

230 System Programs

pathname [,Ttype] [,L#] [,S#] [,D#]

pathname [,A#] [,B#] [,L# ,E#] [,Ttype] [,S#] [,D#]
pathname [,A#] [,B#] [,L# ,E#] [,S#] [,D#]
pathname,A# ,L# ,E# [,B#] [,Ttype] [,S#] [,D#]

[pathname] [,S#] [,D#]
[pathname] [,S#] [,D#]
pathname [,@#] [,S#] [,D#]
[pathname]

pathname [,Ttype] [,S#] [,D#]
pathname [,S#] [,D#]

pathname [,F# ,R#] [,S#] [,D#]
[pathname]

snum A# snum,A#
pathname [,S#] [,D#]
pathname [,S#] [,D#]
[anything]

pathname [,L#] [,Ttype] [,S#] [,D#]
pathname ,F# ,R#
snum A# snum,A#
[pathname] [,S#] [,D#]
pathname [,R#] [,F#] [,B#]
pathname1,pathname2 [,S#] [,D#]
pathname [,S#] [,D#]
pathname [,@#] [,S#] '[,D#]

Table 5-2 Continued

SAVE pathname [,S#] [,D#]
STORE pathname [,S#] [,D#]
UNLOCK pathname [,S#] [,D#]
VERIFY [pathname] [,S#] [,D#]
WRITE pathname [,R#] [,F#] [,B#]

N0TE: Brackets enclose optional parameters and vertical hars separate alternative parameters.

address for a BIN file and the record length for a TXT file). It also displays the disk
capacity in blocks.

CREATE. This command creates a directory entry for a specified file. It is primarily
for creating subdirectory files since the other common types of ProDOS files (Apple-
soft programs, binary files, and textfiles) are automatically created by other BASIC. SYSTEM commands (SAVE, BSAVE, and OPEN). For example, if the volume direc-
tory is active and you want to create a subdirectory called DEMO.PROGRAMS, you
would enter the command

CREATE DEMO. PROGRAMS

from the keyboard. After you do this, the subdirectory appears as a file entry when you
catalog the directory in which the file was created. The file type mnemonic used to
identi(y it in the catalog listing is DIR. Other types of files can be created using the
,Ttype parameter.

DELETE. This command deletes a file by removing its entry from the directory and
altering the volume bit map to free up the blocks the file uses. Only unlocked files can
be erased with the DELETE command.

LOCK This command protects a file from being accidentally or intentionally de-
leted, modified, or renamed. Once a file has been locked, it cannot be deleted,
modified, or renamed unless it is first unlocked. You can tell which files are locked by
cataloging the disk (using the CAT or CATALOG command); if the name of the file is
preceded by an asterisk (*), it is locked.

The BASIC. SYSTEM Interpreter 231

PREFIX. This command defines the chain of directory names to which any
or partial pathname specified will automatically be appended to generate a
pathname. It is this full pathname on which the BASIC.SYSTEM commands will
If the pathname parameter specified after the PREFIX command does not begin'
a slash, it is appended to the default prefix.

RENAME. This command changes the name of any file on the disk from the
pathname parameter specified to the second.

UNLOCK This command unlocks a locked file so that it can be deleted, m
or renamed.

VERIFY This command checks whether a file exists. If no error occurs, the file
exist. Entering VERIFY by itself (that is, without a pathname) causes Apple's
right notice to appear.

File Loading and Execution Commands

- (dash). This is the intelligent run command. Its parameter can be the pathname
an Applesoft program, a binary program, or a textfile, in which cases the - lc~.
exactly like a RUN, BRUN, or EXEC command, respectively. The - command can
be used to execute ProDOS 8 system (SYS) programs.

BLOAD. This command transfers data from a file to an area of memory. The most
common form of this command is

BLOAO MY. FILE,A#

where # represents the address of the beginning of the block to which the file is to be
transferred. The default file type is binary (BIN), but you can override this with the
,Ttype parameter. The BLOAD command can also be used without the ,A# parame-
ter; in this case, the file is loaded at the location from which it was originally saved to
disk using the BSAVE command. (This address appears in the subtype column when
the disk is cataloged using the CATALOG command.) Any portion of a file can be
loaded using one or more optional parameters: ,B# (the starting position within the
file), ,L# (the number of bytes to be transferred), and ,E# (the last memory location to
be transferred to).

BRUN This command is the same as BLOAD except that after the file loads, it is
automatically executed. Execution begins at the loading address. The BRUN com-
mand can be used with binary (BIN) files only.

232 System Programs

BSA'7E. This command saves the contents of a range of memory to a file. (The
default file type used is binary (BIN) but you can override this default with the ,Ttype
parameter.) For example, to save the contents of memory from $300 to $3CF to a
binary file called PAGE.THREE, you would enter the command

BSAVE PAGE.THREE,A$300,E$3CF
or

BSAVE PAGE.THREE,A$300,L$D0

where the ,A$300 parameter indicates the starting address of the range, ,E$3CF
indicates the ending address, and ,L$D0 indicates the number of bytes to be saved.
You can also use the ,B# parameter to indicate the byte position in the file the write
operation is to take place.

EXEC. This command redirects subsequent requests for input to a specified file instead
of the keyboard until everything in the file has been read. For example, suppose you have
defined a file called MY.STARTUP that contains the following two lines:

HOME

CATALOG

When you enter EXEC MY.STARTUP from command mode, the screen clears, and
the disk is cataloged, just as if you had entered the two commands directly from the
keyboard. You can use the ,F# or ,R# parameters to specifi' the number of the first
line in the file to be executed.

LOAD. This command loads an Applesoft program into memory.
RUN. This command is the same as the LOAD command except that alIer the program
is loaded, it is automatically executed. The ,@# parameter can be used to speci~ the
Applesofr line number to be executed first; the default is the first line number. (If RUN is
entered without a pathname, the program already in memory is executed.)

SAVE. This command saves an Applesoft program to a file on disk. The file type
mnemonic for a program file is BAS.

File Input/Output Commands

OPEN. This command opens a file (by default, a TXT file) for reading and writing. If
the pathname specified does not exist, a new file is created. A file must be opened before
it can be accessed using the BASIC.SYSTEM READ, WRITE, FLUSH, and POSITION

The BASIC. SYSTEM Interpreter 233

commands. Textfiles can be opened as one of two basic types: sequential or -
access. A sequential textfile is one in which lines of information are stored one
another, separated only by a carriage return code; if you want to access informal
anywhere in the file, you usually have to read all the information preceding it.

A random-access textfile is organized as a series of fixed-length records that hold
related groups of information; any record can be accessed randomly (that is, with~t
reading all previous records first) simply by specifying its record number when using
the READ command. The record length is assigned to a random-access textfile when
it is first opened by using the ,L# parameter; it is displayed in the subtype column of
a CATALOG listing in the form R = $xxxx. For example, if the record length is 127,
the subtype entry would be R = $007F.

READ. This command redirects subsequent requests for input to an open file
instead of the keyboard. If a random-access textfile is being read, the record number
to be accessed can be specified using the ,R# parameter. You can also specift' a field
number (a field is a string of characters terminated by a carriage return code) using
the ,F# parameter or a byte number using the ,B# parameter. If more than one of
these parameters is used, READ first skips to the proper record number, then to the
proper field number, and finally to the proper byte position. (That is, the byte position
is relative to the current field position.)

POSITION. This command sets the position in the file at which subsequent read
and write operations will take place. The number of fields to skip over is specified by
the ,F# or ,R# parameter.

ATE. This command redirects subsequent output to an open file instead of the video
screen. It works much like the READ command except in the opposite direction.

APPEND. This command opens a file and redirects subsequent output to the end of the
file. The defanlt file type is a textfile, but you can override this with the ,Ttype parameter.

FLUSH. When BASIC.SYSTEM opens a file, it allocates a file buffer for it in
memory. Data written to the file is stored in this buffer and is not transferred to disk
until the buffer fills up or another file block needs to be accessed. The FLUSH
command forces any data stored in the buffer to be saved to disk even if the buffer is
not yet foIl. This minimizes the risk of data loss in the event of an unexpected exit
from the program (caused by a loss of power, pressing Reset, and so on), but it slows
down disk write operations considerably. FLUSH also causes the file's directory entry
to be updated. If you use FLUSH without a pathname, all open files are flushed.

CLOSE. This command closes a file that was opened with the OPEN or APPEND
command. When you close a file, its buffer is automatically flushed, and its directory
entry is updated. If you use CLOSE without a pathname, all open files are closed.

234 System Programs

Miscellaneous Commands

BYE. This command disconnects BASIC.SYSTEM and passes control to a ProDOS
8 system program by calling the QUIT command. This invokes the ProDOS 8 selector
program (as discussed earlier in this chapter). The standard selector prompts you to
enter the prefix and partial pathname of the next system program to run; once you
provide this information, the program is executed.

CHAIN. This command transfers control from one Applesoft program to another
while maintaining the names and current values of all the variables in the pro-
gram from which control is being passed. This allows very large programs
to be executed by breaking them into separate modules and chaining them to-
gether. You can chain to any line number in the new program using the ,@#
parameter.

FRE. This command forces garbage collection of Applesoft string variables. This
command is much faster than the one of the same name built in to the Applesoft
interpreter. (See Chapter 4 of Inside the Apple lIe for more information on the
garbage collection procedure.)

JN#. This command redirects subsequent requests for input to a peripheral card
subroutine at $Cn00 (where n is a slot number) or to a user-installed subroutine. If a
slot number of 0 is specified, the standard keyboard input subroutine at KEYIN
($FDIB) is used instead. IN# can also be used to associate the address of any input
subroutine with any slot number by using the snum,A# construct; once this is done,
an IN#n command can be used to direct later requests for input to this subroutine
rather than to $Cn00.

NOMON. This command is allowed but does nothing. Under DOS 3.3 it disables
the display of disk commands and 1/0 operations; under BASIC.SYSTEM, these
commands and operations are never displayed.

PR#. This command redirects subsequent output to a peripheral card subroutine at
$Cn00 or to a user-installed subroutine. Ifa slot number of0 is specified, the standard
40-column video output subroutine at COUT1 ($FDF0) is used instead. PR# can also
be used to associate the address of any output subroutine with any slot number by
using the snum,A# construct; once this is done, a PR#n command can be used to
direct subsequent output to this subroutine rather than to $Cn00.

RESTORE. This command initializes the names and values of the variables in an
Applesoft program to those contained in the file specified in the argument. This file
must have a file type code of VAR (the type created by the STORE command).

The BASIC. SYSTEM Interpreter 235

STORE. This command saves the names and current values of all the variables in
Applesoft program to a disk file. The mnemonic for the file type code BASIC.S
assigns to the file is VAR.

BASIC.SYSTEM AND THE INPUT AND OUTPUT LINKS
Applesoft programs sometimes need to redirect input or output requests to a device
one of the Apple's expansion slots (called ports on the Ilcs or the slotless Apple
The easiest way to do this is to use the BASIC.SYSTEM IN# and PR# comn
For example, to redirect output to a printer in slot 1, you would execute
statement:

PRINT CHR$(4);"PR#1"

The confusingly similar Applesoft commands of the same names must not be used
redirect 1/0 when using BASIC.SYSTEM.

You can also use a special form of the IN# and PR# commands to redirect I/O

a subroutine located anywhere in memory. The only restriction on its use is that
first byte of the new subroutine must be a 6502 CLD (clear decimal flag) instruction.
To direct 1/0 to any such subroutine, you must execute a statement like
PRINT CHR$(4);"IN# Aaddr"
or

PRINT CHR$(4);"PR# Aaddr"

where addr represents either the decimal starting address of the new 1/0 subroutine
or, if preceded by $, the hexadecimal starting address.
Problems can arise if you try to redirect 1/0 in a BASIC.SYSTEM environment
using assembly-language techniques. Traditionally, 1/0 requests are redirected by
storing the address of a new input routine in KSW ($38-$39) and the address of a new
output routine in CSW ($3~$37); KSW and CSW are the input and output links,
respectively. As we saw earlier, this is exactly how BASIC. SYSTEM gets its hooks into
the system. Thus if we were to overwrite these links, we would interfere with the
operation of BASIC.SYSTEM and may even disconnect it. (If you accidentally discon-
nect BASIC.SYSTEM like this, you can reconnect it by executing a JSR BIENTRY
instruction; BIENTRY is located at $BE00.)

You can avoid this problem in one of two ways. You can use the BRUN command to
load and execute any assembly-language program that modifies the standard 1/0 links.
This works because just before the program that is BRUN ends, BASIC.SYSTEM
checks whether the 1/0 links have changed. If they have, the new link addresses are
moved into BASIC.SYSTEM's own internal 1/0 links, and the addresses of its own 1/0

236 System Programs

subroutines are restored. The BASIC.SYSTEM 1/0 links are used just like the stan-
dard ones, and the subroutines whose addresses are stored in them are called when
BAS1C.SYSTEM wants to perform standard (nondisk) 1/0 operations.

Alternatively, you can install a new input or output subroutine by storing its
address directly into the appropriate internal BASIC.SYSTEM link itself: the input
link at VECTIN ($BE32-$BE33) or the output link at VECTOUT ($BE30-$BE31).

Any other method used to change the standard input links (such as POKEing new
values from an Applesoft program or using CALL to execute a subroutine that stores
new values) will not work properly.

RESERVING SPACE ABOVE THE FILE BUFFERS

As Figure 5-1 shows, once you install BASIC.SYSTEM, it occupies the memory space
from $9A00 to $BEFF in main memory. It also sets up a $400-byte (1K) general-
purpose buffer that initially sits just below this area, beginning at $9600. To prevent
the space above $9600 from being overwritten by Applesoft programs, BASIC.-
SYSTEM sets the Applesoft HIMEM pointer to $9600; this forces Applesoft to store
string variables below $9600. (HIMEM refers to the address stored in the Applesoft
end-of-string pointer at $73-$74.)

The general-purpose buffer always occupies the 1K area just above HIMEM even

if HIM EM changes. BASIC. SYSTEM uses it as a temporary storage area for directory
blocks when it needs to catalog the disk.

BASIC.SYSTEM automatically adjusts HIMEM whenever files are opened or
closed with the OPEN, APPEND, and CLOSE commands. It is not immediately
obvious why a change is necessary, so let's examine how BASIC.SYSTEM manages
files in a bit more detail. When BASIC.SYSTEM opens a file, it creates a $400-byte
buffer for it by lowering HIMEM by that number of bytes (and moving the general-
purpose buffer down with it) and then reserving the $400-byte area beginning at the
original HIMEM position for use as the buffer. If it opens another file (up to eight
files can be open at once), it repeats the process, meaning the new buffer fits in just
below the first one. (Exception: If you open a file with the EXEC command, BASIC. SYSTEM always places its buffer immediately above the highest-addressed active
buffer.) When you close a file, ProDOS 8 removes the file's buffer by relocating the
lowest-addressed active file buffer to the position of the closed buffer and then raising
HIMEM by $400 bytes. Note that BASIC.SYSTEM takes all steps necessary to ensure
that Applesoit's string variables are not over'vritten despite the fluctuations in HIMEM.

It is often convenient to reserve a safe area of memory where assembly~langnage
programs may be stored without fear of being overwritten by either BASIC.SYSTEM
or Applesoft itself. One such area is from $300 to $3CF in page three, but there is
room for only very short programs there. Under DOS 3.3, an alternative area can be
reserved simply by lowering HIMEM and storing the program between the new and
old HIM EM locations. But you can't do this with BASIC. SYSTEM because of the way
it manages buflers when files are opened or closed.

Reserving Space Above the File Buffers 237

When you're using BASIC.SYSTEM, you can reserve a safe area above the
byte directory buffer beginning at HIMEM. To do this, follow these steps:

1. Close all files with the BASIC.SYSTEM CLOSE command.
2. Lower HIMEM by a multiple of $100 (256) bytes with the Applesoft HIM
command. (The HIMEM: command simply places the address specified in
argument directly into the HIMEM pointer.)

You must perform these steps before any Applesoft string variables have been
since the existing Applesoft string space will be overwritten. After completing these
steps, the area from HIM EM + $400 to $99FF can be used for storing assemhly
programs without danger of their being overwi'itten by BASIC.SYSTEM operations.

Be very careful when using the Applesoft HIMEM: command beca'ise no c
are made to ensure the address specified in the command is an integral multiple
256. BASIC.SYSTEM does not operate properly if HIMEM does not point to a
boundary.

Alternatively, you can, at any time, call the GETBUFR ($BEF5) subroutine from
assembly-language program if you want to free up a space of contiguous 256-byte
above HIMEM. Do this by placing the number of pages to be reserved in the acc
tor and then calling GETBUFR; on exit, the carry flag is clear if there was enough ~
space available, or set if there wasn't. If all went well, the number of the first
reserved is in the accumulator. We see an example of how to use GETBUFR later iii
chapter in the installation code for a user-defined command called ONLINE.

You can deallocate space reserved with GETBUFR by calling the FREEBU-
($BEF8) subroutine. This subroutine frees up all buffers that GETBUFR has reserve
since bootup by setting H1MEM back to its original value stored at PAGETOP
($BEFB). (You can selectively free up the most recently allocated buffers by setting
PAGETOP to the page number, less 4, of the start of the buffer you want to remain.)

Whenever you reserve space above HIM EM, it is usually a good idea to modiiy the
system bit map to indicate that the memory pages reserved are in use. If you do this,
the ProDOS 8 command interpreter will not permit these pages to be used as buffer
areas when ProDOS 8 commands are requested. But if you want to use part of the
space as an 1/0 buffer when opening a file, don't mark the pages as in use; if you do,
you will get an error when you try to open a file.

BASIC.SYSTEM PAGE THREE USAGE

We saw in Chapter 3 that ProDOS 8 reserves the area from $3D0 to $3EC for use by
system programs like BASIC.SYSTEM. As Table 5-3 shows, BASIC.SYSTEM uses
only the first six locations; these locations contain two 3-byte JMP instructions to the
BASIC.SYSTEM warm-start entry point.

BASIC.SYSTEM also initializes most of the system vectors from $3ED to $3FF
when it starts up. Table 5-4 shows the contents of this area of page three.

238 System Programs

Table 5-3 ProDOS ~BASIC.SYSTEM page 3 vectors
Address Description of Vector

$3D0-$3D2 A JMP instruction to the BASIC.SYSTEM warm-start entry point. A
call to this vector reconnects BASIC.SYSTEM without destroying
the Applesoft program in memory. Use the 3D0G command to move
from the system monitor to Applesoft.

$3D3-$3D5

Another JMP instruction to the BASIC.SYSTEM warm-start entry
point.

h0TE: Locations $3D6-$3EC are also reserved for use by a ProDOS 8 system program.

Table 5-4 Initialization of page 3 system vectors by ProDOS 8 and BASIC.SYSTEM

Vector Name Address Contents
XFERLOC $3ED-$3EE [not

initialized]

BRK $3F~3F1 $FA59

RESET $3F2-$3F3 $BE00
$3F4 $1B

& $3F~3F7 JMP $BE03
USER $3F~3FA JMP $BE00
NMI $3FIi'=$3FD JMP $FF59
IRQ $3FE-$3FF $BFEB

Descr,ption

Address control passes to when XFER
($C314) is called (lIe, Ilc, Ilcs)
Address of a subroutine that displays
the 6502 registers and then enters the
system Monitor

Address of the BASIC.SYSTEM
warm-start entry point (reconnects
BASIC. SYSTEM) followed by
"powered-up" byte

Jump to BASIC.SYSTEM'5 external
entry point for command strings (see
ChapterS)

Jump to BASIC.SYSTEM'5 warm-start
entry point

Jump to the system Monitor's cold-start
entry point

Address of the special ProDOS 8
interrupt handler (see Chapter 6)

N0TE: The addresses stored at each vector location are stored with the low-order byte first.

BASIC. SYSTEM Page Three Usage 239

BASIC.SYSTEM does not use the rest of page three (from $300 to $3CF), so it is
convenient area for holding short assembly-language subroutines you can call from
Applesoft program.

THE BASIC.SYSTEM GLOBAL PAGE: $BE0~$BEFF
The BASIC.SYSTEM global page occupies locations $BE00 to $BEFF, just
the ProDOS 8 global page. It contains several fixed-position subroutines and
areas that assembly-language programs can use to communicate easily with BASIC--
SYSTEM. For example, the global page contains entry points for executing ASCIl[
command strings, handling user-installed commands, handling errors, and executing
MLI commands. Table 5-5 is a source listing for the BAS1C.SYSTEM global page.

The GOSYSTEM Subroutine

Most of the global page supports the GOSYSTEM ($BE70) subroutine that the BASIC. SYSTEM code calls whenever it needs to execute an MLI command. On entry, GOSYS-
TEM constructs a standard JSR MLI call by storing the MLI command number (passiel
in the accumulator) at SYSCALL ($BE85) and the address of the command's paramet~
table at SYSPARM ($BE86). (As Table 5-5 shows, each command BASIC.SYSTEM uses
has its own parameter table in the global page - the values in the table are set up before
the call to GOSYSTEM.) Since SYSCALL and SYSPARM are located right after the JSR
MLI instruction, as required by the MLI command interpreter, the command is properly
invoked when the JSR MLI is actually executed.

You can use GOSYSTEM in your own assembly-language programs to execute
MLI commands. To do this, first set up the parameters in the appropriate internal
parameter table, and then call GOSYSTEM with the MLI command number in the
accumulator. The code to do this is very simple and looks like this:

[set up parameter
table here]

LOA #CMDNUM
JSR GOSYSTEM
BCS ERROR

;Put MLI command number in A
;Let GOSYSTEM execute command

This method is a bit more convenient than simply calling ML1 ($BF00) in the usual
way because BAS1C.SYSTEM has already reserved space for the command parameter
tables in the global page. Furthermore, GOSYSTEM automatically sets up the JSR
MLI/DFB CMDNUM/DA PARMTBL calling block and converts MLI error codes to
the more familiar BASIC.SYSTEM error codes. We talk more about error handling in
the next section.
Note, however, that you can use GOSYSTEM to execute MLI commands only from
$C0 to $D3. Other commands you must execute using the standard JSR MLI technique.

240 System Programs

Table 5-5 Source listing for the BASIC. SYSTEM global page

2 ********************************~~~~~~
3 * BAS1C.SYSTEM Global Page
4 * for BASIC.SYSTEM version 1.2
5
6 * Comments copyright 1985-1988
7 * Gary B. Little
8
9 Last modified: August 26, 1988
10
11 **************************************
12

13 * Note: these addresses are valid for
14 * BASIC.SYSTEM version 1.2 only
15

16 TXBUF2 EQU $280

17 SYSOUT EQU $9A2F Internal output subroutine
18 SYSIN EQU $9ABA Internal input subroutine
19 N0OEVERR EQU $9AEE
20 ERROR EQU $9AF0
21 PRTERR EQU $9F88
22 PAGEGET EQU $A2B5
23 PAGEFREE EQU $A301
24 SYNTAX EQU $A677
25 WARMDOS EQU $ABF1

26 OOSOUT EQU $B7F1 ;Character out intercept
27 DOSIN EQU $B7F4 Character in intercept
28 SYSCTBL EQU $B805 ;Table of parm table addresses
29 ML1ERTBL EQU $B9EE ;Table of ML1 error codes
30 BIERRTBL EQU $BA01 Table of Applesoft error codes
31 CALLX EQU $BCA8
32 TXBUF EQU $BCBO

33

34 ML1 EQU $BFO0
35

36 C0UT1 EQU $FDFO
37 KEYIN EQU $F01B
38 C0UT8O EQU $C307
39 KEY1N80 EQU $C305
40

41 ORG $BEO0
42

BEQQ; 4C Fl -8 43 81FNTRY J~ WARHG0s
BE03: 4C 77 A6 44 DOSCMD JMP SYNTAX
BE06: 4C 9E BE 45 EXTRNCMO JMP XRETURN

46

Video output (40 column)
;Keyboard input (40 column)
;Video output (80 column)
Keyboard input (80 column)

;Connect BAS1C.SYSTEM 1/0 links
;Execute command string at $200
;User command handler

47 ***************************************************

48 * ERROUT is called by BASIC.SYSTEM whenever a
49 disk error condition is detected. (The error
50 * code -- 2. .22 -- is stored in the accumulator.)

The BASIC. SYSTEM Global Page: $BE0~$BEFF 241

Table 5-5 Continued

51

52
53
54
55
56

BE09: 4C F0 9A 57
BE0C: 4C 88 9F 58
BEOF: 00 59

60
61
62
63
64
65
66
67
68
69
70
71
72
73

BE10: FO FP 74 0UTVECT0 PA
BE12: 00 C1 75 0UTVECT1 PA
BE14: 00 C2 76 0UTVECT2 PA
BE16: 00 C3 77 0UTVECT3 PA
BE18: 00 C4 78 0UTVECT4 PA
BE1A: 00 C5 79 0UTVECT5 PA
BE1C: 00 C6 80 0UTVECT6 PA
BE1E: 00 C7 81 0UTVECT7 PA

82


ERROUT JMP ERROR ;Applesoft error handler
PRINTERR JMP PRTERR Print error message
ERRCODE DFB 0 ;Error code



C0UT1 Standard video output
$C100 ;(Assume printer card)
$C200 (Assume modem card)
$C300 ;(Assume 80-column card)
$C400 ;(Assume mouse card)
$C500 (Assume 3.5-inch drive)
$C600 ;(Assume 5.25-inch drive)
$C70O ;(Assume RAMdisk card)

83 ************** * * *

85
86
87
88
89
90
91
92
93
94
95

BE20: 1B FP 96
BE22: 00 C1 97
BE24: 00 C2 98
BE26: 00 C3 99

84 The following table holds the addresses to


INVECTO PA KEYIN ;Standard keyboard input
1NVECT1 PA $C100 ;(Assume printer card)
1NVECT2 PA $C20O (Assume modem card)
1NVECT3 PA $C300 ;(Assume 80-column card)

242 System Programs