Add rtc_set

This commit is contained in:
Byron Lathi
2023-12-01 08:28:38 -08:00
parent 2cdd260a87
commit e8452eb98c
3 changed files with 27 additions and 0 deletions

View File

@@ -2,8 +2,11 @@
.importzp tmp1
.import popa
.export _init_rtc
.export _handle_rtc
.export _rtc_set
RTC_CMD = $effe
RTC_DAT = $efff
@@ -86,7 +89,19 @@ IRQ_THRESHOLD_3 = $00
sta RTC_DAT
rts
.endproc
; void rtc_set(uint32_t val, uint8_t idx);
.proc _rtc_set
tay ; move cmd to Y
ldx #$04
L1: sty RTC_CMD ; store cmd+idx to CMD
jsr popa ; pop 1 byte of argument
sta RTC_DAT ; write it to data
iny ; increase index
dex
bne L1 ; repeat 4 times
rts
.endproc