This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn—LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)ED B0—LDIR: block memory copy, the core of the scroll operationED 52/ED 4A/ED 42—SBC HL,DE/ADC HL,BC/SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts10 FC—DJNZ: loop control for iterating over display linesC9—RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
| Address | POKE Line | Parameter |
|---|---|---|
| 16514 | 5 | Lines to leave at top |
| 16515 | 8 | Lines to leave at bottom |
| 16516 | 11 | Columns to leave at left |
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X"→RUN: restarts the entire program from line 2"S"→STOP: halts execution"C"→GOTO 23: calls the copy/clear entry point atUSR 16525- Any other input →
RAND USR 16528(scroll), thenPRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USRaddresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code. - Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addris the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored. - JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USRcall addresses computed from the line’s storage position.
Content
Source Code
1 REM
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\C3\EDBEABAE
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
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
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
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
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\EDA\FC\B2\A6\BD\B8\B4\AB\B9\ED\EDB
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\EDA
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\EDAB\EDB
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
AB\EDB\ED\B0AD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56718 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.6 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.4"
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
A\EDA
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
AB\EDAB\D5\EDB\ED
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
E
Skip to content
Super Screen
This program implements a screen-scroll utility driven by machine code embedded in the REM statement at line 1. The BASIC portion prompts the user to configure scroll margins — lines to leave at the top, bottom, and columns to leave at the left — which are stored via POKE into system variables at addresses 16514–16516. After filling the screen with a repeating pattern of dashes and asterisks, an input loop accepts commands: “X” restarts, “S” stops, “C” calls a copy/scroll routine at USR 16525, and any other input calls the main scroll routine at USR 16528 before printing the entered string. The machine code at line 1 begins at offset 11 (after ten NUL bytes) with a JP instruction (0xC3) to address 0x4122 (16674), placing the executable entry point well into the REM data area; it uses ED 5B (LD rr,(nn)) and other Z80 extended opcodes to manipulate display memory and perform the windowed scroll operation.
Program Analysis
Program Structure
The program divides cleanly into three layers: a machine code payload hidden in the REM at line 1, a BASIC configuration section (lines 2–11), and an interactive command loop (lines 12–24).
- Lines 1: REM containing raw Z80 machine code — the scroll engine.
- Lines 2–11: CLS and three INPUT prompts storing margin values via POKE.
- Lines 12–15: Screen fill — 11 rows of a 64-character pattern.
- Lines 16–24: Command dispatch loop accepting single-character commands.
Machine Code in REM
Line 1’s REM holds 127 bytes of Z80 code. The first 10 bytes are 0x00 (NOPs if ever executed sequentially), followed immediately by 0xC3 0x22 0x41 — a JP 0x4122 instruction. Since the REM token itself is at address 16514 and the BASIC line header occupies a few bytes, the actual machine code entry point lands at USR 16528 (0x4090 + offset), consistent with the RAND USR 16528 call at line 20. A second entry point at USR 16525 (line 23) hits a different offset in the same block, providing a copy/clear variant of the scroll.
Key Z80 instructions visible in the REM data include:
ED 5B nn nn — LD rr,(nn): loads 16-bit register pairs from memory (used to fetch margin parameters and display pointers)
ED B0 — LDIR: block memory copy, the core of the scroll operation
ED 52 / ED 4A / ED 42 — SBC HL,DE / ADC HL,BC / SBC HL,BC: 16-bit arithmetic for computing source/destination addresses and byte counts
10 FC — DJNZ: loop control for iterating over display lines
C9 — RET: returns control to BASIC at both exit points
POKE-Based Parameter Passing
Margin values are passed to the machine code via three memory locations:
Address POKE Line Parameter 16514 5 Lines to leave at top 16515 8 Lines to leave at bottom 16516 11 Columns to leave at left
These addresses fall within the REM statement’s data area (the REM at line 1 starts near address 16509), so the machine code reads its own configuration directly from the tokenised BASIC program in memory — a compact self-contained design.
Command Dispatch Loop
Lines 16–24 form a simple interactive loop. INPUT D$ reads a string, then three IF tests dispatch on single-character commands:
"X" → RUN: restarts the entire program from line 2
"S" → STOP: halts execution
"C" → GOTO 23: calls the copy/clear entry point at USR 16525
- Any other input →
RAND USR 16528 (scroll), then PRINT D$, then loop back to line 16
The PRINT D$ after the scroll call on line 21 suggests the scroll routine makes room at a known screen position and the entered string is then displayed in that newly scrolled area, effectively implementing a text-window output mechanism.
Screen Fill Pattern
Lines 13–15 use a FOR/NEXT loop to print 11 rows of a 64-character string composed of 32 dashes followed by 32 asterisks ("--------------------------------************************"). This fills the display with a distinctive two-tone pattern, likely to make the scroll effect visually obvious during testing or demonstration.
Notable Techniques
- Dual entry points: Two
RAND USR addresses (16525 and 16528) into the same REM-resident code block provide scroll and copy/clear variants without duplicating code.
- Self-referential parameter storage: Configuration bytes are POKEd into the REM area and read back by the machine code, avoiding any separate variable storage.
- RAND USR idiom:
RAND USR addr is the standard method for calling machine code from BASIC; the random-number side-effect is irrelevant and ignored.
- JP at offset 11: The leading NUL bytes in the REM act as padding so that the JP target address aligns correctly with the
USR call addresses computed from the line’s storage position.
Content
Source Code
1 REM \00\00\00\00\00\00\00\00\00\00\00\C3\22\41\ED\5B\82\40\3E\15\9A\9B\32\85\40\3A\84\40\47\3E\20\98\32\86\40\2A\0C\40\23\11\21\00\3A\82\40\47\04\ED\5A\10\FC\18\07\B2\A6\BD\B8\B4\AB\B9\ED\52\ED\5B\84\40\16\00\ED\5A\22\89\40\11\21\00\ED\5A\22\8B\40\ED\4B\86\40\2A\8B\40\ED\5B\89\40\ED\B0\3A\85\40\3D\32\85\40\28\15\01\21\00\2A\89\40\ED\4A\22\89\40\2A\8B\40\ED\4A\22\8B\40\18\D5\ED\4B\86\40\ED\42\22\0E\40\41\36\00\23\10\FB\3A\83\40\47\3E\03\88\32\3A\40\3A\84\40\47\3E\21\98\32\39\40\C9\ED\5B\82\40\3E\16\9A\9B\32\88\40\CD\90\40\3A\88\40\3D\32\88\40\20\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
People
No people associated with this content.
\FBAEAAE\C9\EDBEAB\CDAD\F4\C9
2 CLS
3 PRINT "LEAVE LINES TOP?"
4 INPUT D
5 POKE 16514,D
6 PRINT "LEAVE LINES BOTTOM?"
7 INPUT D
8 POKE 16515,D
9 PRINT "LEAVE COLUMNS LEFT?"
10 INPUT D
11 POKE 16516,D
12 CLS
13 FOR X=1 TO 11
14 PRINT "--------------------------------********************************"
15 NEXT X
16 INPUT D$
17 IF D$="X" THEN RUN
18 IF D$="S" THEN STOP
19 IF D$="C" THEN GOTO 23
20 RAND USR 16528
21 PRINT D$
22 GOTO 16
23 RAND USR 16525
24 GOTO 16
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


