fixed TI$ values and UDTIM rollover

This commit is contained in:
FeralChild64 committed 2020-07-19 17:40:06 +02:00
1 parent ffbb58bcbc
commit 24115bc3ab
5 files changed
+41 -39

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ SETTIM:
sty TIME + 0
stx TIME + 1
sta TIME + 2
.break
// Enable interrupts. More elegant solution would be pha + sei + ... + pla,
// but (checked by running a test program) original ROM routine always
// leaves IRQs enabled.
+22 -20
View File
@@ -17,32 +17,34 @@ UDTIM:
// (24 hours * 60 minutes * 60 seconds * 60 jiffies),
// after this time we have to reset the clock.
#if !HAS_OPCODES_65CE02
inc TIME+2
bne udtim_time_done // done with clock
bne udtim_rollover_check
inc TIME+1
#else
inw TIME+2
#endif
bne udtim_clock_rollover
bne udtim_rollover_check
inc TIME+0
// FALLTROUGH
udtim_rollover_check:
lda TIME+0
cmp #$4F
bcc udtim_time_done
lda TIME+1
cmp #$1A
bcc udtim_time_done
// FALLTROUGH
udtim_clock_reset:
lda #$00
sta TIME+0
sta TIME+1
sta TIME+2
// FALLTROUGH
udtim_time_done:
jmp udtim_keyboard
udtim_clock_rollover:
// At this point TIME+0 contains 0
lda TIME+1
cmp #$1A
bne udtim_time_done // done with clock
lda TIME+0
cmp #$4F
bne udtim_time_done // done with clock
lda #$00
sta TIME+0
sta TIME+1
beq udtim_time_done // done with clock - will always jump