Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM E\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57142 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.5 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"DE\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57142 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.5 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"D\EF\CD\A7



Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM \3E\12\CD\1D\15\3E\21\CD\1D\15\EF\04\34\CD\A7\0E\2A\0C\40\09\23\54\5D\7E\23\01\1F\00\ED\B0\2B\77\C9
  10 FOR A=0 TO 21
  20 POKE 16515,A
  30 PRINT AT A,6;"**MERRY  CHRISTMAS**"
  40 FOR B=1 TO 32
  50 RAND USR 16514
  60 NEXT B
  70 NEXT A
  80 FOR A=21 TO 0 STEP -1
  85 POKE 16515,A
  90 PRINT AT A,6;"**HAPPY  NEW  YEAR**"
 100 FOR B=1 TO 32
 110 RAND USR 16514
 120 NEXT B
 130 NEXT A
 140 GOTO 10
 150 SAVE "1009%1"
 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top
E

Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM \3E\12\CD\1D\15\3E\21\CD\1D\15\EF\04\34\CD\A7\0E\2A\0C\40\09\23\54\5D\7E\23\01\1F\00\ED\B0\2B\77\C9
  10 FOR A=0 TO 21
  20 POKE 16515,A
  30 PRINT AT A,6;"**MERRY  CHRISTMAS**"
  40 FOR B=1 TO 32
  50 RAND USR 16514
  60 NEXT B
  70 NEXT A
  80 FOR A=21 TO 0 STEP -1
  85 POKE 16515,A
  90 PRINT AT A,6;"**HAPPY  NEW  YEAR**"
 100 FOR B=1 TO 32
 110 RAND USR 16514
 120 NEXT B
 130 NEXT A
 140 GOTO 10
 150 SAVE "1009%1"
 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top
A

Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM \3E\12\CD\1D\15\3E\21\CD\1D\15\EF\04\34\CD\A7\0E\2A\0C\40\09\23\54\5D\7E\23\01\1F\00\ED\B0\2B\77\C9
  10 FOR A=0 TO 21
  20 POKE 16515,A
  30 PRINT AT A,6;"**MERRY  CHRISTMAS**"
  40 FOR B=1 TO 32
  50 RAND USR 16514
  60 NEXT B
  70 NEXT A
  80 FOR A=21 TO 0 STEP -1
  85 POKE 16515,A
  90 PRINT AT A,6;"**HAPPY  NEW  YEAR**"
 100 FOR B=1 TO 32
 110 RAND USR 16514
 120 NEXT B
 130 NEXT A
 140 GOTO 10
 150 SAVE "1009%1"
 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top
CDE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57142 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.5 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4" itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-57142 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.5 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"F

Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM \3E\12\CD\1D\15\3E\21\CD\1D\15\EF\04\34\CD\A7\0E\2A\0C\40\09\23\54\5D\7E\23\01\1F\00\ED\B0\2B\77\C9
  10 FOR A=0 TO 21
  20 POKE 16515,A
  30 PRINT AT A,6;"**MERRY  CHRISTMAS**"
  40 FOR B=1 TO 32
  50 RAND USR 16514
  60 NEXT B
  70 NEXT A
  80 FOR A=21 TO 0 STEP -1
  85 POKE 16515,A
  90 PRINT AT A,6;"**HAPPY  NEW  YEAR**"
 100 FOR B=1 TO 32
 110 RAND USR 16514
 120 NEXT B
 130 NEXT A
 140 GOTO 10
 150 SAVE "1009%1"
 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top
\ED\B0

Merry Christmas / Happy New Year

This file is part of Timex Sinclair Public Domain Library Tape 1002 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Holiday

This program displays a scrolling Christmas and New Year greeting by printing messages at successive screen rows and calling a machine code routine embedded in the REM statement at line 1. The machine code (stored from address 16514) is invoked repeatedly via RAND USR 16514, which suppresses the resulting error return value. The routine itself appears to implement a colour-cycling or display effect — the inner loop of 32 calls to the machine code at line 50/110 produces a timed animation between each row advance. The program alternates between scrolling “**MERRY CHRISTMAS**” downward (rows 0–21) and “**HAPPY NEW YEAR**” upward (rows 21–0) in a continuous loop.


Program Analysis

Program Structure

