Peace

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Demo

This program generates “peace dove” graphic stickers using UDGs (User Defined Graphics) and the TS2068’s LPRINT facility for a thermal or RS-232 printer. It defines 14 UDGs (characters a through n) by POKEing 8-byte bitmap data into memory via USR “a”, constructing a multi-character dove-and-bomb illustration assembled from those custom characters. Three output modes are offered: a stand-alone peace sticker (LPRINT), a combined address label plus graphic (LPRINT), and an on-screen display using PRINT AT. Block graphics characters (▖▌▀, etc.) are used for the sticker’s decorative border. The program includes a subroutine (lines 530–640) that displays explanatory text across multiple screenfuls, using a PAUSE 0 keypress gate between pages.


Program Analysis

Program Structure

The program is organized into a main flow with several distinct sections connected by GO TO and GO SUB:

  1. Initialization (lines 10–80): Loads UDGs via subroutine at line 660, then runs the introduction text subroutine at line 530.
  2. Menu (lines 90–160): Presents three options — sticker ("s"), address label ("a"), or display-only ("d") — and branches accordingly.
  3. Sticker output (lines 170–260): LPRINTs a bordered peace-dove graphic with slogans.
  4. Address label output (lines 270–390): LPRINTs a combined address and peace-dove graphic.
  5. Screen display (lines 400–520): PRINTs the dove graphic to the screen using PRINT AT, then waits for "s" or "m" input.
  6. Introduction subroutine (lines 530–650): Displays explanatory text across multiple screens, calling the keypress-wait sub at line 620.
  7. UDG loader (lines 660–810): Reads 112 bytes of bitmap data and POKEs them into UDG memory.
  8. Save line (820): SAVE "PEACE" LINE 30 saves with auto-run from line 30.

UDG Definition and Layout

Line 660 uses a FOR loop reading 112 bytes (14 UDGs × 8 bytes each) from DATA statements at lines 670–800, POKEing them sequentially starting at USR "a". This defines characters a through n, which together form the peace-dove-and-bomb composite image. The dove graphic is assembled across a 4×2 block of UDGs (rows printed at lines 400–450 and within the LPRINT blocks):

UDGRole in image
aDove body top-left
bDove body top-right / wing
cDove mid-left
dDove mid-right / bomb intersection
f, g, hLower dove / tail sections
i, j, kBomb lower sections
l, mWing or bomb mid sections
nBomb/fuse detail

The :: block graphic (full block █) appears inline within the LPRINT strings alongside UDGs to fill out the bomb shape, demonstrating mixed use of UDGs and built-in block graphics characters in a single image.

DATA Anomaly: Variable y in DATA Statements

Lines 670–800 contain DATA entries using the bare token y (e.g., DATA 0,y,y,56,60,62,63,y). In Sinclair BASIC, READ will evaluate each data item as an expression, so y refers to the numeric variable y. Since y is never explicitly assigned in the program, it defaults to 0. This means every occurrence of y in the DATA statements is effectively 0, making it a shorthand zero-fill technique — intentional or otherwise. The programmer likely used y as a readable stand-in for zero to indicate “empty row” bytes in the UDG bitmaps.

Sticker Border Technique

Both LPRINT sticker formats use Spectrum/TS2068 block graphics for their borders. The top border (e.g., line 170) uses .... repeating characters, while the bottom border (line 240) uses '''''' repeating characters. The left and right sides use : () to create a solid rectangular frame. This is a common technique for drawing pseudo-box borders entirely within character cells without any additional drawing routines.

Multi-Screen Text Subroutine

The introduction subroutine starting at line 530 spans several PRINT statements with embedded newlines created by the ' idiom (which generates a PRINT newline in Sinclair BASIC). At line 560, it calls the keypress-wait subroutine at line 620 via GO SUB 620, which uses PAUSE 0 at line 630 to halt until any key is pressed. This is a standard Sinclair idiom for paged text display. The subroutine at line 620 doubles as a reusable “any key” prompt since it is also called from line 620 directly by falling through from line 610.

Notable BASIC Idioms

  • The PRINT OVER 1; AT 0,10;"_____________" at line 40 and 570 underlines the title by printing underscores in OVER 1 mode, which XORs them with the existing text pixels to create an underline effect without erasing characters.
  • The menu loop (lines 100–160) uses sequential IF … THEN GO TO tests rather than a computed branch, a common pattern in BASIC of this era.
  • After each LPRINT section (lines 250, 380), the program jumps back to the CLS/menu at line 90 rather than falling through to a STOP, which appears immediately after as a safety catch (lines 260, 390) in case of unexpected flow.
  • The SAVE "PEACE" LINE 30 at line 820 causes the program to auto-start at line 30 (skipping the REMs) when loaded.

Bugs and Anomalies

  • The REM at line 70 contains a coded reference to the graphic layout: n,6;ba;n,6;c::dn;…. This appears to be a developer note describing the UDG arrangement, left in the final program.
  • Line 530 contains a typographical split in the word “the/service” — "I was in theservice" — suggesting the programmer miscounted the 32-character line width when formatting the text to fit the screen.
  • The subroutine at line 620 is structured so that both line 560 (GO SUB 620) and line 600 fall through to it — line 610 calls it as a regular PRINT statement, then line 620 follows immediately. This means the “Any key for program” prompt and PAUSE are executed at both the mid-introduction pause and the end, which is the intended paged behavior.

