fix 24 hours wrap bug

This commit is contained in:
nino-porcino 2022-10-16 16:51:25 +02:00
parent d9863f02f5
commit 5bc71a3cfe
2 changed files with 13 additions and 5 deletions

View File

@ -133,10 +133,18 @@ void main() {
woz_puts("\rWHAT TIME IS IT ?\r");
woz_puts("\r(HOURS ) "); apple1_input_line_prompt(KEYBUF, 2);
_hours = (byte) atoi(KEYBUF);
woz_puts("\r(MINUTES) "); apple1_input_line_prompt(KEYBUF, 2);
_minutes = (byte) atoi(KEYBUF);
do {
woz_puts("\r(HOURS ) ");
apple1_input_line_prompt(KEYBUF, 2);
_hours = (byte) atoi(KEYBUF);
} while(_hours > 23);
do {
woz_puts("\r(MINUTES) ");
apple1_input_line_prompt(KEYBUF, 2);
_minutes = (byte) atoi(KEYBUF);
} while(_minutes > 59);
_seconds = 0;
enable_timer_interrupt();

View File

@ -35,7 +35,7 @@ EXPORT __interrupt(hardware_all) void time_interrupt_handler() {
_seconds = 0;
if(++_minutes == 60) {
_minutes = 0;
_hours++;
if(++_hours == 24) _hours = 0;
}
}
}