I am happy to share an update for the MicroCore Labs MCL68+ project first introduced here: https://microcorelabs.com/2023/10/26/mcl68-motorola-68000-emulator-2/
The good news is that I am now able to completely boot and run the Macintosh 512K!
As a winter project I thought I would pick this project back up after a two year break and see if I could make some progress. When I left off the MCL68+ was able to almost boot to the MacOS desktop but would get a fatal error.
The breakthrough was to run the MCL68+ against Tom Harte’s 68000 opcode test suite which found a number of subtle errors which were resulting in the Mac experiencing the fatal error.
The reason I did not use Tom’s test suite two years ago was because they are all written in JSON format and I lacked the skills to translate it into vectors that my code could use. I STILL lack these skills but I was able to generate the conversion code using ChatGPT. I was impressed that between my prompt and the maturity of ChatGPT it was able to generate the correct code on the first pass!
Once I had the stream of opcode before and after results I was able to plug them into the MCL68+ and see where they diverged. The errors on the MCL68+ were mainly due to incorrect effective address handling when the address for the opcode source and destination was the same register. There were a few instances of incorrect flag calculations and stack ordering as well.
I believe there were over a million tests, so I am fairly confident at this point that the MCL68+ 68000 emulation code is now mostly correct – and cycle accurate to a large degree.
The Macintosh runs the CPU at almost 8 MHz and was a real challenge to get the Teensy 4.1 to bit-bang the local bus at that speed. I believe there are still signal integrity issues at the local bus interface so I chose to emulate the Mac’s 512K of RAM and the BIOS ROM inside of the Teensy to guarantee error-free operation. You may be able to see random dots around the screen which I believe are due to stray bus cycles writing to the video memory. These are harmless.
Here is a short video demo of the MCL68+ running in a vintage Apple Macintosh 512K:
Original post:
The MCL68+ is a Motorola 68000 drop-in replacement emulator. It uses the Teensy 4.1 to emulate both the microprocessor and the local bus interface at full speed. It is the most ambitious drop-in emulator I have designed to date, and I am pleased with the progress I was able to achieve.
Enclosed is a picture of the MCL68+ inside of a Macintosh 512K - the "Fat Mac" It is able to emulate a cycle-accurate 68000 and successfully run the local bus interface at the full 7.8 Mhz bus speed. This is the fastest bit-banged local bus speed that I have ever achieved using a Teensy 4.1! It required a number of tricks such as pre-calculating addresses and using arrays to map GPIO values to the Teensy's output registers. The Motorola 68000 also required more pins than were available on the Teensy 4.1, so I used a series of byte-wide latches to shift out the address and data busses.
Here is a short video which demonstrates the MCL68+ booting System 2 on the Macintosh 512K.
The progress always stops here, but I am able to move the cursor around with the mouse and reboot the machine, so the system is not locked up. I traced the error to an attempted subroutine jump to a misaligned address, but I have not had the time to trace the code backwards to find where this address comes from. Still, the fact that it performs the system configuration and checks and then boots from the disk drive indicates that most of the MCL68+ emulation is correct. Im not sure at this point is there is a problem with my emulation of some opcode, or some quirk with the Macintosh hardware which I am not accommodating...
The project source code is published on GitHub: https://github.com/MicroCoreLabs/Projects
The Teensy did not have enough GPIOs to implement each of the 68000's actual...
Read more »
Ted Fried
Matt Stock
Erik Piehl
It seems like this project could make for an excellent In Circuit Debug tool if there are any CPU cycles available.