Retrochallenge 10/2017

That time of year again… It’s Retrochallenge time!

Retrochallenge is where you challenge yourself to use vintage computers for a personal project for a month. This time, it’s for the month of October 2017. For my Retrochallenge, I will be rewriting an old Christmas graphic and sound demo I wrote on a real VIC-20 computer back in late 1981.

The demo itself is simple, but then again, so was the programming. Much of it was PRINT statements in a chain of BASIC commands, followed by music playback that was just as rudimentary. But now that I had over 35 years to contemplate my original code, I have decided to make it more efficient, modernize it, and make it even better if possible. After all, it ran on an Unexpanded VIC-20 originally. I really should have thought out ways of saving every precious byte available to me. One aspect of a successful “improvement” is to reduce the size of the program. However, if the program can be improved in its presentation, I won’t dwell on size reduction as a primary goal. After all, those kind of changes fall under the “efficient” and “modernize” aspect of change.

The tools I will be using consist of the following:

  • My original VIC-20 (still works)
  • My original program tape(s)
  • CBMStudio (modern system convenience for writing native VIC-20 BASIC code)
  • VICE (to test the program using VIC-20 emulation)

A demonstration of the original program can be seen on a YouTube video.

The program I’ll be working on first will be “Merry Christmas IV.” It is the 4th update of an original Merry Christmas demo I started on. The video will show the previous versions. Here is a preview of the program, in BASIC, as CBM Studio maintains it:

VIC-20 program in CBM Studio

VIC-20 program in CBM Studio

CBM Studio substitutes text commands in braces {} where a real VIC-20 will use special reversed graphic symbols. I will use that same convention with code segments I list in this blog post.

Now to break down the original code…

1 POKE36879,90:POKE36878,15 
2 A$="{black}merry christmas ":B$="{white}to you ":C$="{black}from the salzman's " 
5 PRINT"{clear}" 
6 FORX=22TO3STEP-1:T=T+1:PRINT"{home}{down*4}"SPC(X);LEFT$(A$,T):POKE36876,220:POKE36876,0:NEXT:T=0 
7 FORX=22TO8STEP-1:T=T+1:PRINT"{home}{down*9}"SPC(X);LEFT$(B$,T):POKE36876,220:POKE36876,0:NEXT:T=0 
8 FORX=22TO2STEP-1:T=T+1:PRINT"{home}{down*14}"SPC(X);LEFT$(C$,T):POKE36876,220:POKE36876,0:NEXT

The above code sets the screen color, Defines three string variables for character animation, and then performs the character animations after clearing the screen. Very little, if anything, needs to be done with this section of code, unless I decide to change the animation style. Right now, it’s programmed to give the appearance of the text sliding in from the left, using a quick beep for each step movement to the left.

Something I could do with this section is create a variable array using three elements, save the text to each element, then loop through the array, placing the text as planned, but using calculated values in the FOR:NEXT loops based on variable size. I’m trying to remember if the Commodore V2 BASIC had a LEN() function to determine string length. I feel I’m a bit too jaded on newer programming languages to assume that functions like LEN() are available without checking.

…more to come later.



Leave a Reply

Your email address will not be published. Required fields are marked *

The way ELECTRONICS used to be!