Zeta is an 8086 emulator dedicated for running ZZT and Super ZZT written by Adrian “asie” Siekierka from 2018 onward. It was initially developed for the purpose of providing a lightweight, small HTML5-friendly emulator for the Museum of ZZT, but over time gained an additional purpose of working around some of ZZT's quirks. It is available, with source code, under the terms of the MIT license.
ZZT, being a 1991-era DOS program, generally runs at 100% CPU time, without means of yielding control to the operating system. This would be unfavorable in a modern environment (laptop, web browser, etc.) As such, Zeta uses the following calls for idle detection:
INT 16h AH=0x01
(check for keystroke) to detect the execution of InputUpdate
, as done once per player tick and/or once per window tick.INT 21h AH=0x25
(systime) to detect the execution of SoundHasTimeElapsed
.Obviously, these are tailored for ZZT/Super ZZT's code logic, and may cause erratic delays in forks (or with a very high number of player clones). Currently, the interrupt 0xA5 extensions may be used to disable idle hacks and yield control to the operating system on Zeta.
Zeta does the following hacks in audio-related logic:
As of beta 27, Zeta has started allocating custom hooks under the INT A5h
interrupt call. In order to detect the presence of a compatible version of Zeta, it is recommended to use the following code:
To call an INT A5h
interrupt, one must additionally set the register CX to one of the following values:
All calls also modify the carry flag - it will be cleared on success, and set on failure.
The following functions are provided by interrupt 0xA5:
Available since: Zeta beta 27.
Arguments:
Returns:
Nothing. Note that disabling idle hacks requires you to modify ZZT's source code to insert FORCE IDLE WAIT calls in the correct places! Example implementation.
Available since: Zeta beta 27.
Arguments:
Returns:
Nothing. Stalls code execution (without incurring unnecessary CPU usage for emulation) for a period of time not longer than the next frame or PIT tick. Note that the engine does not guarantee the next frame or PIT tick occuring! For PIT ticks in particular, you still want to check TimerTicks.
Available since: Zeta beta 27.
Arguments:
Returns:
Nothing. Stalls code execution (without incurring unnecessary CPU usage for emulation) for a period of time roughly matching DX milliseconds.
Available since: Zeta beta 30.
Arguments:
Returns:
Nothing. Please note that the repeat delays will be rounded up to the nearest PIT tick.