For a couple of years of my time in high school (for those not familiar with US usage, the 4 years right before university), I used my Commodore 64 as an alarm clock.
I first got my 64 for Christmas during my second year. I didn't do much with it at first, because I didn't have any sort of storage device. No peripherals of any kind whatsoever, really. I played some games on cartridge, and dabbled in BASIC. But starting in my third year, I'd been digging through the user guide and found out about TI$, and decided to use it to wake me up in the mornings.
At first, I just PRINTed TI$ directly to the screen, with no formatting. And every cycle through the main loop, it would check for being equal to a hard-coded alarm time, and GOSUB to a subroutine that would play an upward frequency sweep in triangle wave at maximum volume, and I likewise had the sound on the television monitor cranked up... well, not all the way up, but quite loud. At least halfway through the volume knob's range.
As the weeks and months rolled on, I added more formatting features to the output. Eventually it would parse the TI$ 24-hour time into 12-hour AM/PM and suppress the zero in the hours display, so that a TI$ value of "170522" would print out as " 5:05:22 PM".
Even though I still didn't have storage (I finally got a 1541 in the middle of fourth year), I was so familiar with the structure of the program that I could type it in again in just a few minutes if the computer lost power.
But once I did have storage, I saved my best version. Armed with my new Programmer's Reference Guide, I started working on a new version that would use the 6526 CIA internal time-of-day clock (TOD). I'd learned that any I/O would cause the TI$ clock to lose time, and I'd already noticed that it would drift quite a bit over the course of only a few nights.
I still have a lot of bits and pieces of paper around that I've held onto since back in those days, over 30 years ago at this point, and as it turns out one of those bits pf paper was a listing from when I'd finally gotten a printer, only a couple of months before graduating high school, an MPS803, and I'd listed out the contents of the work in progress, probably right before I'd stopped working on it.
The point where I'd left it was where I was comparing TOD to TI$, printing them both out, fully formatted, but without the alarm feature yet. (I'd had some ideas about changing that as well, such as making the alarm time user-adjustable instead of hard-coded, adding a snooze function, or a progressively louder alarm.) I wanted to see for myself ho much better TOD was before committing to it... and I still hadn't quite worked out how to check for the alarm-set time.
What I had done was a fair amount of cleanup. I added some very simple comments, and had all the line numbers incrementing by 10. This would allow me to stuff in several extra lines to handle however complicated the alarm check might turn out to be.
Anyway, I
I've also loaded it into VICE. However, the host computer I used does CPU throttling for power savings and heat reduction, so starting a run of the program when the machine was at full speed and then leaving it overnight caused both clocks to run almost 30 minutes slow over an 8-hour period. For best results, then, I would suggest running this on a real machine or, if emulated, on a host machine that doesn't slow down the CPU.
time.asc