For Retro Computing Enthusiasts
,

VIC Timepiece

By Joseph Wright — originally published in COMPUTE!’s Gazette Volume 1, Issue 1

With this program, your VIC becomes a clock complete with sound and colors. And, when you prefer quiet, you can turn the sound down. For the unexpanded VIC. If you have an expanded VIC, unplug the memory cartridge before loading and running the program.

What do you do with your computer when you’re not using it? Why not let it display the time and show off some of its talents during your “downtime.”

This program was fashioned after the plastic rolling-ball clocks. But with this clock, you can turn the sound down when you sleep or watch TV.

Patterns, Sound, Colors

The first step in designing the clock was to lay out different patterns on the screen until a feasible design was found. The next step was to draw the screen display on graph paper (5 x 5 Quadrille), making it easier to list all screen coordinates to which the ball could move.

The screen locations were put in an array, A(40), in the order they would be encountered: from the lower right of the screen, up the “elevator,” and across the top ramp to where the ball falls to the second ramp and continues to the position where the first ball might be located. Another array, B(48), shows the route all extra balls take to the bottom of the screen.

A delay was added to the sound routine to slow the ball to a reasonable speed. The program worked fine without a delay when only one ball was involved, but when five balls started rolling, things got a little hectic. It would have been nice to have the balls fall at a faster rate than they rolled the rest of the way down the clock, but memory restrictions dampened any chance of such intricacies. I decided to increase the overall speed of the balls so the “fall” speed would be close to normal.

The sound routine is designed so any condition that warrants a “hit” sound is sent to that section of the routine. Otherwise, control falls through to the “roll” sound. Two sounds were tied together to approximate the sound of a rolling ball.

Usually I prefer the orange background because it gives more color to work with. The dark color also allows POKEing into screen memory without also POKEing a color into color memory. By the way, a simple way to add color is to add CO to the previously POKEd location, where CO equals 30720 (38400-7680, which is the beginning of color memory minus the screen memory). For example, POKE SC + (var),81:POKE SC + (var) + CO,(color).

A Little Ingenuity

To convert this program to another computer, try using the same program lines and change only the variables to allow for your screen size (for instance, to allow for the Commodore 64’s 40-column screen). If your computer addresses screen locations with X and Y coordinates, try changing the DATA statements to four-digit numbers, such as 0215 where 02 is the X value and 15 is the Y value. These values can be obtained by the formulas: X = VAL(LEFT$(B(X),2)) and Y = VAL (RIGHT$(B(X),2)) in Microsoft BASIC. The DATA statements would have to be READ in as strings. For those of you with PRINT@ statements, similar results can be achieved by PRINTing an “o” or an “*” (or anything else that better resembles a ball) at the proper locations.

With a little ingenuity, this clock could be displayed on any computer, although it might require some fancy manipulating of PRINTTAB or other statements.

If you’d rather not type this program listing, just send $3 and a stamped, self-addressed mailer with blank cassette (no disks) to:

J. D. Wright
1030 Charles Street
Louisville, KY 40204

See program listing on page 124.

Companion disk Companion Disk (.d64)

Enjoyed this? It’s what we do every month.

The revived COMPUTE!’s Gazette brings the spirit of the golden era to today’s retro scene — Commodore, Atari, Amiga, and more, in full-color print and digital every month.