Play Zork on PicoCalc/PicoMite

Hi folks,

After some prompting and testing by @cjstoddard I’ve updated my MMBasic Z-Machine implementation (Z-MIM) to run on the PicoCalc:

The download includes “minizork” but Z-MIM should be capable of playing all of Infocom’s classic .z3 adventures if you have the files:

  • ballyhoo.z3 - Ballyhoo
  • cutthroat.z3 - Cuthroats
  • enchanter.z3 - Enchanter
  • hollywood.z3 - Hollywood Hijinx
  • lgop.z3 - Leather Goddesses of Phobos
  • lurking.z3 - The Lurking Horror
  • planetfall.z3 - Planetfall
  • plundered.z3 - Plundered Hearts
  • seastalker.z3 - Seastalker
  • sorcerer.z3 - Sorcerer
  • spellbrkr.z3 - Spellbreaker
  • wishbringer.z3 - Wishbringer
  • infidel.z3 - Infidel
  • zork1.z3 - Zork: The Great Underground Empire - Part I
  • zork2.z3 - Zork II: The Wizard of Frobozz
  • zork3.z3 - Zork III: The Dungeon Master

Note: Z-MIM is not firmware, it is an MMBasic program that runs under the PicoMite firmware (v6.00+).

Caveat: The performance could generously be described as “leisurely”, especially on the Pico 1. Cut it some slack, it is implementing a 16-bit virtual machine in BASIC !

Best wishes,

Tom

11 Likes

Tom did a great job updating Z-MIM to run on the PicoCalc. Please consider buying him some coffee for all his hard work.

2 Likes

Just waiting for a SD card reader to arrive in the post (old one getting upset) and will give it a test on my pico2 before sending over a coffee sir :smiling_face_with_sunglasses:.

1 Like

Its running !, some questions…

  1. In a game is there an easy way to exit (maybe saving progress at the same time) ?. Only seems to be *break followed by q ?

  2. *save, *restore… Will these work fine if flipping between different stories ?

Note - if you do *break followed by ‘h’ the output is not properly formatted for the PicoCalc screen hence difficult to read.

Its running !

That’s great news.

*break is to break into the interactive Z-Machine debugger, you probably don’t need that unless you are planning on writing your own story or extending/fixing Z-MIM.

  1. In a game is there an easy way to exit (maybe saving progress at the same time) ?. Only seems to be *break followed by q ?

In general just type save to save and quit to quit, with no * prefix.

Note the meta-commands *save and *restore are really there for any stories that don’t provide their own save/restore.

  1. *save, *restore… Will these work fine if flipping between different stories ?

save and restore provide 10 independent save slots per story.

Note - if you do *break followed by ‘h’ the output is not properly formatted for the PicoCalc screen hence difficult to read.

Thanks, I’m not sure the PicoCalc is the ideal platform for using the debugger, but I’ll take a look next time I am passing through.

Best wishes,

Tom

1 Like

I have been using z-mim for the better part of 3 weeks now and it never once occurred to me to go into the debugger.

And now its not !!. Seems to be my recent upgrade to rc20. On bootup it gives the immediate error (no startup screen)…

[712] Line Input #1, s$
Error : Line is too long

:flushed_face:

Well that’s looks like a new firmware bug - I speculate that it is no longer correctly handling reading from files that just have line-feed ‘\n’ line-endings.

It’s possible Peter cocked it up in the PicoMite main-line, I’ll try and find time to check tomorrow.

However I also know that @adcockm “fixed” a PicoCalc specific bug with line-endings read from standard input using INPUT … and I can’t help but wonder if that fix broke reading from files ?

Please note I don’t have a PicoCalc so it’s difficult for me to do any debugging specific for that platform.

Best wishes,

Tom

Yes probably. I just tried deleting the whole folder and copying back to the PicoCalc incase of file corruption… exact same error :expressionless_face:. A coffee awaits if you can find a way round this !

