a naive attempt to emulate Classic MacOS runtime
NOTE: This is a hacky experiment and is by no means pretty.
- This is an ugly hack that hasn't been completely refactored
- 64MB of RAM is allocated for the process and there's no real memory management
- There's very little sanity checks anywhere so it will cause buffer overflows
- It only runs on Little Endian systems but it should be easy to fix it
- It only builds on 64-bit Linux so far, I guess
Depends on Qt5.
$ make
$ ./woolshed run examples/hello
You can see quite a bit of information about the PEF image with:
$ ./woolshed dump examples/hello
Most of the runtime initialization code is in src/run.c and in src/pef.c except the CPU emulation.
System libraries are in lib/ and all library function calls take the CPU state as their sole argument.
Resources used to write this hack:
- SheepShaver BeOS PPC CPU emulation code
- Mac OS Runtime Architectures (book) for PEF reference
- GNU binutils for PowerPC to disassemble code with objdump
- Macintosh Programmer's Workshop to compile examples
- Original Apple Developer Connection API reference