Abusing X86 SIMD Instructions To Optimize PlayStation 3 Emulation

Key to efficient hardware emulation is an efficient mapping to the underlying CPU’s opcodes. Here one is free to target opcodes that may or may not have been imagined for that particular use. For emulators like the RPCS3 PlayStation 3 emulator this has led to some interesting mappings, as detailed in a video by [Whatcookie].

It’s important to remember here that the Cell processor in the PlayStation 3 is a bit of an odd duck, using a single regular PowerPC core (PPE) along with multiple much more simple co-processors called synergistic processing elements (SPEs) all connected with a high-speed bus. A lot of the focus with Cell was on floating point vector – i.e. SIMD – processing, which is part of why for a while the PlayStation 3 was not going to have a dedicated GPU.

As a result, it makes perfect sense to do creative mapping between the Cell’s SIMD instructions and those of e.g. SSE and AVX, even if Intel removing AVX-512 for a while caused major headaches. Fortunately some of those reappeared in AVX2.

The video goes through a whole range of Cell-specific instructions, how they work, and what x86 SIMD instructions they were mapped to and why. The SUBD instruction for example is mapped to VPDPBUSD as well as VDBPSADBW in AVX-512, the latter of which mostly targets things like video encoding. In the end it’s the result that matters, even if it also shows why the Cell processor was so interesting for high-performance compute clusters back in the day.

Continue reading “Abusing X86 SIMD Instructions To Optimize PlayStation 3 Emulation”

A view of the schematics for each major component.

Simulating The Commodore PET

Over on his blog our hacker [cpt_tom] shows us how to simulate the hardware for a Commodore PET. Two of them in fact, one with static RAM and the other with dynamic RAM.

This project is serious business. The simulation environment used is Digital. Digital is a digital logic designer and circuit simulator designed for educational purposes. It’s a Java program that runs under the JVM. It deals in .dig files which are XML files that represent the details of the simulated hardware components. You don’t need to write the XML files by hand, there is a GUI for that. Continue reading “Simulating The Commodore PET”

Tetris In A Single Line Of Code

PC gaming in the modern era has become a GPU measuring contest, but back when computers had far fewer resources, every sprite had to be accounted for. To many, this was peak gaming. So let’s look to the greats of [Martin Hollis, David Moore, and Olly Betts], who had the genius (or insanity) to create Tetris in a single BBC BASIC line.

Created in 1992, one-line Tetris serves as a great use of the limited resources available. The entirety of the game fits within 257 bytes. With the age of BASIC, the original intent of the game for BBC BASIC was to be played on computers similar to Acorn’s BBC microcomputer or Archimedes.

One line Tetris has all the core features of the original game. Moving left, right, and rotating all function like the traditional game, most of the time. Being created in a single line, there were a few corners cut with bug fixing. Bugs such as crashing every 136 years of play due to large numbers or holding all keys causing the tetrominoes to freeze make it an interesting play experience. However, as long as our GPUs are long enough to play, we don’t mind.