Page 1 of 2

Infocom games Z-machine

Posted: Mon Sep 21, 2015 4:11 pm
by Hialmar
While searching for info on Z-machines (the interpreter for Infocom games) I stumbled on an old interview of Dbug saying that someone actually ported a Z-machine to Oric.

Anyone knows where I could find it or even better the source code ?

Thanks.

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 4:45 pm
by Chema
Those were Fabrice and me, and the program is called pinforic :)

You can download it from http://isa.uniovi.es/~chema/bin/pinforic.zip

I can provide the sources, but need to get to my computer first. It is written in C and assembly.

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 6:25 pm
by Hialmar
Awesome !

I'd be interested in the sources in order to add the possibility (if it's not already possible) to add loading compressed pictures from a Sedoric disk.
So that it makes a sort of Hobbit like text/graphics game with all the power of the Z-machine.

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 8:34 pm
by Dbug
Hialmar wrote:Awesome !

I'd be interested in the sources in order to add the possibility (if it's not already possible) to add loading compressed pictures from a Sedoric disk.
So that it makes a sort of Hobbit like text/graphics game with all the power of the Z-machine.
If Pinforic does not use the ROM/Sedoric, it would be much simpler to do this project with FloppyBuilder: It natively supports loading compressed stuff, so you could just put a bunch of pictures and it will automatically decompress them to the screen.

Repeat after me: Sedoric is bad for games. When you use Sedoric:
- God kills a dozen kitten
- You waste 15 kilobytes of memory in average
- You waste kilobytes of disk space
- You waste even more memory because of the intermediate buffers required by decompression if you use Sedoric

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 8:38 pm
by Hialmar
I have read the readme file. If I understand correctly the code to read and write from/to a DOS disk was made to be fully compatible with existing Infocom games.
As we will be writing our games we could go instead to a full Sedoric solution, couldn't we ?

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 8:40 pm
by Hialmar
Ah yes FloppyBuilder could be a solution if we can save/load games.

IIRC you were working on this, right ?

If I can help with this, I will of course.

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 8:47 pm
by Chema
Yes, the code is made to read the game data file from a MSDOS formatted disk and supports all the Oric disk drives, including Jasmin. Thank Fabrice for that :)

It also gets rid of the DOS and uses the overlay memory, as the emulator needs it. IIRC the Z machine is 128K and we had to use a virtual memory system to get it working. That did the original Pinfocom interpreter, that I just adapted.

And it also uses the Hires memory to gain space, so text mode only.

This does not mean it couldn't t be done. I'd start by getting rid of the C code and rewrite everything in assembly. This will give some extra space.

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 9:22 pm
by Hialmar
Ah ok. I'll look at it.
I thought that the first Infocom games worked on low end Apple IIs with 48K of memory.
Maybe I can disassemble one of the first Apple II interpreters and see if it's understandable.

Edit; I checked here and it looks like only the V6 (graphics ones) needed 128 Kbytes:
http://pdd.if-legends.org/infocom/fact-sheet.txt

Re: Infocom games Z-machine

Posted: Mon Sep 21, 2015 10:10 pm
by Chema
Yes, you might be right and it is the data file which is at most 128K. Can't remember.

Will search for my sources. But I recall they did not use the OSDK, but the old LCC compiler and assembler. And we tweaked the oric library to include some routines we wanted and support switching the overlay ram on and off when needed (we also used the ROM for things like printf);

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 7:50 am
by Dbug
Chema wrote:Yes, the code is made to read the game data file from a MSDOS formatted disk and supports all the Oric disk drives, including Jasmin. Thank Fabrice for that :)
It also gets rid of the DOS and uses the overlay memory, as the emulator needs it.
Cool, did not know that it was actually MSDOS compatible with a custom loading system, that's cool :)
So yeah not much opportunities for reducing the size except by crunching down the code of the zmachine I guess.

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 10:43 am
by Chema
Yep. You just have to fresh format an MSDOS (FAT) disk and copy the adventure data file there. After booting pinforic it asks for the game disk and uses it for loading but also for saving the game progress.

The sources are a bit of a mess, really. I have Fabrice's folder contents somewhere, but they include the intermediate files generated by the LCC compiler. I need to clean it up a bit.

Sources were originally written in C by adapting pinfocom's sources and are full of #ifdefs so I could compile it for msdos/linux or Oric and make tests. Fabrice converted many functions to asm to reduce the size and give more speed, and also tweaked the Oric library files to support switching Overlay RAM/ROM.

The only way I'd see to go, would be starting from scratch and making the program fully assembly code. That would crunch the size a lot, and give it more speed, maybe leaving room for the HIRES memory. Adding graphics will be more difficult, as v3 games did not include them in the game file, so they'd have to be drawn from scratch and loaded when needed too!

Supporting v5 datafiles which included graphics and more advanced adventures would be great, but that would need a complete rewrite of the interpreter.

What could be even cooler is using a smaller font to give more columns to the text! (not easy with the Oric's 6-pixel wide characters).

James Groom wrote a review of pinforic here http://freespace.virgin.net/james.groom/oric/rev2.htm

And you can download ready to run disk images with games from the Swedish Oric archive (Infocom section): http://www.skarstad.net/oric/archive.html

Currently pinforic runs at a speed equivalent (and even faster!) to the original implementation of the z-interpreter (measured by Fabrice).

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 1:31 pm
by Hialmar
In fact we (Silicium - being my association of old computers fans which includes artists ;) ) will be writing our own games with Inform and then run them with Z-machines.

The first target will be Apple IIs but of course I'd really like to have them running on the Oric ;)

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 5:13 pm
by Dbug
Chema wrote:Yep. You just have to fresh format an MSDOS (FAT) disk and copy the adventure data file there. After booting pinforic it asks for the game disk and uses it for loading but also for saving the game progress.
I guess a possibility would be to have an utility to convert the FAT format to something more adequate for the Oric and package the pinforic with it.
Chema wrote:maybe leaving room for the HIRES memory. Adding graphics will be more difficult, as v3 games did not include them in the game file, so they'd have to be drawn from scratch and loaded when needed too!
Technically, since it's still a text mode adventure, I guess a half HIRES/half TEXT video mode would be enough, that would just use 4 KB instead of 8.
Chema wrote:Supporting v5 datafiles which included graphics and more advanced adventures would be great, but that would need a complete rewrite of the interpreter.
Do you have examples of games using the v3 and the v5 format?
Chema wrote:What could be even cooler is using a smaller font to give more columns to the text! (not easy with the Oric's 6-pixel wide characters).
The Scribe word processor did just that: http://www.oric.org/software/oriscribe-210.html
(But of course in this case you need the full HIRES mode, not the half mode)

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 6:15 pm
by Chema
In the links above you have a list of v3 games (most of Infocom's adventures). About version 5 and graphics, I was wrong. V5 dir some character based graphics (Beyond Zork) but real graphics were not included up to V6, as Hialmar said, with Zork Zero.

Have a look at th Z-code section here http://www.infocom-if.org/more/glossary.html

Anyway still think that a complete rewrite, using FloppyBuilder as you suggest and including graphics is the best idea. But ask should be used, imho.

Re: Infocom games Z-machine

Posted: Tue Sep 22, 2015 7:50 pm
by Symoon
Chema wrote:Yep. You just have to fresh format an MSDOS (FAT) disk and copy the adventure data file there. After booting pinforic it asks for the game disk and uses it for loading but also for saving the game progress.
Wait wait wait.
My mind may be over-simplifying things as it often does, but are you saying that you have a program:
- that runs on Microdiscs and Jasmin
- that can save on a MS-DOS formated disk
???
Am I crazy thinking this could be used to easily make .DSK files form Oric real disks, to PC? :D