Throughout this section, the board is assumed to be jumpered as supplied to you, i.e. with the base I/O address at 192 decimal (C0 Hex).
For further information on board addresses refer to Sections 3 and C.
'Type 1' commands to the SFDC board (those concerned with moving the head around, rather than reading or writing data) are not time-sensitive and one may therefore send the commands from a slow, high-level language such as BASIC in order to check out your system configuration and drive setup. Before sending any commands direct to the SFDC, the port at BASE+8 i.e. 200 (C8 Hex) must be written to to select the drive, drive type, density, side and interrupt response.
The port control bits (at address BASE+8) act as follows:
Address | Pattern | Bit | Function | ||
---|---|---|---|---|---|
7654 3210 | |||||
(BASE+8) | .... 1111 | Disables all drives | |||
.... 1110 | bit 0 | LOW to select Drive 0, | No more than one drive should be enabled at once. | ||
.... 1101 | bit 1 | LOW to select Drive 1, | |||
.... 1011 | bit 2 | LOW to select Drive 2, | |||
.... 0111 | bit 3 | LOW to select Drive 3, | |||
...0 .... | bit 4 | LOW to select side 1, | |||
...1 .... | HIGH to select side 0, | ||||
..0. .... | bit 5 | LOW to select Double Density, | |||
..1. .... | HIGH to select Single Density. | ||||
.0.. .... | bit 6 | LOW to select 5.25 or 3.5 inch drives, | |||
.1.. .... | HIGH to select 8 inch drives. | ||||
0... .... | bit 7 | LOW to enable interrupts, | |||
1... .... | HIGH to disable interrupts. |
For example to select Drive 0, Side 0, Double density, 3.5 inch drives with no interrupts, we need 10011110 (Binary), = 9E (Hex) = 158 (Dec) so in Arcom BASIC we would write OUT 200,158 to set this up.
Once the port at (BASE+8) is correct, the drive selected can be controlled by sending commands direct to the SFDC at addresses (BASE) to (BASE+7). The arrangement of registers is as follows;
Table 2. Register Functions.
Address | READ | WRITE | Uses |
---|---|---|---|
BASE | Status | Command | Normal, non-hanging access for control of the SFDC and reading the status. |
BASE+1 | Track | Updated automatically by the SFDC if desired. Otherwise acts as a simple RAM location. | |
BASE+2 | Sector | Simple RAM-type location, used to tell the SFDC which sector is to be read from or written to in a sector read/write. | |
BASE+3 | Data | RAM-type location, loaded regularly with data during a write, read regularly during a read, and used to tell the SFDC which track to 'SEEK'. | |
BASE+4 to BASE+7 |
As (BASE) to (BASE+3) above, but the access will hang
if the SFDC is busy and not requesting data. These addresses may be used during disk read/write operations, depending on operating system software. |
||
BASE+8 | Switches | Control | Controls external/onboard functions and reads the state of 8 DIL switches. |
Thus, to write a command to the 279x chip it is necessary to write that command to I/O address BASE. To read the status of the 279x read I/O address BASE. Table 5 of Appendix D describes the function of all the bits to send a command and Table 7 describes how to interpret the status.
The following list of commands describes in outline how to read and write to a sector.
Set latch with drive select, side select, density etc., (BASE+8)
To read or write to a sector first 'seek' the required track. For example:
Write current track number into track register (BASE+1)
Write required track into data register (BASE+3)
send 'seek' command. (Write 018H into BASE)
Wait until BUSY bit of status is false
Write required sector number into sector register (BASE+2)
send read (or write) command to command register (BASE)LOOP: Read data from data register (BASE+3) (or write to data register)
Wait for DRQ or NOT BUSY bits in status port
IF DRQ then Jump to LOOPRead status port to check if an error has occurred.
It is necessary to use machine-code to read to and write from the data register during a disk data transfer, since the time between successive bytes of data is very short. Appendix E contains some Z80 assembler code which will read a track of data in from side 0 of drive zero in double density mode on a 3.5 inch or 5.25 inch drive (to change these options just change the value of the 'A' register at address 0114 in accordance with the definition of port control bits above) and print it out on the display in hex.