--- title: "SuperScan" id: 56720 type: "computer_media" slug: "superscan" url: "http://localhost/computer_media/superscan/" markdown_url: "http://localhost/computer_media/superscan.md" published_at: "2024-09-22T23:31:54+00:00" modified_at: "2026-04-03T13:02:10+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-rxxb.png" excerpt: "A machine code scroll routine lets this chatty demo program print text in screen sub-regions while keeping other areas visible — and it even does arithmetic for you." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Programming" slug: "programming" taxonomy: "genre" url: "http://localhost/type/programming/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/SuperScan%20%28198x%29%28TS1000%29%28US%29%28Cassette%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-rxxb.png" - url: "http://localhost/wp-content/uploads/2024/09/SCR-20241029-rxui.png" - url: "http://localhost/wp-content/uploads/2024/09/SuperScan-scaled.jpg" media_type_tags: "Programming" --- # SuperScan SuperScan is a demonstration program that uses an embedded machine language routine to scroll and display text within a sub-region of the screen, allowing simultaneous output on different screen areas. The machine code is stored beginning at address 16514 (just after the system variables area) and is invoked repeatedly via RAND USR 16528 and RAND USR 16525 throughout the program. POKEs at lines 5, 6, and 7 write parameters to addresses 16514–16516, configuring the scroll routine’s operating region, and are zeroed out at the end (lines 620–630) to restore normal display behavior. The demonstration sequence introduces itself, accepts user input (a name and two numbers whose sum it displays), prints decorative patterns, and cycles through multiple screen segments, concluding with a full CLS and a GOTO loop back to line 1. SLOW mode is engaged at line 9 to ensure the machine code routine and display operations remain in sync. *** ## Program Analysis ### Program Structure The program is organized into a linear demonstration sequence with no subroutines in BASIC. The flow is: 1. Lines 1–9: Machine code storage in REM and initial POKEs to configure the scroll routine; `SLOW` mode enabled. 2. Lines 20–199: Introductory conversation — greets the user, accepts a name via `INPUT N$`, and displays a series of teaser messages. 3. Line 200–205: Waits for a keypress using `PAUSE 4E4` followed by a `IF INKEY$ <>""` branch to continue. 4. Lines 209–390: Demonstrates the scrolling sub-region by printing decorative strings (`A$`, `D$`) in a loop, interspersed with `RAND USR 16528` calls. 5. Lines 395–500: Accepts two numbers, adds them, and displays the result, all punctuated by scroll calls. 6. Lines 505–610: Closing messages and farewell sequence. 7. Lines 620–640: Teardown — zeroes the POKE parameters, `CLS`, and loops back to line 1 via `GOTO 1`. 8. Lines 697–699: `STOP`, `SAVE`, and another `GOTO 1` — utility tail used during development/saving. ### Machine Code Routine The machine language payload lives inside the `REM` statement at line 1. This is a standard technique for storing executable code: the Z80 bytes are embedded as the text of a REM, keeping them safe from BASIC’s memory management. Two entry points are referenced: | Address | Role | | --- | --- | | `16525` | Secondary entry point — called to reset or reinitialize the scroll region (used after pauses between sections). | | `16528` | Primary entry point — called before every `PRINT` to advance or manage the sub-region scroll. | Addresses `16514`, `16515`, and `16516` are POKEd at program start with values 6, 3, and 17 respectively. These fall just beyond the system variables and serve as parameters (likely defining the scroll window’s top row, height, or column boundaries) read by the machine code. They are zeroed at lines 620–630 to restore normal PRINT behavior before the program restarts. ### Key BASIC Idioms - `PAUSE 4E4` at line 200 uses floating-point scientific notation to express a large pause value (40,000 frames), a common trick to avoid typing many zeros. - `IF INKEY$ <>"" THEN GOTO 209` at line 205 polls for a keypress immediately after the long pause, providing early-exit capability without halting execution. - `RAND USR` is used purely as a mechanism to call machine code and discard the return value — `RANDOMIZE USR` does not affect subsequent random number generation in a meaningful way here. - `GOTO 1` at line 640 loops back to the start of the program including the REM line, effectively restarting the demo without re-executing the POKEs independently — however, lines 5–7 will re-POKE the parameters on each cycle. ### Notable Techniques The core novelty is the sub-region scroll: by calling `RAND USR 16528` before each `PRINT`, the machine code presumably shifts previously printed lines upward within a defined window, preventing the normal full-screen scroll. This allows text to appear to accumulate and scroll within a portion of the display while the rest of the screen remains static — the effect advertised in the demo messages about “printing on one side while you read the other.” The `RAND USR 16525` calls, used at section boundaries (lines 272, 356, 395, 505, 535, 595), likely clear or reset the scroll window, analogous to a localized `CLS` for the sub-region. Block graphic characters (the `▞` pattern in `A$` at line 210) are used as a decorative fill string, demonstrating the machine code’s scrolling visually with a high-contrast repeating pattern. ### Bugs and Anomalies - Line 380 reads `PRINT "ON THIS SIDE."` while line 370 already printed `PRINT "OTHER THING ON"` — the word “ON” is repeated across two consecutive lines, which appears to be a typo (“OTHER THINGS ON / THIS SIDE” was likely intended). - Line 640 does `GOTO 1`, which jumps to the REM line. Execution then falls through to line 5 and re-POKEs the machine code parameters, which is harmless but slightly redundant. - Lines 697–699 form an unreachable tail: `STOP` at 697 prevents `SAVE` at 698 from ever being reached in normal flow, suggesting these lines were used manually during development to save the program. ## Source Code ``` 1 REM ▞▀) ? .#W##6INKEY$ GOSUB #▙RNDY+[,][.]M▐RNDU▜RND#Y4[/]M▚RNDE£RND7)5 U▙RND#▖ GOSUB #( UNPLOT /▛[M][A][X][S][O][F][T] GOSUB # GOSUB #▜RND- GOSUB #6[,,]RND)5 GOSUB #6["]RND GOSUB #▚RNDE["]RND GOSUB #[,,]RND GOSUB [K]U▐RNDXM▐RNDC+▘5 E[,,]RND GOSUB #6[,,]RNDE["]RND GOSUB #6["]RND/STR$ GOSUB #▚RND GOSUB PI6:RNDINKEY$ Q 7( CLSU▄RND#Y▀[▒]MURNDU▜RND#Y5[/]MTRNDTAN GOSUB #▙RNDY-[,][.]M[▒]RNDLN [(]RNDU[▒]RNDXM[▒]RND4 POKE TAN 5 POKE 16514,6 6 POKE 16515,3 7 POKE 16516,17 9 SLOW 20 PRINT "HELLO, I AM" 30 PRINT "YOUR TS/1000" 40 PRINT "COMPUTER. WHAT" 50 PRINT "IS YOUR NAME?" 60 INPUT N$ 70 PRINT "HELLO, ";N$ 80 PRINT "GLAD TO MEET" 90 PRINT "YOU. YOU ARE" 100 PRINT "WATCHING A" 110 PRINT "DEMONSTRATION" 117 PRINT "OF SOME STUFF" 120 PRINT "I BET YOU" 130 PRINT "DIDN▘T THINK" 140 PRINT "I COULD DO." 150 PRINT "SEE,EVERYONE " 160 PRINT "THINKS I▘M A" 170 PRINT "TOY. BUT I" 180 PRINT "REALLY CAN DO" 190 PRINT "BIG STUFF" 192 PRINT "TOO." 195 PRINT "PRESS ANY KEY" 197 PRINT "AND WATCH WHAT" 199 PRINT "HAPPENS." 200 PAUSE 4E4 205 IF INKEY$ <>"" THEN GOTO 209 209 FOR J=1 TO 20 210 LET A$="▞▞▞▞▞▞▞▞▞▞▞" 215 RAND USR 16528 220 PRINT A$ 225 RAND USR 16528 230 NEXT J 235 RAND USR 16528 240 PRINT "PRETTY GOOD" 245 RAND USR 16528 250 PRINT "DON▘T YOU" 255 RAND USR 16528 260 PRINT "THINK?" 270 PAUSE 100 272 RAND USR 16525 275 RAND USR 16528 280 PRINT "I CAN ALSO" 285 RAND USR 16528 290 PRINT "PRINT ON ONE" 295 RAND USR 16528 300 PRINT "SIDE WHILE YOU" 305 RAND USR 16528 310 PRINT "READ THE OTHER" 315 RAND USR 16528 320 PRINT "SIDE." 325 PAUSE 200 326 RAND USR 16528 327 FOR J=1 TO 20 330 LET D$="--**++**--" 340 PRINT D$ 345 RAND USR 16528 350 NEXT J 355 PAUSE 100 356 RAND USR 16525 357 RAND USR 16528 360 PRINT "OR WE CAN DO" 365 RAND USR 16528 370 PRINT "OTHER THING ON" 375 RAND USR 16528 380 PRINT "ON THIS SIDE." 385 RAND USR 16528 390 PAUSE 100 395 RAND USR 16525 400 RAND USR 16528 405 PRINT "GIVE ME A" 410 RAND USR 16528 415 PRINT "NUMBER." 420 INPUT X 425 RAND USR 16528 430 PRINT "THANKS,YOUR" 435 RAND USR 16528 440 PRINT "NUMBER WAS" 442 RAND USR 16528 444 PRINT X 445 RAND USR 16528 450 PRINT "GIVE ME" 452 RAND USR 16528 454 PRINT "ANOTHER." 455 INPUT Y 456 RAND USR 16528 465 PRINT "YOUR NUMBER" 470 RAND USR 16528 475 PRINT "WAS ";Y 480 RAND USR 16528 485 PRINT "AND THEY ADD" 490 RAND USR 16528 495 PRINT "UP TO ";X+Y 500 PAUSE 300 505 RAND USR 16525 510 RAND USR 16528 515 PRINT "NOT TOO SHABBY" 520 RAND USR 16528 525 PRINT "HUH......." 530 PAUSE 200 535 RAND USR 16525 540 RAND USR 16528 545 PRINT "WELL THATS IT" 550 RAND USR 16528 555 PRINT "ABOUT IT, I" 560 RAND USR 16528 565 PRINT "HAVE TO GET" 570 RAND USR 16528 575 PRINT "WHILE THE" 580 RAND USR 16528 585 PRINT "GETTINS GOOD." 590 PAUSE 200 595 RAND USR 16525 600 RAND USR 16528 605 PRINT "B Y E." 610 PAUSE 100 620 POKE 16514,0 625 POKE 16515,0 630 POKE 16516,0 635 CLS 640 GOTO 1 697 STOP 698 SAVE "DEM[O]" 699 GOTO 1 ```