Here are my ideas for alarms, which I've been thinking about from time to time:
API
OSWORD 14,6,n read time of alarm n, and return as 7 BCD bytes. Unspecified values are &FF.
OSWORD 15,4,"Ann=" cancel alarm nn.
OSWORD 15,len,"Ann="<alarmspec> set the time of alarm nn.
Alarm specifications
mm:ss hourly alarm at given minutes & seconds past each hour
hh:mm:ss daily alarm at given time
www.hh:mm:ss weekly alarm at given time and day
dd.hh:mm:ss monthly alarm at given time and day
ooo www.hh:mm:ss monthly alarm at given time and day, where ooo is 1st, 2nd, 3rd, 4th, 5th, pen or lst
dd mmm.hh:mm:ss yearly alarm at given time and date
ooo www mmm.hh:mm:ss yearly alarm at given time and day
www weekly alarm on given day, at unspecified time
dd monthly alarm on given day, at unspecified time
ooo www monthly alarm on given day, at unspecified time
dd mmm yearly alarm on given day, at unspecified time
ooo www mmm yearly alarm on given day, at unspecified time
Notes
There are two different kinds of wildcard: at the "big end", unspecified means trigger every time; at the "small end" unspecified means trigger as soon as possible, but only once.
Unspecified in the middle is ambiguous, so I propose to ban it.
Years are always unspecified.
Because there are only seven weekdays, the ordinal can fit in the high nibble of the same byte.
There is little point in specifying both a weekday and a day of month, except as a gimmick.
Alarms of the form ooo www mmm.hh:mm:ss can be used for the start & end of summertime.
Responding
The obvious thing is to implement a new event. It's a great pity that BASIC doesn't have an ON EVENT GOSUB command similar to ON ERROR GOTO, but even without this, I think events are the most useful way to do it.
API
OSWORD 14,6,n read time of alarm n, and return as 7 BCD bytes. Unspecified values are &FF.
OSWORD 15,4,"Ann=" cancel alarm nn.
OSWORD 15,len,"Ann="<alarmspec> set the time of alarm nn.
Alarm specifications
mm:ss hourly alarm at given minutes & seconds past each hour
hh:mm:ss daily alarm at given time
www.hh:mm:ss weekly alarm at given time and day
dd.hh:mm:ss monthly alarm at given time and day
ooo www.hh:mm:ss monthly alarm at given time and day, where ooo is 1st, 2nd, 3rd, 4th, 5th, pen or lst
dd mmm.hh:mm:ss yearly alarm at given time and date
ooo www mmm.hh:mm:ss yearly alarm at given time and day
www weekly alarm on given day, at unspecified time
dd monthly alarm on given day, at unspecified time
ooo www monthly alarm on given day, at unspecified time
dd mmm yearly alarm on given day, at unspecified time
ooo www mmm yearly alarm on given day, at unspecified time
Notes
There are two different kinds of wildcard: at the "big end", unspecified means trigger every time; at the "small end" unspecified means trigger as soon as possible, but only once.
Unspecified in the middle is ambiguous, so I propose to ban it.
Years are always unspecified.
Because there are only seven weekdays, the ordinal can fit in the high nibble of the same byte.
There is little point in specifying both a weekday and a day of month, except as a gimmick.
Alarms of the form ooo www mmm.hh:mm:ss can be used for the start & end of summertime.
Responding
The obvious thing is to implement a new event. It's a great pity that BASIC doesn't have an ON EVENT GOSUB command similar to ON ERROR GOTO, but even without this, I think events are the most useful way to do it.
Statistics: Posted by Barneyntd — Wed Jan 22, 2025 6:38 pm