ComRing 1.20 protocol
Instead of documentation...

0.

Serial port frame: 8n1 (8 bits data, no parity, 1 stop bit)

1.

ComRing uses 257 codes to transmit ethernet packets. These are 256 ordinary
byte values and a special code: 'break'.

The 'break' code is used for synchronization. Receive error is interpreted
as 'break' too.

To send this special code following encoding scheme is used:

send:
	AA FF -> AA FE FF
	AA FE -> AA FE FE
	break -> AA FF
	(other not changed)

receive:
	AA FE -> AA
	AA FF -> AA break
	(other not changed)

Note that AA is inserted before 'break' during transmission.
(break -> AA FF -> AA break). It's not a problem, because such additional
bytes are ignored by higher layer of the driver (and not retransmited).
When AA is received it is passed to higher layer without delay, even if
it has been created by 'break' code, not AA itself.

2.

Computers (nodes) are identified by 'id' letters assigned during driver
invocation. FF (255 dec) is used as a broadcast address.

Intel byte order is used.

Packet format:

	  [BREAK]
	+---------+
	|  dest   |	; id of destination node or FF
	+---------+
	|   src   |	; id of source node (always true address)
	+----+----+
	|flag| ttl|	; ttl: number of nodes packet can traverse
	+----+----+
	|         |
	+ length  +	; length of the packet's data (16 bit)
	|         |
	+=========+
	|         |
	.  data   .	; data (including eth. type field)
	.         .
	|         |
	+=========+
	|         |
	+   crc   +	; crc (16 bit)
	|         |
	+---------+

flags:  bits 0-3		ttl field
	bit 4 (ComprIPX)	1 <=> contains compressed ipx header
	bit 5 (OddLenIPX)	1 <=> the length of ipx packet is odd
	bits 6-7		unused (should be 0)

crc calculation:
	break:	mov crc,0
	byte:	rol crc,1
		xor low_byte_of_crc,byte

If packet is truncated (eg. by error) the break is send to free the line.
If additional bytes are after packet, they're ignored.
Packet traverse node if it has ttl field greater than 0 and both destination
and source addresses are different from node id. Ttl field is decreased
during retransmision.

3.

Ethernet packet is encapsulated in a single CR packet.
As only adresses generated by the driver are valid, ethernet address is
compressed to one byte. First 12 bytes of the ethernet packet are
encoded in CR header. The rest is a data.

Additional compression of ipx packets is used.

4.

IPX compression.
Following sequence identifies ipx packet (generated by pdipx):

DD DD DD DD DD DD	- destination	\
SS SS SS SS SS SS	- source         > header of eth. packet
81 37			- ipx protocol  /
FF FF			- check (none?)
LL LL			- length of whole packet minus 14 or 15 (OddLenIPX)
00			- control (?)
04			- type of packet (exchange)
00 00 00 00  DD DD DD DD DD DD	- destination
?? ??			- dest. port number - NOT REMOVED!
00 00 00 00  SS SS SS SS SS SS	- source


Attrs are altered and the sequence (14+26 bytes) is removed from packet
(it is redundant).

JB