Content

Appears On

Library tape of the Indiana Sinclair Timex User’s Group.

Related Products

Related Articles

Related Content

Image Gallery

Peace

Source Code

   10 REM Program to generate graphic stickers, using the TS printer
   20 REM Use the techniques in the subroutines to generate your own message and/or graphic.
   30 CLS 
   40 PRINT AT 0,10;"PEACE GRAPHIC": PRINT OVER 1;AT 0,10;"_____________"
   50 GO SUB 660
   60 REM graphics for peace
   70 REM e.g. n,6;ba;n,6;c\::dn;n,7;mlg;n,7;f#h;n,8;i\::;n,8;jk
   80 GO SUB 530
   90 CLS 
  100 PRINT "For peace sticker input ""s"""''"For your address input ""a"""''"For the display only input ""d"""
  110 INPUT b$
  120 CLS 
  130 IF b$="s" THEN GO TO 170
  140 IF b$="a" THEN GO TO 270
  150 IF b$="d" THEN GO TO 400
  160 GO TO 100
  170 LPRINT "\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\.."
  180 LPRINT "\: \b\a                    \ :"
  190 LPRINT "\: \c\::\d\n""PEACE DOVE WINS!""\ :" 
  200 LPRINT "\:  \m\l\g                  \ :"
  210 LPRINT "\:  \f \h                  \ :"
  220 LPRINT "\:   \i\:: ""BAN THE BOMB &  \ :"
  230 LPRINT "\:   \j\k   SPACE WEAPONS!""\ :"
  240 LPRINT "\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''"
  250 GO TO 90
  260 STOP 
  270 LPRINT "\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\.."
  280 LPRINT "\: Mr. + Mrs. John Smith \ :"
  290 LPRINT "\: Address Street        \ :"
  300 LPRINT "\: Pleasentry USA    ZIP \ :"
  310 LPRINT "\:   \b\a                  \ :"  
  320 LPRINT "\:   \c\::\d\n   ""PEACE DOVE  \ :" 
  330 LPRINT "\:    \m\l\g      WINS!""    \ :"
  340 LPRINT "\:    \f \h                \ :"
  350 LPRINT "\:     \i\::""BAN THE BOMB & \ :"
  360 LPRINT "\:     \j\k SPACE WEAPONS"" \ :"
  370 LPRINT "\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''"
  380 GO TO 90
  390 STOP 
  400 PRINT AT 1,13;"\b\a"
  410 PRINT AT 2,13;"\c\::\d\n"
  420 PRINT AT 3,14;"\m\l\g"
  430 PRINT AT 4,14;"\f \h"
  440 PRINT AT 5,15;"\i\::"
  450 PRINT AT 6,15;"\j\k"
  460 PRINT AT 9,10;"""BAN THE BOMB"
  470 PRINT AT 10,15;"AND"
  480 PRINT AT 11,10;"""SPACE WEAPONS!"""
  490 INPUT "s=stop  m=menu ";a$
  500 IF a$="m" THEN GO TO 90
  510 IF a$="s" THEN STOP 
  520 GO TO 490
  530 PRINT ''"Please let me make this clear,  I am not countering those of    whom are sincerely trying to    protect our nation. I was in theservice like a lot of you."
  540 PRINT '"I do believe & trust in peace   though & this graphic gets the  meaning to you.";''"Really well, myself, I believe  it's a winner."
  550 PRINT '"Makes a winning sticker and,    or put your address where John  Smith is & use it as a return   address label"
  560 GO SUB 620: CLS 
  570 PRINT AT 0,10;"PEACE GRAPHIC": PRINT OVER 1;AT 0,10;"_____________"
  580 PRINT ''"You should be able to notice    that it is the peacedove that   breaks the bomb & saves mankind."
  590 PRINT '"Make sure your printer is on as the sticker & address are       LPRINT only."
  600 PRINT '"The program is easy to use &    without obstacles"
  610 PRINT '"Add colors, should you desire."
  620 PRINT AT 21,0;"Any key for program"
  630 PAUSE 0
  640 RETURN 
  650 STOP 
  660 FOR N=0 TO 111: READ Y: POKE USR "a"+N,Y: NEXT N
  670 DATA 0,y,y,56,60,62,63,y
  680 DATA 0,y,y,y,y,6,7,3
  690 DATA 0,y,31,y,y,15,7,3
  700 DATA 224,240,248,252,254,255,y,y
  710 DATA 255,y,y,127,63,31,14,7
  720 DATA 15,7,3,1,0,y,y,y
  730 DATA 0,1,3,6,12,16,0,y
  740 DATA 3,15,63,127,255,y,y,y
  750 DATA 128,192,224,240,248,252,254,255
  760 DATA 255,63,15,3,1,0,y,y
  770 DATA 255,252,240,192,128,0,y,y
  780 DATA 255,143,7,3,y,65,1,0
  790 DATA 127,255,y,y,126,60,24,15
  800 DATA 0,y,y,y,y,y,128,192
  810 RETURN 
  820 CLS : SAVE "PEACE" LINE 30

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top