Prev: 6498 Up: Map Next: 64F0
64C7: Handler: Update Time
Used by the routine at 6A9B.
HandlerTime 64C7 LD A,($5C78) A=FRAMES.
64CA CP $32 Return if A < 32.
64CC RET C
64CD SUB $32 A = A - 32.
64CF LD ($5C78),A Write A back to FRAMES.
Update the time from the smallest unit upwards.
Handles the "seconds".
64D2 LD HL,$5E33 HL=Time_3.
64D5 LD A,(HL) Grab the seconds.
64D6 INC A Increase seconds by one.
64D7 DAA Write seconds back to Time_3.
64D8 LD (HL),A
64D9 CP $60 Return unless seconds have reached 60.
64DB RET NZ
64DC LD (HL),$00 Reset seconds to 00.
Handles the "minutes".
64DE DEC HL HL=Time_2.
64DF LD A,(HL) Grab the minutes.
64E0 INC A Increase minutes by one.
64E1 DAA Write minutes back to Time_2.
64E2 LD (HL),A
64E3 CP $60 Return unless minutes have reached 60.
64E5 RET NZ
64E6 LD (HL),$00 Reset minutes to 00.
Handles the "hours".
64E8 DEC HL HL=Time_1.
64E9 LD A,(HL) Grab the hours.
64EA INC A Increase hours by one.
64EB DAA Keeping only bits 0-3, write hours back to Time_1.
64EC AND %00001111
64EE LD (HL),A
64EF RET Return.
Prev: 6498 Up: Map Next: 64F0