[Coco] TCP/IP Programming in Commodore BASIC

Jonno Downes jonnosan at gmail.com
Tue Nov 9 20:41:58 EST 2010


gene heskett <gheskett at ...> writes:

> > This is using a card (originally called RR-NET although there also
> > clones called C64NIC+) that uses a cs8900 chip to interface to
> > ethernet. The chip will easily can interface to an 8-bit data bus and
> > there are lots of dev modules around e.g.
> > http://www.sparkfun.com/commerce/product_info.php?products_id=200
> > 
> I did DL the pdf on it, and while it may be usable, the interface will be a 
> bear, with 5 IRQ lines, and 3 DMARQ/DMAAK pairs, it looks like a lot of 
> external translation support would be needed.  Is this the chip that this 
> networking stack supports?
> 


ip65 does indeed support the cs8900a. Don't be too concerned about the all the
interface complexity the cs8900a is capable of supporting, you don't need to use
DMA or interrupts, or even 16 bit mode. It will work happily  in 8 bit polling
mode (and more than fast enough for the volume of data a typical 8 bit computer
could sensibly produce or consume). Have a look at
http://cbm8bit.com/fotios/fbnet.php which shows how little interface logic is
needed to connect a cs8900a breakout module into the c64 cartridge port. This
ends up mapping the registers inside cs8900a into the C64 memory space,
specifically

cs_packet_page	= $de02 ;address of 'packet page' port 
cs_packet_data	= $de04;address of 'packet data' port 
cs_rxtx_data	= $de08 ;address of 'receive/transmit data' 
cs_tx_cmd	= $de0c;address of 'command' port 
cs_tx_len	= $de0e;address of 'transmission length' 

To send a packet out once the appropriate ethernet frame with correct src & dest
MAC address etc has been built in RAM, the next step is:

1) write a byte to the 'command' port to request the cs8900a accept a packet for
transmission
2) change the 'packet page' to the 'status' page inside the cs8900a .
3) read a byte from the 'packet data' port to get current status
4) wait until status byte indicates cs8900a is ready to accept a new ethernet
frame - if not, go back to step 3
5) once status is OK, write the length of the frame to be transmitted to the
"transmission length" port
6) write all the bytes in the ethernet frame to the "receive/ transmit data" port


reading data (via polling) is done by:
1) read the status byte to see if there is a packet to be read
2) if so, start reading from the "receive/ transmit data" - the first 2 bytes
read are the length of the frame, followed immediately by the frame contents.






More information about the Coco mailing list