--- title: "Tree" id: 64779 type: "computer_media" slug: "tree" url: "http://localhost/computer_media/tree/" markdown_url: "http://localhost/computer_media/tree.md" published_at: "2026-03-08T00:48:55+00:00" modified_at: "2026-03-30T21:46:06+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/03/Christmas-Tree.png" excerpt: "A Christmas card program with a UDG-built decorated tree, Jingle Bells melody with three-voice AY chord accompaniment, and a scrolling seasonal greeting." 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 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Patrick Spera" slug: "patrick-spera" taxonomy: "indiv" url: "http://localhost/indiv/patrick-spera/" genre: - name: "Holiday" slug: "holiday" taxonomy: "genre" url: "http://localhost/type/holiday/" media_contents: - id: 64715 title: "Miscellaneous Programs" type: "computer_media" url: "http://localhost/computer_media/miscellaneous-programs/" media_type: "Program" programmers: - name: "Patrick Spera" slug: "patrick-spera" taxonomy: "indiv" url: "http://localhost/indiv/patrick-spera/" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/03/Christmas-Tree.png" media_type_tags: "Holiday" --- # Tree A Christmas greeting card program by [Pat Spera](http://localhost/indiv/patrick-spera/), displaying a fully decorated tree built from twelve custom UDG characters — left and right foliage edges, three interior fill textures, round baubles, sparkle and teardrop ornaments, and a two-character star topper. Decorations are placed at multiple positions around the tree in red, yellow, magenta, white, and cyan. The program plays *Jingle Bells* in full using BEEP for the melody and the AY chip’s three-voice SOUND statement for chord accompaniment (D, G, F, Bb, C, A, and seventh-chord variants), then scrolls “Merry Christmas and Happy New Year! from the Sysops of Computer Club!!!” across the screen before looping. A missing semicolon in the C major chord routine at line 9050 will cause a runtime error when that chord is triggered. *** **UDG definitions (lines 10, 8500–8560):** 96 bytes are loaded into `USR "a"` through `USR "a"+95`, filling twelve UDGs \a–\l: | UDGs | Role | | --- | --- | | \a, \b | Left and right outer edges of tree foliage (triangular silhouette) | | \c, \d, \e | Interior foliage fill — three texture variants (dense mixed pixel patterns) | | \f, \g | Left and right lower-edge variants | | \h | Round bauble ornament (byte pattern: 24,126,126,255,255,126,126,60 — a filled oval) | | \i | Sparkle/star ornament (0,90,36,90,90,36,90,0 — open cross/star shape) | | \j | Teardrop ornament (24,60,60,60,60,126,255,24) | | \k, \l | Two-character star topper (symmetrical 8-pointed star split across two chars) | **Tree construction (lines 120–250):** The tree is assembled row-pair by row-pair, each PRINT statement laying down two rows and widening by one character on each side. `PRINT AT 6,14` anchors the top: | Lines | TAB | Width (chars) | Rows | | --- | --- | --- | --- | | 120 | 14 | 3 | 6–7 | | 140 | 13 | 5 | 8–9 | | 160 | 12 | 7 | 10–11 | | 180 | 11 | 9 | 12–13 | | 200 | 10 | 11 | 14–15 | | 220 | 9 | 13 | 16–17 | | 230 | 8 | 15 | 18 (single) | Each row uses \a as the left edge, \b as the right edge, and a mix of \c/\d/\e as foliage fill. The two-row structure (one row per PRINT TAB) uses \a–\b for the upper row and \f–\g variants for the lower, giving slight vertical texture variation. Line 250 adds the trunk as two INK 1 (blue) `█` blocks at column 15, followed by a small \a\d\b tip — establishing continuity at the bottom. **Decorations (lines 310–620):** - `\h` (baubles) at four positions, INK 2 (red) - `\j` (ornaments) at four positions in INK 6 (yellow), INK `PI` = 3 (magenta), INK 7 (white), INK 0 (black) - `\i` (sparkles) at two positions in INK 2 and INK 1 - `\k \l` star topper at AT 4,14, INK 5 (cyan) — `" \k "` and `"(\l)"`, where the parentheses appear to be part of the star’s visual framing `INK PI` at line 410 is the standard Sinclair trick of using `PI` (~3.14, truncated to 3) to set magenta without the digit 3 conflicting with tokenization. **Music engine (lines 1000–2050):** Data triplets `(d, p, c)` drive playback: - `c > 0` → `GO SUB 9000+c` sets an AY chord via `SOUND` before the note plays - `d = -99` → music section ends, jump to scrolling banner - `d < 0` → `PAUSE ABS(d)` (rest) - `d > 0` → `BEEP d, p` (duration d, pitch p semitones) The melody note sequence (pitches 2, 7, 7, 7, 9, 11, 11, 11, 12, 6, 9, 7…) with the chord progression D→G→D→G maps clearly to *Jingle Bells*. The bridge section in DATA 2020–2030 (pitches 14, 11, 16, 14, 12, 9, 14…) corresponds to the “Dashing through the snow” verse. The AY chord subroutines (9010–9090) program registers 0–5 with three-voice tone frequencies (D maj, G maj, F maj, Bb maj, C maj, C7, G7, A maj, D7) and set registers 7/8/9/10 for all-tone output at fixed amplitude 12. Routine 9900 silences all voices. **Scrolling banner (lines 800–860):** “Merry Christmas and Happy New Year! from the Sysops of Computer Club!!!” scrolls left across row 2 by displaying a 31-character window and rotating the string with `m$(2 TO )+m$(1)`. After 105 iterations it jumps back to the music section, creating a continuous loop. ## Source Code ``` 1 REM Tree © 1985 Pat Spera 5 REM ==> UDG 10 RESTORE 8500: FOR l=0 TO 95: READ a: POKE USR "a"+l,a:: NEXT l 20 BRIGHT 0: PAPER 0: INK 4: BORDER 0: CLS 100 REM ==> TREE 120 PRINT AT 6,14;"\a\d\b";TAB 14;"\f\e\g" 140 PRINT TAB 13;"\a\d\c\d\b";TAB 13;"\f\d\e\c\g" 160 PRINT TAB 12;"\a\d\e\d\c\d\b";TAB 12;"\f\d\d\e\d\e\g" 180 PRINT TAB 11;"\a\d\e\c\d\d\c\d\b";TAB 11;"\f\e\d\e\d\e\d\e\g" 200 PRINT TAB 10;"\a\c\d\e\c\d\d\c\c\d\b";TAB 10;"\f\d\e\c\e\e\d\e\d\e\g" 220 PRINT TAB 9;"\a\d\c\d\e\c\d\d\c\d\c\d\b";TAB 9;"\f\e\d\e\e\c\e\e\e\e\d\e\g" 230 PRINT TAB 8;"\a\e\c\d\c\d\c\d\d\d\c\d\c\d\b" 250 PRINT TAB 15; INK 1;"█";TAB 15;"█";TAB 14;"\a\d\b" 310 PRINT AT 14,15; PAPER 4; INK 2;"\h";AT 18,11;"\h" 330 PRINT AT 8,16; PAPER 4; INK 2;"\h";AT 16,20;"\h" 410 PRINT AT 15,12; PAPER 4; INK 6;"\j";AT 10,15; INK PI;"\j" 420 PRINT AT 12,17; PAPER 4; INK 7;"\j";AT 18,19; INK 0;"\j" 500 PRINT AT 17,16; PAPER 4; INK 2;"\i";AT 11,13; INK 1;"\i" 610 PRINT AT 4,14; INK 5;" \k ";TAB 14;"(\l)" 700 GO TO 1000 800 LET m$=" Merry Christmas and Happy New Year! from the Sysops of Computer Club!!!" 810 LET l=0 820 PRINT AT 2,0; INK 6;m$( TO 31): PAUSE 10 830 IF l=105 THEN GO TO 1000 840 LET m$=m$(2 TO )+m$(1) 850 LET l=l+1 860 GO TO 820 1000 REM ==> MUSIC 1010 RESTORE 2000 1020 READ d,p,c 1030 IF c>0 THEN GO SUB 9000+c 1040 IF d=-99 THEN GO TO 800 1050 IF d<0 THEN PAUSE (ABS d): GO TO 1020 1060 BEEP d,p 1070 GO TO 1020 2000 DATA .40,2,0,.30,7,20,.10,7,0,.40,7,0,.40,9,10,.30,11,20,.10,11,0,.40,11,0,.40,11,0,.20,9,90,.20,11,0,.40,12,0,.40,6,0,.40,9,0,.40,7,20 2010 DATA .40,2,0,.30,7,20,.10,7,0,.40,7,0,.40,9,10,.30,11,20,.10,11,0,.40,11,0,.40,11,0,.20,9,90,.20,11,0,.40,12,0,.40,6,0,.40,9,0,.40,7,20 2020 DATA .40,14,0,.25,14,0,.25,11,0.30,16,0,.15,14,0,.25,14,90,.25,12,0,.30,12,0,.15,12,0 2030 DATA .25,12,0,.25,9,0,.30,14,0,.15,12,0,.25,12,20,.25,11,0,.40,11,0 2050 DATA .40,2,0,.30,7,0,.10,7,0,.40,7,0,.40,9,10,.30,11,20,.10,11,0,.40,11,0,.40,11,0,.20,9,90,.20,11,0,.40,12,0,.40,6,0,.40,9,20,.60,7,0,-99,-99,900 8000 REM 8500 REM ==> UDG DATA 8510 DATA 3,7,14,25,63,103,254,255,192,224,112,152,252,253,127,255 8520 DATA 255,183,255,255,221,255,247,255,255,243,223,255,254,123,255,255 8530 DATA 225,255,191,247,255,191,253,255,3,3,3,7,13,31,54,127 8540 DATA 192,192,192,224,112,248,236,126,24,126,126,255,255,126,126,60 8550 DATA 0,90,36,90,90,36,90,0,24,60,60,60,60,126,255,24 8560 DATA 60,126,90,126,102,60,60,126,195,195,231,102,126,60,60,60 8999 STOP 9000 REM ==> Chords 9010 REM D maj. chord 9012 SOUND 0,248;1,0;2,186;3,0;4,147;5,0;7,56;8,12;9,12;10,12 9014 RETURN 9020 REM G maj. chord 9022 SOUND 0,23;1,1;2,221;3,0;4,139;5,0;7,56;8,12;9,12;10,12 9024 RETURN 9030 REM F maj. chord 9032 SOUND 0,248;1,0;2,209;3,0;4,156;5,0;7,56;8,12;9,12;10,12 9034 RETURN 9040 REM Bb maj. chord 9042 SOUND 0,234;1,0;2,186;3,0;4,156;5,0;7,56;8,12;9,12;10,12 9044 RETURN 9050 REM C maj. chord 9052 SOUND 0,23;1,1;2,209;3,0;4,165;5,07,56;8,12;9,12;10,12 9054 RETURN 9060 REM C 7th chord 9062 SOUND 0,234;1,0;2,209;3,0;4,165;5,0;7,56;8,12;9,12;10,12 9064 RETURN 9070 REM G 7th chord 9072 SOUND 0,23;1,1;2,221;3,0;4,156;5,0;7,56;8,12;9,12;10,12 9074 RETURN 9080 REM A maj. chord 9082 SOUND 0,248;1,0;2,197;3,0;4,165;5,0;7,56;8,12;9,12;10,12 9084 RETURN 9090 REM D 7th chord 9092 SOUND 0,248;1,0;2,209;3,0;4,147;5,0;7,56;8,12;9,12;10,12 9094 RETURN 9900 REM STOP chords 9902 SOUND 7,63;8,0;9,0;10,0;13,0 9904 RETURN 9990 STOP 9999 SAVE "TREE" LINE PI ```