A Few Christmas Programs

Date: 1984
Type: Program
Platform(s): TS 2068
Tags: Holiday

A Christmas card on tape, followed by a menu of joke programs. The card shows a snowman with a broom and a caricature of Clive Sinclair for a face, and prints “MERRY CHRISTMAS”, “AND A HAPPY, NEW COMPUTING YEAR IN 1985” and the greeting in large lettering, a page at a time, each after a “PRESS A KEY” speech bubble. The menu offers:

  • Super Adventure: a two-word adventure in which whatever you type gets you killed.
  • Word Processor: your typing drops into a drawn kitchen blender, which whirrs at the speed you chose and processes the words away.
  • Spectrum versus 2068: “a complete list of all Spectrum commands and functions which are not available on the T/S 2068”, which is empty.
  • Xtra Fast Loading: advice to run the cassette recorder on 220 volts.
  • Uncle Clive again (spelled “Unle” on screen): the card once more.

The card is addressed to the Toronto Timex-Sinclair Users Club from “the London members”. No author is named.

Program Analysis

Structure

  • Line 200 loads 6,046 bytes of code and graphics at 59490 and starts the card.
  • Lines 300–640: draw the snowman. The face is built from UDGs taken from four different places in the code block by moving the UDG pointer (23675/6) between PRINTs.
  • Lines 700–850: the messages, drawn by machine code, and the “PRESS A KEY” bubble.
  • Lines 100–150: the menu. Lines 1000–5010: the five items, reached with GO SUB q*1000.

Machine code

Two routines in the code block are called from BASIC. USR 60000 prints the text in p$ in large letters, with the screen address set in c beforehand, and USR 61400 is called after each page, with c, s and t set and one byte of the routine POKEd first. The BASIC passes its values only through these variables. The routines were not disassembled.

Notable Techniques

  • The large greeting is drawn by machine code from ordinary BASIC strings.
  • The blender uses the TS2068 SOUND command to set the AY chip’s noise and envelope (line 2210) and SOUND 8,0 to stop it.
  • POKE 23607 switches CHARS to a different character set for the “To:” and “From:” labels.

Potential Issues

  • The menu does not reject 0 or negative numbers. 0 gives GO SUB 0, which restarts the menu inside a subroutine call.

This program came from an Oliger (JLO SAFE) disk, a copy of the SNUG library disk 17/18, and was converted to load from tape. The LOAD / in line 200 and the SAVE / in line 9998 became plain LOAD and SAVE, and the code block follows the program on the tape. It was tested in ZEsarUX through the card, the menu and the word processor.

Related Content

Image Gallery