And this is why I wait two or three revisions between upgrading firmware. I am hoping adcockm finds a nice stable RC of 6.00.02, does his thing with it, then stops trying to chase Peter and settles into a nice leisurely once a month update.

1 Like

Try running this program:

txt$ = "Moses supposes his toeses are "
Cat txt$, "roses; Moses supposes "
Cat txt$, "eroneously, For nobody's "
Cat txt$, "toeses are roses or "
Cat txt$, "posies, As Moses "
Cat txt$, "supposes his toeses "
Cat txt$, "to be."
Open "output.txt" For Output As #1
For i = 1 To 20
  ' End line with just \n
  Print #1, txt$; Chr$(10);
Next
Close #1
Open "output.txt" For Input As #1
Do While Not Eof(#1)
  Line Input #1, s$
  Print s$
Loop

It should print the rhyme about Moses 20 times, if as I suspect the PicoCalc firmware is broken then you will get a “Line is too long” error from line 16.

Best wishes,

Tom

1 Like

I have tested Z-MIM with RC22 of the standard PicoMite (LCD) build (RC20 is no longer available for download) and it works fine so on the balance of probabilities I believe this is a new PicoCalc specific bug.

Best wishes,

Tom

OK, I’ve poked some more, and I think I’m wrong, that error is not from LINE INPUT, it’s from the new line continuation feature.

Try disabling it with OPTION CONTINUATION LINES OFF and see if the problem persists.

I’m not sure exactly how this caused the specific error you saw (which may be transitory and fixed by RC22), but I do need to make some fixes to Z-MIM because it was using _ as the name of a (dummy) variable in places.

Best wishes,

Tom

1 Like

Ran your test…

[16] Line Input #1, s$
Error : line is too long

I’m on PicoMite_PICORP2350_V6.00.02RC20.uf2 by adcockm, not the RC21 with line break update…

OK, that is very confusing, that error message is generated by the line continuation code which I don’t think should be getting invoked.

Have you tried disabling line continuation ?

Best wishes,

Tom

I just picked up that fix from Peter’s mainline changes.

But I see you found the issue with the “_”. I turned off line continuation after trying it, since it already had one bug reported shortly after it was added. And it’s not on by default on PicoCalc though it can be turned on. Personally, i found it an… odd choice to dynamically change source code back and forth in the editor and assume that it wouldn’t break anything, especially when the underscore character presumably had no special meaning before, and could have been used by programs already. And your program is a perfect example. If official changes to the PicoMite code can break existing code so easily, it makes me question the long term stability of it. At least the line continuation is optional and can be turned off.

That feature isnt in my version (RC20)

Both Visual Basic and FreeBASIC use an underscore as a line continuation character, but Peter’s implementation is idiosyncratic, as you say, you wouldn’t expect it to be reformatting the source (but I know why he has to do it).

If official changes to the PicoMite code can break existing code so easily, it makes me question the long term stability of it.

It’s relatively rare but not unheard of, and we are currently in a very prolonged alpha/beta/rc phase.

Tom

1 Like

Hmm … very true … I think we should wait a couple of days for another half-dozen release candidates to fly by :wink: .

Best wishes,

Tom

2 Likes

Since this is my first experience with a “release cycle” of PicoMite, I can only hope that it reaches some kind of stable state. It seems that even though these are RCs and the intention is to get to some final release, random new features keep being added that create more code churn and create new bugs. At this rate there doesn’t seem to be an end in sight, and while that might work for Peter and many PicoMite fans, at some point I’m going to burn out or lose interest, or both. This kind of frenzied development can be impressive, but to have a group of people expecting to rely on the latest bleeding edge release is unusual. And it also seems to require folks to rewrite their code when the system changes out from under them. Maybe that’s part of the reason to try to stay caught up, because required changes to existing programs would be even more drastic from one major release to the next?

In any case, i’m looking forward to a stable release as well!

I hesitated to even try to add the PicoCalc specific keyboard backlight and battery stuff, but that seemed pretty isolated and something people had been interested in.

1 Like