Zork I on an Apple I

25 replies [Last post]
Offline
Joined: Aug 24 2013
Posts: 45

I have been working on a project the last few weeks and came up with this:

Apple 1 Zork

While I have only tested it with a few titles, it appears to run most .z3 Infocom data files without alteration.

It requires a CFFA1 card as mass-storage for the interpreter and data file due to the paging that the interpreter uses, and the extra RAM required. I've tested it with OpenEmulator and it should run on Replica-1 systems as well.

Hopefully, I will have a chance to run it on the Apple 1 that shows up at Vintage Computer Fair Midwest in late September.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Offline
Joined: Oct 9 2011
Posts: 1044
Re: Zork I on an Apple I

Great work!!!

How much RAM does it actually use? Are you doing anything special that is written to the CFFA or if an A-1 has been modified for more memory will it run?

Cheers,
Corey

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

Corey,

The interpreter itself is only around 7.5k. Once you add the needed zero page, 6502 stack, z-machine stack, keyboard/display buffer, data file block pointer buffer, etc. it requires 9k.

The individual Z-machine data files can reach up to 128k in size and do seem to be quite large. For example, Zork I is over 92k.

The interpreter loads the data file pages as necessary, however a large chunk of them are required to be in memory at all time. This will depend on which game is being played, but for Zork I the initial read-in loads around 20k before the virtual machine is started. Hitchhiker's Guide to the Galaxy takes slightly more. Once the game is started, it loads another roughly 4k to get to the mailbox in Zork I.

While I have the interpreter assembled with the end of memory just under what the CFFA1 uses for buffers/data starting at $8700, I have run it with the end of memory set at $7FFF. It loads the few games I tried. Running with the top of memory set much lower fails.

However, based on the above numbers, I think it is safe to say that it will have to have 32k to just load the game itself. In theory the z-machine could use up to 64k of non-paged memory, which means that some games may not be playable without swapping pages, or additional memory.

In short, a CFFA1 is absolutely required, but it also means that games can be saved/restored (a feature which I also have working.)

Offline
Joined: Oct 9 2011
Posts: 1044
Re: Zork I on an Apple I

I thought you ported the actual game ala 1976'. What you did was port the 6502 version of the "Frotz" engine and adapt it to the CFFA for paging file loads. Correct???

Cheers,
Corey

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

Corey,

Not quite, I have the taken Apple II version of the version 3 (rev A.) interpreter and used it as the "core" of the Apple I one. This required rewriting the DISK I/O as well as tweaking the keyboard and display sections. It wasn't difficult, but did result in my learning quite a bit about the CFFA1, ProDOS file structure, and most importantly the Z-machine system itself.

This Digital Antiquarian article has an excellent description of the z-machine, how it works, and the system requirements for running it. The numbers seem to match up quite a bit to what I referenced above in regards to memory/storage requirements.

Offline
Joined: Oct 16 2012
Posts: 26
Re: Zork I on an Apple I

This is very cool! Do you plan to release it so others can download and enjoy it?

Offline
Joined: Aug 24 2013
Posts: 45
Zork I on an Apple I

Dave,

Yes, although individuals will need the Rev. A interpreter (generally found on the original Zork III disks for the Apple II) and the appropriate version 3 (.z3) data files for the games that they wish to play. I will look more into how to release it after VCFMW later this month.

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

I have uploaded a zip file containing the small "preload" code that patches and then executes the Apple II version "A" z-machine interpreter. The patches allow the interpreter to use the CFFA1 as storage as well as to properly access the display and keyboard of the Apple 1.

In order to use this, you will need three things, besides the Apple 1 (replica or emulator) and CFFA1.

1. The preload utility
2. The Apple II Infocom interpreter version "A"
3. The datafile for the Infocom game (version 3/z3 games only)

All three of these items should be placed on the compact flash card (or image) as:

PRELOAD.BIN
ZIP.BIN
INFOCOM.DAT

Using the CFFA1, load PRELOAD.BIN at $0500 and ZIP.BIN at $0800. Then quit the CFFA1 menu and execute 0500R from the Woz monitor. The preloader will patch the interpreter, and start executing it with the current game stored as INFOCOM.DAT.

preload.zip (679 bytes)

Version "A" of the interpreter can be spotted on games that when run on an Apple //e do not prompt for 40/80 columns. I found it on a version of Zork III. Using the technique found in the Infosnarf package, this can be obtained by loading the game, and at the prompt hitting reset. Move the game temporarily out of the way by issuing *4000<0800.08FFM, boot a DOS 3.3 disk without a hello program, restore the original version by using *0800<4000.40FFM, and save with BSAVE ZIP.BIN,A$800,L$1A00

