-
Notifications
You must be signed in to change notification settings - Fork 5
PascalFileSystem
UCSD Pascal was a language/virtual machine/OS/File System developed by the University of California, San Diego. Apple sold an Apple II implementation/port. IIgs System 6 included a read-only Apple Pascal FST.
The Pascal File system used 512k blocks (like ProDOS) and 2-byte block pointers (which implies a maximum disk size of 32 Meg, like ProDOS). Files don't store their file size per se, but rather the start block, end block, and size of last block. This implies a maximum file size of 32 Meg, minus the overhead of boot and volume blocks.
Block 0 and 1 contain boot code. Blocks 2--5 contain the volume header and up to 77 file entries. When a file is deleted, all subsequent records are moved up.
All values are little-endian unless specified otherwise. All blocks are 512 bytes in length.
Name | Offset | Size |
---|---|---|
first_block | $00 | 2 bytes |
last_block | $02 | 2 bytes |
file_kind | $04 | 1 byte |
reserved | $05 | 1 byte |
volume_name | $06 | 8 bytes |
volume_last_block | $0e | 2 bytes |
file_count | $10 | 2 byte |
load_time | $12 | 2 bytes |
boot_date | $14 | 2 bytes |
reserved | $16 | 4 bytes |
The first block of the file system header (boot block and directory blocks) This should always be 0.
The block after the last block of the directory structure. (i.e., the next available block). This should always be 6.
This should always be 0.
The volume name, stored with a leading length byte (i.e., a pstring). May be 1--7 characters in length.
The number of blocks on the volume.
The number of files. May be 0--77.
????
The date last booted.
Name | Offset | Size |
---|---|---|
first_block | $00 | 2 bytes |
last_block | $02 | 2 bytes |
file_kind | $04 | 1 byte |
status | $05 | 1 byte |
file_name | $06 | 16 bytes |
last_byte | $16 | 2 bytes |
modification_date | $18 | 2 bytes |
The first block of the file
The block after the last file block (i.e., the next available block).
Name | Value | Use |
---|---|---|
untypedfile | $00 | Volume Header |
xdskfile | $01 | Bad blocks |
codefile | $02 | Machine executable code |
textfile | $03 | Text |
infofile | $04 | Debugger Information |
datafile | $05 | Data |
graffile | $06 | Compressed graphic image *
|
fotofile | $07 | Screen image |
securedir | $08 | Subdirectory [???] *
|
*
Not implemented.
Used by wildcard file listings [???]
N.B. -- bit 0 is the status bit, all other bits are reserved.
The file name, stored with a leading length byte (i.e., a pstring). May be 1--15 characters in length.
The number of bytes used in the last block. Should be 1--512.
The date the file was created or last modified.
Dates are stored in a 2 bytes structure:
Field | bits | range |
---|---|---|
year | 15--9 | 0-100 |
day | 8--4 | 0--31 |
month | 0--3 | 0 -- 12 |
yyyy yyyd dddd mmmm
Year 100 is used to indicate a temporary file.
There seems to be a lot of bad information about file name restrictions. Wikipedia states:
Apple Pascal dropped the length to fifteen characters and allowed only letters, numbers and periods to be used.
The UCSD Pascal II manual states:
A volume name be be 7 or less characters long and may not contain '=', '$', '?' or ','.
A legal filename can consist of up to 15 characters. ... Lower-case letters are translated to upper-case, and blanks and non-printing characters are removed from the filename. Legal characters for filenames are the alphanumerics and the special characters '-', '/', '', '', and '.'.
Research (with the file manager) has shown that the only illegal characters are:
- $
- =
- ?
- ,
- whitespace (stripped out)
Additionally, the file manager cannot create (or transfer to) files with a '['. I did not try creating a '[' file programmatically, so its status is ambiguous.
For volume names, ':' and subsequent characters are stripped. The illegal filename characters are allowed but confuse the file manager. You can still refer to the disk by volume number though.