The program has three distinct phases running in an infinite loop via GOTO 10 at line 140:

  1. Downward scroll (lines 10–70): Iterates A from 0 to 21, printing “**MERRY CHRISTMAS**” at row A, column 6, and calling the machine code routine 32 times per row for timing/effect.
  2. Upward scroll (lines 80–130): Iterates A from 21 down to 0, printing “**HAPPY NEW YEAR**” at the same column, again calling the machine code 32 times per row.
  3. Loop restart (line 140): GOTO 10 repeats indefinitely. Line 160 is dead code — it is never reached due to line 140.

Machine Code Routine in REM

The REM statement at line 1 contains a machine code routine beginning at address 16514 (the second byte of the REM data, since 16514 = start of program + 4-byte line header + 1 for the REM token). The bytes are:

OffsetHexZ80 InstructionNotes
03E 12LD A, 18Load attribute or border value
2CD 1D 15CALL 0x151DROM routine (likely set colour attribute)
53E 21LD A, 33Load next value
7CD 1D 15CALL 0x151DROM routine called again
10EF 04 34RST 08 / data bytesRST 8 is ZX81 error/CALL ROM handler; 04 34 are parameters
13CD A7 0ECALL 0x0EA7ROM routine (likely SLOW/FAST display sync)
162A 0C 40LD HL, (0x400C)Load address from system variable area
1909ADD HL, BCOffset into display file
2023INC HL
2154LD D, H
225DLD E, L
237ELD A, (HL)Read display byte
2423INC HL
2501 1F 00LD BC, 31Block of 31 bytes
28ED B0LDIRBlock copy (shift display left by one character)
302BDEC HL
3177LD (HL), AWrite original byte to end
32C9RETReturn to BASIC

The routine performs a one-character left-rotate of a line in the display file — shifting 31 bytes left with LDIR and placing the first byte at the end, producing a hardware-level horizontal scroll effect on one row of the ZX81 display.

Role of POKE 16515

Address 16515 is the second data byte of the REM, used by the machine code as a parameter. By poking A into this location before calling the routine, the BASIC program tells the machine code which display row to scroll, synchronising the visual effect with the printed message position.

Key BASIC Idioms

  • RAND USR 16514 — calls the machine code without needing a subroutine or risking a STOP; the random number side-effect is discarded.
  • The inner FOR B=1 TO 32 loop runs the scroll routine 32 times per row, providing both the scrolling animation and a timing delay.
  • Two-space padding in the message strings (“MERRY CHRISTMAS”, “HAPPY NEW YEAR”) is used for visual centering rather than AT column arithmetic.

Bugs and Anomalies

  • Line 160 (GOTO 10) is unreachable dead code; line 140 already loops the program back to line 10.
  • Line 150 is a SAVE command embedded in the running program flow between lines 140 and 160 — it is also unreachable at runtime and appears to be a development artifact left in the listing.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10051 – 10121.

Related Products

Related Articles

Related Content

Image Gallery

Merry Christmas / Happy New Year

Source Code

   1 REM \3E\12\CD\1D\15\3E\21\CD\1D\15\EF\04\34\CD\A7\0E\2A\0C\40\09\23\54\5D\7E\23\01\1F\00\ED\B0\2B\77\C9
  10 FOR A=0 TO 21
  20 POKE 16515,A
  30 PRINT AT A,6;"**MERRY  CHRISTMAS**"
  40 FOR B=1 TO 32
  50 RAND USR 16514
  60 NEXT B
  70 NEXT A
  80 FOR A=21 TO 0 STEP -1
  85 POKE 16515,A
  90 PRINT AT A,6;"**HAPPY  NEW  YEAR**"
 100 FOR B=1 TO 32
 110 RAND USR 16514
 120 NEXT B
 130 NEXT A
 140 GOTO 10
 150 SAVE "1009%1"
 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top
B\C9 10 FOR A=0 TO 21 20 POKE 16515,A 30 PRINT AT A,6;"**MERRY CHRISTMAS**" 40 FOR B=1 TO 32 50 RAND USR 16514 60 NEXT B 70 NEXT A 80 FOR A=21 TO 0 STEP -1 85 POKE 16515,A 90 PRINT AT A,6;"**HAPPY NEW YEAR**" 100 FOR B=1 TO 32 110 RAND USR 16514 120 NEXT B 130 NEXT A 140 GOTO 10 150 SAVE "1009%1" 160 GOTO 10

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

People

No people associated with this content.

Scroll to Top