Difference between revisions of "83Plus:Ports:00"
(→Data transfer) |
(Got rid of first person) |
||
Line 10: | Line 10: | ||
* Bit 0 and 1: The low 2 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. | * Bit 0 and 1: The low 2 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. | ||
* Bit 5 and 6: Bits 5 and 6 indicate which lines are pulled low by the calculator (unlike bits 0 and 1 they are not influenced by the other calculator). A 1 bit indicates your calculator is holding the line low. A 0 bit indicates your calculator is not holding the line low. (When both calculators have a 0 bit here, the corresponding line will read 1.) In other words, these bits reflect bits 0 and 1 from the most recent write to this port. | * Bit 5 and 6: Bits 5 and 6 indicate which lines are pulled low by the calculator (unlike bits 0 and 1 they are not influenced by the other calculator). A 1 bit indicates your calculator is holding the line low. A 0 bit indicates your calculator is not holding the line low. (When both calculators have a 0 bit here, the corresponding line will read 1.) In other words, these bits reflect bits 0 and 1 from the most recent write to this port. | ||
− | * Bit 2: | + | * Bit 2: Unknown. |
=== Write Values === | === 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). | * 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). | ||
− | * Bit 2: | + | * Bit 2: The complete meaning of this bit is unknown. What is known is that any change of this bit causes both lines to be released, writing with this bit set causes bit 2 to read 1, and the next write causes it to read 0 and both lines are released. |
<br> | <br> | ||
Revision as of 15:12, 27 May 2005
Contents
Synopsis
Port Number: 00h
Function: Link
This port controls the calculator's serial link port (the standard link port present on the 83+, 83+ SE, 84+ and 84+ SE - do not confuse this with the 84+/84+SE's USB link port).
Read Values
- Bit 0 and 1: The low 2 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.
- Bit 5 and 6: Bits 5 and 6 indicate which lines are pulled low by the calculator (unlike bits 0 and 1 they are not influenced by the other calculator). A 1 bit indicates your calculator is holding the line low. A 0 bit indicates your calculator is not holding the line low. (When both calculators have a 0 bit here, the corresponding line will read 1.) In other words, these bits reflect bits 0 and 1 from the most recent write to this port.
- Bit 2: Unknown.
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).
- Bit 2: The complete meaning of this bit is unknown. What is known is that any change of this bit causes both lines to be released, writing with this bit set causes bit 2 to read 1, and the next write causes it to read 0 and both lines are released.
Comments
Bit 2
As mentioned bit 2's effect is unknown. An example of it's behavior follows:
Start, read 03. Write 02, read 01. Write 07, read 07. Write 07, read 03. Write 07, read 07. Write 00, read 03. Write 09, read 07. Write 01, read 03.
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,0 ; Set both lines high out (0),a ld a,2 ; Set tip high, ring low out (0),a ld a,1 ; Set tip low, ring high out (0),a ld a,3 ; Set both low out (0),a
Receiving/Reading
in a,(0) ; Get the link port value bit 0,a ; Check tip jr z,tip_low jr nz,tip_high bit 1,a ; Check ring jr z,ring_low jr nz,ring_high