timecoiner

by kappatechy

Game: SMW

Description: Sets the coins based on the timer (mod 50)

; Define some useful addresses
!coins = $7E0DBF
!timer_hundreds = $7E0F31
!timer_tens = $7E0F32
!timer_ones = $7E0F33

LDA !timer_tens   ; Load the tens value from the timer, multiplied by 10
ASL
ASL
ADC !timer_tens
ASL

ADC !timer_ones   ; Add the ones value from the timer

CMP #50           ; Never let coins exceed 50
BCC +
SBC #50
+

end:
STA !coins        ; Store in the coins
RTL
back to listings