Source Code

  100 CLS : PRINT '" A FEW CHRISTMAS PROGRAMS"
  110 PRINT AT 7,PI;"1  Super Adventure"''"   2  Word Processor"''"   3  Spectrum versus 2068"''"   4  Xtra Fast Loading"''"   5  Unle Clive again"
  120 INPUT "    SELECT by NUMBER...  ";q
  130 IF q>5 THEN GO TO 120
  140 GO SUB q*1000
  150 GO TO 100
  200 CLEAR 59489: PRINT "Loading Code": LOAD "Xmasgift C"CODE : BEEP .2,22
  300 INK 0: PAPER 7: BORDER 5: CLS 
  400 POKE 23675,88: POKE 23676,255
  410 PRINT "       cdefg"
  420 PRINT "      kl   pq"
  430 PRINT "     stu    ab"
  440 POKE 23675,182: POKE 23676,233
  450 PRINT "     cdef   hi"
  460 PRINT "     jklmn  q"
  470 PRINT "     rstu";
  480 POKE 23675,12: POKE 23676,233
  490 PRINT "abcd"
  500 PRINT "     efghijkl"
  510 PRINT "     mnopqrs"
  520 PRINT "     tu";
  530 POKE 23675,98: POKE 23676,232
  540 PRINT "abcd"
  550 PRINT "      fghij"
  600 PLOT 48,112: DRAW 40,0,1.64*PI: PLOT 31,80: DRAW -15,-15,.4*PI: DRAW 0,-14,.4*PI: DRAW 106,0,.8*PI: DRAW -16,16,.4*PI
  610 PLOT 69,92: DRAW -4,0: DRAW -2,4: DRAW 8,0: DRAW -2,-4: DRAW 4,-32: DRAW -6,-6: DRAW -6,6: DRAW 4,32
  620 PLOT 38,62: DRAW 8,14,PI: DRAW 0,8: PLOT 90,82: DRAW 0,-8: DRAW 8,-14,PI
  630 PLOT 48,61: DRAW 36,-60: DRAW 2,2: DRAW -36,60: PLOT 32,90: DRAW -16,24: DRAW 2,2: DRAW 16,-24
  640 PRINT AT 6,1;"ut";AT 7,1;"sr"
  700 LET c=28808: LET s=16*0+2: LET p$="    MERRY": LET t=0: RANDOMIZE USR 60000
  710 LET c=22664: LET p$="  CHRISTMAS": RANDOMIZE USR 60000
  720 GO SUB 800
  740 LET c=28808: LET t=0: LET s=2: LET p$="    AND A": RANDOMIZE USR 60000: LET c=c-6144: LET p$="  HAPPY, NEW": RANDOMIZE USR 60000
  750 LET c=c-6144: LET p$="COMPUTING YEAR": RANDOMIZE USR 60000
  752 LET c=c-6144: LET p$="   IN 1985": RANDOMIZE USR 60000
  760 GO SUB 800
  770 POKE 23607,248: PRINT AT 8,16;"To: ";: POKE 23607,245: PRINT "THE TORONTO";AT 10,16;"TIMEX-SINCLAIR";AT 12,18;"USERS CLUB"
  780 POKE 23607,248: PRINT AT 16,16;"From:";: POKE 23607,245: PRINT "THE LONDON";AT 18,22;"MEMBERS": POKE 23607,60
  790 GO SUB 800
  795 GO TO 100
  800 PLOT 132,140: DRAW 0,16,-PI: DRAW 80,0: DRAW 0,-16,-PI: DRAW -72,0: DRAW -24,-8,-.6*PI: DRAW 16,8,.5*PI: PRINT AT 3,16;"PRESS A KEY"
  810 IF INKEY$="" THEN GO TO 810
  820 PRINT AT PI,16;" THANK YOU ": PAUSE 10
  830 PRINT AT 2,15;"             ";AT PI,15;"             ";AT 4,15;"             ";AT 5,14;"    "
  840 LET c=30848: LET s=4344: POKE 61404,104: LET t=4: RANDOMIZE USR 61400
  850 RETURN 
 1000 CLS 
 1010 POKE 23675,98: POKE 23676,232
 1020 PRINT AT 11,PI;"k";AT 9,4;"k";AT 6,6;"k";AT 5,9;"k";AT 4,12;"k"
 1030 PLOT 16,48: DRAW 16,24: DRAW 16,40: DRAW 32,16: DRAW 48,16: DRAW 8,16: PLOT 16,72: DRAW 16,48: DRAW 32,16: DRAW 40,8: DRAW 16,16
 1040 LET a$="l l l l l"
 1050 FOR q=5 TO 9: PRINT AT q,q+13;a$: NEXT q
 1060 PRINT AT 8,8;"m";AT 9,8;"no"
 1070 PRINT AT 13,9;"You are standing beside";TAB 9;"a river. Nearby is a";TAB 9;"wooded area. At your";TAB 9;"feet lies a wand."
 1080 PRINT AT 19,PI;"IN 2 WORDS OR LESS,"'"   WHAT DO YOU DO?"
 1090 INPUT B$
 1100 LET c=LEN b$: IF c>12 THEN PRINT AT 19,PI;"I cannot understand big words": GO TO 1090
 1110 FOR q=1 TO c-3
 1120 IF b$(q TO q+3)="wand" THEN GO TO 1140
 1130 NEXT q
 1135 GO TO 1200
 1140 CLS : PRINT "The magic wand turns everything into gold."''"BUT... gold is useless in this  adventure and you have just diedof starvation."''"Better luck next time."
 1150 PRINT AT 19,0;"Press any key": PAUSE 0
 1160 RETURN 
 1200 CLS : PRINT "You should have taken the wand."''"Have you never played adventure games before?"''"You are now totally lost and    will die of starvation."''"Better luck next time!"
 1210 GO TO 1150
 2000 CLS 
 2020 PRINT "  W O R D   P R O C E S S O R"
 2030 PLOT 104,32: DRAW 8,-8: DRAW 120,0: DRAW 8,8: DRAW -136,0
 2040 PLOT 184,32: DRAW 8,56: DRAW 32,0: DRAW 8,-56
 2050 PLOT 108,48: DRAW -12,0: DRAW -16,48: DRAW 20,0
 2060 PLOT 112,32: DRAW -16,80: DRAW 0,32: DRAW 24,0: DRAW 0,-32: DRAW 60,0: DRAW -10,-80
 2070 FOR q=12 TO 16: PRINT AT q,25;q-11;"*": NEXT q
 2080 PRINT AT 17,15;"'....''''."
 2090 INPUT "  SELECT SPEED (1-5)...  ";d: PRINT AT 11+d,26;"*"
 2120 PRINT AT 21,0;"ENTER TEXT..."
 2130 PAUSE 0: LET d$=INKEY$
 2140 IF d$=" " THEN GO TO 2200
 2150 PRINT AT 9+RND*6,14+RND*5;d$
 2160 GO TO 2130
 2200 PRINT AT 17,15; FLASH 1;"'....''''."
 2210 SOUND 7,55;8,16;13,12;12,6-d
 2220 FOR q=9 TO 15: PRINT AT q,14;"       ": PAUSE 10-d: NEXT q
 2240 PRINT AT 17,15;"'....''''.": SOUND 8,0: PRINT AT 20,0;"Press STOP to quit"'"or enter more text": PAUSE 0
 2250 IF CODE INKEY$=226 THEN RETURN 
 2260 LET d$=INKEY$: GO TO 2140
 3000 CLS 
 3020 PRINT " The following is a complete"'"     list of all Spectrum"'"    commands and functions"'"  which are not available on"'"         the T/S 2068:"
 3030 PAUSE 150: PRINT AT 21,0;"scroll?": PAUSE 0: RETURN 
 4000 CLS 
 4020 PRINT "For super fast program loading..": PAUSE 0: PRINT AT 8,0;"OPERATE CASSETTE RECORDER"''"ON 220 VOLTS"
 4030 PAUSE 0: RETURN 
 5000 GO TO 300
 5010 RETURN 
 9998 SAVE "XMASGIFT" LINE 200: BEEP .2,22: SAVE "Xmasgift C"CODE 59490,6046: BEEP .2,22: PRINT '"SAVED O.K."

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