Sony PSP stuff

Latest update: 07-Jan-11.

Added SIMH 3.8-1 binaries. Yes, at last you can run CP/M 2 on your PSP! (but see below..) The problems don't happen on my other SIMH CP/M systems. The other test was of the PDP-1 'quick brown fox' tape, and that ran perfectly.

Simulators which do not run

Maybe it would be better if I listed those emulators which do work? Perhaps replacing the standard malloc() with a safe PSP Linux-compatible version would fix this (uClibc?). Frotz works okay, so maybe they've used a different way of allocating memory.

Very brief instructions: unpack the SIMH binaries to your PSP's PSP/GAME150/uClinux/ dir. Boot uClinux. Do 'cd /ms0/psp/game150/uclinux' (I don't think that the case matters). Type the simulator name and 'press' Return. Since this is quite awkward to do with the on-screen keyboard, I recommend using the serial port to type on the console. Please visit the SIMH website for software and instructions.

PSP Pictures

If you're looking for the old 'PSP pictures' page, there it is.

PSP Linux

I've been experimenting with Jackson Mo's PSP Linux port lately. I would like to have compiled a kernel, but getting the toolchain working was very difficult. I must have been quite tired when I completed this, as I'd completely missed the instructions on how to compile a binary:
mipsel-linux-gcc -static -Wl,-elf2flt -fno-jump-tables hello.c -o hello
N.B. An optimisation level > 1 crashes Linux immediately, so try '-O0' or '-O1'. The above method works okay for a single binary, but what about something bigger with multiple source files? I tried the Frotz Zcode interpreter. At first, I was not able to compile ncurses, and then I tried installing Debian MIPS on QEmu, installed development tools and was able to compile ncurses. I copied that back to the cross-compilation project on the main PC, messed around with the Frotz Makefile a bit, and managed to link it with this manually-typed command:
mipsel-linux-gcc -o frotz src/frotz_common.a src/frotz_curses.a -static \
  -elf2flt -B/home/lex/Projects/Sony_PSP/PSP_Linux/ncurses-5.7/lib \
  -B/home/lex/Projects/Sony_PSP/PSP_Linux/staging_dir/usr/lib \
  -L/home/lex/Projects/Sony_PSP/PSP_Linux/staging_dir/usr/lib \
  -L/home/lex/Projects/Sony_PSP/PSP_Linux/ncurses-5.7/lib -lncurses
I've patched curses/ux_init.c in the Frotz source so it will run as root, but it can't open the terminal because of the lack of terminfo files in the minimal uCLinux system. It might be possible to painstakingly type in an environment variable setting...

The plaintext ZCode interpreter dfrotz runs okay: I've run it from the PSP console and I've tested it over the serial link too.

Binaries

SIMH 3.8-1 (md5sum = bce697277e141647e33386778d638e36)
dfrotz (md5sum = cf07613a92e75f01fc0bee89eccc6ab6)
dfrotz.gdb (md5sum = e168d2553b41510cd26b8778b3bcc0df)
frotz (md5sum = 5d6422fcebebed2e299b2035d84ec548)
frotz.gdb (md5sum = cbf90c8fa8411304ef428017badf833a)
zork1.z3 (md5sum = 4a0f76b9014a4c407520920710c42588)

You can find other files at The Interactive Fiction Archive.

Source code

The original Frotz 2.43 Makefile is 8999 bytes long, and has the md5sum 1495cb6f0ddadd99162c16e781719759.
Here's my udiff patch to make Frotz compile with the mipsel toolchain (warning: this probably has lots of unnecessary edits).

Frotz 2.43 source with PSP MIPS FLT binaries (md5sum = c6ed4dc74905595cd3915806221e0a4e): frotz-2.43-built.tar.gz (880K)
Ncurses 5.7 source with PSP MIPS libraries (md5sum = 1878a6e3c396d123dea7944dbbb0ea26): ncurses-5.7-built.tar.gz (24M)

Here are a couple of photos of dfrotz running - sorry about the awful image quality.


