Programming
Relative Addressing vs. Absolute Addressing
The SeaIO API makes a distinction between “absolute” and “relative” addressing modes. In absolute addressing mode, the Port argument to the API function acts as a simple byte offset from the base I/O address of the device. For instance, Port #0 refers to the I/O address 0; Port #1 refers to the I/O address 1.
Relative addressing mode refers to input and output ports in a logical fashion. With a Port argument of 0 and an API function meant to output data, the first (0th) output port on the device will be utilized. Likewise, with a Port argument of 0 and an API function designed to input data, the first (0th) input port of the device will be utilized.
In all addressing modes, port numbers are zero
Given Bank 1, Port B2, Port A3 and Port C3 are all inputs and the rest of the ports are outputs, Figure 5 gives the Absolute address, and Figure 6 gives the relative address.
Bank 1 – P2 | Bank 2 – P3 | ||
Address | Port | Address | Port |
0 | A1 | 3 | A2 |
1 | B1 | 4 | B2 |
2 | C1 | 5 | C2 |
Figure 5- Absolute Byte Address (Same for any configuration)
Bank 1 – P2 | Bank 2 – P3 | ||
Address | Port | Address | Port |
0 (input) | A1 | 0 (output) | A2 |
1 (input) | B1 | 3 (input) | B2 |
2 (input) | C1 | 1 (output) | C2 |
Figure 6- Relative Byte Address (Only applies to the given configuration)
Page 9 |