Scare Bear's Ethernet Experiments

Doc Bacardi


Table of Contents
1. Memory Map
2. Detection?
3. The Registers
4. The Packet Page Registers
Product Identification Code
Receiver Configuration (RxCFG)
Receiver Event (RxEvent)
Receiver Control (RxCTL)
5. Feedback
List of Tables
1-1. a short description of $de01
3-1. CS8900 registers (chip order)
3-2. CS8900 registers (swapped)

Chapter 1. Memory Map

The ethernet adapter (I'll call it etha from now on) is plugged into the clock port of the retro replay (rr). The registers are mapped in from $de02 to $de10, but only if bit #0 in $de01 is set.

The banking address in bits 3, 4, 5 and 7 is important and should not be modified without purpose.
Bit 1,2 and 6 can only be set once after a reset. For write access it's a nice idea to set them to 0.

This little routine maps the etha in:
	lda $de01
	and #%10111000
	ora #%00000001
	sta $de01


Chapter 2. Detection?

Now the etha is mapped into the c64's memory. Or something else which is connected to the clock port, like a silver surfer. The only way to find out for sure is a detection routine which looks for the etha, or better the used chip, a CS8900.


Chapter 3. The Registers

The CS8900 has 8 registers, each 16 bits wide. They are mapped into the c64 memory from $de00 - $de10. Unfortunately the rr uses the same location for the 2 controll registers at $de00 and $de01. This means both locations are lost for the clock port. Here's the chip's register map:

The lost register is the "Receive/Transmit Data (Port0)". It is quite useful for efficient operation. A very pointless register is the "Interrupt Status" at $de08. The CS8900 simply supports no interrupts in it's 8 bit mode. So the idea is to swap the registers from $de00-$de07 with $de08-$de0f:

Now the useless "Interrupt Status" is lost. For the other registers I will use some shorter labels from now on:
CS_PacketPage  = $de02
CS_PacketData0 = $de04
CS_PacketData1 = $de06
CS_RxTxPort0   = $de08
CS_RxTxPort1   = $de0a
CS_TxCmd       = $de0c
CS_TxLength    = $de0e

The first 3 registers deal with a so called "Packet Page". They are used to access the internal ram and configuration registers. The "packet page" technique is very similar to the C128's $d800 registers which access the VDC.

Write the address to write to or read from to the CS_PacketPage register. Now the CS_PacketData0 and CS_PacketData1 register are like a window to this selected address. It can be read or modified with the CS_PacketData registers.

Example: I want to read register #4 of the internal ram.
	lda #4
	sta CS_PacketPage
	lda #0
	sta CS_PacketPage+1

	ldx CS_PacketData0
	ldy CS_PacketData0+1
Now X and Y contain the data from register #4. Writing is also easy:
	lda #4
	sta CS_PacketPage
	lda #0
	sta CS_PacketPage+1

	lda #$12
	sta CS_PacketData0
	lda #$34
	sta CS_PacketData0+1

This looks quite slow and unefficient (and it really is), but fortunately there is a much faster way to read and write data for ethernet packets (later more).


Chapter 4. The Packet Page Registers

The Packet Page contains information and configuration registers. All registers are 16 bits wide and start at an even address. This can be useful for a routine to read or write to the packet page.

Here are two little demo routines:
cs_readPage:
	asl
	sta CS_PacketPage
	lda #0
	rol
	sta CS_PacketPage+1
	ldx CS_PacketData0
	ldy CS_PacketData0+1
	rts

cs_writePage:
	asl
	sta CS_PacketPage
	lda #0
	rol
	sta CS_PacketPage+1
	stx CS_PacketData0
	sty CS_PacketData0+1
	rts


Chapter 5. Feedback

Most specs were copied from the crystal docs. The few sources are written by me, Doc Bacardi/The Dreams.

If you found some of the bugs or typos, have better information or whatever, then just give me a mail: