This program is a joystick-controlled screen stamp tool that lets the user position a text string anywhere on the display and print it at chosen coordinates. It uses STICK to read a joystick (port 1, interface 1) for directional movement, updating row variable A and column variable B with boundary clamping to keep the cursor within the 22×32 character grid. Ink color is selectable via keys 0–7, with INVERSE and FLASH toggled by additional joystick values; pressing Space clears the screen while pressing 9 sends output to the COPY (printer) device. Line 9998 saves both the BASIC loader and a companion SCREEN$ file named “rsload C,” suggesting the program expects a pre-drawn loading screen.
Program Analysis
Program Structure
The program divides into three logical phases:
- Initialization (line 1): Sets black border and paper, loads a companion SCREEN$ file, pauses, prompts for the string to stamp, and clears the display.
- Main loop (lines 20–92): Resets or preserves coordinates, prints the string at the current position, reads the joystick and keyboard to move, toggle attributes, save/load screens, and change ink color, then loops back to line 30.
- Save stub (line 9998): Saves the BASIC program itself and the companion SCREEN$ data block, intended to be run manually to (re)create the distribution files.
Joystick Handling with STICK
All movement and several special actions are driven by STICK(1,1), which returns a bitmask representing the joystick direction. The decoded values used are:
| STICK value | Action |
|---|---|
| 1 | Move cursor up (A−1) |
| 2 | Move cursor down (A+1) |
| 4 | Move cursor left (B−1) |
| 8 | Move cursor right (B+1) |
| 5 | INPUT filename, then SAVE SCREEN$ |
| 6 | INVERSE 1 |
| 9 | INPUT filename, then LOAD SCREEN$ |
| 10 | INVERSE 0 |
STICK(2,1) is used on lines 78–79 to toggle FLASH on or off based on the fire button or a second joystick port.
Boundary Clamping
After each directional update the program immediately clamps the coordinates to legal screen positions. Row A is kept in the range 0–21 (lines 45 and 55) and column B in the range 0–31 (lines 65 and 75), matching the 22-row × 32-column character grid.
Keyboard Controls
While the joystick handles movement, several functions are mapped to keyboard keys detected via INKEY$:
- Keys
0–7: Set INK color (lines 82–89) Space: Double-beep, clear screen, restart loop (line 81)9: Beep and send display to printer via COPY (line 90)8: Re-enter the stamp string via INPUT P$ (line 91)
Screen Stamp Mechanic
The core visual technique is the continuous PRINT AT A,B;P$ on line 30 inside a tight loop. Because the screen is not cleared between iterations (except when Space is pressed), each print leaves a permanent mark at the previous position while the new position is printed. This effectively “stamps” the string at every location the cursor passes through, building up a composition across the display.
Save/Load Infrastructure
Line 9998 saves the BASIC program under the name RSLOAD with LINE 1 autostart, followed immediately by a raw CODE block saving 6912 bytes from address 16384 — the full display file — as rsload C. This matches the LOAD "rsload C"SCREEN$ call on line 1, establishing a self-contained distribution pair. The inline SAVE/LOAD SCREEN$ triggered by joystick values 5 and 9 allow saving and restoring work-in-progress compositions during a session.
Notable Anomalies
- Line 20 resets both
AandBto 0 on every pass through the loop top, meaning the cursor always snaps back to the home position (0,0) before being updated. The intended entry point for the loop is line 30, not line 20; line 20 appears to be vestigial initialization that was not relocated. - STICK is polled individually on every conditional line (40, 50, 60, 70, 71, 72, 76, 77, 78, 79) rather than read once into a variable. This means the joystick state could change between checks, potentially triggering unexpected combinations within a single loop iteration.
- The FLASH toggle on lines 78–79 uses
IF |(2,1)(non-zero) andIF |(2,1)=0in the same loop pass, so if the second stick reads zero, both conditions could apply sequentially.
Content
Image Gallery
Source Code
1 BORDER 0: PAPER 0: LOAD "rsload C"SCREEN$ : PAUSE 260: INPUT p$: CLS
20 LET A=0: LET B=A
30 PRINT AT A,B;P$
40 IF |(1,1)=2 THEN LET A=A+1
45 IF A<0 THEN LET A=0
50 IF |(1,1)=1 THEN LET A=A-1
55 IF A>21 THEN LET A=21
60 IF |(1,1)=4 THEN LET B=B-1
65 IF B<0 THEN LET B=0
70 IF |(1,1)=8 THEN LET B=B+1
71 IF |(1,1)=5 THEN INPUT A$: SAVE A$SCREEN$
72 IF |(1,1)=9 THEN INPUT B$: LOAD B$SCREEN$
75 IF B>31 THEN LET B=31
76 IF |(1,1)=6 THEN INVERSE 1
77 IF |(1,1)=10 THEN INVERSE 0
78 IF |(2,1) THEN FLASH 1
79 IF |(2,1)=0 THEN FLASH 0
81 IF INKEY$=" " THEN BEEP 1,1: BEEP 1,1: CLS : GO TO 30
82 IF INKEY$="1" THEN INK 1
83 IF INKEY$="2" THEN INK 2
84 IF INKEY$="3" THEN INK 3
85 IF INKEY$="4" THEN INK 4
86 IF INKEY$="5" THEN INK 5
87 IF INKEY$="6" THEN INK 6
88 IF INKEY$="7" THEN INK 7
89 IF INKEY$="0" THEN INK 0
90 IF INKEY$="9" THEN BEEP 1,1: COPY
91 IF INKEY$="8" THEN INPUT P$
92 GO TO 30
9998 SAVE "RSLOAD" LINE 1: SAVE "rsload C"CODE 16384,6912
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.