Min80 Prototype 1 IO Ports and Devices

Wednesday, 27 February 2013 08:31 Shael
Print

This article contains information regarding the I/O devices implemented in the first prototype for the Mini80 project. The first prototype of the Mini80 implements a number of I/O devices such as; 4 channel floppy disk controller, 3 serial UARTS, and access to read files from the FAT partition on the SD card used to store the CPM floppy disk images.

 All I/O peripheral devices are implemented by a Parallax Propeller chip. The peripheral devices implemented by the Propeller chip are accessed by the Z80 via the Z80 "port" instructions that generate I/O port access signals (/IOREQ = low).
 
Min80Proto1Intercon2Mini80 PropTerm Interconnect
  Min80 board with I/O board on top
 
The Mini80 Propeller chip code splits the Z80 port map in to two regions. Port addresses 00h to 1Fh are handled by the Propeller COG controlling the Z80 CPU directly. The remaining port addresses, 20h to FFh are passed to a spin process. Each of the peripherals attached to the Z80 is manipulated by reading and writing the port addresses mapped to the specific device. For the first prototype of the Min80 all peripheral devices and there port addresses are listed below;

UART 1 port mappings (ports 00h, 01h, and 20h)

The UART 1 device is used for asynchronous serial data transmission. The UART is full duplex and supports 7 and 8 bit data transmission. When using 7 bit transmission an optional parity bit (odd/even) can be appended to the data. The UART supports 1 or 2 stop bits per data byte in transmit mode. The UART optionally supports hardware based flow control (RTS/CTS).

UART 2 port mappings (ports 02h, 03h, and 21h)

The UART 2 device is used for asynchronous serial data transmission. The UART is identical to UART 1 but uses ports 02h for data, 03h for status/FIFO control and 21h for data format and baud rate.

UART 3 port mappings (ports 04h, 05h, and 22h)

The UART 3 device is used for asynchronous serial data transmission. The UART is identical to UART 1 but uses ports 04h for data, 05h for status/FIFO control and 22h for data format and baud rate. UART 3 is a two wire serial port and does not support the hardware flow control signals.

Z80 CPU Frequency (port 08h)

The master clock signal for the Z80 CPU is generated by the Propeller chip. Port address 08h is used to read and write the desired Z80 clock frequency. The frequency can be set from 0.1MHz to 25.5MHz in 0.1MHz steps. As an example writing the decimal value 52 to port 08h will set the Z80 frequency to 5.2MHz. If a value of zero is written to the port the Min80 system will reboot. 
Min80Proto1
  Standard SD card to store CPM disk images and other files.

Floppy Disk Controller (ports 10h...1Fh)

The Propeller chip is used to emulate a four drive floppy disk controller. From 4 to 128 CPM floppy disk images are stored in a disk pack file called "CPMDISK.CDP". The disk pack file must be in the root folder of a FAT16 or FAT32 formatted SD card. The disk controller can control up to 4 disk drives. Any of the disk pack floppy disk images can be mounted into any one of the 4 disk drives. Each floppy disk sector contains 128 bytes of data. The disk controller allows the reading and writing of any 128 byte CPM standard sector on any of the four disk drives. To read or write a disk sector the Z80 first sets the following ports; Disk Select, Sector number, and Track number.
 
If a read disk sector is to be performed the Z80 writes the read command byte to the disk controller command port. The Z80 then reads the disk controller status port to determine if the request completed properly. If there is no error (status = 0) the Z80 can read the disk sector data bytes from the disk controller sector buffer. The Z80 first sets the sector buffer address port to 0. Next the Z80 reads the disk controller sector buffer data port 128 times to read the disk sector data. The sector buffer address port will auto-increment each time a byte of data is read from the sector buffer data port.
 
If a write disk sector is to be performed the Z80 must write 128 bytes of data to the disk controller sector buffer. The Z80 first sets the sector buffer address port to 0. Next the Z80 writes to the disk controller sector buffer data port 128 times to write the disk sector data. The sector buffer address port will auto-increment each time a byte of data is written to the sector buffer data port. Next the Z80 writes the write sector command byte to the disk controller command port. The Z80 then reads the disk controller status port to determine if the request completed properly. If there is no error a read of the disk controller status port will equal to 0.
 
The floppy disk controller uses 4 port addresses to select which of the possible (4 to 128) floppy disk images are mounted in a specific disk drive. The floppy disk images are numbered from 0 to 127 where the max disk number is controlled by the size of the CPM disk pack file on the SD card. There is an additional 4 port address the are used to hold the one byte disk attribute flags, one port for each disk drive. Currently the disk controller support the boot attribute and the read only attribute.
 
The following port addresses are used by the disk controller;
Mini80 Amount Program
  Mini80 AMOUNT.COM program to mount floppy disk images in to disk drives.

Floppy Disk Attribute Controller (ports 30h..35h)

The floppy disk attribute controller allows the Z80 CPU to enumerate and change the attributes of the floopy disk images stored in the disk pack file "CPMDISK.CDP". The floppy disk attribute controller can be used to read and write the CPM floppy disk image display name and disk attributes.
 
To provide access to the floppy disk display names the controller implements a 32 byte name buffer. The disk name buffer works in much the same way as the sector buffer in the disk controller. Once the floppy disk image index select register is set a command can be requested to set/read the display name of the selected floppy disk image. The results of the command request can be read from the status register. Once a disk image is selected the disk attribute register can be read/written to read or set the floppy disk image attributes byte. The the CPM "AMOUNT.COM" program uses this API to allow the disk images to be mounted in to a specific disk drive as well as rename and change the attributes of the floppy disk images stored in the disk pack file.
 
The floppy disk attribute controller registers are read/written using the following port numbers;
Mini80 FatFiles.com program
  Min80 "FATFILES.COM" program to import fat files to CPM disk

Fat File Access Controller (ports 0Fh, 17h, 30h, 32h, 33h, 36h..3Ah)

The fat file controller allows the Z80 to read and enumerate files stored in the root directory of the SD card. This allows CPM programs to import files stored on the SD card. The fat file controller shares the disk drive controller's sector buffer ports and the floppy disk attribute controller's disk name buffer and command/status ports.

CPM Character Device Control Ports (48h and 49h)

The character device control ports are primarily intended to be used by the BIOS and boot loader at start up. Port address 48his used to pass the start-up value for the CPM IOBYTE variable. This controls which CPM logical character devices are mapped to which physical CPM character devices at start-up. Port 49his used to write data to the currently selected CPM console character device. Port 49h can be used by the CPM boot loader to display information or error messages during the boot loader operation.
 
 
Last Updated on Monday, 18 March 2013 05:16