RaveGuru wrote:
@zap: Thanks for a cool challange. I hope to see more of this on the forum in the future

@oliver: IIRC that Vice implementation of RR/RR-Net doesn't require you to activate the clockport. Could it just be the clockport setup that's incorrect? All I do (provided that you attach RR-Net to RR and RR to the C64) is...
Code:
lda $de01
ora $#01
sta $de01
...to activate the clockport and that's about it for the initialization. The mmc64 setup involves a few more steps. After this I do the cs8900a_init(), uip_init(), etc.
I'd like to thank everybody in this thread pointing me to the clockport issue und helping me to understand - at least enough to get the driver working !
Yes, the VICE implementation of RR-Net is really just an emulation of RR-Net and not an emulation of RR+RR-Net. The NIC selection just adjusts the I/O port mapping. Otherwise I would have notice much earlier that I was missing something.
Now some words on the actual implementation (and the missing MMC64 support): I'm afraid that this seems quite arrogant/ignorant - especially as I'm just starting to begin to understand thing - but nevertheless:
The goal for my Contiki 2.1 port to cc65 targets is really to stay as generic and "clean" as possible. I hope that the extremly quick availability of the C128 port kind of proves that benefit.
I put quite some effort I implementing the Ethernet support in a generic way as well:
1. Separate the common stuff (like ARP handling) from the actual device driver (which isn't common for Contiki) and load the actual device drivers based on user configuration at runtime using the cc65 module loader.
2. Let the device drivers modify themselves to the user configurable I/O port mapping. This allows to support all "known" NICs both in the CBM and Apple world with just two driver binaries. The Apple2 benefits from this especially as it has 7 slots a NIC can be plugged in in every slot has a specific "own" port mapping range.
That self modification generally works this way: The NIC register addresses are declared as offsets to the base address. For the CS8900A in example:
rxtxreg := $0000
txcmd := $0004
...
Then the highbyte of address given in the configuration file is used to just overwrite all register address highbyte occurances and the lowbyte is ORed with all register address lowbyte occurances.
That works for every C64/Apple2 NIC but the RR-Net. Fortunately there was an elegant solution for that: Just replace the OR with an XOR. With a configuration address of $DE08 it does the same address bit-3 toggle done in the RR-Net hardware. So far so good - no "if RR-Net then ... else ..." type of code

.
But then came the RR clockport initialization: Checking out the CS8900A data sheet I noticed that in 8-bit non-interrupt mode any read/write access to the ISQ (Interrupt Service Queue) is supposed to have no effect at all. So I declared the register in the usual way:
isq := $0008
And added the follwoing code:
; Activate C64 RR clockport in order to operate RR-Net
; - RR config register overlays CS8900A ISQ register
; - No need to distinguish as ISQ access doesn't hurt
fixup01:lda isq+1
ora #$01 ; Set clockport bit
fixup02:sta isq+1
You see - the code is unnecessary with all other NICs but still no "if then else"

.
From my perspective I've stretched my generic approach to the maximal extent. And - although I have very limited knowledge on this - I feel that there's rather something "wrong" with the MMC64 if it isn't able to "emulate" the behaviour of RR more closely when it comes to replace RR as RR-Net "mother".
Once more thanks for the great friendliness and support in this community. There's one other binary I plan to create out of the existing Contiki applications. Maybe in time for a XMAS present ... But then I really hope that someone else will take advantage of Contiki 2.1 to built something !
Best, Oliver