Friday, September 19, 2014

RR-NET emulation dramas

I have been working for the past couple of weeks on getting RR-NET ethernet emulation working so that existing ethernet-enabled programs for the C64 can use it.

This has been a fascinating process.

First, the 8-bit mode of the CS8900a chip that the RR-NET uses is a bit weird, as it still uses 16-bit registers, and so you have to write to the two halves of the registers in turn, among various oddities.

Once I figured out the semantics I managed to get packet receiving working relatively quickly.  Packet transmission proved a little more frustrating, until I eventually removed the buggy code and wrote it again from scratch.    This is often the case with software that it is faster to re-write something than it is to fully understand and fix it.

I wrote a little BASIC test program that just uses POKE to send an ethernet frame, and it works quite nicely.

However, I haven't had a fully positive response from any of the C64 network-enabled programs I could fine.

The Breadbox64 twitter client requires a supertweet account, and Twitter have disconnected supertweet, so no joy there.

udpslave runs, sees packets, and tries to send replies, but seems to mess up the checksum fields. I don't know whether this represents a bug in my RR-NET emulation, the C65GS more generally, or something else.

The Contiki webserver runs, but fails to actually service any request, even though it does respond to ARP, reply to PING (sometimes at least), and can see and parse HTTP requests given to it.  It looks like there is something fishy going on with packet reception.  I might need to improve buffer handling in my ethernet controller to stop packets getting stomped on while you are still reading them out.  You can see what it does here:



The Contiki webserver and IRC client don't want to accept keyboard input on the C65GS for reasons I don't understand.

Most of the other ethernet-enabled software for the C64 requires either GEOS or a Final Replay or similar cartridge, neither of which are an option right now.

So I am at the frustrating point where it mostly works, and I can see very tantalising signs, but can't actually do anything useful with it.

The one program I have yet to test, but intend to, is the RR-NET version of 64NET/2.  64NET/2 is software that I wrote almost 20 years ago to interface C64s to PCs, and which was extended by some volunteers to support the RR-NET in place of a user port cable.  The RR-NET version consists of a patched kernel, which will be easy enough to load on the C65GS, I just need to make a little program that can load a custom kernel and then restart the machine.