# GXemul: PlayStation 2 emulation

Back to the index.

The PlayStation 2 emulation is not working yet. The focus is not on making an emulator for running games, as there are other emulators for that, but rather on making it possible to run NetBSD/playstation2. This page contains preliminary instructions for how to experiment with NetBSD.

### NetBSD/playstation2:

NOTE: This doesn't work, and the playstation2 port of NetBSD is not active at the time of writing this.

It was removed from NetBSD's tree in 2009, although a blog post from 2014 indicates that it could possibly be brought back to life.

To attempt to run the latest snapshot (from 2002):

1. Create an empty harddisk image, which will be the root disk that the guest OS installs itself onto:

       	dd if=/dev/zero of=nbsd_playstation2.img bs=1024 count=1 seek=3900000

2. Download ftp://ftp.netbsd.org/pub/NetBSD/arch/playstation2/snapshot/20020327/binary/kernel/netbsd-GENERIC.gz and run

       	gxemul -X -E playstation2 -d nbsd_playstation2.img netbsd-GENERIC.gz

Then it hangs, waiting for keyboard input from a keyboard which doesn't exist, in order to select the root device.

As a horrible hack, which probably doesn't really work, one could imagine setting `root_device` and `rootdev` manually. For example:

- Run with `-p wdattach` and get the second argument to that function (register a1).
- Run again with `-p setroot`, and type something like:

      <setroot>
      ffffffff8002ad98: 27bdff20      addiu   sp,sp,-224
      BREAKPOINT: pc = 0xffffffff8002ad98
      (The instruction has not yet executed.)

      GXemul> put w root_device, 0xffffffffc0016800		<-- the a1 value from wdattach
      GXemul> put w rootdev, 0x100				<-- ???

      GXemul> pc=ra						<-- to return from setroot without
      GXemul> co						    keyboard interaction

But there are timeouts and lost interrupts, so even if a correct disk image was used, and the correct `rootdev` value was used, it is unlikely that it would work yet.