I really enjoyed the design exercise for the FreeBee main board, especially doing the whole thing without using any PLDs. It had me drawing Karnaugh maps and trying different methods of simplifying TTL logic, which I find really satisfying.
So over the Christmas break I figured I'd revisit an older project, the Compact Flash Coreboard. Last time I worked on this was back in 2016. It basically featured a compact flash socket, some RAM, ROM, Floppy controller, and three Atmel 44 pin CPLDs. The design of these CPLDs was an exercise in frustration, tracking down glitches everywhere due to the big difference in their speed compared to that of the Microbee that was running them. One of the key issues was that I convinced myself that in order to talk IDE, I needed to do 16 bit transfers, where this simply isn't the case. This greatly complicated the design.Recently however I've been reading of RCBUS designs, including a compact flash interface in just three TTL chips (see this work by Tadeusz Pycio) that corrects for timing differences between the Z80 (rd, wr, iorq) and 8086 (iord, iowr) bus, meaning it will work reliably with any smallish Flash card, not just a select few.
The board essentially replicates what my old rev 0.4 coreboard did, with up to 512K of RAM, up to 512K of EEPROM, a floppy disk controller, and the Compact Flash interface. It's the "I want to have the CP/M bee experience" equivalent of the SuperPAK coreboard.
By allowing for up to 512K of EEPROM, my hope is that the machine can run a ported version of ROMWBW, which is an unencumbered version of CP/M developed by the retrocomputing community.
I built a prototype in early 2024, fixed a couple of really obvious stuff-ups (F000 line not going back to mainboard connector, and floppy drive enables swapped) and was then able to boot both from CF and from floppy. It stalled there for a while, as I couldn't get my head around the software for creating Compact Flash images on my PC. As it turns out, my mac, which I use for dumping images to Compact Flash cards, lies about the CHS (Cylinder, Head, Sector) values for a CF card when I run fdisk. This doesn't matter for most things, but the BIOS we're using for the CF card is based on the early Microbee hard drive BIOS, which does it's disk addressing in CHS mode. In any case, Brad from MSPP to the rescue, he figured out the difficult software stuff and got a whole bag of CF cards to run. He also suggested pullups on the data lines, plus series resistors for the CF data lines as well as the IORD, IOWR, and CFSEL lines, to combat potential ground bounce issues from newer faster cards.
In any case, now the production version is ready to roll and there is huge interest. I have 35 orders already. So I'd better get the production release right!
So on to the description of how it works. Our BIOS expects a WD2793 floppy disk controller at IO location 40h, plus disk and side select latch at 48h, IDE drive at 60h, and bank select port at 50h. IC13, a 74HCT138, performs port decode into 8 port chunks, from P40h-47h, through to port 78h-7Fh.
Bank switching is performed to allow up to 512K of RAM and 512K of EPROM on the Microbee or FreeBee mainboards, in a way that works with the standard Microbee BIOS. This involves a write-only port at 50h, with the following bit assignments:
There's a bit of weirdness with the Microbee bank select that we have to account for as well. Essentially bank select bit 1 is exclusive ORed with ROM disable. I'm not completely sure why they did this, and it's really hard to figure out from the contradictory documentation. When the computer boots and the register is cleared, RAM bank 0 appears from 0000h to 7FFFh, ROM bank 0 from 8000h to EFFFh, and video memory from F000h to FFFFh. Setting bit 2 then sees RAM bank 2 from 0000h to 7FFFh, RAM bank 0 from 8000h to EFFFh, and video memory from F000h to FFFFh.
The compact flash interface is composed of just two dedicated chips, IC26 and IC28. IC26B, a 74HCT32, creates a shortened IORD* pulse by delaying the start of RD* by one CPU clock. IC26A lengthens CFSEL* by a CPU clock. The two gates on IOWR* simply delay this signal by two gate delays.
The compact flash and IDE interface exists from P60h to P68h. This maintains compatibility with the Microbee CF8 BIOS.
I added pullups (RN1) and series resistors (RN2, RN3, R13, R16, R20) in order to minimise potential for ground bounce when using really fast CF cards, hopefully meaning the circuit will work with more (newer) cards. This hasn't been trialled yet, but can be removed by simply not installing RN1, and jumpering out all the series resistors (or substituting low value resistors.
The reset circuit is straight from the standard SRAM coreboard. Note thet we are not asserting NMI instead of reset with jump latch, as they do for the Microbee DRAM coreboards. I believe this is done to ensure refresh is continued to the RAM. As we're not using DRAM, we don't need to do this. As with the SuperPAK board, some adjustment of D4 might be necessary depending on what supply voltage you run your bee on.
The rest of the board is the Floppy Disk Interface. This is really only interesting if you have old floppy disks to read. There are a pile of changes from the "standard" microbee floppy interface. Firstly, The board should work (with some code changes) for either WD2793 or WD2797 FDC chips. This is done by not using the ENMF* input (WD2793) to do a divide by two on the clock. This is instead done separately using a flipflop.
IC15 is a four bit latch at port 48h. Bit 0 selects the floppy drive (A or B). Bit 2 selects the side. Bit 3 is used to select double density (MFM encoding) on the FDC. Bit 4 (unused on the microbee normally) selects high density (8", 5.25" 1.2MB, or 3.5" 1.44MB) disks. When set it doubles the FDC clock, and selects a different set of precompensation trimpots, as well as doubling the pump frequency (by halving the capacitance on the pump pin. This is based on the FloppyIO board from MSPP.
There's some jumpers for selecting Head Load Timeout delays. I've labelled them 3 (fast), 5 (medium) and 8 (glacial) to correspond to the varying delays that must be incorporated for various hardware.
The last tidbit from the FDC sheet is the NMI logic. The microbee is not fast enough normally to keep up with the data rate from a high density drive. Tony Ellis did a lot of work to develop a faster FDC interface, and worked out that if you use the INTRQ output from the FDC to trigger an NMI and heavily optimise your code, you can _just_ keep up at 3.375 MHz.
So IC20D, IC18A, and IC23B does that. When HD floppies are enabled and halt is active (ie the CPU is waiting for an interrupt), the INTRQ or DRQ output of the FDC is gated to NMI.
The PCB design is a simple 269 x 107mm, two layer board. The Compact flash socket dictates 8 thou (0.2mm) clearance, but otherwise it's much the same as other FreeBee boards. I've taken a lot of care to get grounds low impedance, and added a 40mm IDE socket, so if you're not brave enough to solder on the 0.635mm pitch SMD Compact Flash socket, you can just buy a cheap eBay adapter and use thet.
It's part of the FreeBee family, so has been treated to the same attention to detail as other boards from the family. Nice rounded tracks and a clean hand-done layout, with generous elliptical pads for all ICs making for ease of construction.
It's a completely open source design. Design files are on my Google drive.
Here's the prototype ready for smoke test...
There is a process documented on the MSPP site for generating the CF images to work with this, as well as the BIOS ROM, in the "tech" repository, under Microbee/Software/Compact_Flash/IDE_CF_Adapter.
Disk controller setup is as follows:
Boot into monitor with ctrl-M (no CF card installed).
Install a jumper across the TEST header (This has to be done after boot).
In monitor type O 48 8. This will enable DDEN mode, but keep HDEN mode disabled.
- Check the clock frequency (pin 24 IC19), it should be 1 MHz.
- Adjust RV4 to make the pulse on the TG43 test point 500ns.
- Adjust C23 to make the pulse on the DIRC test point 2µs.
- Adjust RV2 to make the pulse on the WD test point 250ns.
Now type O 48 18 in monitor. This enables HDEN mode, as well as DDEN mode.
- Check the clock frequency (pin 24 IC19), it should be 2 MHz.
- Adjust RV3 to make the pulse on the TG43 test point 250ns.
- Check that the pulse length on DIRC is now 1µs.
- Adjust RV1 to make the pulse on the WD test point 125ns.