83:Ports:00
Contents
Synopsis
Port Number: 00h
This port controls the calculator's serial link port.
Read Values
- Bit 2 and 3: These two bits indicate the state of the link port's two lines. A 1 bit indicates a high line, and a 0 bit indicates a low line. When idle (no transfer in progress, no cable plugged in, etc), both lines are usually high (1). When a cable is connected on both ends, a line reads high if and only if both ends have set the line high. The line will read low if either calculator sets it low.
Write Values
- Bit 0 and 1: The low 2 bits indicate what state the lines should be put into. A 1 bit will pull the line low. A 0 bit will stop holding the line low (allowing it to go high if the other calculator is not holding it low).
- Bits 4, 6 and 7: These bits should be high for unknown reasons
Comments
Ti-OS interference
One thing to keep in mind when writing link port related software is that the Ti-OS checks for silent transfers in the background. When two calculators are connected and one pulls a line low, the other calculator will respond by pulling the other line low to acknowledge that it has received a bit. This phenomenon is known to cause severe headaches for programmers who attempt to write synchronization routines :). It's unclear if this is only when the other calculator is in the homescreen, or if it is part of the default interrupt routine at $0038.
Data transfer
Transferring an entire byte requires you to implement some form of protocol. Examples include TI's official linking protocol, and Michael Vincent's TachyonLink protocol.
Other useful information on linking in general:
Example
Sending/Setting
ld a,$D0 ; Set both lines high out (0),a ld a,$D2 ; Set tip high, ring low out (0),a ld a,$D1 ; Set tip low, ring high out (0),a ld a,$D3 ; Set both low out (0),a
Receiving/Reading
in a,(0) ; Get the link port value bit 2,a ; Check tip jr z,tip_low jr nz,tip_high bit 3,a ; Check ring jr z,ring_low jr nz,ring_high