[Ti-Asm(83+)] Link port problems

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
Deathsting
Regular Member
Posts: 110
Joined: Wed 19 Jan, 2005 4:57 pm
Location: Inside you

[Ti-Asm(83+)] Link port problems

Post by Deathsting »

I cant figure out whats wrong with this routine.
well i have two calc one runs CheckServer while the other runs CheckHost
When executed Check host routine executes and then exits while the CheckServer routine gets stuck at CheckServer1.
Any idea to why this is happening??? Am i checking the right bits???

Code: Select all

CheckServer:
	ld a,3     ; Set tip low, ring low
	out (0),a
CheckServer1:
       	in a,(0)                             
	bit 0,a         ; Check tip
	jr z,CheckServer1		;tip is not yet high wait till high
            jp exit

CheckHost:
	in a,(0)            
	bit 0,a         ; Check tip
	jr nz,CheckHost		;wait till low
CheckHost1:
	ld a,2     ; Set tip high, ring low
	out (0),a
            jp exit
Also to my knowledge both the ti lcd and keypad require a specific delay before each read and write, do the link ports require any such delays??
Currently working on ColdFusion
Visit our programing group at revsoft.org
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Sorry some one forgot to write something extremely important on the wiki.

The values you write to the port are inverted of the values you read. So writing 0 you would read 3 which means both lines are high. Writhing 3 you would read 0 so both lines are low.

The link port doesn't really need a delay I believe.
Image
Deathsting
Regular Member
Posts: 110
Joined: Wed 19 Jan, 2005 4:57 pm
Location: Inside you

Post by Deathsting »

thank you :bow
Finally...this thing has been driving me crazy since yesterday...i ll try it out soon
Currently working on ColdFusion
Visit our programing group at revsoft.org
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

@Jim: He is using the Bell defines, so the read and write values should be just fine.

As I wrote in my last e-mail he's got the logic mixed up. If the "server" routine pulls the tip low, there's no way the "client" routine can get it back up. That's just not how it works.

I'm sorry I'm not around more often, but I have many many other things to work on besides z80, so it's a good thing you e-mailed me, Deathsting.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Bell defines?
Image
Deathsting
Regular Member
Posts: 110
Joined: Wed 19 Jan, 2005 4:57 pm
Location: Inside you

Post by Deathsting »

umm after realizing that the bits were wrong i used some code from timendus's "BELL" routines and emailed him...
Anyway i sort of get it (although not completly)

SOMEBODY should fix Wiki TI
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 :).
That doesnt talk much about any or gate now does it
Currently working on ColdFusion
Visit our programing group at revsoft.org
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Deathsting wrote:umm after realizing that the bits were wrong i used some code from timendus's "BELL" routines and emailed him...
Anyway i sort of get it (although not completly)

SOMEBODY should fix Wiki TI
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 :).
That doesnt talk much about any or gate now does it
Why don't you fix it? That's the point of a wiki. :)

Yeah, this always confused the hell out of me until some combination of Timendus and Ben Ryves helped me wrap my head around it.
Image Image Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Deathsting wrote:That doesnt talk much about any or gate now does it
It doesn't. Slightly higher on the page, under "read values" though it reads:
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.
In other words; there's nothing wrong with the WikiTi entry, you just need to read more carefully ;)
But perhaps it could benefit from a nice schematic showing how it works.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
Deathsting
Regular Member
Posts: 110
Joined: Wed 19 Jan, 2005 4:57 pm
Location: Inside you

Post by Deathsting »

why do i have the weird feeling that someone just added that in...i dont remeber seeing
Bit 0 is the tip and bit 1 is the ring."
...and that just drove be crazy

@Timenedus - u were right rgp and bell screw each other up...the interupts in rgp seem to make bell routines go out of sync and for some odd reason bell_connect just causes both calculators to hang
Currently working on ColdFusion
Visit our programing group at revsoft.org
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Yup, that part has been added on the 30th of june by Jim e. It's a wiki, you can look back it's history ;-)

Edit: You could try to increase the timeout delay, but I doubt it's going to help much. Maybe check if RGP does any weird magic with the link port. But as I said; you're the first to try to combine the two, so I'm not surprised that things don't work smoothly.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

I'm not surprised. It takes about 60% of the cpu time. If you want linking you'll probably need to use the link assist. 83+ and the 83+SE Both have a receiving link assist with a 2 second timeout.

But honestly I don't suggest linking with grey. it will only slow things down more.
Image
Post Reply