The original instructions from Infosnarf can be found here: http://apple2.org.za/gswv/a2zine/Utils/InfocomProInfo.txt I found that I had to adjust the first two bytes to read D8 A9, as indicated.

Alternatively, some emulators allow the saving of memory directly, which may be easier for some individuals. Appending the ZIP.BIN to the PRELOAD.BIN can save an extra step as well.

Typically, I load the compact flash card with the following tree (using preload+zip combined as ZIP.BIN)

ZIP.BIN
GAME1/INFOCOM.DAT
GAME2/INFOCOM.DAT
GAME3/INFOCOM.DAT

This allows me to load the two bin files into memory, and then select the game with the prefix command. The interpreter will save/restore games into the current prefix as well, which allows a user to not interfere with other saved games. If saving a game fails, verify that there is sufficient space left on the Compact Flash card (or image.) Saved games should always be done to the default disk 2, although positions 0-7 can be used.

This has been run on an original Apple 1 with a CFFA1, OpenEmulator, and a modified version of the MESS emulator (to add the CFFA1.)

Thanks go to Eric Smith for his disassembly of the Apple II version "A" interpreter.

megadrive4511's picture
Offline
Joined: Oct 5 2013
Posts: 19
Re: Zork I on an Apple I

That is neat and all but I just am wondering how you emulate an apple 1 machine like that.

__________________

Max

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

Quote:

That is neat and all but I just am wondering how you emulate an apple 1 machine like that.

Max,

OpenEmulator for the Mac will allow you to emulate the Apple 1 with the CFFA1 using a fairly simple interface. I used that to develop this until I added CFFA1 support to my copy of MESS.

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

megadrive4511 wrote:

That is neat and all but I just am wondering how you emulate an apple 1 machine like that.

Max,

I know that this is a bit old, but with recent versions of MESS, it is possible to now emulate an apple 1 with a CFFA1. This will allow running not only the Infocom games as above but also the Ultimate Apple 1 Software Collection as well. This provides an additional option for individuals who may not have a MacOS system available.

Offline
Joined: Apr 27 2013
Posts: 4
Re: Zork I on an Apple I

Thanks so much for this.

I played through some Hitchhiker's tonight.

It works pretty well. I have seen some issues if I let it sit for a while a the command prompt, but otherwise it plays Z3 games flawlessly.

Infocom games are kind of a perfect use for a Apple 1. Very cool.

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Infocom games on Apple I

My post ignored.

Post deleted.

Bye...

gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 2609
Re: Zork I on an Apple I

Asus,

What are you talking about?
"My post ignored".

Steven

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

gsmcten wrote:

Asus,

What are you talking about?
"My post ignored".

Steven

I came here looking for help from apple II experts about how to get infocom games working on the apple 1. First my post was completely ignored for days, then today I finally got a pm from the author, and was basically met with, "others have been able to figure it out" response.

End of rant.

I'll just figure this out on my own.

Thanks for your reply by the way. Nothing more needs to be said.

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

Here's my exact response:

Quote:

Hi,

I don't feel comfortable uploading those images as they contain copyright material. I posted the instructions, which others have successfully used, in order to avoid getting involved in a copyright
discussion.

I reviewed the instructions that I posted, and don't feel that I really have anything else to add
to them. They are worded in such a way that they give proper credit to the individuals who were key
to the development of the software.

I apologize for not being able to post responses to questions promptly.

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

ChristopherB wrote:

Here's my exact response:

Quote:

Hi,

I don't feel comfortable uploading those images as they contain copyright material. I posted the instructions, which others have successfully used, in order to avoid getting involved in a copyright
discussion.

I reviewed the instructions that I posted, and don't feel that I really have anything else to add
to them. They are worded in such a way that they give proper credit to the individuals who were key
to the development of the software.

I apologize for not being able to post responses to questions promptly.

No need to defend yourself. I read the whole thing the first time around.

Like I said, I'll figure this out on my own.

You did a great job with the apple II infocom games on the apple I by the way. I admire what you have done.

Thanks for your time, and have a good day.

gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 2609
Re: Zork I on an Apple I

Asus,

Please do not give up on this site because
of a small glitch.

There are many exceptional members here
who are extremely knowledgeable about the Apple I.

Unfortunately I am not one of the folks you should talk to. lol

