--- title: "High Resolution Graphics" id: 53135 type: "computer_media" slug: "high-resolution-graphics" url: "http://localhost/computer_media/high-resolution-graphics/" markdown_url: "http://localhost/computer_media/high-resolution-graphics.md" published_at: "2024-02-21T00:48:46+00:00" modified_at: "2026-04-03T07:59:09+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/02/Bird-High-Res.jpg" excerpt: "A machine code graphics toolkit exposing eight USR entry points for high-resolution pixel plotting, screen switching, inversion, and a mixed-case printer routine." 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: "Inter-Pacific Systems" slug: "inter-pacific-systems" taxonomy: "post_tag" url: "http://localhost/tag/inter-pacific-systems/" - 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/" indiv: - name: "Craig Bird" slug: "craig-bird" taxonomy: "indiv" url: "http://localhost/indiv/craig-bird/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Cassette" programmers: - name: "Craig Bird" slug: "craig-bird" taxonomy: "indiv" url: "http://localhost/indiv/craig-bird/" download_url: "https://archive.org/download/timex-sinclair-software-archive/High%20Resolution%20Graphics%20%281984%29%28Inter-Pacific%20Systems%29%28CA%29%28TS1000%29%28Cassette%29.zip" mediadate: "1984" producer_company: - id: 27144 title: "Inter-Pacific Systems Inc." type: "company" url: "http://localhost/company/inter-pacific-systems/" images: - url: "http://localhost/wp-content/uploads/2024/02/Bird-High-Res.jpg" related_products: - id: 27146 title: "High Resolution Graphics" type: "product" url: "http://localhost/product/high-resolution-graphics-2/" media_type_tags: "Graphics" --- # High Resolution Graphics High Resolution Graphics is a machine code graphics toolkit for the ZX81/TS1000 that provides a 256×192 (or similar high-resolution) pixel display system accessible via direct USR calls. The program documents eight entry points—spanning addresses 16514 through 17600—that handle switching to the high-res screen, returning to the standard Sinclair display, clearing and inverting the high-res frame buffer, plotting and unplotting individual points, testing a point’s state, and driving an uppercase/lowercase printer routine. The REMs at line 0 and line 1 contain dense machine code stored as tokenized BASIC data, a common technique for embedding Z80 routines directly in the program file. Lines 20–320 serve as a self-contained demonstration and can be deleted once the USR entry points are in use, as noted by the on-screen instructions. A companion “BUSTOUT” breakout game and a “SAMPLE” program are included, both relying on the same machine code kernel loaded into memory above the BASIC area. *** ## Program Analysis ### Program Structure The listing actually contains three independent programs sharing a common machine code kernel embedded in REM statements: 1. **High Resolution Graphics loader/demo** (lines 10–320) — documents entry points and runs a brief display demonstration. 2. **BUSTOUT** (lines 1–60 of the second block) — a Breakout-style game that calls `USR 17298` for its main game loop. 3. **SAMPLE** (lines 10–120 of the third block) — a skeleton that invokes the hi-res screen and waits for a keypress before returning to the standard display. The machine code payload is stored in `REM` lines 0 and 1 of the respective blocks. Because the ZX81/TS1000 BASIC interpreter stores the raw bytes of a REM line verbatim, this is the standard method for embedding Z80 binary data inside a BASIC file without needing a separate loader. ### Machine Code Entry Points The BASIC documentation at lines 80–170 lists eight USR entry points. Their advertised functions are: | Address | Function | | --- | --- | | `16514` | Switch to the high-res display | | `16563` | Return to the standard Sinclair display | | `16572` | Clear the high-res display | | `16594` | Plot a point | | `16598` | Unplot a point | | `16602` | Test a point | | `17285` | Upper/lowercase printer driver | | `17572` | Print out the high-res screen | | `17600` | Invert the high-res screen | The close spacing of addresses 16594, 16598, and 16602 (4 bytes apart each) strongly suggests a common pixel-address calculation subroutine shared by all three point operations, with each entry point branching into it and then performing a set, reset, or test of the relevant bit. ### Demonstration Sequence (Lines 240–320) The demo loop at lines 240–280 iterates `N` from 0 to 20, POKEing `16417` with `N` before each `RAND USR 17285` call. Address 16417 is a system variable, and passing an incrementing value there likely selects successive character rows or scroll positions for the printer driver, creating a scrolling text effect. After the loop, `RAND USR 17600` inverts the screen, `SLOW` restores normal display mode, and `RAND USR 16514` switches to the hi-res framebuffer. The program then spins at line 290 waiting for any keypress, then `FAST`s, `CLS`es, and calls `RAND USR 16563` to restore the standard display. ### Key BASIC Idioms - `RAND USR
` — the idiomatic way to call machine code from BASIC; the return value in HL is discarded by RAND, preventing any type-mismatch error. - `IF INKEY$ ="" THEN GOTO 290` — a busy-wait keypress loop; the program blocks here until any key is pressed. - `POKE 16417,N` inside the demo loop passes a parameter to the machine code via a fixed memory location rather than through a register, a common technique when calling Z80 routines that do not use the BASIC parameter stack. - `SLOW` / `FAST` at lines 284 and 300 switch between the display-generating (SLOW) and non-display (FAST) modes, necessary when the hi-res driver manages the display independently. ### REM-Embedded Machine Code The lengthy `REM` at line 0 (and its counterpart in the other program blocks) contains the entire Z80 machine code binary. When the BASIC file is loaded, this data sits at a fixed offset from the start of the BASIC area. The `RAND USR 16572` at line 30 is the first call, using it to initialize or clear the hi-res buffer before the demo proceeds. Because the REM content is rendered here as tokenized BASIC keywords (the file’s bytes happen to match keyword token values), the disassembly-like appearance of the REM line is an artifact of the tokenizer, not actual BASIC code. ### BUSTOUT Integration The BUSTOUT game calls `USR 17298`, an entry point not listed in the documentation panel, suggesting it is an internal game-logic routine within the same machine code block. The game uses `PAUSE 3E4` (approximately 30,000 display frames) at line 30 as a long delay, and its main loop is entirely handled in Z80 code. Lines 1–9 provide instructions and wait for a keypress before starting; line 10 launches the machine code game engine. ### SAMPLE Program The SAMPLE skeleton (third block, lines 30–120) calls the same three USR entry points — `16572` (clear), `16514` (show hi-res), and `17298` (game/demo loop) — confirming the shared kernel design. Line 110 begins a `FOR N=18024 TO 18081` loop with only a `REM` body, indicating that range covers the machine code area and the loop was likely used during development to examine or verify memory contents. ### Anomalies and Notes - Line 200 instructs the user to press ENTER to exit, but the actual wait at line 290 responds to *any* key, not specifically ENTER. - The `SAVE "HIRE[S]"` at line 20 and `SAVE "BUSTOU[T]"` / `SAVE "SAMPL[E]"` in the other blocks allow each program to re-save itself with its machine code REM intact. - Lines 20–320 are explicitly noted as removable once the USR entry points are in use, making the toolkit self-documenting in its own source. ## Source Code ``` 0 REM Y: GOSUB #<>5["]RNDTAN 5 TO NEW)5 NEXT : RETURN▞-( RETURN▞"" GOSUB #PEEK COPY;LN INT RND▌TAB [,]RNDLN [>]▝LN 4▝<>5["]RND#[8]▝Y2 GOSUB #<>5▟▝TAN 5 #:""▞4Q~~7( CLSQTAN 7$4 NEXT TAN DIM TAN : /▞:▘/▝:▝U#RND #A ##DDDDD;U#RND RETURN█K#▞▒ACS ZK▝ACS SACS ZK▖ACS SACS S#-#;# FAST5ZINKEY$ ##[Y]C▀7/ IF [R] GOSUB ###[R]4▖#[K]/▞X4~~#J[5]#;# LPRINT #/▘ LPRINT #[5]C▌R▘▘ TAN ▘ [R]TAN RETURN▝~~A▜[)]["]9[Z]▙▝Z[9]")▖[A][~~][$][$]~~~~~~~~~~▗>>)>>[-]Q[-][X][-]S[-]Q~~Q~~~~~~Q~~[-]££[-]B~~BL▌▌▌▌▌L▌LLLLL▌BL▜£▜LB£8▜L▜8£~~~~[-]~~~~[-]~~~~QQ[-]QQ~~~~~~~~[-]~~~~~~~~,,[Z]Q[Z],,~~£8▜L▌>▝~~Q~~~~Q▌~~~~~~~~~~~~Q▌~~~~~~~~~~QQ[Z]?????[Z]▌[X]QQQQQ[.]▀£[-]>>[-][-]££[-]££[-]???[-]£££[-]>>[Z]££[Z][-]>>[-]??[-][-]£8▜L▌>▙▀▀▙▀▀▙[-]??[-]££[-]~~~~[Z][D][D][Z]£>>[-]???[-]~~~~[-]>>>[-]££[-]???[-]~~~~[-]?[-]>[-][Z]▌▌[-]▌▌▌~~~~[-]?[-]£[-]>>[-]????L~~LLLLL£~~££££[-]>>[:][X]B[X][:]LLLLLLL~~~~[-]TTTT~~~~[-]????~~~~[-]???[-]~~~~[-]?[-]>>~~~~[-]?[-]1A~~~~[-]>>>>~~~~[-]>[-]£[-]LL[-]LLL[.]~~~~????[-]~~~~?[D]QQL~~~~TTTT[-]~~~~?[D]Q[D]?~~~~??[-]£[-]~~~~[-]▜QQ[-][-]??[-]???[-]??[-]??[-][-]>>>>>[-][Z][D]▀▀▀[D][Z][-]>>[-]>>[-][-]>>[-]>>>[-]>>>[:]?[-]▀▀▀▙▀▀▀[Z]QQQQQ[Z]£££££O[.]?[:][X]B[X][:]?>>>>>>[-][-]TTTTTT▀99▞██▀[-]?????[-][-]??[-]>>>[-]???T[:][-][-]??[-][X][X][:][-]>>[-]££[-][-]QQQQQQ??????[-]??[D][D]QQLTTTTTT[-]?[D][D]Q[D][D]??[D]QLQQQ[-]▜▜QQQ[-]YYY""#YYC##[>]#YU5RNDA #▘ #DDD##DDDDD,,;6##E£RND76##E### RETURN# RETURN C#CHR$ "M▟# RETURN[,]S▌CHR$ #M▟#E### RETURNTAN COS 6▙#▘ U▟#A ###DDD[B] GOSUB #,,)#INKEY$ ;#ACS [R]E###)5 ;6##£Y▛[T]4 OR E▙#76##E##76##/[7]E##76##/ INPUT 76##E##76##/▙E##76##/ INPUT -▘5WRNDLN SCROLL▝VAL FAST[J]#PEEK CLS LPRINT LN #?S▌3PEEK CLSINT £<= CLS▗ IF THEN▒K INPUT FASTSTR$ # RETURN▝[3][7]▛[7]###7 RETURN#C8 FASTACS B▗▗A▛ACS =▄#ACS )[3][I]#▞▒#ACS ▘3#<= CLS3K CLS#PEEK CLS( LET LPRINT /STR$ <= CLS3K CLS#?PEEK CLSSGN 0ACS #▞[B]AT +4[4]Y▖PEEK CLSLN ▛▝AT 5#RNDQ#▞4FQ ( CLS#ACS COPYMSRNDTAN Y""5 #)WRND▘4 FAST PRINT GOSUB [K]LN 4# LET LPRINT ▘5 ,,X4 REM TAN 5 #2█:""▞4#▚#7( IF 7$4 POKE TAN G BIRD (C) 1984 10 REM HIGH RESOLUTION GRAPHICS PROGRAM VERSION 2.1 (C) 1984 CRAIG BIRD 20 SAVE "HIRE[S]" 30 RAND USR 16572 40 PRINT "[H][I][G][H] [R][E][S][O][L][U][T][I][O][N] [G][R][A][P][H][I][C][S] [P][R][O][G][R][A][M]" 50 PRINT " [V]ERSION 2" 60 PRINT " ([C]) 1984 BY [C]RAIG [B]IRD" 70 PRINT 80 PRINT "16514-[G]OTO HIGH RES SCREEN" 90 PRINT "16563-[R]ETURN TO [S]INCLAIR DISPLAY" 100 PRINT "16572-[C]LEAR HIGH-RES DISPLAY" 110 PRINT "16594-[P]LOT A POINT " 120 PRINT "16598-[U]NPLOT A POINT" 130 PRINT "16602-[T]EST A POINT" 140 PRINT "17285-[U]/[L] CASE PRINTER" 150 PRINT "17572-[P]RINT OUT HIGH-RES SCREEN" 160 PRINT "17600-[I]NVERT HIGH-RES SCREEN" 170 PRINT 180 PRINT "[L]INES 20 TO 320 MAY BE REMOVED" 190 PRINT 200 PRINT "[P]RESS [E][N][T][E][R] TO EXIT" 240 FOR N=0 TO 20 250 POKE 16417,N 260 RAND USR 17285 270 SCROLL 280 NEXT N 282 RAND USR 17600 284 SLOW 286 RAND USR 16514 290 IF INKEY$ ="" THEN GOTO 290 300 FAST 310 CLS 320 RAND USR 16563 0 REM Y: GOSUB #<>5["]RNDTAN 5 TO NEW)5 NEXT : RETURN▞-( RETURN▞"" GOSUB #PEEK COPY;LN INT RND▌TAB [,]RNDLN [>]▝LN 4▝<>5["]RND#[8]▝Y2 GOSUB #<>5▟▝TAN 5 #:""▞4Q~~7( CLSQTAN 7$4 NEXT TAN DIM TAN U9RND RETURN COPY4 RAND LN ▙RND5[S]#:▒LN AT RND#P#W###### RETURNTAN COS RETURN~~4▝: RETURN£4▝:▀ RETURN▜4▝:£ RETURN[)]4▝:? RETURNI4▝:K RETURN[M]4▝:N RETURN[Z]4▖7£/ RUN FASTCHR$ 0#A ; FOR LPRINT 7# RETURN