Dragon I/O Cartridge (Rink)
This board is a latched input/output cartridge that fits into a standard Dragon Data shell case (although plugging wires in would be awkward).
The design provides for eight digital inputs and eight digital outputs. The output port is switchable between 5v and 3.3v (using the on-board jumper) whilst the input port is 3.3v and 5v tolerant.
General Usage Information
A row of headers at the top of the cartridge allow you to connect jumper wires to other circuits, such as a breadboard or Arduino. From the left, there are the 12v, 5v and 3v3 outputs. The next eight is the digital output port. The following eight is the digital input port. And rounding things off, the remaining three headers are all connected to ground.
To control which output pins are high and which are low, you write a single byte to any address between 0xFF40 and 0xFF5F. During that write operation, your number is latched on the cartridge and the binary representation of that number controls which output pins are high.
POKE &HFF40, &HFF Sets all output pins high (0xFF being 11111111 in binary).
POKE &HFF40, 170 Alternates between high and low pins (170 being 10101010 in binary).
POKE &HFF40, 0 Sets all output pins low.
To read the status of the digital input pins, you read a value from any address between 0xFF40 and 0xFF5F.
X = PEEK(&HFF40)
The binary representation of the number X tells you which pins were at logic 1, and which were at logic 0, at the time of your read operation.
If X contains the value 255 (0b11111111) then all pins were high. If X contains 0 (0b00000000) then all pins were low. If X contains 8 (0b00001000) then only input 3 was high.
Be wary of unconnected inputs. They won't do any harm but will tend to float high unless grounded, which can be confusing when reading the input port value.
The outputs from this cartridge were not intended to supply a large level of current. I would recommend that you don't draw more than 25-35mA from the output port, and instead use these pins to turn on transistors connected to a more suitable power source if you're working with higher current demands.