I captured the following log with Minicom, connected to ttyUSB0 (Prolific PL2303 serial adaptor), which was connected to a 3.3V RS232 voltage shifter to convert the RS232 levels into the 3.3V used by the PSP (uses a MAX3232, I think).

:/> ls

bin   dev   etc   init  ms0   proc  sbin  usr
:/> cd ms0
:/ms0> cd psp
:/ms0/psp> cd common

:/ms0/psp/common> 
ls

dfrotz       hello_world
:/ms0/psp/common> cp dfrotz /

:/ms0/psp/common> ls -l

-rwxr-xr-x    1 0        0          142664 Apr 22  2009 dfrotz
-rwxr-xr-x    1 0        0            7952 Apr 21  2009 hello_world

:/ms0/psp/common> 
cp hello_world /

:/ms0/psp/common> cd /
:/> 
ls -l

drwxr-xr-x    2 0        0               0 Jan  1 00:00 bin
drwxr-xr-x    3 0        0               0 Jan  1 00:00 dev
-rwxr-xr-x    1 0        0          142664 Jan  1 00:02 dfrotz
drwxr-xr-x    2 0        0               0 Jan  1 00:00 etc
-rwxr-xr-x    1 0        0            7952 Jan  1 00:02 hello_world
lrwxrwxrwx    1 0        0              11 Jan  1 00:00 init -> bin/busybox
drwxr-xr-x   18 0        0           16384 Jan  1  1970 ms0
dr-xr-xr-x   29 0        0               0 Jan  1 00:00 proc
drwxr-xr-x    2 0        0               0 Jan  1 00:00 sbin
drwxr-xr-x    3 0        0               0 Jan  1 00:00 usr
:/> ./hello_world
Hello world!
:/> 
# good!
:/> 

:/> 
./dfrotz

FROTZ V2.43	dumb interface.
An interpreter for all Infocom and other Z-Machine games.
Complies with standard 1.0 of Graham Nelson's specification.

Syntax: dfrotz [options] story-file
  -a   watch attribute setting 	 -Q   use old-style save format
  -A   watch attribute testing 	 -R xxx  do runtime setting \xxx
  -h # screen height           	    before starting (can be used repeatedly)
  -i   ignore fatal errors     	 -s # random number seed value
  -I # interpreter number      	 -S # transscript width
  -o   watch object movement   	 -t   set Tandy bit
  -O   watch object locating   	 -u # slots for multiple undo
  -p   plain ASCII output only 	 -w # screen width
  -P   alter piracy opcode     	 -x   expand abbreviations g/x/z
	-Z # error checking mode (default = 1)
	     0 = don't report errors   1 = report first error
	     2 = report all errors     3 = exit after any error

:/> # woo!
:/> 
# no ncurses yet..

[ I rebooted the PSP and downloaded some more Infocom story files. ]

:/ms0/psp/common> cp dfrotz /

:/ms0/psp/common> cp amfv.z4 /

:/ms0/psp/common> cp suspect.z3 /

:/ms0/psp/common> cp suspended.z3 /

:/ms0/psp/common> cp zork1.z3 /

:/ms0/psp/common> cd /
:/> 
ls

amfv.z4       dfrotz        ms0           suspect.z3    zork1.z3
bin           etc           proc          suspended.z3
dev           init          sbin          usr
:/> ls -
-rwxr-xr-x    1 0        0          262018 Jan  1 00:05 amfv.z4
drwxr-xr-x    2 0        0               0 Jan  1 00:00 bin
drwxr-xr-x    3 0        0               0 Jan  1 00:00 dev
-rwxr-xr-x    1 0        0          142664 Jan  1 00:05 dfrotz
drwxr-xr-x    2 0        0               0 Jan  1 00:00 etc
lrwxrwxrwx    1 0        0              11 Jan  1 00:00 init -> bin/busybox
drwxr-xr-x   18 0        0           16384 Jan  1  1970 ms0
dr-xr-xr-x   29 0        0               0 Jan  1 00:00 proc
drwxr-xr-x    2 0        0               0 Jan  1 00:00 sbin
-rwxr-xr-x    1 0        0          118784 Jan  1 00:05 suspect.z3
-rwxr-xr-x    1 0        0          105984 Jan  1 00:05 suspended.z3
drwxr-xr-x    3 0        0               0 Jan  1 00:00 usr
-rwxr-xr-x    1 0        0           84992 Jan  1 00:05 zork1.z3

