An experimental emulator
Go to file
joevt 650c2c88dd Add socket type for serial_backend
With the option --serial_backend=socket, input and output to a serial port will use a SOCK_STREAM type UNIX domain socket. This allows you to do Open Firmware in one window, while the first window can be used for dingusppc debugger.

Other fixes:

- Added SIGTERM handler so that if the user force quits dingusppc, the terminal settings are properly restored. A user needs to force quit when --serial_backend=stdio and Open Firmware is taking input from ttya. If terminal settings are not restored, then running dingusppc after a force quit will cause Control-C to not work when --serial_backend is not stdio.

- Added a couple numbers to rcv_char_available - 15 is the number of consecutive characters that can processed. 400 is the total number of calls to rcv_char_available after 15 consecutive characters have been read before additional characters can be read. This delay in processing additional characters allows pasting arbitrarily large amounts of text into Open Firmware. A real serial port terminal app might have a text pacing option to limit the number of output characters per second but that is not an option since the emulator is not limiting character data to a baud rate.

Related Notes:

The socket file is created when dingusppc starts.
The socket file is named dingusppcsocket and is created in the current working directory (usually where the executable is located and where the dingusppc.log, nvram.bin, and pram.bin files are created).
The socket file is not visible in the Finder. You can see it in the terminal using the ls command.
The socket file can be used with the following command in a new terminal window:
socat UNIX-CLIENT:dingussocket -,cs8,parenb=0,echo=0,icanon=0,isig=0,icrnl=0
When dingusppc quits, the socat command ends.

Other notes:

The dingusppc --debugger option causes dingusppc to enter the debugger before Open Firmware outputs anything. You can connect to the socket while dingusppc is in the debugger. Then enter the go command to leave the debugger and start Open Firmware. However, since the startup sound takes a long time, you can probably connect to the socket before Open Firmware starts even without the --debugger option. It's like with a real Power Mac - you have a few seconds to hold Command-Option-O-F except in this case you have a few seconds to press the up arrow and press enter (for executing the last command from the terminal command history) and if you do it too late you'll still get into Open Firmware if auto-boot? was previously set to false using the dingusppc debugger which is actually the only way to get into Open Firmware since a keyboard is currently not emulated?).

To set ttya as the input and output device in Open Firmware, you can use the setenv command in the dingusppc debugger. The device path needs to be longer than the current device path (because code for handling shortening of the paths is currently not implemented). For example, ttya can replace kbd for the input-device, but to replace screen for the output-device you need to add some extra characters like this: ttya,11 (I think the number is for baud but we're not using a real serial port so baud doesn't matter).

Future ideas:

- Have dingusppc execute the socat command for you so that it opens a terminal window before Open Firmware starts.
- Add another --serial_backend for the printer port (ttyb) since now we have more than one type of serial backend. If both serial ports use socket backend, then a different name for the second socket is required.
- Have an option to make dingusppc block until something connects to the socket (this means calling accept after listen instead of after select).
- Test compatibility with serial port socket created by Parallels Desktop virtual machines in macOS.
- Find a solution that works with Windows.
- Test with Linux.
- Create a serial_backend type for tty devices. I suppose maybe socat can pipe the file socket to tty but a direct connection might be easier to setup.
- Allow using a socket created by some other app (for example, socat UNIX-LISTEN). This means dingusppc will assume the client role and will call connect instead of accept.
2022-08-14 16:36:52 -07:00
.github Improve Github actions. 2022-05-21 15:14:30 +02:00
benchmark Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
core Implement MPC601 style RTC. 2022-05-21 14:51:27 +02:00
cpu/ppc Remove unnecessary linefeeds from log 2022-08-14 05:26:56 -07:00
debugger debugger: fix ofnvram commands for Nubus machines. 2022-07-18 20:27:34 +02:00
devices Add socket type for serial_backend 2022-08-14 16:36:52 -07:00
machines Remove unnecessary linefeeds from log 2022-08-14 05:26:56 -07:00
thirdparty Remove unnecessary linefeeds from log 2022-08-14 05:26:56 -07:00
utils Fix forgotten include. 2021-04-19 00:13:33 +02:00
zdocs zdocs/openfirmware.md: minor corrections. 2021-11-29 22:35:12 +01:00
_config.yml Set theme jekyll-theme-minimal 2020-03-26 23:30:27 -07:00
.clang-format clang-format everything 2020-05-12 23:55:45 +05:00
.gitignore Fix build on linux 2020-05-12 21:20:57 +05:00
.gitmodules Add Capstone submodule. 2020-12-03 00:53:28 +01:00
CMakeLists.txt Initial attempt at terminal support for Windows 2022-05-22 17:46:40 -07:00
CMakeSettings.json Started config file reading 2020-03-26 12:32:24 -07:00
CONTRIBUTING.md CONTRIBUTING: Use code blocks for code examples. 2020-03-05 11:53:28 +01:00
dppcicon.ico More fixes, plus a temp icon 2019-07-19 14:24:39 -07:00
endianswap.h Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
icon.rc More fixes, plus a temp icon 2019-07-19 14:24:39 -07:00
LICENSE Initial commit 2019-07-01 19:13:30 -07:00
main.cpp Refactor MachineBase and MachineFactory classes. 2022-07-18 20:27:34 +02:00
memaccess.h Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
README.md README.md: minor corrections. 2020-11-30 14:47:22 +01:00

DingusPPC

Written by divingkatae and maximumspatium

Be warned the program is highly unfinished and could use a lot of testing. Any feedback is welcome.

Philosophy of Use

While many other PowerPC emus exist (PearPC, Sheepshaver), none of them currently attempt emulation of PPC Macs accurately (except for QEMU).

This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC Old World ROMs, including those of the PowerMac G3 Beige.

Implemented Features

This emulator has a debugging environment, complete with a disassembler. We also have implemented enough to allow OpenFirmware to boot, going so far as to allow audio playback of the boot-up jingles.

How to Use

This program currently uses the command prompt to work.

There are a few command line arguments one must enter when starting the program.

-r, --realtime

Run the emulator in runtime.

-d, --debugger

Enter the interactive debugger.

-b, --bootrom TEXT:FILE

Specifies the Boot ROM path (optional; looks for bootrom.bin by default)

-m, --machine TEXT

Specify machine ID (optional; will attempt to determine machine ID from the boot rom otherwise)

As of now, only the Power Macintosh G3 Beige is implemented.

How to Compile

You need to install development tools first.

At least, a C++11 compliant compiler and CMake are required.

You will also have to recursive clone or run

git submodule update --init --recursive

This is because the CubeB module is not included by default. All other components are already included in the thirdparty folder and compiled along with the rest of DingusPPC.

For example, to build the project in a Unix-like environment, you will need to run the following commands in the OS terminal:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make dingusppc

You may specify another build type using the variable CMAKE_BUILD_TYPE.

Future versions may drop SDL 2 as a requirement.

For Raspbian, you may also need the following command:

sudo apt install doxygen graphviz

Testing

DingusPPC includes a test suite for verifying the correctness of its PowerPC CPU emulation. To build the tests, use the following terminal commands:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make testppc

Intended Minimum Requirements

  • Windows 7 or newer (64-bit), Linux 4.4 or newer, Mac OS X 10.9 or newer (64-bit)
  • Intel Core 2 Duo or better
  • 2 GB of RAM
  • 2 GB of Hard Disk Space
  • Graphics Card with a minimum resolution of 800*600

Compiler Requirements

  • GCC 4.7 or newer (i.e. CodeBlocks 13.12 or newer)
  • Visual Studio 2013 or newer