This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526 - Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX - Calls the ROM display/character routine at
0x02B5(CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine - Reads the keyboard port directly via
DB FE(IN A,(#FE)) for real-time input scanning - References system variables in the 16384–16512 range, particularly addresses like
0x400C(16396, D-FILE pointer) and0x4010(16400, VARS pointer area) - Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
| Address | System Variable | Value POKEd | Purpose |
|---|---|---|---|
| 16389 | RAMTOP (high byte) | 128 | Sets usable RAM top to 32768, protecting machine code area |
| 16516 | ERR_SP area / stack | 0 | Clears error/stack pointer low byte |
| 16519 | — | 223 (0xDF) | Likely a game parameter or speed value |
| 16524 | — | 0 | Initialises another game state variable |
Key BASIC Idioms
RAND USR 16526— the standard ZX81 idiom for calling machine code;RANDdiscards its argument so no error is raised on returnFAST/SLOWbracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cyclesRUNat line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TOPAUSE 99at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control - The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\FF\DFFD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\DD\D3\FF
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C\CB\FC itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5" itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"F itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"E\FB\CD\B5
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
B itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
E\E7\CD\B5
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
B itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5" itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"F itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"E\E7\CD\B5
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
EF\DB\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"F\D0E\E7\DB\FE\DDE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\A7F\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C\DDE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"C\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\DDE\DDE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\CB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
B\CB\DD\CB\CBEC\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\DDE\ED\DD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"F\DDE\CB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\C6
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C\CB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\D6
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C\C6\DD\BE\A8\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5" itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"\DDE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\EDB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"FE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\DD\CB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
EDE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
D
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
D\BE\E5\DD\DF
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\EDB
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
CE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"C\BE\E1\C8\FEE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
E\DD\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
F\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"F
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
ED\DD\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\F0\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\FE\AF\DD\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
AA
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\DF\FFE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"C\BEA\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
AE\BEE\DD\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
AE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
D\DD\BE
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
BF itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"E\FD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\FB\C9\CB\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"\DDE\FF\DF\FF\EDBA itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"\FE\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
BF\DD
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
B
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
C
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
D itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"ED itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\ED\B0
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
ED
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
B
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
E\ED\B8
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\FE\DDE\FF
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\CB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5" itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"B\CB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"\AF\B6\ED itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57534 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.7 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.5"E
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Laser 5
This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
This program implements a space shooter game using a large block of machine code embedded in a REM statement at line 1. The BASIC portion draws a decorative title screen using block graphics characters to form a spacecraft or station shape, then uses POKE statements to set up machine code parameters before transferring control via RAND USR 16526, which jumps into the machine code in the REM. REMs at lines 3 and 4 contain encoded numeric data (likely sprite or level data) read by the machine code at runtime. The program uses FAST mode during machine code execution and loops back via RUN after a brief PAUSE, with a SAVE command at line 270 storing the program with an auto-run flag.
Program Analysis
Program Structure
The program is divided into distinct functional zones:
- Lines 1, 3, 4 — REM statements acting as machine code and data storage
- Line 10 (first instance) — Sets up the system variable at address 16389 (RAMTOP high byte), placing the top of BASIC RAM at 32768
- Lines 90–170 — CLS and PRINT statements drawing the title/splash screen using block graphics
- Lines 180–220 — POKE parameter setup and machine code invocation via
RAND USR 16526
- Lines 230–280 — Post-game loop: PAUSE, SLOW, RUN restart, and SAVE with auto-run flag
Note that line 10 appears twice in the listing — the first instance (POKE 16389,128) sets up memory, and the second (REM, blank) likely overwrites or replaces it after the SAVE/RUN cycle. The STOP at line 255 and CLEAR at line 260 act as safety guards that are never reached during normal execution.
Machine Code Usage
The primary machine code block is embedded in the REM at line 1, beginning at address 16526 (the first byte after the REM token and length bytes, given the standard ZX81 BASIC header). RAND USR 16526 calls this routine as a subroutine from BASIC. The disassembly bytes reveal a Z80 routine that:
- Uses
DD-prefixed instructions (IX register), suggesting a structured data block or sprite record is pointed to by IX
- Calls the ROM display/character routine at
0x02B5 (CD B5 02) multiple times — this is the ZX81 ROM’s PRINT-A character output routine
- Reads the keyboard port directly via
DB FE (IN A,(#FE)) for real-time input scanning
- References system variables in the 16384–16512 range, particularly addresses like
0x400C (16396, D-FILE pointer) and 0x4010 (16400, VARS pointer area)
- Contains what appears to be a main game loop with collision detection logic, speed/direction calculations, and score management
The REM statements at lines 3 and 4 contain long strings of ASCII digit characters. These are almost certainly game data tables (sprite shapes, level maps, or score thresholds) read sequentially by the machine code using pointer arithmetic rather than BASIC access — a common ZX81 technique for packing data into REM lines.
Title Screen and Block Graphics
Lines 100–170 render a decorative graphic using ZX81 block graphic characters. The pattern suggests a spacecraft or gun emplacement, consistent with the “LASER 5” title. Line 170 is notably complex, printing a long row of \## (inverse space / solid block) characters at two TAB positions to create a horizontal barrier or ground line. The % character in line 140 renders as an inverse space in the display, providing a visual accent within the graphic.
Memory Layout and POKE Setup
Address System Variable Value POKEd Purpose 16389 RAMTOP (high byte) 128 Sets usable RAM top to 32768, protecting machine code area 16516 ERR_SP area / stack 0 Clears error/stack pointer low byte 16519 — 223 (0xDF) Likely a game parameter or speed value 16524 — 0 Initialises another game state variable
Key BASIC Idioms
RAND USR 16526 — the standard ZX81 idiom for calling machine code; RAND discards its argument so no error is raised on return
FAST / SLOW bracketing the machine code call suppresses display generation during gameplay, giving the Z80 full cycles
RUN at line 250 restarts the program from line 1, providing a clean game-over loop without needing a GO TO
PAUSE 99 at line 230 inserts a brief delay between the machine code returning and the restart, allowing the player to see a final screen state
SAVE and Auto-Run
Line 270 saves the program as SAVE "1028%9". The %9 sequence represents an inverse digit 9 appended to the filename — on ZX81/TS1000, an inverse character in the SAVE filename string is the flag for auto-run on load, causing the program to execute automatically from line 1 when loaded from tape.
Notable Techniques
- Storing the entire game engine as Z80 binary in a REM statement is the canonical ZX81 method of shipping machine code with a BASIC loader
- Data tables packed as ASCII digit strings in additional REM lines allow the machine code to walk through them with simple pointer increments, avoiding slower BASIC DATA/READ overhead
- Direct port reads (
IN A,(#FE)) inside the machine code bypass the BASIC keyboard scanning entirely for responsive control
- The double appearance of line 10 in the source is consistent with the ZX81’s ability to have duplicate line numbers when editing; only the last one is retained after a NEW or RUN cycle, which here serves to clear the POKE 16389 setup line once the program is properly running
Content
Source Code
1 REM \01\03\00\54\FF\DF\3F\49\6D\47\00\06\DD\21\82\40\D3\FF\2A\0C\40\CB\FC\01\1F\01\3E\FB\CD\B5\02\2B\01\02\19\3E\E7\CD\B5\02\2B\01\1F\01\3E\E7\CD\B5\02\3E\7F\DB\FE\1F\D0\3E\E7\DB\FE\08\DD\7E\02\A7\20\77\06\23\18\3F\DD\35\00\20\6C\DD\7E\01\3C\DD\77\00\DD\4E\03\DD\5E\04\06\01\2A\0C\40\09\36\00\CB\2B\53\CB\13\19\79\83\DD\77\03\36\05\19\CB\23\CB\23\19\3E\75\3C\BE\06\04\20\0A\DD\7E\04\ED\44\DD\77\04\06\01\08\4F\08\DD\7E\03\CB\61\20\02\C6\0C\CB\51\20\02\D6\0C\C6\94\DD\BE\05\20\A8\DD\36\02\01\26\01\DD\6E\03\11\21\00\19\ED\4B\0C\40\09\22\88\40\36\05\06\1F\18\5E\11\21\00\2A\88\40\19\DD\34\02\DD\CB\02\7E\20\3D\3E\0D\06\0D\BE\36\05\20\15\E5\DD\36\05\DF\21\07\00\ED\4B\0C\40\09\35\3E\1C\BE\E1\C8\06\03\10\FE\3E\0E\DD\BE\02\06\14\20\0F\DD\36\02\80\2A\88\40\11\74\FE\19\06\1F\36\00\22\88\40\18\11\36\00\3E\8D\06\23\DD\BE\02\20\F0\06\23\DD\36\02\00\10\FE\AF\DD\BE\0A\28\49\2A\8A\40\36\00\11\DF\FF\19\3E\05\06\1C\BE\28\29\22\8A\40\DD\34\0A\3E\06\06\16\BE\28\22\38\18\3E\10\06\14\DD\BE\0A\28\11\3E\0D\06\13\DD\BE\0A\38\39\36\01\06\11\18\33\36\00\DD\36\0A\00\18\2B\06\4F\1E\FD\36\00\19\10\FB\C9\08\CB\47\06\22\20\19\DD\36\0A\01\DD\6E\05\26\FF\11\DF\FF\19\ED\4B\10\40\09\22\8A\40\36\01\06\18\08\10\FE\DD\35\0B\06\5F\20\24\DD\36\0B\06\2A\0C\40\11\0D\01\19\7E\54\5D\23\01\17\00\ED\B0\12\11\20\00\19\7E\54\5D\2B\0E\17\ED\B8\12\06\0A\10\FE\DD\5E\05\16\FF\2A\10\40\19\36\00\11\00\00\08\CB\67\20\01\1B\CB\57\20\01\13\19\AF\B6\06\13\28\06\ED\52\06\11\1E\00\36\0D\10\FE\DD\7E\05\83\DD\77\05\C3\92\40
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
D\FE\DDE\DD\C3
10 POKE 16389,128
3 REM 211317111111714278212681112866121112766121112766124781627781741514121272114741274173173111212121623611447412116262124261111741727411113174163116163117165761157211217411111731211422111131112421721761412211162111772171117312122167611182176111117214
4 REM 242148111211421121251276117127211186761232422117812111622142721211162121211176121211176122211112217211121318211186163111172117412817817312114221111187211312721121211114332111761111143321176111187311821212111116311163111166112173111121187414741652
10 REM
90 CLS
100 PRINT "LASER 5";TAB 15;"\..\.."
110 PRINT TAB 12;"\..\''\'' \''\''\.."
120 PRINT TAB 10;"\ .\''";TAB 20;"\''\. "
130 PRINT TAB 9;"\ .\' ";TAB 21;"\ '\. "
140 PRINT TAB 9;"\.' % \: \'."
150 PRINT TAB 8;"\ : \':\' \: "
160 PRINT TAB 8;"\: \ .\':\'. \ :"
170 PRINT TAB 8;"\: \.'\. \ :";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##";TAB 4;"\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##\##"
180 POKE 16516,0
190 POKE 16519,223
200 POKE 16524,0
210 FAST
220 RAND USR 16526
230 PAUSE 99
240 SLOW
250 RUN
255 STOP
260 CLEAR
270 SAVE "1028%9"
280 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
