A Tetris game for the ZX81/TS1000, written in Z80 machine code. Pieces fall into a well 10 cells wide, with the next piece shown beside it, a running score, a high score and a level. Keys: B moves left, M moves right, A and D rotate, S drops the piece, P pauses and Q quits. Each 10 rows cleared raises the level, up to level 10, and each level makes the pieces fall faster and the rows worth more.
The source header reads “ZXTRIS V1.0 / Z80 TETRIS CLONE FOR THE ZX81 / Steve Smith 2022”. The README calls it the author’s first Z80 program, written in VS Code with the SjASMPlus assembler and debugged with DeZog and the ZEsarUX emulator.
Program Analysis
zxtris.p is a 4.3K program built straight from the assembler source. Line 1 is a REM that holds all the code, and line 10 is RAND USR 16514, so the game starts as soon as it loads.
Notable Techniques
- Pieces are picked from the low byte of the FRAMES counter at 4034H, masked to 0–7 and retried on 7.
- Clearing a row scores 5 × level, doubled once for each level, and every level takes 5 off the drop delay, which starts at 45.
- The cursor-key codes for left and right are accepted as well as B and M.
Potential Issues
- The row bonus is worked out in the 8-bit A register, so from level 4 up (5 × 4 doubled four times is 320) it appears to wrap past 255 and add less than intended.
- The source comments in the key handler swap the letters: code 29H (D) is labelled A, and 26H (A) is labelled D. The game itself is unaffected.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
