VMB Disk Device Specification

Disk Device Specification

Memory Layout

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 | R | Capacity | Total number of sectors of the disk
10-17 | RW | Sector | sector number of the first sector to be transferred in the next command
18-1F | RW | Count | number of disk sectors to be transferred in the next command.
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

Operation

The program will contact the motherboard at [host:]port and register itself with the given address and interrupt.

The disk simulates a disk controller and the disk proper by using a file of an appropriate size and organization on the host system. The file is read into memory and reread after a RESET or a Power ON. It is considered as a disk immage, that is organizes as a sequence of 512 byte blocks. Disk images can be modified by mounting them as loopback filesystems under Unix with the mount command, or by using the ImDisk Tool under windows.

The disk understands two commands:

  • read a block of data from the disk or
  • write a block of data to the disk.

The amount of data transferred is specified as an integral number of sectors. The size of a sector size is fixed at 512 bytes. The number of sectors to read or write is given to the controller in the count register. The position of the starting sector on the disk is given to the controller in the sector register. The disk sectors are numbered starting at 0 through (and including) the capacity of the disk minus one. The number of sectors on the disk can be read by software from the capacity register.

The memory buffers from where data is read in a write operation or to where data is written in a read operation is determined by the contents of the 16 DMA register. 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 with gather its data first from buffer number one then from buffer number two, and so forth until the number of sectors requested are written or the buffers are all written. A read operation will scatter the sectors read from disk by filling the first buffer and then the second, until all disk sectors are written to memory or the bufferes are all filled.

The 3 low order bits of the control register are used to control the disk. These bits are from low order to high order:

  • 0x01 - GO As soon as a 1 is written to this bit, the next command is carried out.
  • 0x02 - IEN Enables (1) or disables (0) interrupts from the disk.
  • 0x04 - WRT Must be set to 1 to write to the disk, or set to 0 to read from the disk.

The status register is read only. Only two bit are significant, the first and the last.

  • The sign bit is set if any error prevented the successful completion of the last command. It makes the value in this register negative.
  • 0x01 BUSSY the lest significant bit is set by the hardware during command execution. When the command is completed (or cannot be completed due to an error), BUSSY is reset to zero. Comand completion also raises the disk interrupt if it is enabled.

Tesing the status register, there are three typical values: negative means error, 1 meand bussy, 0 means idle.

Configuration

The disk has the following configurable parameters:
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 character is ready
file | not set | Name of the file containing the disk image
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