-
Notifications
You must be signed in to change notification settings - Fork 1
cat.dasm16
CAT is the default file system for cubeOS. It is based on the Harry's Allocation Table file system format.
In order to act on a file or directory, it must be "opened." This copies the inode's contents to a temporary position (as provided by the program opening it.) Some of the subroutines below act on opened directories, so as to add links. When one is finished with a directory or file, one must "write" it back into its strip.
The high-level commands provide a smooth interface with the filesystem that can be used easily by modules and the rest of the operating system.
Creates a new, empty file of type at pathPointer. Type can be either 1, for directory, or 0, for file.
assumes there is open space at 0xa000 currently only supports making files in the current directory
returns the sector number of the new file
Uses lower-level subroutines to parse either relative or absolute paths.
assumes there is open space at 0xa000
returns the start sector of the given file (via pathPointer,) or 0xffff
if it doesn't exist
The low-level commands are used by the high level commands to provide fast and efficient access to the framework of the filesystem itself.
Mounts / directory at location, reserving length words after it. It then initializes a cat filesystem with the given sectorSize.
returns location of first word in header
Obeying sector joins, copies the entire file or directory (including inode) specified by stripStartSector to continuousMemoryLocation.
Obeying sector joins, copies the entire contents of an open file at inputPointer to the sector at sectorNumber, linking new sectors as needed and unlinking old ones if they become unnecessary.
If sectorNumber does not link to another sector, link the first open sector to it.
modifies A
returns the sector number joined
modifies A
returns the sector joined to sectorNumber, or 0 if unjoined or unused
Finds the first open sector in the filesystem. Does not detect when the system is full.
modifies A returns sector number
modifies A returns a pointer to the location of the given sector in memory
Creates a new inode of type and length 0 at sector. It also marks the corresponding sector in sector map as used. Types are 0, for unused, 1, for directory, and 2, for file.
modifies A, B
returns the sector of the inode
Marks sector unused in the sector map, unlinks the rest of the strip, and marks its inode unused.
modifies A
returns sector
Unlinks all of the sectors in a strip and marks them each as free
Marks a sector used in the bitmap.
modifies A
returns sector
Marks a sector unused in the bitmap.
modifies A
returns sector
Creates a new link under the given open file, extending the length of the inode automatically.
The first word is the targetStripStartSector, and the remaining fifteen words are copied literally (maximum length fourteen) from the null-terminated word at namePointer.
returns 0 if successful, and 1 if the given sector does not contain a directory
Gets the sector pointed to by the link in currentOpenDirectoryPointer by relativePath. This is not recursive. relativePath is considered terminated by a slash null.
returns the target sector if found, or 0xffff
if not