I wrote this test link program, the idea is to have the calc that fist runs it to invevitably display 0, and the second to display 1.

Code:

   call linkConnect
   ld a, 0
   ld (curCol), a
   ld (curRow), a
   ld hl, (currentLine)
   bcall(_DispHL)
   ret

linkConnect:
   in a, (0) ;Check if the other calc is waiting
   and 3
   cp 2
   jr z, _setCurrentLine1

   ld a, 0
   ld (currentLine), a

_waitLoop:
   ld a, 1 ;Pulling our line low
   out (0), a

   in a, (0) ;Waiting for both lines to be low
   and 3
   cp 0
   jr nz, _waitLoop

   jr _endLinkConnect
_setCurrentLine1:
   ld a, 1
   ld (currentLine), a

   ld a, 2 ;Setting the line low
   out (0), a
_endLinkConnect:
   ret
currentLine:
   .db 0

After running it on one calc, when I attach the link cable (wabbitemu virtual link) the program ends and displays 0 (the calcs also freeze, but I think this is a problem with the emulator, because opening/closing the debugger fixes it). I've compared this with some other similar routines and I can't find the issue, anybody have any ideas?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement