32016 stand alone planetfall!

InfoTaskForce’87 running on a simple NS32016 emulator

What is it?

It sure may not look like much but it was an adventure getting here.

First, what is it? Well it’s the very simple NS32016 from here, with a few minor changes. I expanded the RAM from 256kb to a whopping 8MB. Then I added simple character I/O allowing me to print messages to the screen. Next looking at the toolchain page, I used my old Linux to Windows GCC 4 cross compiler to build the appropriate Canadian cross compiler to the NS3216.

Building the tools

A while back, I had built a cross compiler from Linux to Windows using GCC 4.1 as the basis as it was the last version that didn’t have massive external dependencies. NS32016 support was dropped some time in the late 3.x or early 4.x GCC so it means we need to go old anyways. I arbitrary picked GCC 2.8.1 for this build, while using the recommended Binutils 2.27

I cheated and just downloaded my existing linux-minw32.7z cross compiler as I didn’t feel like rebuilding everything again, although it is all in the Building a MIPS Compiler for Windows on a Linux VM! article. I also used an old Linux to Linux i586 32bit compiler (back from the OSKit build!) although you can use your hosts as well.

configuring Binutils is pretty simple like this:

./configure --prefix=/cross --target=ns32k-pc532-netbsd --host=i686-mingw32 --build=i586-linux

You can try omitting the –build portion, Debian GNU Linux 10 seemed okay with Gcc 8 as the default system compiler.

configuring GCC 2.8.1 was pretty similar:

./configure --target=ns32k-pc532-netbsd --prefix=/cross --disable-libssp --build=i586-linux --host=i686-mingw32

GCC 2.8.1 doesn’t quite know what we are doing so there is some flags we need to run off in auto-config.h namely

  • #define HAVE_BCMP 1
  • #define HAVE_BCOPY 1
  • #define HAVE_BZERO 1
  • #define HAVE_INDEX 1
  • #define HAVE_KILL 1
  • #define HAVE_RINDEX 1
  • #define HAVE_SYS_RESOURCE_H 1
  • #define HAVE_SYS_TIMES_H 1

You can just comment them out, or remove those lines all together.

When it came to building GCC, I did run into issues with GCC 7/8 trying to build GCC 2.8.1. I found it much easier to either have that Linux 4.1 compiler, or if you have access to Wine or WSL you can just run the Win32 binaries for the gen phases.

./configure --prefix=/cross --target=ns32k-pc532-netbsd --host=i686-mingw32
make CC=i686-mingw32-gcc xgcc cccp cc1 cc1obj

If you can run your own Win32 exe’s on Linux it’ll run just fine using the Linux to Windows GCC 4 cross. Otherwise you will need to either patch GCC or make your own GCC 4 hosted Linux to Linux cross compiler like this:

make CC=i686-mingw32-gcc HOST_CC=i586-linux-gcc xgcc cccp cc1 cc1obj

Hopefully that worked enough, and now you have your cross compiler. Now it’s time to build libgcc1.a

cp cccp cpp.exe
cp cc1 cc1.exe
cp xgcc xgcc.exe
cp ../binutils-2.27/gas/.libs/as-new.exe as.exe
cp ../binutils-2.27/binutils/.libs/ar.exe ar
cp ../binutils-2.27/binutils/.libs/ranlib.exe ranlib
make libgcc1.a TARGET_TOOLPREFIX="./" OLDCC=./xgcc.exe

Again you really want to be able to run the resulting programs on Linux but I guess you could script it out. Naturally if you wanted to just use Linux, it’d be easier to make that cross compiler directly, although I’m not sure how much of GCC 2.8.1 I want to fight, or just get GCC 4 running on Linux and use that to port.

crt0, somewhere for C to start

As mentioned a crt0.s is missing but there was enough inspiration to come up with this:

#NO_APP
gcc_compiled.:
.text
        .align 1
.globl _start
_start:
        enter [],0
#APP
#       setting the stack 256k under 8MB
        lprd sp,0x7c0000
        jsr _main
#NO_APP
L1:
        exit []
#       setting the stack 256k under 8MB
        lprd sp,0x7c0000
        bpt
        .align 1

#does nothing
.globl ___main
___main:
        ret 0

.globl _exit
_exit:
        bpt
        ret 0

I used a bit of the C example, and added some hooks that GCC was expecting namely a __main call that is made from main before it does anything (a place to init memory perhaps?), a place to catch an explicit exit call, along with setting the stack of course.

Patching InfoTaskForce without malloc / disk access

It’s not going to win any awards, but it was really great to get it to run a simple program written in GCC. Looking for something more fun, I took the old InfoTaskForce interpreter from ’87, and dug up my modification to run on cisco routers, and cooked up this version, that adds enough of printf from Linux, a bogus malloc that just allocates from a fixed memory array (otherwise you have to actually know about your platform), and a fun trick with later binutils where you can import a binary file directly as an object!

Neat!

Since I don’t have any file I/O being able to have the game data in RAM is crucial. I tried to tweak it so you could build the same working thing on Windows (maybe others?).

So for anyone who wants to look at the standalone adventure Win32 hosted tools are here, although the emulator should be somewhat portable.

Infocom: The Documentary

Infocom (1979-1989) is recognized as the all-time leader in Interactive Fiction, releasing top-selling games and products that dominated the sales charts and still extend considerable influence and memory on the gaming industry. At times they were half of the top ten games being sold and were considered a flagship of the game industry. And then they were gone.

As part of the 2010 documentary GET LAMP, director Jason Scott talked to creators, management, fans and academics about the Infocom story, and produced this 45 minute overview of this unique and wonderful company.

Jason Scott on Twitter; http://twitter.com/textfiles​

Patreon for Jason Scott's podcast: http://patreon.com/textfiles​

To purchase the DVD of this and the other GET LAMP features, visit http://WWW.GETLAMP.COM​.

Edilbert Kirk’s Z-Machine for CBM computers

I never heard of this one before, but it’s legit!… As long as you have expanded your RAM, Edilbert’s Z-Machine opens up the world of Infocom to a whole host of machines:

  • C64
  • C128
  • CBM 4032
  • CBM 8032
  • CBM 8096 / CBM 8296
  • VC-20 (32K / 40K)
  • +4
Sweet looking 8296 from xAD / nIGHTFALL‘s post on nightfallcrew.org

I’ve never seen the more advanced ‘European Business’ PET’s before, I’ve only dealt with the incredibly limited PET 2001-8C Chiclet keyboard models that were so insanely limited. It wasn’t until much later I saw the dual disk drives (4040’s??) that could have helped those machines so much more, but that was that. I’d been asked as a kid to make an electronic card file on an 8kb machine with a single tape drive. Sadly 8 year old me didn’t know about loading and saving sequential records on tape. Or maybe luckily as I can only imagine how insanely slow this would have been, and or tedious to not only save and update, but find things.

Anyways I thought I’d fire up some mythical 8296 beast with 128Kb of RAM. Attaching the disk image, and firing up “LOADER”, you can watch it load up as much as possible into memory:

And once it’s loaded up, the Z-Machine is active!

Now granted I don’t have a PET to test with, but using VICE, I can happily say that for an 8bit machine, this is incredibly fast. Maybe it’s the disk subsystem interface, as the VIC-20/C64 have an absolutely dreadful interface, but yeah wow playing HHGTTG on a non C64!

You can find downloads over at “PET FOOD“.

Anyways this is pretty neat, and all new to me. Just like the Tandy CoCo 6809 interpreter source being found was as well.

Are you Japanese?

On my latest trip, I managed to find a copy of Zork 1 for the PC-98! And let me say, let the adventure begin!

I went to Beep and the place next door I always forget it’s name, and I found this burried in the back for a mere Â¥2,860! Not exactly what I thought would be a bargain, but flipping it over however…

Zork 1 for the PC-98!

Â¥7,800 YEN! From 1991!Honestly I don’t even know what is up with the price of software in Japan! Clutching this thing in my hands for the Â¥2,800 makes it feel like a steal so of course I buy it!

Contents of the box

Nice to see that opening of the box gives me a catalogue, a manual, minimal map, registration card and a diskette! And I’m hoping I can read it using a USB drive.

