Byte | Mode | Name | Description |
---|---|---|---|
00-03 | R | Status | Status register, is negativ if an error occured, 0 if idle, 1 if bussy. |
04-07 | RW | Control | Controll register, write to initiate disk operations |
08-0F | RW | Handle | Handle for the current operation |
10-17 | R | Mode | Mode parameter |
18-1F | RW | Position | Position parameter |
20-27 | RW | DMA0.address | physical address of first buffer where the next transfer takes place |
28-2F | RW | DMA0.size | size of first buffer where the next transfer takes place |
... | RW | DMA1-14 | more DMA address and size registers |
110-117 | RW | DMAf.address | physical address of 16th and last buffer where the next transfer takes place |
118-11F | RW | DMAf.size | size of 16th and last buffer where the next transfer takes place |
The disk simulates a kind of disk controller but is using the host file system.
The disk understands the following commands:
The status register is read only. Only two bit are significant, the first and the last.
Tesing the status register, there are three typical values: negative means error, 1 meand bussy, 0 means idle.
The 2 low order bits of the control register are used to control the disk. These bits are from low order to high order:
The next 6 bits of the control register contain the operation code. These are the following:
Files are identified by Handles. A Handle is a one byte unsigned value. Al l operations have a handle as a parameter and it is stored in the low byte of this register.
The mode parameter of the open command is stored in the low byte of this register. See the open comand below for details.
The position parameter of the seek command and the result of the tell command is stored here. See the commands for details.
The memory buffers from where data is read in a write-to-disk operation or to where data is written in a read-from-disk operation is determined by the contents of the 16 DMA registers. Each DMA register consists of an address and a size register. It holds the physical address of the buffer and its size. Several buffers can be used in a scatter or gather IO operation. This means that the IO operations view the content of the 16 DMA buffers as one consecutive data area, as if the buffers would have been concatenated. For example a write operation will gather its data first from buffer number one then from buffer number two, and so forth until all the buffers are all written (or some error has occured). A read operation will scatter the data read from disk by filling the first buffer and then the second, until all buffers are filled or the end of the file has been reached.
This command has three parameters, the handle, the mode, and the filename. Handle and mode must be set in the respective registers. The address of the filename and its length must be given using the first DMA register. The given filename will be concatenated with the configured root directory to form a host filename. Then this host file is opened and associated with the given handle. It is an error to use a handle that is already associated with an open file. You must close the file before you can reuse the handle.
The mode can be a combination of
Not all combinations are, however possible. Vallid combinations and their corresponding mode strings of the UNIX fopen function are:
Value | Mode Bits | Mode String |
1 | READ | rt |
2 | WRITE | wt |
3 | READ|WRITE | r+t |
5 | READ|BINARY | rb |
6 | WRITE|BINARY | wb |
7 | READ|WRITE|BINARY | r+b |
10 | WRITE|APPEND | at |
11 | READ|WRITE|APPEND | a+t |
14 | WRITE|BINARY|APPEND | ab |
15 | READ|WRITE|BINARY|APPEND | a+b |
This command has just one parameter, the handle. The handle must have been opened before with the open command.
This command needs a handle and at least one of the DMA registers. When the command has completed, the size values in the DMA registers reflect the anount of data actually read.
The command needs a handle and at least one of the DMA registers. When the command has completed, the size values in the DMA registers reflect the anount of data actually written.
The command needs a handle and a position parameter specifying the location of the next read or write operation. If the command is successful. the new location will be determined as follows:
host | localhost | the host where the bus is located |
port | 9002 | the port where the bus is located |
address | default | address where the resource is located |
interrupt | not set | interrupt sent when operation has completed |
file | not set | Name of the directory where the root is located |
x | 0 | the x position of the window |
y | 0 | the y position of the window |
minimized | false | start with a minimized window |
debug | false | to generate debug output |
debugmask | 0xFFF0 | set mask to hide debug output |
verbose | false | make debugging verbose, sets debug mask to zero |
define | not set | to define a name for conditionals |
config | not set | filename for a configuration file |
help | false | to print information |
These can be set in default.vmb