The Chameleon64 is a very powerful and versatile cartridge: Although its initially a C64 cartridge, it also runs standalone and allows to emulate different machines by replacing the FPGA programming. Today I use mine mainly as a HW Amiga emulator with the brilliant Minimig FPGA implementation.
If you look at the HW of the Chameleon you’ll see the clockport connector on the lower right. While this connection was initially devised for the Amigas to add a Real Time Clock (hence the name), it soon became a versatile 8 Bit interface for lots of different HW extensions. It was even “ported” back to the C64 to use some of the Amiga extension cards there as well… That’s the reason why you find it on your Chameleon…
Hmm, I thought… now with an Amiga running on the cartridge why not close the circle and make the clockport accessible to the Minimig, too?
A new project was born: TC64 Minimig-cp (cp for clockport!):
Read on if you want to know how this was done and if you want to try it out yourself, e.g. use your SilverSurfer serial card on your Minimig Amiga 🙂
I had this idea quite some time ago and started development by creating a public repository for the Minimig on Chameleon 64 port at GitHubÂ a few years ago. I started playing with this topic and did my first experiments with HDL programming. Unfortunately, this code base is not well suited as a beginners’ project and so I lost motivation and interest soon. While in total I only cloned the original port of tobiflexx into a repository,Â Alastair M. Robinson (of retroramblings fame) forked the repository and really pushed the current implementation forward by fixing memory issues and adding the Chameleon IO entity to support the docking station and joysticks connected to a real C64 in cartridge mode: He now hosts the most recent Minimig builds for the Chameleon.
With some time at hand and equipped with a shiny new logic analyzer and USB blaster device, I returned to this project a few weeks ago: I updated my initial repository to AMR’s most recent setup and started with this code base on the clockport branch. First I stripped down the Chameleon IO entity, removed everything C64 specific, and reduced it to the basic mux driver it initially was. There I added optional read or write accesses to the clock port. Then I modified the TG68k CPU bridge module that connects the m68k soft processor to the Amiga Minimig entity: There I added the memory accesses to the spare clockport address range starting at $d80001. Read and write accesses there are mapped to clockport accesses and while the access runs the CPU is halted until the access is finished. With this approach, no change of the Minimig core was necessary and it simplified my access to the whole project (needless to say that the 68k bridge is still a beast of code to understand :). Thanks go to AMR for the valuable input on this topic! Finally, I needed to touch the Minimig to correctly route the int6 interrupt line…
With a version of the core that finally showed an Amiga again, I was able to perform the first accesses to the clockport memory range. Here is a snapshot of my development setup: I connected a silver surfer serial card from Individual Computers as a sample board for the clockport access. Between the card and the Chameleon I added a self built connector that replicates all pins of the 2mm connector to a 2.54mm connector that helps me attaching my Logic Analyzer. Surrounding the setup is a USB Blaster device to program the FPGA directly via USB and some cabling to attach the silver surfer back to my Mac:
First tests with the virtual signal analyzer SignalTap II inside Quartus II went really well, but unfortunately the resulting signals on the clockport were not always correct 🙁 In fact the IOWR and IORD looked right but the card did not respond. I did a lot of debugging on the code/SW side but finally I found out that its a HW problem: the reset line is held low by default and thus the device is always in reset and never active. To fix this the resetÂ (and also the interrupt line) of the clockport needs a pull up resistor to restore their signal to high if no one pulls it low… These resistors are available inside the C64 if the Chameleon is used in cartridge mode, but are missing in standalone mode. (That’s the reason why the RRNet is not supported in the C64 core in standalone mode). Jens SchÃ¶nfeld told me that the docking station has an internal reset pull up built in and therefore needs no fix, but I haven’t tried that, yet.
To fix this issue I built a little adapter by soldering a 2×11 pin 2mm header and connector together and added two 10k pull up resistors there:
Here is a detailed pinout of the clockport so you can see where the 2 pull ups need to be added:
With this adapter in place, the clockport works like a charm on the Amiga!! Even interrupts are correctly delivered and I am able to run the silver surfer Amiga driver without any problems! If you run a 68000k Minimig then you can use my patched silver surfer driver as the original one requires a 020 CPU.
If you want to try it out yourself, I have uploaded a prebuilt Minimig image on my site:
- 1.9.2013:Â minimig-clockport-b743536.zip
Just flash the contained RBF file with chacocmd in a free slot and copy theÂ OSD_CA01.sys file next to a kickstart rom called kick.rom to an SD Card. Attach your clockport extension card to the clockport with a pull up adapter and then give it a try! I’d be interested in your feedback if you got other clockport cards running, too.. Just drop me a mail or write a comment…
Before you start, please note that this core:
- does run fine in standalone mode (tested)
- might run with the docking station (please test)
- must NOT run in cartridge mode in a C64 as it drives the data/address lines without any phi2 sync! this will crash or harm your C64!!!!
Additionally note that:
- the core is based on the Chameleon IO added by AMR’s code base BUT its stripped down:
- so NO keyboard, joystick support via docking station or via IR CDTV controller… (I don’t need that – although this might be added again)
My only other clockport card here is the RRNet 2 (while still waiting for v3 :)… Maybe that’s my next project for the minimig-cp…
Pingback: Networking on the Minimig with PPP and Roadshow « Lallafa's Blog
Pingback: CHAMELEON - NeXuS23 BrÃ¸derbund