Are you going to throw us your draft for critiquing and fact-checking, or are you fairly confident with it as it is?
Help with my networking chapter

The following explanation is what I have in my tutorial about the send-acknowledge method (mirroring the OS's). Please comment/correct.

Quote:
The Send-Acknowledge Method
In the send-acknowledge method, one unit begins the transmission by pulling one of the lines low. The line that has been pulled low first communicates the bit being sent. If the tip was pulled low first, then the bit was a 0. If the ring was pulled low, then the bit was a 1. Remember that the if one line is pulled low, both units see it as low. The receiver should then read out the value from the link port. Below is a segment of code to read and write to the link port.


Code:
; Sending a bit, valued 1, out the link port
; Sender executes this
   ld   a, 2
   out   (0),a

; Reading a bit from the link port
; Receiver executes this
loop:
   in   a,(0)
   ; the value in the link port is in a.
   bit   1,a
   ; sets the zero flag if the ring was low   
   jr   z, Do_this_if_Ring_Low
   ; jumps if the ring was low
   bit   0,a
   jr   z, Do_this_if_Tip_Low
   ; jumps if the tip was low
   jr   nz, loop
   ; keep waiting if neither was low



When the receiver sees that the line has been pulled low, and successfully records the value of the bit sent, it proceeds to acknowledge the transmission by pulling the other line low. In the case of the above, the receiver will be pulling the tip low, since the ring is already low.


Code:
; Receiver executes this
; Pulls the tip line low
Do_this_if_Ring_Low:
   ld   a, 1
   out   (0),a


The sender should at this point be waiting for such a change in the tip line. This is done through looping the following code.


Code:
; Sender executes this
; Reads the tip value from the link port
; if it is low, release both lines
loop:
   in   a,(0)
   bit   0,a
   jr   nz,loop


Once the sender sees the acknowledgement, then both calculators can proceed to release both lines. This is accomplished via the following code:


Code:
release_lines:
   ld   a,0
   out   (0),a


  
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 2 of 2
» 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