Might I suggest that you use the "Search" function in the
Upper Right part of the screen and do a search on the
topic you are interested in?

There are many Apple I Topics there that may cover exactly what you are looking for.

Steven Smile

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

Offline
Joined: Oct 9 2011
Posts: 1044
Re: Zork I on an Apple I

Yes we are a bunch of great guys Smile

However we do get busy in our non Apple lives. Sometimes you post something here and you'll have near real time answers as if you were on instant messenger and other times it's may take a week on the Apple-1 threads. Some of this stuff is pretty specialized. For example I know nothing about running Zork on an Apple-1 because you need specialized hardware to do it. A stock A-1 with ACI and 8k can't run it. So I won't usually chime into these threads, but I do read them out of curiosity. Now if you asked how to run Zork on a Sol-20 with Helios II disk setup, I can help Smile

Cheers,
Corey

Offline
Joined: Aug 24 2013
Posts: 45
Re: Zork I on an Apple I

It may have gotten lost in the above instructions, but you can probably load a copy of an Infocom game running the correct interpreter, halt the emulator, and then use the emulators debugger to change the two bytes at 0800 to D8 A9.

Then save the entire block of memory from 0800 through 21FF (1A00 bytes.) How this is done will likely depend heavily on which emulator you are using.

This will give you the ZIP.BIN file.

This is probably going to be much simpler than the infosnarf method.

While I've not done this with mess/mame, I think that the save command executed after changing the two bytes within the debugger would be:

save ZIP.BIN,0800,1A00

Remember that ZIP.BIN needs to be loaded using the CFFA menu at $0800, and the PRELOAD.BIN file needs to be loaded at $0500.

The INFOCOM.DAT game file needs to be in the current directory. Game files can be obtained in a number of different ways. You'll need to do some research as I just used one that I already had from another project.

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

Thank you for your invaluable information. I'm definitely going give what you said a try. Usually I’m pretty good at figuring things out, but this has had me stumped for a few weeks now.

I really am impressed at what you have done.

I’ll report back when I have Zork up and running. It may be a while.

Thanks again for your help. =)
---------------------------------------------------------------
@gsmcten and Corey986

Thanks for your friendly response.

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

ChristopherB

I DID IT! I DID IT! I have Infocom Zork 1 working in Apple 1 (MAME emulator)!! I know it had something to do with changing the two bytes at 0800 to D8 A9. That was the hardest part for me. I used CiderPress and copied the zip.bin data to a text document and then changed the address from there. I then changed the .txt extension back to .bin. I know that is a strange workaround, but it worked!

I'm SOOOO happy! I can't believe I got it to work! I was almost at the point of giving up, but your tip really helped.

You sir are a genius!

THANK YOU SO MUCH!

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

Update:

I used (and made) custom in-game artwork (monitor bezel with a custom apple II'ish green color overlay) to make it look better than Apple 1 vintage black and white. I found the artwork monitor bezel from a Linux terminal emulator. Hey they "borrowed" one of my artwork bezels for their emulator, so I "borrowed" one of theirs for MAME! Sounds fair to me. Thumbs up for open-source Linux! Cool

This is the Linux terminal emulator (Cool Retro Term) showing the monitor bezel I MADE! https://www.youtube.com/watch?v=T5y9yRXxQsA It doesn't look right because he stretched out the artwork for a wide screen monitor. This is what my artwork bezel is supposed to look like. https://camo.githubusercontent.com/89840504c6e3e7cfff33a17ac7f868e7aeb4d330/687474703a2f2f692e696d6775722e636f6d2f313245716c704c2e706e67

Here is the Linux (and OSX) GeitHub DL for cool-retro-term. https://github.com/Swordfish90/cool-retro-term

Here is what the custom (the other Linux terminal emulator bezel) in-game artwork looks like in the Apple 1 emulator provided by MAME.

[url=]Zork 1 in Apple 1 (MAME)[/url]

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

I've managed to get an older version of Zork I working in MAME. I now have many Infocom games on the CFFA1. Thanks for your tutorial.

MAME version used 0.171 (with custom amber color overlay) MAME 0.172 is out, and has improved graphics. MAME 0.172

[url=]Zork I Release Number 30[/url]

gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 2609
Re: Zork I on an Apple I

Asus,

Thanks for the MAME Link.

Steven Smile

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

Asus's picture
Offline
Joined: Mar 12 2016
Posts: 8
Re: Zork I on an Apple I

gsmcten,

You're very welcome. Smile