December 25

This file is part of and Miscellaneous Programs. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Holiday

This program, a variation on Warren Fricke’s Santa-C, displays an animated Christmas card with accompanying music. It draws a festive scene using block graphics and UDGs — including a Christmas tree, decorations, and candles — then cycles through three melodic voices encoded as packed strings where each note is represented by a duration digit and a two-digit pitch value offset by 10. The scrolling text banners in strings F$, G$, and H$ rotate one character left each beat to create a ticker-tape animation effect. An AY sound chip initialisation sequence is sent via the SOUND statement at line 4210 before the music loop begins.


Program Structure

  1. Line 10 — Entry point: calls the graphics setup subroutine at 5000, then the screen-drawing subroutine at 4000.
  2. Lines 1100–1350 — Main music/animation loop: plays three melody voices (d$, a$, c$) in sequence, then loops back.
  3. Lines 2000–3500 — Display subroutine: prints two scrolling banner lines from f$, g$, or h$, then rotates each string left by one character.
  4. Lines 4005–4220 — Screen setup: draws border, starfield, geometric shapes, block-graphic artwork (tree, candles, decorations), flashing “MERRY CHRISTMAS” banner, and initialises AY registers.
  5. Lines 5000–5999 — Initialisation: POKEs 88 bytes of UDG data for characters \a through \k, reads note-duration constants, and builds the melody strings and banner strings.
  6. Line 6000 — Saves the program with autostart at line 1.

Note Encoding Scheme

Each melody string (a$, b$, c$, d$) packs notes as 3-character groups: one character for duration index and two characters for a pitch value. The playback loop (e.g. lines 1100–1135) steps through the string in strides of 3:

  • dur = VAL d$(n) — reads a single digit; the actual BEEP duration is dur/48 seconds.
  • pit = VAL d$(n+1 TO n+2) - 10 — reads a two-digit pitch code and subtracts 10 to recover the semitone offset passed to BEEP.
  • The subtraction of 10 allows pitches from semitone 0 upward to be stored as two-digit positive integers (e.g. “10” = 0, “22” = 12, “09” = −1).

The duration constants aj are read at line 5100 from the DATA at line 5040 (.25, .5, 1, 2, 4, 6, 8, 12, 16, 20) and then embedded as single digit characters inside the melody strings via string concatenation — a compact look-up table substitution done at initialisation time.

Scrolling Banner Technique

Three 42-character strings f$, g$, and h$ are built in lines 5050–5070 as 32 spaces followed by 10 UDG characters. Each time the display subroutine at line 3500 is called, every string is rotated left by one position:

  LET f$=f$(2 TO LEN f$)+f$(1)

Only the first 32 characters (one screen row) are PRINTed at any time, so the UDG motif scrolls smoothly into view from the right and then wraps around. Lines 2000 and 3005 select between g$ and h$ on alternating note beats using the parity test n/2=INT(n/2), producing a two-line alternating animated display.

UDG Definitions

Lines 5000–5030 POKE 88 bytes (11 UDGs × 8 bytes each) into the UDG area starting at USR "a". The UDGs used in the banners and scene graphics are:

EscapeCharRole (inferred)
\a144Banner animation frame 1
\b145Banner animation frame 2
\c146Banner animation frame 3
\d\g147–150Banner animation frames 4–7
\h\k151–154Banner end-cap / special motifs

AY Sound Chip Initialisation

Line 4210 uses SOUND to write directly to AY-3-8912 registers before the music loop starts:

  • Registers 0/1 (channel A pitch): 34
  • Registers 2/3 (channel B pitch): 26
  • Registers 4/5 (channel C pitch): 12
  • Register 6 (noise period): 0
  • Register 7 (mixer): 0 (all tone channels enabled)
  • Registers 8–10 (amplitudes): 16 (envelope mode)
  • Registers 12–13 (envelope period): 8

Actual melody playback then uses BEEP (which drives the internal buzzer or AY tone channel depending on the implementation), not further SOUND statements.

Graphics Drawing

The scene is built entirely in BASIC without machine code:

  • Line 4030: 70 random coloured PLOT OVER 1 dots for a starfield, using INK (3*RND+4) to vary between yellow, cyan, and white.
  • Lines 4040: A series of CIRCLE OVER 1 calls with fractional step (1.3) to draw an imperfect ring/wreath effect.
  • Lines 4050: Two PLOT/DRAW pairs for diagonal lines (ground/hill silhouettes).
  • Lines 4060–4120: Block-graphic characters (▐, █, ▌, ▝, ▀, ▘) to render a candle and flame.
  • Lines 4160–4200: A Christmas tree outline and star topper built from characters and underscores, printed with INK 4 (green) and INK 6 (yellow).
  • Line 4150: A three-line FLASH 1 banner for “MERRY CHRISTMAS”.

Content

Related Products

Related Articles

Related Content

Image Gallery

December 25

