Difference between revisions of "83:Ports:00"

From WikiTI
Jump to: navigation, search
(Read Values)
(Data transfer)
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
'''Port Number:''' 00h
 
'''Port Number:''' 00h
  
'''Function:''' Link
+
'''Function:''' Link port and Rom page swapping
  
This port controls the calculator's serial link port.
+
This port has two functions. It controls the calculator's serial link port and together with [[83:Ports:02]], the ROM page that is swapped into 4000h-7FFFh.
  
 
=== Read Values ===
 
=== Read Values ===
 
* Bit 0 and 1: The inverse of the values output to the link port.
 
* Bit 0 and 1: The inverse of the values output to the link port.
 
* 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.
 
* 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.
* Bit 4: Bit 3 of the current ROM page
+
* Bit 4: Bit 3 of the current ROM page. See also [[83:Ports:02]].
 
* Bit 5-7: Zero
 
* Bit 5-7: Zero
  
 
=== 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 4: Bit 3 of the current ROM page
+
* Bit 4: Bit 3 of the current ROM page. See also [[83:Ports:02]].
* Bit 6 and 7: These bits should be 1 for unknown reasons
+
* Bit 6 and 7: These bits should be 1 for unknown reasons.
<br>
+
  
 
== Comments ==
 
== Comments ==
  
 
=== Ti-OS interference ===
 
=== 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.
+
One thing to keep in mind when writing link port related software is that the Ti-OS checks for silent transfers in the background of input routines. 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. Even when the other calculator is running an assembly program that uses the getkey romcall. This phenomenon is known to cause severe headaches for programmers who attempt to write synchronization routines :).
  
 
=== Data transfer ===
 
=== Data transfer ===
Transferring an entire byte requires you to implement some form of protocol. Examples include TI's official linking protocol, and [http://www.ticalc.org/archives/files/fileinfo/277/27718.html Michael Vincent's TachyonLink protocol].
+
Transferring an entire byte requires you to implement some form of protocol. Examples include TI's official linking protocol, [http://www.ticalc.org/archives/files/fileinfo/277/27718.html Michael Vincent's TachyonLink protocol] and [http://bell.timendus.com/ Timendus' Bell library].
  
<p>Other useful information on linking in general:<br>
+
Other useful information on linking in general:
* [http://www.ticalc.org/archives/files/fileinfo/247/24750.html TI Link Protocol & File Format Guide]<br>
+
* [http://www.ticalc.org/archives/files/fileinfo/247/24750.html TI Link Protocol & File Format Guide]
* [http://www.ticalc.org/archives/files/fileinfo/294/29418.html Ti-83 Link Port Tutorial]
+
* [http://www.ticalc.org/archives/files/fileinfo/294/29418.html Ti-83 Link Port Tutorial]
<br>
+
*  [http://www.ticalc.org/archives/files/fileinfo/242/24244.html All about the Ti-86 link port]
 +
*  [http://bell.timendus.com/ Bell] and [http://clap.timendus.com/ CLAP] projects
  
 
== Example ==
 
== Example ==
  
 
=== Sending/Setting ===
 
=== Sending/Setting ===
<pre>ld a,$D0    ; Set both lines high
+
<nowiki>ld a,$D0    ; Set both lines high
 
out (0),a
 
out (0),a
  
Line 45: Line 45:
  
 
ld a,$D3    ; Set both low
 
ld a,$D3    ; Set both low
out (0),a</pre>
+
out (0),a</nowiki>
  
 
=== Receiving/Reading ===
 
=== Receiving/Reading ===
<pre>in a,(0)        ; Get the link port value
+
<nowiki>in a,(0)        ; Get the link port value
  
 
bit 2,a        ; Check tip
 
bit 2,a        ; Check tip
Line 56: Line 56:
 
bit 3,a        ; Check ring
 
bit 3,a        ; Check ring
 
jr z,ring_low
 
jr z,ring_low
jr nz,ring_high</pre>
+
jr nz,ring_high</nowiki>

Latest revision as of 15:14, 1 July 2007

Synopsis

Port Number: 00h

Function: Link port and Rom page swapping

This port has two functions. It controls the calculator's serial link port and together with 83:Ports:02, the ROM page that is swapped into 4000h-7FFFh.

Read Values

  • Bit 0 and 1: The inverse of the values output to the link port.
  • 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.
  • Bit 4: Bit 3 of the current ROM page. See also 83:Ports:02.
  • Bit 5-7: Zero

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 4: Bit 3 of the current ROM page. See also 83:Ports:02.
  • Bit 6 and 7: These bits should be 1 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 of input routines. 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. Even when the other calculator is running an assembly program that uses the getkey romcall. This phenomenon is known to cause severe headaches for programmers who attempt to write synchronization routines :).

Data transfer

Transferring an entire byte requires you to implement some form of protocol. Examples include TI's official linking protocol, Michael Vincent's TachyonLink protocol and Timendus' Bell library.

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