TimeCoiner64

by kappatechy

Game: SMW

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

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

; This first chunk converts decimal back to hex
LDA !timer_hundreds
ASL
ADC !timer_hundreds
ASL
ASL
ADC !timer_tens
ASL
ADC !timer_hundreds
ASL
ADC !timer_tens
ASL
CLC
ADC !timer_ones

CMP 0
BCC end

; Never let coins exceed 64 (the timer usually will)
-
SEC
SBC #64
CMP #64
BCS -

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