Now I have no pc98 gear in Japan, and I’m trying to not have a mountain of hardware here, the i7 desktop and 30″ cinema display are already feeling ‘too big’ for this place anyways. I go to hardoff and pick up 2 USB floppy drives hoping to read the 3 1/2″ diskette.

Now I bought an IBM & some weird iMac looking drive, I was hoping between the two drives, maybe one would work. And I was right for buying the two. The IBM drive didn’t read the disk AT ALL.

However this iMac looking Logitec LFD-31US did the trick!

Apparently you need what is known as a “3-mode USB floppy drive”. Whatever that means. Although I can read the disk fine from Windows 10, winimage was unable to make a disk image. Disk Explorer is another option, which also specializes in the PC-98’s weird 1.2MB on a 1.44MB disk, however it couldn’t read the disk either.

I write a simple C program to read 512, 1024, 2048 blocks from \\.\A: (the physical drive), however it was cut short after 138kb. Maybe a hidden bad sector? Xcopy ran without issues, so who knows.

Looking at what I could dump, it does look like a bootable image:

and the xcopy did pick up MSDOS.SYS & IO.SYS. I though Microsoft was so against people redistributing MS-DOS, but then again aren’t most PC98’s floppy only?

I was able to cobble together a DIY disk image, and it doesn’t work fully on Neko Project II sadly. However Annex86 works fine.

On boot there is a nice graphical logo, and animation as the door opens. Really cool I have to say. Searching through zork.exe there is some interesting strings

  • Are you Japanese?
  • MS Run-Time Library – Copyright (c) 1988, Microsoft Corp
  • Original copyright (c)1988 Infocom Inc.
  • Used under license from Activision. All rights reserved.
  • (c)1991 SystemSoft
  • Copyright VACS Corp./ASCII Corp.,1986-90.
  • @(#)sunedit.c 1.0 07/03/1989 by VACS Corp.

Well that’s interesting. I was wondering how to trigger the ‘Are you Japanese?’ and well it turns out it’s pretty simple:

I’d have to figure out how to type in things like eat/sleep take… Although it is a twist on the old Infocom style. Now could this have ‘saved’ Infocom before their sale to Activision? I guess there was a market for Infocom games in Japan, although probably far earlier than 1991.

Confessions of a paranoid DEC Engineer: Robert Supnik talks about the great Dungeon heist!

What an incredible adventure!

Apparently this was all recorded in 2017, and just now released.

It’s very long, but I would still highly recommend watching the full thing.

Bob goes into detail about the rise of the integrated circuit versions of the PDP-11 & VAX processors, the challenges of how Digital was spiraling out of control, and how he was the one that not only championed the Alpha, but had to make the difficult decisions that if the Alpha succeeded that many people were now out of a job, and many directions had to be closed off.

He goes into great detail how the Alpha was basically out maneuvered politically and how the PC business had not only dragged them down by management not embracing the Alpha but how trying to pull a quick one on Intel led to their demise.

Also of interest was his time in research witnessing the untapped possibilities of AltaVista, and how Compaq had bogged it down, and ceded the market to the upstart Google, the inability to launch a portable MP3 player (Although to be fair the iPod wasn’t first to market by a long shot, it was the best user experience by far).

What was also interesting was his last job, working at Unisys and getting them out of the legacy mainframe hardware business and into emulation on x86, along with the lesson that if you can run your engine in primary CPU cache it’s insanely fast (in GCC land -Os is better than -O9).

The most significant part towards the end of course is where he ‘rewinds’ his story to go into his interest in simulations, and of course how he started SIMH when he had some idle time in the early 90’s. SIMH of course has done an incredible amount of work to preserve computing history of many early computers. He also touches on working with the Warren’s TUHS to get Unix v0 up and running on a simulated PDP-7 and what would have been a challenge in the day using an obscure Burroughs disk & controller modified from the PDP-9.

Yes it’s 6 hours long! But really it’s great!

So the Infocom source code base was just ‘released’.

https://twitter.com/textfiles/status/1118005126457888768

So I woke up to this incredible news. Jason Scott at the most excellent archive.org had just uploaded the old Infocom source code to github. It’s from the infamous ‘found hard disk’ that has been mentioned going back to the failed game ‘The restaurant at the end of the universe’.

So looking at the repos here, you can see the latest ones are all Infocom. It’s best to get them all via git for reason below:

git clone https://github.com/historicalsource/abyss.git
git clone https://github.com/historicalsource/amfv.git
git clone https://github.com/historicalsource/arthur.git
git clone https://github.com/historicalsource/ballyhoo.git
git clone https://github.com/historicalsource/beyondzork.git
git clone https://github.com/historicalsource/borderzone.git
git clone https://github.com/historicalsource/bureaucracy.git
git clone https://github.com/historicalsource/checkpoint.git
git clone https://github.com/historicalsource/cutthroats.git
git clone https://github.com/historicalsource/deadline.git
git clone https://github.com/historicalsource/enchanter.git
git clone https://github.com/historicalsource/hitchhikersguide.git
git clone https://github.com/historicalsource/hollywoodhijinx.git
git clone https://github.com/historicalsource/infidel.git
git clone https://github.com/historicalsource/infocom-sampler.git
git clone https://github.com/historicalsource/journey.git
git clone https://github.com/historicalsource/leathergoddesses-gold.git
git clone https://github.com/historicalsource/leathergoddesses.git
git clone https://github.com/historicalsource/lurkinghorror.git
git clone https://github.com/historicalsource/minizork-1982.git
git clone https://github.com/historicalsource/minizork-1987.git
git clone https://github.com/historicalsource/minizork2-1988.git
git clone https://github.com/historicalsource/moonmist.git
git clone https://github.com/historicalsource/nordandbert.git
git clone https://github.com/historicalsource/planetfall.git
git clone https://github.com/historicalsource/plunderedhearts.git
git clone https://github.com/historicalsource/restaurant.git
git clone https://github.com/historicalsource/seastalker.git
git clone https://github.com/historicalsource/sherlock.git
git clone https://github.com/historicalsource/shogun.git
git clone https://github.com/historicalsource/sorcerer.git
git clone https://github.com/historicalsource/spellbreaker.git
git clone https://github.com/historicalsource/starcross.git
git clone https://github.com/historicalsource/stationfall.git
git clone https://github.com/historicalsource/suspect.git
git clone https://github.com/historicalsource/suspended.git
git clone https://github.com/historicalsource/trinity.git
git clone https://github.com/historicalsource/wishbringer.git
git clone https://github.com/historicalsource/witness.git
git clone https://github.com/historicalsource/zork-german.git
git clone https://github.com/historicalsource/zork.git
git clone https://github.com/historicalsource/zork1.git
git clone https://github.com/historicalsource/zork2.git
git clone https://github.com/historicalsource/zork3.git
git clone https://github.com/historicalsource/zorkzero.git

NEW the ‘gold’ versions of various games, these are the ones with built in help systems

git clone https://github.com/historicalsource/wishbringer-gold.git
git clone https://github.com/historicalsource/planetfall-gold.git
git clone https://github.com/historicalsource/zork1-gold.git
git clone https://github.com/historicalsource/hitchhikersguide-gold.git

The reason being of course that if there are multiple versions they are stacked. Now why is this important? Who cares? it’s all in ZILL which there is no compiler for, as the TOPS-20 tools are still lost?

Enter ZILF!

Written by Jesse McGrew in an apparent vacuum, this toolchain can Z3 machine based ZIL source code. Yes that’s right it’s a compiler!

I know Zork will get all the headlines, but back the 80’s I preferred Planetfall. I’m not even going to talk about the insanity that was the Hitchhiker’s guide to the galaxy.

Zilf is really only suited for Z3 compilation, and looking at planetfall there are two commits of note:

$ git log| tail -11 commit e85ca899aac575e74a4b3845f44d09a891c1563a Author: historicalsource Date: Sat Apr 13 21:35:51 2019 -0400 Final Revision commit 281bd3417faada8011397244d4bfaad562cb7bfc Author: historicalsource Date: Sat Apr 13 21:34:42 2019 -0400 Revision 37 (Original Source)

The source for the Final version won’t build with ZILF. However the Revision 37 source will!

$ git checkout 281bd3417faada8011397244d4bfaad562cb7bfc Note: checking out '281bd3417faada8011397244d4bfaad562cb7bfc'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b HEAD is now at 281bd34... Revision 37 (Original Source)

Ok, now let’s trash the directory! (you did backup the repo first, right?)

C:\temp\zilf\zilf-0.8\planetfall>..\bin\Zilf planetfall.zil ZILF 0.8 built 3/19/2017 1:34:17 PM Planetfall [warning MDL0417] C:\temp\zilf\zilf-0.8\planetfall\MISC.zil:509: ROUTINE: only 3 routine arguments allowed in V3, so last 2 "OPT" arguments will never be passed in INSERT-FILE called at planetfall.zil:14 in IFILE called at planetfall.zil:25 [warning ZIL0208] C:\temp\zilf\zilf-0.8\planetfall\SYNTAX.zil:143: preaction routine mismatch for 'V?ZAP': using PRE-ZAP as before [error ZIL0113] C:\temp\zilf\zilf-0.8\planetfall\MISC.zil:150: SETG: argument 1: bare atom argument must be a variable name [error ZIL0113] C:\temp\zilf\zilf-0.8\planetfall\MISC.zil:315: SETG: argument 1: bare atom argument must be a variable name [error ZIL0113] C:\temp\zilf\zilf-0.8\planetfall\MISC.zil:317: SETG: argument 1: bare atom argument must be a variable name [error ZIL0113] C:\temp\zilf\zilf-0.8\planetfall\MISC.zil:319: SETG: argument 1: bare atom argument must be a variable name [warning ZIL0504] C:\temp\zilf\zilf-0.8\planetfall\PARSER.zil:244: treating SET to 0 as true here [warning ZIL0502] C:\temp\zilf\zilf-0.8\planetfall\VERBS.zil:156: RETURN value ignored: block is in void context [warning ZIL0204] C:\temp\zilf\zilf-0.8\planetfall\VERBS.zil:1879: no such global variable 'WHERE', using the local instead [warning ZIL0505] C:\temp\zilf\zilf-0.8\planetfall\COMPTWO.zil:3035: COND: clauses after else part will never be evaluated [warning ZIL0308] : too many parts of speech for 'PORT': Object (C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:78), Adjective (C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:224), Direction (C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:11) [warning ZIL0306] C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:224: discarding the Adjective part of speech for 'PORT' [warning ZIL0308] : too many parts of speech for 'BRUSH': Object (C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:548), Adjective (C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:549), Verb (C:\temp\zilf\zilf-0.8\planetfall\SYNTAX.zil:283) [warning ZIL0306] C:\temp\zilf\zilf-0.8\planetfall\GLOBALS.zil:549: discarding the Adjective part of speech for 'BRUSH' 10 warnings 4 errors C:\temp\zilf\zilf-0.8\planetfall>dir *zap Volume in drive C is BOOTCAMP Volume Serial Number is 903B-72D4 Directory of C:\temp\zilf\zilf-0.8\planetfall 04/17/2019 08:32 PM 247,803 planetfall.zap 04/17/2019 08:32 PM 162,476 planetfall_data.zap 04/17/2019 08:32 PM 1,336 planetfall_freq.zap 04/17/2019 08:32 PM 40,495 planetfall_str.zap 4 File(s) 452,110 bytes 0 Dir(s) 238,542,704,640 bytes free C:\temp\zilf\zilf-0.8\planetfall>..\bin\zapf planetfall.zap ZAPF 0.8 Reading planetfall.zap Reading planetfall_freq.zap Reading planetfall_data.zap Reading planetfall_str.zap Measuring.. Assembling Wrote 121952 bytes to planetfall.z3

Sure it said 4 errors, but it compiled! Using a z3 or higher interpreter we can load up Planetfall

Planetfall!

At first glance it may look the same, but check the serial number. 190417. That’s today!

I’ve played it about 1/5th of the way though. There is a walkthru here.

There seems to be so much in flux about this source dump. replicate while you can!

Confusion & MDL Zork

I don’t know how I missed this, but there is a MDL interpreter that can run MDL Zork!

This Zork created December 2, 2015.
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying ‘Welcome to Zork!’ lies by the door.
“DONE”
> open mailbox
Opening the mailbox reveals a leaflet.
> take leaflet
Taken.
> read leaflet
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 mortal
man. Hardened adventurers have run screaming from the terrors
contained within!

In ZORK the intrepid explorer delves into the forgotten secrets
of a lost labyrinth deep in the bowels of the earth, searching for
vast treasures long hidden from prying eyes, treasures guarded by
fearsome monsters and diabolical traps!

No PDP-10 should be without one!

ZORK was created at the MIT Laboratory for Computer Science, by
Tim Anderson, Marc Blank, Bruce Daniels, and Dave Lebling. It was
inspired by the ADVENTURE game of Crowther and Woods, and the long
tradition of fantasy and science fiction adventure. ZORK is written
in MDL (alias MUDDLE).

On-line information may be available using the HELP and INFO
commands (most systems).

Direct inquiries, comments, etc. by Net mail to [email protected].

(c) Copyright 1978,1979 Massachusetts Institute of Technology.
All rights reserved.

>

How is that for cool?  The MDL interpreter is called Confusion by Matthew T. Russotto, and can be found here.  There is even a port to Windows, by  David Kinder back in 2009!

I don’t know how I missed it, but this is as close as you can get to the original 1979 experience.

Speaking of which, gunkies should be on faster hardware, and the DNS records should be updated by the time you read this.

The Infocom Cabinet

You haven't played Planetfall??

What? You haven’t played Planetfall??

 

Over on archive.org:

A collection of digitized scans from a large cache of documents related to the game publisher Infocom, Inc. of Cambridge, MA. Assembled by Steven Meretzky of Infocom.

During his time at Infocom, Steve Meretzky meticulously gathered thousands of pages of notes, journals, maps, memos, forms and other printable materials related to all aspects of Infocom, and kept them in his basement for decades. During the GET LAMP production, Jason Scott scanned in roughly 9,000 pages of these documents across a number of months, borrowing the materials from Steve and scanning them as quickly as possible, at around 600dpi. From these scans, a portion was used in the GET LAMP movie to illustrate various scenes and descriptions by interviewees.

Pretty cool!

Includes detailed information on the Hitchhikers Guide To The Galaxy, Planetfall parts 1 & part 2, Stationfall, Zork Zero, Leather Gods of Phobos, production schedules and ZIL the interpretive language.   And other goodies!

Great thanks to Steven Meretzky for being a hoarder (aka archiver) and Jason Scott for being a bigger hoarder, and digitizer sharing everything for all!

InfoTaskForce running on PowerPC (Dynamips)

choices..

choices..

Well considering what a hit it was, the last time I did this, I thought I’d give it another go!

And after a bit of fighting, I got it to run!

Now what were the obstacles?  Well for starters not having a full libc certainly hurts things.  Things like a malloc.  And without getting fancy with the memory map I did the lamest cheat ever, which is a 1MB static array I just handed out with a fake malloc (no free, I didn’t bother to track chunks), and you know it works enough.

Also I need to read files, and I need to look more into the hardware to see how to do that.  There seems to be plenty of hooks for NVRAM, but the ROMMON substitute doesn’t seem to support them.  Also there is no ROMMON hook for reading from the console!  The MIPS cilo is more ROMMON dependent, while the PowerPC c1700 talks to the uart directly so this is a PowerPC thing for right now.

I also learned something exciting about ld, which is how it can absorb binary images into objects, that you can link and access directly into your program!  No more having to convert it to hex, make these insane headders that CPP may or may not bomb over.  No you can make them objects right away!

ppc-elf-ld -r -b binary -o planetfa.o planetfa.dat

In this example I read the file planetfa.dat as BINARY, and encapsulate it in an object file called planetfa.o . It’ll now have a symbol name of _binary_planetfa_dat_start for where the image begins, _binary_planetfa_dat_size will tell me how big it is in memory, and _binary_planetfa_dat_end will mark the end of this ‘file’ in memory.

Now in the old days when it was a file I could access it like this:

fread ((char *)ptr,block_size,(int)num_blocks,game_file);

But that won’t work.  So now instead of calling fopen/fclose (which don’t exist in CILO), I set a counter to what my current offset is, change the ‘fseek’ to just set the global counter to where it should be, and when I fread I just memcpy:

memcpy(ptr,_binary_planetfa_dat_start+fseekp,num_blocks*block_size);
fseekp=fseekp+(num_blocks*block_size);

I suppose I could just have wrapped the f* calls into some emulation library but I don’t need to get all that crazy sophisticated.

C:\temp\dynamips>dynamips.exe -P 1700 -X -r 4 ciscoload.bin
Cisco Router Simulation Platform (version 0.2.15-experimental(merge uppc smips)Build-3-x86/MinGW stable)
Copyright (c) 2005-2011 Christophe Fillot.
Build date: Sep 19 2015 19:33:12

Local UUID: 0450c178-6480-11e5-a559-019031cf957a

Pcap version [WinPcap version 4.1.3 (packet.dll version 4.1.0.2980), based on libpcap version 1.0 branch 1_0_rel0b (20091008)]
Unsure if this file (c1700_i0_rommon_vars) needs to be in binary mode
Virtual RAM size set to 4 MB.
IOS image file: ciscoload.bin

ILT: loaded table “mips64j” from cache.
ILT: loaded table “mips64e” from cache.
ILT: loaded table “ppc32j” from cache.
ILT: loaded table “ppc32e” from cache.
vtty_term_init
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C1700 instance ‘default’ (id 0):
VM Status : 0
RAM size : 4 Mb
NVRAM size : 32 Kb
IOS image : ciscoload.bin

Loading BAT registers
Loading ELF file ‘ciscoload.bin’…
ELF entry point: 0x8000d9c8

C1700 ‘default’: starting simulation (CPU0 IA=0xfff00100), JIT enabled.
ROMMON emulation microcode.

Launching IOS image at 0x8000d9c8…
CILO
CiscoLoader (CILO) – Linux bootloader for Cisco Routers
Available RAM: 4096 kB
Available commands:
queen
hanoi
horse
fib
planetfall
halt

Enter filename to boot:
malloc 64512 offset is 0 offset is now 64522
malloc 38912 offset is 64522 offset is now 103444
PLANETFALL
Infocom interactive fiction – a science fiction story
Copyright (c) 1983 by Infocom, Inc. All rights reserved.
PLANETFALL is a trademark of Infocom, Inc.
Release 37 / Serial number 851003

Another routine day of drudgery aboard the Stellar Patrol Ship Feinstein. This
morning’s assignment for a certain lowly Ensign Seventh Class: scrubbing the
filthy metal deck at the port end of Level Nine. With your Patrol-issue
self-contained multi-purpose all-weather scrub brush you shine the floor with a
diligence born of the knowledge that at any moment dreaded Ensign First Class
Blather, the bane of your shipboard existence, could appear.

Deck Nine
This is a featureless corridor similar to every other corridor on the ship. It
curves away to starboard, and a gangway leads up. To port is the entrance to
one of the ship’s primary escape pods. The pod bulkhead is closed.

Deck Nine Score: 0/4451
PLANETFALL
Infocom interactive fiction – a science fiction story
Copyright (c) 1983 by Infocom, Inc. All rights reserved.
PLANETFALL is a trademark of Infocom, Inc.
Release 37 / Serial number 851003

Deck Nine Score: 0/4451
>

For anyone crazy enough, you can find my MinGW Dynamips on sourceforge, cross compilers for PowerPC, and the branch of the firmware source that includes InfoTaskForce, and the binary image.

While I don’t want to write an OS for this, it is almost tempting.  Or go the other route, and add in some non router based hardware… Like audio hardware, or a framebuffer.

Does anyone have a 1700 to test to see if any of this works?  Or a 7200?! 😀

Tracking down the InfoTaskForce from 1987.

So like all zork obsessed people (I really should get help or something), I was trying to build a z-machine interpreter for the x68000, using Lydux’s cross GCC compiler.  And it was honestly looking like a LOT of work in the IO department.  Thinking that the older versions were more simpler, I went looking for the oldest open Z-machine, called the “The InfoTaskForce Infocom interpreter”, released by the InfoTaskForce.  Unfortunately I can only find version 4.01 searching for the source code.  Which still looks too complicated.  But looking the history file, the project started back in 1987.  So with that to go on a new google search got me this:

Infocom Adventure Executor Source Files (1987)(InfoTaskForce)[C].zip

From an TRS-80 dump of all things.  I don’t know what version this is other than the brief copyright mention:

/* (C)opyright 1987 InfoTaskforce. */

All of the files are dated 4/12/2001 so they obviously aren’t original. And the version string is:

echo ( “Interpreter: C Version 1.0\n” ) ;

So assuming this is correct, from the 4.01 history file:

REV_E – June 25, 1987.
———————-

REV_E is the first major overhaul to the interpreter.

* The source is now significantly lint free.

* TERMCAP support has now been added [#define TERMCAP option].

* Screen paging and word wrap has been added, along with a new
command line option which disables screen paging (-p).

* Random number generator seeding using time () added [#define
TIMESEED option].

* Attributes in the object list are listed as bits.

* A debuging version can now be produced as an inbuilt options
[#define DEBUG option].

* The coded requirement that 25k is always free in the system can
now be removed [#define ALLOCALL option].

* A new command line option was added to print the object/room list
as a tree (-r).

* interp.c has been re-written to improve efficiency [large
switches have been replaced with arrays of pointers to funcions].

There are now 14 machines on the porting list:

Machine C Compiler Operational Porting details

128K Apple
Macintosh Aztec C Version 1.06F 18/05/87

128K Apple
Macintosh Lightspeed C 2.01 29/05/87 Use “rb” & “wb” in all fopen()s

IBM PC/AT Microsoft C 4 30/05/87 Link with binmode.obj

DEC VAX 11/780 UNIX V7 cc 01/06/87

HP-9000 HP-UX cc 02/06/87

gould cc 03/06/87

Amiga Aztec C 04/06/87

Pyramid 9810 cc 04/06/87

Pyramid 90x cc 04/06/87

Osiris cc 05/06/87

DEC PDP-11/? UNIX V? cc 07/06/87 EXTENSIVE
mods to fix problems with signed chars.

VAX VMS cc 16/06/87 Add #define
times ttmes to fix multiply defined symbol problem. [infocom.h]

Version 1.00 – August 17, 1987.
——————————-

The REV_C interpreter of June 2, 1987 was officially archived as
Version 1.00 on August 17, 1987.

So this means it’s very 16bit & 32bit friendly, especially on BIG endian machines like the 68000 processor.

Luckily this older version is pretty trivial to compile, and get running.  But I was over thinking the build process and decided to strip the executable as GCC would kick out a 500kb file, which objcopy would extract a 81kb executable.  Stripping it brought the size down to a 50kb executable but it wouldn’t run in either xm6 or run68.  I ended up going in circles for a while trying to find fault in what is broken where until I manually compiled the interpreter, and omitted the strip step and suddenly had a working interpreter.

Now there is one issue, saving doesn’t work.  Something in the libc is having issues using fopen with a file to write.  Reading works perfectly fine though.  So to fix it, I went ahead and redid the save feature to use the HumanOS native _open/_write/_close functions and I’m able to now save & restore a game.

D:\proj\run68\test>run68.exe infocom.X minizork.z3
MINI-ZORK I: The Great Underground Empire
Copyright (c) 1988 Infocom, Inc. All rights reserved.
ZORK is a registered trademark of Infocom, Inc.
Release 34 / Serial number 871124

West of House
You are standing in an open field west of a white house, with a boarded front
door. You could circle the house to the north or south.
There is a small mailbox here.

West of House Score: 0/0
>restore
Filename: mz1.sav
Ok.

Living Room Score: 10/19
>inventory
You have:
A nasty knife
A rope
A sword
A brass lantern (providing light)
A brown sack
A glass bottle
The glass bottle contains:
A quantity of water
A leaflet

Living Room Score: 10/20
>

In this process I’ve also managed to build run68, and verified that it’s operating correctly, as both run68 and XM6 both failed to write to a file with fopen, and both work using the native calls.

Planetfall on a x68000

Planetfall on a x68000

I’m sure most people won’t care but I think it’s great having the ability to run a GCC generated C program in a relatively small interpreter.

If anyone cares, here is my updated cross compiler + run68 source along with tweaked Info Task Force 1.0 source.  Or a disk image that XM6 can boot up, and run some demo programs from Infocom of ages ago.