Classic Computer Magazine Archive COMPUTE! ISSUE 38 / JULY 1983 / PAGE 230

Commodore Programmer's Alarm Clock

Bruce Jaeger

You'll appreciate this program if you've ever lost track of time while at your computer. It will act as a countdown timer and print "QUIT!" on screen and sound a bell when the time comes to stop. For VIC, 64, and PET/CBMs.

Have you ever sat down at your computer after dinner to "just touch up that program a bit," only to find again that you've lost all notion of time and you've just missed the first half of that movie you've waited for all week? Or you're supposed to pick someone up at 6:00, and by the time you look up from the screen it's 7:30? Me too!

That's why "Programmer's Alarm Clock" came about. When you first sit down at your desk, load and run the program. It will ask you for the alarm time, and for the current time of day.

That's all. You can run games, develop programs, write computer articles, whatever. But when the alarm time comes, the word "QUIT!" comes up on the screen and there's a healthy beep from the CB2 speaker.

Programmer's Alarm is a machine language routine located in the second cassette buffer, and is accessed 60 times a second by the interrupt routine that updates TI$ and does other housekeeping chores. The program merely compares the previously stored alarm time with the time-of-day, and lets you know when they match.

The program as written is for the PET/CBM Upgrade ROM set, 4.0 ROMs, 64, and VIC.

Notes For Commodore Alarm Clock

Since Commodore provides a realtime clock in all of its computers, the versions presented here differ only in the location of the machine language routine and the location of the interrupt request vectors which continually check the internal clock. Since the internal clock is affected by using the cassette, the VIC and 64 versions of this program will give unpredictable results if you use the cassette unit. Disk operation and TOOLKIT seem unaffected.

Also, if the alarm time is set for after 12:00 and you set the time of day to a point before 12:00, then you must use military time (1300 for one o'clock, etc.). Otherwise, the two times will not match, and the alarm will not sound.

This program is a good one to study if you are interested in learning about simple machine language and interrupt-driven routines. Since the program is so short, it is fairly simple to understand and adapt for use in other programs.