:/> 
./dfrotz -h

FROTZ V2.43	dumb interface.
An interpreter for all Infocom and other Z-Machine games.
Complies with standard 1.0 of Graham Nelson's specification.

Syntax: dfrotz [options] story-file
  -a   watch attribute setting 	 -Q   use old-style save format
  -A   watch attribute testing 	 -R xxx  do runtime setting \xxx
  -h # screen height           	    before starting (can be used repeatedly)
  -i   ignore fatal errors     	 -s # random number seed value
  -I # interpreter number      	 -S # transscript width
  -o   watch object movement   	 -t   set Tandy bit
  -O   watch object locating   	 -u # slots for multiple undo
  -p   plain ASCII output only 	 -w # screen width
  -P   alter piracy opcode     	 -x   expand abbreviations g/x/z
	-Z # error checking mode (default = 1)
	     0 = don't report errors   1 = report first error
	     2 = report all errors     3 = exit after any error

:/> ls

amfv.z4       dfrotz        ms0           suspect.z3    zork1.z3
bin           etc           proc          suspended.z3
dev           init          sbin          usr
:/> 
:/> 

:/> dfrotz zork1.z3

 West of House                               Score: 0        Moves: 0

ZORK I: The Great Underground Empire
Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights reserved.
ZORK is a registered trademark of Infocom, Inc.
Revision 88 / Serial number 840726

West of House
You are standing in an open field west of a white house, with a boarded
front door.
There is a small mailbox here.

>open mailbox
 West of House                               Score: 0        Moves: 1

Opening the small mailbox reveals a leaflet.

>get leaflet
 West of House                               Score: 0        Moves: 2

Taken.

>read leaflet
 West of House                               Score: 0        Moves: 3

"WELCOME TO ZORK!

ZORK is a game of adventure, danger, and low cunning. In it you will
explore some of the most amazing territory ever seen by mortals. No
computer should be without one!"

>put leaflet in mailbox
 West of House                               Score: 0        Moves: 4

Done.

>close mailbox
 West of House                               Score: 0        Moves: 5

Closed.

>quit
Your score is 0 (total of 350 points), in 5 moves.
This gives you the rank of Beginner.
Do you wish to leave the game? (Y is affirmative): >y> 
l

> ls

              dev           init          sbin          usr
amfv.z4       dfrotz        ms0           suspect.z3    zork1.z3
bin           etc           proc          suspended.z3
> ./dfrotz amfv.z4

                                    * PART I *
. 
                        "Tomorrow never yet
                         On any human being rose or set."
                                         -- William Marsden
. 
) [Hit any key to continue.]
   Mode:  Communications Mode                                Time:  7:07pm
   Location:  (undefined)                                    Date:  3/16/2031
  You "hear" a message coming in on the official message line: "PRISM?
  Perelman here. The psych tests have all checked out at 100%, which means
  that you've recovered from the, ah, awakening without any trauma or other
  serious effects. We'll be ready to begin the simulation soon. By the way,
  your piece is in the current issue of Dakota Online."
  
  A MIND FOREVER VOYAGING
  Infocom interactive fiction - a science fiction story
  Copyright (c) 1985 by Infocom, Inc. All rights reserved.
  A MIND FOREVER VOYAGING is a trademark of Infocom, Inc.
  Release 77 / Serial number 850814
  
  You have entered Communications Mode. The following locations are equipped
  with communication outlets:
     PRISM Project Control Center (PPCC)
     Research Center Rooftop (RCRO)
     Dr. Perelman's Office (PEOF)
     PRISM Facility Cafeteria (PCAF)
     Maintenance Core (MACO)
     World News Network Feed (WNNF)
  To activate a specific outlet, submit the associated code.
***MORE***> >

> >quit
) Do you really want to quit? (y/n) >y> 

> 
date

Sat Jan  1 00:08:29 UTC 2000
[This date is obviously wrong!]
> # end of (brief) test
> 
Return to the index page