No edit summary |
|||
Line 116: | Line 116: | ||
* in header we wait destination network station number 0x00 |
* in header we wait destination network station number 0x00 |
||
* does not send response byte |
* does not send response byte |
||
+ | |||
+ | == Example bitstream == |
||
+ | This is not a real 'bitstream', because in the real life the width of the 'bits' are different! |
||
+ | |||
+ | Start 'test' byte: |
||
+ | {| border=1 |
||
+ | |- |
||
+ | ! start bit !! colspan=8 | test byte (network station number) !! stop bit |
||
+ | |- |
||
+ | | 0 || 0 || 0 || 0 || 0 || 1 || 0 || 1 || 0 || 1 |
||
+ | |} |
||
+ | |||
+ | |||
+ | Header packet: |
||
+ | {| border=1 |
||
+ | |- |
||
+ | ! start packet !! !! start !! colspan=8 | destination !! stop !! !! start !! colspan=8 | source !! stop !! !! start !! colspan=8 | serial num hi. || stop |
||
+ | |- |
||
+ | | 0 || || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 0 || || 1 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || 1 || 0 || || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 0 |
||
+ | |} |
||
+ | |||
+ | {| border=1 style='margin-left: 4em' |
||
+ | |- |
||
+ | ! start !! colspan=8 | packet type !! stop !! !! start !! colspan=8 | data length !! stop !! !! start !! colspan=8 | data checksum !! stop !! !! start || colspan=8 | header checksum || stop || || stop packet |
||
+ | |- |
||
+ | | 1 || 0 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || 0 || || 1 || 0 || 0 || 0 || 1 || 1 || 1 || 1 || 1 || 0 || || 1 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || 1 || 0 || || 1 || 1 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || || 0 || 1 |
||
+ | |} |
||
+ | |||
+ | |||
+ | Data packet: |
||
+ | {| border = 1 |
||
+ | |- |
||
+ | ! start packet !! !! start !! colspan=8 | data byte 0 !! stop !! !! start !! colspan=8 | data byte 1 !! stop !! !! start !! colspan=8 | data byte 2 !! stop !! !! start || colspan=8 | data byte 3 || stop |
||
+ | |- |
||
+ | | 0 || || 1 || 1 || 0 || 1 || 0 || 0 || 1 || 0 || 1 || 0 || || 1 || 1 || 1 || 1 || 0 || 0 || 1 || 0 || 1 || 0 || || 1 || 1 || 1 || 1 || 1 || 1 || 0 || 1 || 1 || 0 || || 1 || 1 || 0 || 0 || 0 || 1 || 1 || 0 || 1 || 0 |
||
+ | |} |
||
+ | |||
+ | {| border=1 style='margin-left: 4em' |
||
+ | |- |
||
+ | ! start !! colspan=8 | data byte 4 !! stop !! !! start !! colspan=8 | data byte 5 !! stop !! !! start !! colspan=8 | data byte 6 !! stop !! !! stop packet |
||
+ | |- |
||
+ | | 1 || 0 || 1 || 0 || 1 || 1 || 0 || 0 || 1 || 0 || || 1 || 1 || 1 || 0 || 1 || 0 || 0 || 0 || 1 || 0 || || 1 || 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || 0 || || 1 |
||
+ | |} |
||
[[Category:ZX Spectrum technical information]] |
[[Category:ZX Spectrum technical information]] |
Revision as of 19:09, 10 August 2009
Interface 1 offered two network ports, allowing up to 64 ZX Spectrums to be daisy-chained using network leads up to 3 m (10 ft) long. The network, called ZX Net, used a proprietary CSMA-like protocol. Data could be sent or received at 100 kbit/s either to or from a numbered workstation, or broadcast to all nodes, allowing one machine to act as a server.
ZX Net concept
- network use 1 bidirectional data wire
- all ZX Spectrum has a network station number (range 1 to 64)
- station number 0 used to indicate broadcast
- data broke up max. 255 byte length packets
- every packet has a 8 byte length packet header
- every packet has a serial number
- the packet and the header have checksum
- last packet in the chain is marked, so the receiving end is know about end of data
- the receiving end send a response byte (value 0x01) after got the good excepted header or packet except broadcast
- if sender does not got the respons byte in time, send the header or packet again
Header and data details
Header
Offset Length Comment 0x00 1 destination network station number 0-64 0x01 1 source network station number 1-64 0x02 2 packet serial number 0-65535 0x04 1 packet type 0 - normal, 1 - last packet 0x05 1 data length 1-255 0x06 1 data checksum 0x07 1 header checksum (from pos. 0 - pos. 6)
Data
Offset Length Comment 0x00 data length field in header data bytes
Communication details
Data bytes broke up 255 bytes packet. Last packet should be shorter if length cannot divide by 255. Last packet type is 1, every other packets' type is 0. There is a header before every packet. Packets numbered from 0 to 65535.
Sending packets
- check network state, if there is no any activity during a random time length, then go to next else this again
- send a test byte, before every octet, send a 1 bit, and after every octet send a 0 bit; send lower bits first
0 1 2 3 4 5 6 7 8 9 1 bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 0
- send header bytes
- after the whole header send a 1 bit (release the line)
- wait for response byte 0x01, if not arrive a certain time, send header again (go to 1)
- check network state, if there is no any activity during a random time length, then go to next else this again
- send data bytes like header's
- wait for response byte (0x01), if not arrive a certain time, send header and data again (go to 1)
Receiving packets
- check network state, if there is activity go to next
- wait test byte length time
- read header bytes
- check header, if valid and we wait this go to next else start again (go to 1)
- send response byte (0x01)
- check network state, if there is activity go to next
- wait test byte length time
- read data bytes
- check data validity (checksum), if not valid wait header and data again (go to 1)
- send response byte (0x01)
Broadcast send
Same as plain sending except:
- in header the destination network station number is 0x00
- no wait for response byte
Broadcast receive
Same as plain receiving except:
- in header we wait destination network station number 0x00
- does not send response byte
Example bitstream
This is not a real 'bitstream', because in the real life the width of the 'bits' are different!
Start 'test' byte:
start bit | test byte (network station number) | stop bit | |||||||
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 |
Header packet:
start packet | start | destination | stop | start | source | stop | start | serial num hi. | stop | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
start | packet type | stop | start | data length | stop | start | data checksum | stop | start | header checksum | stop | stop packet | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
Data packet:
start packet | start | data byte 0 | stop | start | data byte 1 | stop | start | data byte 2 | stop | start | data byte 3 | stop | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
start | data byte 4 | stop | start | data byte 5 | stop | start | data byte 6 | stop | stop packet | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |