Introducing the Å-machine

Yeah I was thinking in terms of a JITting interpreter. But also from my experience with Emscripten - which is less necessary seeing as you’ve already provided a JS terp. So it probably won’t actually be an issue.

Å-machine release 0.2 contains the following changes:

Javascript engine

  • Bugfix: Runtime error handler can now use undo.

Web frontend

  • Improved screen reader support.
  • Now possible to save gamestate and transcript in Internet Explorer.
  • Text selection now works, for copy-paste.
  • Support for logging to a remote server.
  • Progress bars are displayed correctly.
  • Simplified the HTML wrapper by moving most of the initial document structure to javascript.

The specification is still at version 0.1.

2 Likes

Will A-machine support html type hyperlinks to external resources? (now or in future releases)

For example a link to a photograph or additional optional narrative?

Thank you,
Jeff

Yes, I have some plans for this. But it needs to be designed carefully, to blend in well with the rest of the language, and to encourage (as far as possible) self-contained games that can be archived.

1 Like

Very good news. My use for limited external links involving photographs and possibly audio as a post lesson clarification in an educational based project.

Thank you,
v/r
Jeff

The Å-machine toolkit version 0.2.1 has been released. This includes version 0.2 of the specification, and updated versions of the Å-machine toolchain and official Javascript interpreter.

From now on, the version number has three parts. The first two are equal to the specification version, and the third gets incremented when the tools are improved without changing the specification.

Changes introduced in version 0.2 of the specification:

  • Support for external resources (e.g. embedded graphics and external link targets).

  • Ability to check at runtime whether the interpreter supports quitting.

Changes introduced in version 0.2.1 of the web interpreter:

  • Support for embedded images, downloadable feelies, and external links.

  • Added “restart” and “save story file” menu items.

  • Don’t move focus to the input element if the last command was clicked. Only do it if the last command was typed.

Changes introduced in version 0.2.1 of the Node.js interpreter:

  • Slight modification to the word-wrapping code, to ensure compatibility with dgdebug and dumbfrotz.
4 Likes

The Dialog system is amazing. Its features keep moving toward things that will find most useful. In this case, the availability of external links will be most useful in education applications that I have in mind for special needs students.

Thank you,
v/r
Jeff

If there is a Jesus, he must be Linus.

Version 0.2.2 fixes a bug where external restart (e.g. from the menu in the web interpreter) didn’t work properly.

1 Like

I’m happy to announce the Å-machine toolkit version 0.3.1.

It fixes a couple of minor bugs in the Javascript interpreter, but the big news is:

Commodore 64 interpreter

I have claimed that the Å-machine is designed to perform well on vintage systems. Now it’s time to deliver on that promise.

This release contains an interpreter written in generic 6502 assembly language, with a frontend for the Commodore 64 (equipped with a 1541-compatible floppy drive). A RAM Expansion Unit (REU) is required for the UNDO command, but is otherwise optional. The presence of a large (at least 256 kB) REU will also improve performance dramatically.

Creating a Commodore 64 version of an Å-machine game is easy. As before, the Å-machine toolkit contains a command-line tool called aambundle, that can read an .aastory file and create a directory with a self-contained web player. With the option -t c64, it will create a disk image for the C64 instead.

The performance on a stock system (C64 + 1541) is competitive. The first few commands tend to be slow (about 10–15 seconds), as the engine retrieves data on demand from disk. Once the system is warmed up, the typical response time before output starts to appear is about 1–3 seconds. Of course, printing a large chunk of text also takes time, especially if new content has to be loaded from disk. But that is all happening while you read, so it is not as frustrating as the initial wait.

With a REU, response times are typically less than a second.

I obtained these figures by running the Å-machine versions of Tethered and Pas De Deux. When the same games are compiled for the Z-machine, and played on a C64 with a REU (using Zeugma), they respond to commands in about 3–7 seconds. Without a REU (using Ozmoo), the response time is 1–3 minutes (!) because of the increased disk access. (I would have used the same interpreter for the benchmark, but Zeugma needs a REU by design, and Ozmoo crashed on these games in REU mode.) Part of the reason for the speed boost is that Å-machine storyfiles are only about half the size of their Z-machine counterparts. Each of these games now fits comfortably on a single disk side, along with the interpreter.

To put this in context, the original Hitchhiker’s Guide for the C64 (using Infocom’s own interpreter, and paging from disk) has response times of around 1–5 seconds. With a modern interpreter (e.g. Ozmoo with a REU), this can be reduced to half a second. So Dialog games are now on par with classic Infocom games in terms of performance, despite the fact that Dialog is a high-level, rule-based language with a complex in-game parser and standard library, more in the spirit of Inform 7 than ZIL.

In the long run, I hope this will open the gates for lots of modern, narrative-driven text games for the Commodore 64!

Updates to the specification

The original Å-machine specification document was written in tandem with the compiler and the Javascript interpreter, and went through several rounds of editing. As I wrote the 6502 interpreter, I went back to the specification document with fresh eyes, and discovered several errors. Another person, who I suspect is working on an interpreter of their own, also reported some. All of these errors have now been fixed, a couple of corner cases have been clarified, and the input tokenization process is described in detail. The document version number has been incremented to 0.3.

New option in the web player

The web player menu now contains a checkbox called “Always re-focus”. When this mode is enabled, the browser will move focus to the input text field after every move, regardless of whether the move was typed or clicked. This can be desirable (according to taste) when playing on a desktop computer. By default, the mode is disabled, and focus does not move when clicking on a link. This makes sense on mobile devices, where focusing on a text field will often bring up an on-screen keyboard that cuts the amount of visible text in half.

8 Likes

6 Likes

Get version 0.4.1 of the Å-machine toolkit! The archive contains version 0.4 of the specification, and updated versions of the Å-machine toolchain and interpreters. This is a companion release to Dialog version 0j/01.

Release notes:

  • Several improvements and clarifications in the specification document, including an attempt at formalizing the output model.

  • Spans, i.e. inline text segments with style attributes.

  • Support for hyperlinks where the target text is determined from the displayed text.

  • Clear Links opcode to transform old hyperlinks into plain text.

  • Ability to check whether a value is a dictionary word that doesn’t appear in the game dictionary (i.e. is represented internally by a list of characters).

  • Ability to split and join dictionary words.

  • Inhibit whitespace around certain stop characters when they are printed as a value.

  • New runtime error: Invalid output state.

  • Several new opcodes and opcode variants to reduce bytecode footprint.

  • Better text string encoding.

  • The javascript engine now handles extremely long input lines gracefully.

2 Likes

Version 0.4.2 of the Å-machine toolkit fixes two bugs that caused the various interpreters and tools to hang on very small story files. Thanks @Juhana!

2 Likes

Here’s version 0.4.3 of the Å-machine toolkit. There are two new features in the web interpreter:

  • Progress is automatically saved in local web storage. You can close the tab or browser, and come back later to find the game as you left it. Try it right now with Tethered or Pas De Deux!

  • Clicking/tapping anywhere in the main text area (except on a link) moves focus to the input field. Tapping on the status bar takes focus away, which is useful for hiding the on-screen keyboard on a mobile device. Selecting text for copy-paste should work as before.

6 Likes

Version 0.4.4 is a small upgrade:

  • C64 interpreter: Added French accented characters to the font. Thanks @farvardin!

  • Web interpreter: Improved support for scrolling with page up and page down when the input field is active. This failed on some browsers before.

  • aambundle: Added target web:story for generating just the story.js file for the web interpreter. This can sometimes make it easier to fit the Å-machine tools into a larger build process. Thanks @Mikawa!

If you use the web:story target, please be aware that the web interpreter also expects to find the original .aastory file in the resources directory, with a mangled filename. This is the file that gets served when the player selects “Download story file” from the menu.

4 Likes

Here’s the Å-machine toolkit, version 0.5.1. This is a companion release to Dialog version 0m/01.

Version 0.5 of the specification includes:

  • Optional support for multiple status areas, with the ability to detect which status areas are available at runtime.

  • Optional ability to clear the current div.

  • Optional ability to clear all text that the player has had a chance to read.

  • Words that consist of a single digit are now consistently represented by numbers. This affects line input, keypress input, word splitting, and word joining.

  • Some new opcodes and opcode variants.

  • Updates and clarifications.

Improvements to the web-based interpreter include:

  • Support for an inline status area. Ability to clear the current div. Ability to clear all text that the player has had a chance to read.

  • Ability to view the current transcript without saving it.

  • Ragged right margin by default.

  • Checkbox to turn off hyperlinks.

  • Checkbox to toggle smooth scrolling.

  • Checkbox settings are remembered in local web storage.

  • In the transcript, non-zero div margins become paragraph breaks.

  • Improved remote transcript functionality.

6 Likes

Version 0.5.2 of the Å-machine toolkit makes a small but significant change to the web interpreter:

  • Hovering over a link no longer causes the link target to appear in the input field. The feature can be re-enabled with a checkbox, but I assume most players will leave it off. Clicking works as before.

Originally, the hover effect was created for two reasons: It would communicate to the player that links are shorthand for typing, and it would give the player a chance to see what they were about to do.

The effect is now removed (by default) because it gets in the way. Links are primarily useful on touch-screen devices, where there’s no hovering anyway. On the desktop, many players switch to typing because it is faster. But as new text scrolls into view, a link may slide in under the mouse cursor, and text is unexpectedly entered at the prompt. This is particularly annoying if the player is typing several commands in rapid succession, for instance while walking around the map. The feature has also been causing trouble for players with low vision.

1 Like

Perhaps you could use a tooltip/title on hover instead? That should be less disruptive.

This is a good change for me. I have low vision and have trouble tracking a mouse cursor. I only see a small fraction of the screen and usually don’t have any idea where the mouse cursor is located. I can only use a mouse when I place my primary focus on the mouse cursor. When the input is automatically placed at the command prompt due to hovering, it can become a problem.

Thank you

1 Like

Here is version 0.5.3 of the Å-machine toolkit.

Web interpreter

  • Change mouse pointer over clickable links. Thanks @mathbrush!

6502 interpreter

  • Reserve a smaller paging area during early startup, to accomodate stories that need a lot of RAM.

  • Don’t corrupt memory when loading storyfile chunks with a size divisible by 256.

Aambox frontend (6502)

  • Accept 3-byte unicode input.

  • Handle unexpected unicode characters without crashing.

  • Don’t hang after 2^32 clock cycles.

  • Limit undo history to 50 steps.

With these bugfixes, it is now possible to run The Impossible Bottle on the aambox virtual computer. This is an important step towards making it run on the C64.

5 Likes