Source Code

   10 GO SUB 5E3: GO SUB 4E3
 1100 FOR n=1 TO LEN d$-2 STEP 3
 1135 LET dur=VAL d$(n): LET pit=VAL d$(n+1 TO n+2)-10: BEEP dur/48,pit: GO SUB 2e3+(1e3 AND n/2=INT (n/2)): NEXT n
 1200 FOR n=1 TO LEN a$-2 STEP 3
 1235 LET dur=VAL a$(n): LET pit=VAL a$(n+1 TO n+2)-10: BEEP dur/48,pit: GO SUB 2e3+(1e3 AND n/2=INT (n/2)): NEXT n
 1300 FOR n=1 TO LEN c$-2 STEP 3
 1335 LET dur=VAL c$(n): LET pit=VAL c$(n+1 TO n+2)-10: BEEP dur/48,pit: GO SUB 2e3+(1e3 AND n/2=INT (n/2)): NEXT n
 1350 PAUSE 30: GO TO 1100
 2000 PRINT AT 6,0; INK 6;f$( TO 32)' INK 6;g$( TO 32): GO TO 3500
 3005 PRINT AT 6,0; INK 6;f$( TO 32)' INK 6;h$( TO 32)
 3500 LET f$=f$(2 TO LEN f$)+f$(1): LET g$=g$(2 TO LEN g$)+g$(1): LET h$=h$(2 TO LEN h$)+h$(1): RETURN 
 4005 BORDER 0: PAPER 0: INK 7: CLS : FOR N=1 TO 70
 4030 PLOT OVER 1; INK (3*RND+4);255*RND,50*RND+125: NEXT N
 4040 FOR f=1 TO 8 STEP 1.3: CIRCLE OVER 1;200,145,f: NEXT f
 4050 PLOT 0,48: DRAW 255,32: PLOT 0,112: DRAW 110,-51
 4060 PRINT AT 13,5; INK 2;"▐"
 4070 PRINT AT 14,5;"██████";AT 15,5;"██████";AT 16,5; INK 1;"▐████▌";AT 17,5;"▝▀▀▀▀▘"
 4090 PRINT AT 16,6; INK 6;"▄";AT 16,9;"▄";AT 17,9;"▀": PLOT OVER 1;78,39
 4120 PRINT INK 1;AT 9,8;".";AT 11,5;".";AT 12,5;"."
 4130 PRINT INK 1;AT 11,6;"S"; OVER 1;CHR$ 8;"s"
 4140 PRINT INK 1;AT 10,7;"O"; OVER 1;CHR$ 8;"s"
 4150 PRINT FLASH 1; INK 4; PAPER 2;AT 19,2;"                  ";AT 20,2;" MERRY  CHRISTMAS ";AT 21,2;"                  "
 4160 PRINT INK 4;AT 9,26;"█";AT 10,25;"█ █";AT 11,26;"██";AT 12,25;"█ ██";AT 13,26;"██";AT 14,24;"█ ███";AT 15,23;"█ ███ █";AT 16,22;"█   █   █"
 4170 FOR N=16 TO 18: PRINT INK 6;AT N,26;"█": NEXT N
 4200 PRINT AT 8,26;"_";AT 9,25;"_";AT 9,27;"_"
 4210 SOUND 0,34;1,0;2,26;3,0;4,12;5,0;6,0;7,0;8,16;9,16;10,16;12,8;13,8
 4220 PRINT AT 11,28;"_";AT 13,28;"_";AT 14,29;"_";AT 15,30;"_";AT 17,11;"_";AT 18,2;"__________________";AT 19,24;"______";AT 20,21;"____": RETURN 
 5000 RESTORE : FOR n=0 TO 87: READ k: POKE USR "a"+n,k: NEXT n
 5010 DATA 0,2,4,8,120,24,28,27,0,0,0,0,0,0,24,240,0,16,16,32,96,176,24,27,19,15,6,28,32,64,0,0
 5020 DATA 112,242,48,24,4,2,0,0,19,79,60,32,16,8,0,0,112,242,48,32,32,64,128,0,0,0,6,7,2,3,7,7
 5030 DATA 0,0,1,2,8,21,88,170,95,151,188,82,49,15,0,0,218,254,8,20,34,255,0,0
 5040 DIM E$(32): DATA .25,.5,1,2,4,6,8,12,16,20
 5050 LET F$=E$+"\a\b\c\b\a\b\c\b\h\i"
 5060 LET G$=E$+"\d\e\f\g\d\e\f\g\j\k"
 5070 LET H$=E$+"\f\g\d\e\f\g\d\e\j\k"
 5100 READ a,b,c,d,e,f,g,h,i,j
 5120 LET A$="d17d14d15e17f17d17d19d21e22g22d14d15e17e17e17d19d17e15g15e14e17e10e14e12g15e09i10"
 5130 LET b$="g79e79d79"
 5140 LET c$="g69e69e12e14e12e11e12e09g09e12e14e12e11e12h09e14e16e14e13e14e11e11e11d11d12e14e12e11e09e07e69f07d07d04d05e07f07d07d09d11e12g12d04d05e07e07e07d09d07e05g05e04e07e00e04e02g05e14j12h69"
 5150 LET d$=a$+b$
 5999 RETURN 
 6000 SAVE "dec25" LINE 1

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

People

No people associated with this content.

Scroll to Top