beneath-apple-dos/D1S2/CH8.4#064000.txt

256 lines
9.8 KiB
Plaintext
Raw Normal View History

.np
A884-A908 DOS command name text table.
This table consists of the ASCII name for each DOS
command in order of command index values, with the
last character of each indicated by the MSB being
on. Commands in order are:
INIT,LOAD,SAVE,RUN,CHAIN,DELETE,LOCK,UNLOCK,CLOSE,
READ,EXEC,WRITE,POSITION,OPEN,APPEND,RENAME,
CATALOG,MON,NOMON,PR#,IN#,MAXFILES,FP,INT,BSAVE,
BLOAD,BRUN,VERIFY.
Example: INIT is $49 $4E $49 $D4 (I N I T)
.np
A909-A940 Command valid keywords table.
This table is used to determine which keywords are
required or may be given for any DOS command.
Each command has a two byte entry with 16 flags,
indicating which keywords may be given. The flag
bit settings are as follows:
.ul
BIT MEANING
0 Filename legal but optional
1 Command has no positional operand
2 Filename #1 expected
3 Filename #2 expected
4 Slot number positional operand expected
5 MAXFILES value expected as positional operand
6 Command may only be issued from within a program
7 Command may create a new file if file not found
8 C, I, O keywords legal
9 V keyword legal
10 D keyword legal
11 S keyword legal
12 L keyword legal
13 R keyword legal
14 B keyword legal
15 A keyword legal
Thus, for a typical command, OPEN, where the value
is $2378, bits 2, 6, 7, 9, 10, 11, and 12 are set so
the command has one filename operand, may only be
issued from within a program, may create a new file,
and the V, D, S, and L keywords are legal.
The command entries are:
INIT 2170
LOAD A070
SAVE A170
RUN A070
CHAIN 2070
DELETE 2070
LOCK 2070
UNLOCK 2070
CLOSE 6000
READ 2206
EXEC 2074
WRITE 2206
POSITION 2204
OPEN 2378
APPEND 2270
RENAME 3070
CATALOG 4070
MON 4080
NOMON 4080
PR# 0800
IN# 0800
MAXFILES 0400
FP 4070
INT 4000
BSAVE 2179
BLOAD 2071
BRUN 2071
VERIFY 2070
.np
A941-A94A Keyword name table.
This table contains all the ASCII names of the DOS
keywords in standard order. Each keyword name
occupies one byte:
V,D,S,L,R,B,A,C,I,O
.np
A94B-A954 Keyword flag bit positions table.
This table gives the bit positions for each keyword
into the second byte of the command valid keyword
table above and in the flag (AA65) which indicates
which keywords were present on the command line.
The bit positions are:
V - 40
D - 20
S - 10
L - 08
R - 04
B - 02
A - 01
C - C0 ...
I - A0 ... not used in valid keyword table
O - 90 ...
.np
A955-A970 Keyword value valid range table.
This table indicates the range any keyword value
may legally have. Each keyword has a four byte entry,
two bytes of minimum value, and two bytes of maximum
value. Values are:
.ul
KEYWORD MIN MAX
V 0 254
D 1 2
S 1 7
L 1 32767
R 0 32767
B 0 32767
A 0 65535
C, I, and O do not appear in this table since they
do not have numeric values.
.np
A971-AA3E Error message text table.
This table contains the text for each error code in
order of error code number:
.ul
NUMBER TEXT
0 RETURN BELL RETURN
1 "LANGUAGE NOT AVAILABLE"
2 "RANGE ERROR" (Bad file manager opcode)
3 "RANGE ERROR" (Bad file manager subcode)
4 "WRITE PROTECTED
5 "END OF DATA"
6 "FILE NOT FOUND"
7 "VOLUME MISMATCH"
8 "I/O ERROR"
9 "DISK FULL"
10 "FILE LOCKED"
11 "SYNTAX ERROR"
12 "NO BUFFERS AVAILABLE"
13 "FILE TYPE MISMATCH"
14 "PROGRAM TOO LARGE"
15 "NOT DIRECT COMMAND"
.np
AA3F-AA4F Error message text offset index table.
This table contains the offset in bytes to the text
of any given error message in the table above.
Entries are one byte each for each error code number.
.np
AA4F-AA65 DOS main routines variables.
AA4F Current file buffer address (2 bytes).
AA51 Status flags: $01=READ state, $00=Warmstart,
$80=Coldstart, $40=APPLESOFT RAM
AA52 DOS CSWL intercept state number.
AA53 Address of true CSWL handler (2 bytes).
AA55 Address of true KSWL handler (2 bytes).
AA57 MAXFILES value.
AA59 Save area for S, X, Y, and A registers when DOS is
entered (4 bytes).
AA5D Command line index value (offset into line).
AA5E MON flags: (C=$40, I=$20, O=$10)
AA5F Index of last command times 2.
AA60 Range length for LOAD and BLOAD (2 bytes).
AA62 Index of pending command, if any.
AA63 Scratch variable (counter, message index, etc.)
AA64 Index of current keyword.
AA65 Keywords present on command line flags.
.np
AA66-AA74 Keyword values parsed from command and defaulted.
AA66 Volume (2 bytes)
AA68 Drive (2 bytes)
AA6A Slot (2 bytes)
AA6C Length (2 bytes)
AA6E Record (2 bytes)
AA70 Byte (2 bytes)
AA72 Address (2 bytes)
AA74 MON value (one byte)
.np
AA75-AA92 Primary file name buffer
.np
AA93-AAB0 Secondary (RENAME) file name buffer
.np
AAB1-AAC0 DOS main routines constants and variables.
AAB1 MAXFILES default ($03).
AAB2 Control-D ($84).
AAB3 EXEC file active flag ($00=not active).
AAB4 EXEC file buffer address (2 bytes).
AAB6 Active BASIC flag: $00=INTEGER, $40=APPLESOFT ROM,
$80=APPLESOFT RAM
AAB7 RUN intercepted flag.
AAB8 "APPLESOFT" characters in ASCII (9 bytes)
.np
AAC1-AAC8 File manager constants.
AAC1 Address of RWTS paramter list (B7E8).
AAC3 Address of VTOC sector buffer (B3BB).
AAC5 Address of directory sector buffer (B4BB).
AAC7 Address of last byte of DOS plus one. (C000)
.np
AAC9-AAE4 File manager function routine entry point table.
This table contains a two byte function handler
routine address for each of the 14 file manager
opcodes in opcode order.
.np
AAE5-AAF0 File manager read subcode handler entry point table.
This table contains a two byte function handler
routine address for each of the 6 read subcodes.
.np
AAF1-AAFC File manager write subcode handler entry point table.
This table contains a two byte function handler
routine address for each of the 6 write subcodes.
.np
AAFD-AB05 File manager external entry point (from $3D6).
Is X register zero?
If so, allow new files by simulating an INIT command
index.
Otherwise, require old file by simulating a LOAD
command index.
Fall through to main file manager entry point.
.np
AB06-AB1E File manager main entry.
Save S register at B39B.
Restore file manager workarea from file buffer (AE6A)
Make sure opcode does not exceed 13.
If it does, return with code=2 (invalid opcode).
Use opcode as index into file manager function
routine entry point table and go to proper handler
via RTS.
.np
AB1F-AB21 Return with return code=2 (bad opcode).
.np
AB22-AB27 OPEN function handler.
Call common open code (AB28).
Exit file manager.
.np
AB28-ABDB Common open routine.
Initialize file manager workarea by resetting
variables to their defaults (ABDC).
Set sector length to 256.
Insure record length is non-zero. If zero, use 1.
Store record length in file manager workarea.
Locate or allocate a directory entry for the file
(B1C9).
If file already exists, go to ABA6.
Otherwise, save directory index for free entry.
Using last command index and valid keywords table,
determine whether current command may create a new
file.
If so, go to AB64.
Otherwise, if running "APPLESOFT", set return code
to "LANGUAGE NOT AVAILABLE" and exit.
If not running "APPLESOFT" set return code to "FILE
NOT FOUND" and exit.
AB64 Set sector count in directory entry to 1 (there will
only be a T/S List sector initially).
Allocate a sector for a T/S List (B244).
Store sector number of this sector in directory
entry and in first and current T/S List sector number
in file manager workarea.
Store track number in both places also.
Move file type desired to directory entry.
Write directory sector back to catalog (B037).
Select T/S List buffer (AF0C).
Zero it (B7D6).
And write it back (AF3A).
Set return code to 6 ("FILE NOT FOUND").
.nx ch8.5