This project is no longer being developed.
I decided to restart from scratch to fix some architectural flaws in Rustation. Some of the code has been imported from this project, other bits have been thoroughly rewritten. The new repository is rustation-ng. It's now more advanced than this project, with proper sound support and generally more accurate emulation.
One significant difference between the two projects is than rustation-ng dropped the GL renderer in favor of a threaded software one. The GL renderer of Rustation has been ported to C++ and has been integrated in the Beetle PSX emulator however, so it's not completely dead.
Rustation PlayStation emulator
PlayStation emulator in the Rust programing language.
This repository only contains the source code for the core of the emulator. The OpenGL renderer and the libretro interface is is the rustation-libretro repository.
The focus of this emulator is to write code that's clean, accurate and hopefully easy to understand. There's no plugin infrastructure, the emulator is monolithic.
Performance is pretty poor at the moment but it should be enough to run close to realtime on a modern CPU.
For the time being it can only boot a few games. Crash Bandicoot (Japanese version) is mostly playable, although I've had random crashes. Some other games (like Spyro) freeze after or during the intro.
If you have any questions, in particular if something in the code is not clear or properly commented don't hesitate to fill an issue.
I also created a /psx/ board on 8chan if you prefer something less formal to discuss this emulator and all things PlayStation. We'll see if this turns out to be a good idea...
Currently implemented (even partially)
- Basic GTE support (ported from mednafen PSX)
- Instruction cache
- Basic GPU (no semi-transparency or mask bit emulation)
- Timers (incomplete)
- CDROM controller (missing many commands)
- Gamepad controller (only digital pad for now)
- Many things in the GPU
- Memory card
- CPU pipeline emulation
- More accurate timings
- Many, many other things...
You should then be able to build the emulator with:
cargo build --release
Don't forget the
--release flag in order to turn optimizations
on. Without them the resulting binary will be absurdly slow.
If the build is succesful you can run the emulator using:
cargo run --release /path/to/SCPH1001.BIN
For Windows check issue #12.
Escape key to exit the emulator,
Pause/Break to "break" into the
debugger, the emulator will then listen on TCP port
9001 for a GDB
In order to debug you'll need a GDB targetting
mipsel-unknown-elf. Once the emulator is running press the
Pause/Break key to trigger the debugger and then connect GDB to it
using (at the gdb command prompt):
target remote localhost:9001
GDB might complain about not finding symbols or the boundaries of the current function but you can ignore that. From then you should be able to use the familiar GDB commands to debug the live emulator.
A few examples:
# Dump the CPU registers info registers # Disassemble 20 instructions around PC disassemble $pc-40,+80 # Display word at address 0x1f801814 (GPU status) x/x 0x1f801814 # Add code breakpoint at address 0x00004588 break *0x00004588 # Add write watchpoint at address 0x1f801070 (IRQ ack) watch *0x1f801070 # Step over a single instruction stepi # Continue until a break/watchpoint is reached (or Pause/Break is pressed) continue
The debugger support is pretty experimental and quircky but it works for basic debugging needs.
I'm also attempting to document the emulator writing process in a LaTeX document available in the psx-guide repository. It's generally lagging behind the actual code but I'll try to update it as often as possible.
I also run tests on the real hardware and store them in the psx-hardware-tests repository.