Programming my own Mac emulator
Moderators: Cat_7, Ronald P. Regensburg
Re: Programming my own Mac emulator
Alright. Just let me know!
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
Going to bump this topic here - The emulator has a decent amount of progress put into it. With a hack or two, we can display the black-and-white display pattern, but locks up there.
To get farther requires hard drive emulation, so we'll need to emulate either the IDE interface (we've documented much of it in the zdocs folder) or the SCSI interface (which is what all Old World Macs will need).
There's also some slight progress in regards to Power Mac 6100 emulation.
To get farther requires hard drive emulation, so we'll need to emulate either the IDE interface (we've documented much of it in the zdocs folder) or the SCSI interface (which is what all Old World Macs will need).
There's also some slight progress in regards to Power Mac 6100 emulation.
Last edited by kataetheweirdo on Mon Sep 27, 2021 2:54 pm, edited 1 time in total.
Re: Programming my own Mac emulator
I highly recommend going for the SCSI interface, at least the mass storage spec. It opens up more long-term opportunities for improvement.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
We'll have to include SCSI emulation sooner or later, as we're also targeting the Power Mac 6100.
I've also cleaned up 601 opcode emulation.
I've also cleaned up 601 opcode emulation.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
As of writing, we recently merged into some commits that allow us to see the Sad Mac using a Power Mac 6100 ROM. We'll need to code some fixes in for the processor (namely, the crxor instruction) and the ADB emulation.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
Over the past month, we've implemented enough to start booting off a floppy with the current Power Mac 6100 emulation. It currently can reach the "Welcome to Macintosh"/Mac OS logo before crashing due to unemulated NuBus hardware.
- uliwitness
- Student Driver
- Posts: 11
- Joined: Thu Feb 17, 2022 12:04 am
Re: Programming my own Mac emulator
That sounds cool. I'd be curious in hearing where one would even start with such an emulator. I'm currently working on a HyperCard clone, which involves a bytecode compiler for HyperTalk, and I have a manual for some Mototrola PowerPC CPU that Apple never used, but where do you even find details like how to emulate NuBus stuff etc.?
Cheers,
-- Uli Kusterer
https://hypercard.org
-- Uli Kusterer
https://hypercard.org
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
While a good chunk of it was gathered from open source repositories, some of it required digging into documents not available to the public. That said, here are a few resources we found that are publicly available:
- This NuBus DECL ROM decompilation - It also has some useful links, like one for designing hardware for 68k NuBus Macs.
- MkLinux - The earliest machines supported in Apple's own open source repos are Beige Power Mac G3s and the like. For anything earlier, MkLinux has significant amounts relating to both NuBus and early PCI PowerMacs. nubus-pmac might be another possibility if you want to look at OSes with NuBus support.
- The SuperMario code - This was occasionally spread around as leaked System 7.1 source code, but it's actually ROM and Toolbox code. The current version floating around dates from February 1994 and covers Macs up until early prototyping on PCI boards. This also includes a significant chunk of NuBus code. cdg5 have also made patches for this, mainly to get Mac OS 9 working on newer G4 machines.
- The Power Macintosh Book (1994) by Stephan Somogyi, Foreword by Donald A. Norman - General hardware overview of early Power Macs
Re: Programming my own Mac emulator
It's also sometimes useful to refer to the NetBSD codebase; that was my first exposure to Mac hardware from an outside perspective. Of course, there's parts that the NetBSD guys just ignored/co-opted from an already-booted Mac OS, but it's useful in helping to figure out where one part of the hardware leaves off and the other more open areas start, too. And they did a good job of clean-room analysis of the calls and APIs they did have access to.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
Right now, DingusPPC can boot off installation floppies from the System 7 era. I'll be implementing whatever I can for hard disk support next.
- uliwitness
- Student Driver
- Posts: 11
- Joined: Thu Feb 17, 2022 12:04 am
Re: Programming my own Mac emulator
Cool, thanks for all those resources!kataetheweirdo wrote: ↑Thu Feb 17, 2022 2:56 pmWe also had to dissect the Power Mac 6100 ROM
- This NuBus DECL ROM decompilation
- MkLinux
- The SuperMario code
- The Power Macintosh Book (1994)
Cheers,
-- Uli Kusterer
https://hypercard.org
-- Uli Kusterer
https://hypercard.org
- uliwitness
- Student Driver
- Posts: 11
- Joined: Thu Feb 17, 2022 12:04 am
Re: Programming my own Mac emulator
Thanks! I didn't really think that people would just look at how other open source OSes that ran on the same hardware would do.
Cheers,
-- Uli Kusterer
https://hypercard.org
-- Uli Kusterer
https://hypercard.org
- uliwitness
- Student Driver
- Posts: 11
- Joined: Thu Feb 17, 2022 12:04 am
Re: Programming my own Mac emulator
Looking forward to seeing how it works. I really want a System 7 emulator I can play around on, ideally without using the boot disk whenever my inevitably buggy C code crashes :Dkataetheweirdo wrote: ↑Sun Mar 06, 2022 6:41 pm Right now, DingusPPC can boot off installation floppies from the System 7 era. I'll be implementing whatever I can for hard disk support next.
Cheers,
-- Uli Kusterer
https://hypercard.org
-- Uli Kusterer
https://hypercard.org
Re: Programming my own Mac emulator
As an aside, you can use the QEMU-system-m68k custom builds on here to that purpose: I believe it should support snapshotting if you use a qcow2 volume, and emulates a Quadra. That way, you can just pop open the monitor and do a snapshot before testing, then revert if you corrupt HFS.uliwitness wrote: ↑Wed Mar 09, 2022 9:59 pmLooking forward to seeing how it works. I really want a System 7 emulator I can play around on, ideally without using the boot disk whenever my inevitably buggy C code crashes :Dkataetheweirdo wrote: ↑Sun Mar 06, 2022 6:41 pm Right now, DingusPPC can boot off installation floppies from the System 7 era. I'll be implementing whatever I can for hard disk support next.
- uliwitness
- Student Driver
- Posts: 11
- Joined: Thu Feb 17, 2022 12:04 am
Re: Programming my own Mac emulator
Wasn't aware QEMU worked with 68k as well, will have to set aside some time to play with that, thanks!adespoton wrote: ↑Thu Mar 10, 2022 12:14 am As an aside, you can use the QEMU-system-m68k custom builds on here to that purpose: I believe it should support snapshotting if you use a qcow2 volume, and emulates a Quadra. That way, you can just pop open the monitor and do a snapshot before testing, then revert if you corrupt HFS.
Cheers,
-- Uli Kusterer
https://hypercard.org
-- Uli Kusterer
https://hypercard.org
Re: Programming my own Mac emulator
"QEMU" doesn't work with 68k, but the custom qemu-system-68k builds on here do -- there's one for generic Mac OS and one for A/UX. They aren't ready to roll into QEMU yet, but ARE functional on their own. Soon they'll be part of QEMU....uliwitness wrote: ↑Thu May 26, 2022 5:52 pmWasn't aware QEMU worked with 68k as well, will have to set aside some time to play with that, thanks!adespoton wrote: ↑Thu Mar 10, 2022 12:14 am As an aside, you can use the QEMU-system-m68k custom builds on here to that purpose: I believe it should support snapshotting if you use a qcow2 volume, and emulates a Quadra. That way, you can just pop open the monitor and do a snapshot before testing, then revert if you corrupt HFS.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
OpenFirmware now can be run through the command line using the -d and --serial-backend=stdio commands.
-
- Tinkerer
- Posts: 92
- Joined: Sun Sep 28, 2014 11:53 am
Re: Programming my own Mac emulator
Cool! My System 7.6 image boots. but I can't get mouse and keyboard work, it just "hangs" there.
the image I made for mame pm6100, also boots on DingusPPC.
https://mega.nz/file/DQ8WAJqJ#POduD-quP ... KnUjSM_N_c
the image I made for mame pm6100, also boots on DingusPPC.
https://mega.nz/file/DQ8WAJqJ#POduD-quP ... KnUjSM_N_c
Re: Programming my own Mac emulator
Wow! Congrats! So the core now works and you're on to the serial interface?
Since you're doing 7.6, I presume you're going to go the ADB route?
Since you're doing 7.6, I presume you're going to go the ADB route?
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
We already got some work in for the serial interface. We'll need to fix some timing issues and probably want to implement hard disk support first before tackling ADB.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
So, which symbols are included can vary between ROMs.kataetheweirdo wrote: ↑Thu Feb 17, 2022 2:56 pm We also had to dissect the Power Mac 6100 ROM, which includes a decent chunk of debugging symbols.
For example, here's where the GetPPCGlobalFlag symbol can be found:
- 63ABFD3F - Power Mac & Performa 5200,5300,6200,6300
83A21950 - PowerBook 1400cs.ROM
9B037F6F - Workgroup Server 9150-120.ROM
9B7A3AAD - Power Mac 7100 (newer)
9FEB69B3 - Power Mac 6100 & 7100 & 8100
On the flip side, it seems only the PowerMac and PowerBook G3 ROMs (and PowerExpress) have any strings for LLNub (Low Level Debug Nub?) and many of the PCI Power Mac ROMS have the string "Switched to Macsbug- G to resume" in them.
Re: Programming my own Mac emulator
Wow! how did you learn where to start?
-------------------------------------------------------------------------------------------------------------------------
i could be doing something productive right now.
i could be doing something productive right now.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
I actually found a document relating to the Yosemite Boot ROM, specifically the engineering requirements spec. The copy available is incomplete, but it goes over a lot of technical details for the Mac.
There's also source code available from Apple, which means code specifically for PPC hardware can be found in source code tress for Mac OS X 10 to 10.5. That said, you might be better off trying to get source code from the Mac OS Server X 1.x discs or using the MkLinux tree.
There's also source code available from Apple, which means code specifically for PPC hardware can be found in source code tress for Mac OS X 10 to 10.5. That said, you might be better off trying to get source code from the Mac OS Server X 1.x discs or using the MkLinux tree.
-
- Master Emulator
- Posts: 320
- Joined: Sun Feb 01, 2009 4:55 pm
Re: Programming my own Mac emulator
Been some progress going on. I can't reveal what we're doing yet, but I'll give a sneak peek:
Re: Programming my own Mac emulator
Hi kataetheweirdo,
Nice, that is the g3beige target attempting to run 10.0 or 10.2?
How's adb support for the older Mac OS coming along?
Best,
Cat_7
Nice, that is the g3beige target attempting to run 10.0 or 10.2?
How's adb support for the older Mac OS coming along?
Best,
Cat_7