Memory limits
ZZT features a number of memory limits owing to the limitations of its 16-bit DOS platform and its programming.
These limits are typically increased by patched builds, forks and source ports. The wiki discusses the limits as they apply to official ZZT builds, in particular ZZT 3.2.
Board size limit
The maximum theoretical size of a board is 65535 bytes; however, the maximum size of a board in practice is 20000 bytes, excluding the two-byte size header at its beginning. This is caused by the memory buffer used to serialize worlds having that size - larger boards are possible, but corrupt dynamically allocated memory past the serialization buffer.
Remember that this serialization happens every time a player tries to exit the board, using both board edges and passages, as well as whenever a player chooses to save the game. A board's size also changes dynamically as stats get created and destroyed, as well as when elements are placed and removed.
World size limit
The maximum size of a world is bound only by the 640 kilobytes of conventional memory present on a DOS. This memory consists of:
- memory used by DOS,
- memory used by drivers and resident programs,
- static memory used by ZZT itself,
- dynamically allocated memory for storing all boards of a loaded world,
- dynamically allocated memory for storing the current board's state: object code and text window contents.
As some versions of ZZT have less code and data than others, they can allow loading slightly larger worlds. In particular, SoftDisk's Worlds of ZZT is compiled without the built-in editor.
To check the amount of free memory at any time, use the ?+DEBUG cheat. Here are some measurements of applying this cheat on an empty world in various emulated environments:
| Environment | ?+DEBUG | Notes |
|---|---|---|
| FreeDOS 1.4 | m315762 | Empty CONFIG.SYS and AUTOEXEC.BAT |
| MS-DOS 6.22 | m391650 | Empty CONFIG.SYS and AUTOEXEC.BAT |
| MS-DOS 6.22 + HIMEM + EMM386 | m432770 | DOS=HIGH, no other drivers |
| FreeDOS 1.4 + HIMEMX | m436082 | DOS=HIGH,UMB + SHELLHIGH, no other drivers |
| DOSBox v0.74-3 | m448931 | |
| Zeta 1.1.2 | m549906 | Zeta cheats by offering 736 kilobytes of conventional memory and an effective DOS memory size close to zero. |
Rule of thumb advice is as follows:
- A world under 300 kilobytes should run on almost every DOS instance including machines with only 640 KB of memory and machines with significant driver overhead.
- A world under 350 kilobytes should run on most DOS instances configured for running games which require a lot of conventional memory.
- A world under 400 kilobytes should be able to run on most DOS instances specially configured for maximizing conventional memory above all else.
- A world above around 420 kilobytes will not run on most DOS configurations achievable in the real world.
However, these are ballparks, not exact measurements - in general, the larger a world is, the more work is required for a DOS machine to run it. Don't worry about hitting them precisely.
Text window line limit
The maximum number of lines that may be displayed in a text window is 1024 lines. This also acts as an effective limit on the number of world files that may be present in ZZT's directory, as demonstrated in this video.