Prev: 63DA Up: Map Next: 645A
63FF: Handler: Pick Up Cup
Used by the routine at CollectCup.
Awards the points for a cup, which are 0200 for the first cup up to 1600 for the eighth (the number of cups already collected plus one, doubled, in hundreds). If this was the last of the eight cups then the "congratulations" messaging is shown along with the time taken, "Best Time Today" is updated if it has been beaten, and a new round starts (without resetting the lives). Otherwise the number of cups collected is displayed.
Calculate number of points to award.
HandlerCup 63FF LD A,($5E3C) Fetch the number of cups collected so far (Cups_Collected).
6402 INC A Work out the points as (cups collected + 01) * 02 in BCD.
6403 ADD A,A
6404 DAA
Adds points to score.
6405 LD B,A Set the points to award, in hundreds (as BCD).
6406 LD C,$00 Set the units and tens of the points to 00.
6408 CALL AddPointsToScore Add the points to the score using AddPointsToScore.
Handle incrementing the cup counter.
640B LD HL,$5E3C Increment Cups_Collected by one.
640E INC (HL)
Have all the cups been collected?
640F LD A,(HL) Fetch the number of cups collected.
6410 CP $08 If fewer than 08 cups have been collected then jump to DisplayCupsCollected to display the count.
6412 JR C,DisplayCupsCollected
All cups have been collected, display the "congratulations" messaging.
6414 CALL SetDayAttributes Switch to day time using SetDayAttributes.
6417 CALL CreateWindow Create the game window using CreateWindow.
641A CALL DisplayCongratsMessaging Display the congratulations message using DisplayCongratsMessaging.
Writes the line "YOUR TIME WAS".
641D LD HL,$5868 HL=5868 (pixel co-ordinates: H is the Y position and L is the X position).
6420 LD DE,$63E3 Point DE at the "YOUR TIME WAS" text (Message_YourTime).
6423 CALL MenuWriteText Print the text using MenuWriteText.
Set HL to where the time itself will display.
6426 LD HL,$6880 HL=6880 (pixel co-ordinates: H is the Y position and L is the X position).
6429 CALL ScreenAddress Call ScreenAddress to convert this into a screen address.
642C CALL DisplayTime_Minutes Display the time taken using DisplayTime_Minutes.
Has a "Best Time Today" been set yet?
642F LD A,($5E03) If Flag_BestTime is zero then jump to BestTime_Set.
6432 AND A
6433 JR Z,BestTime_Set
6435 CALL DisplayBestTime Display the best time so far using DisplayBestTime.
Compare the time taken with the best time, one byte at a time starting with the most significant.
6438 LD HL,$5E00 Point HL at the best time (BestTime_1).
643B LD DE,$5E31 Point DE at the time taken (Time_1).
643E LD B,$03 Set the byte counter to 03.
BestTime_Compare 6440 LD A,(DE) Compare the byte of the time at DE against the byte of the best time at HL.
6441 CP (HL)
6442 JR C,BestTime_Update If the time is less than the best time then jump to BestTime_Update.
6444 JR Z,BestTime_Compare_Next If the bytes are the same then jump to BestTime_Compare_Next.
6446 JR HandlerCup_Delay The time is more than the best time, so jump to HandlerCup_Delay.
BestTime_Compare_Next 6448 INC HL Move onto the next BestTime_1 byte.
6449 INC DE Move onto the next Time_1 byte.
644A DJNZ BestTime_Compare Decrease the byte counter by one and loop back to BestTime_Compare until all of the bytes have been compared.
This entry point is used by the routine at BestTime_Set.
Create a short pause, then start the next round.
HandlerCup_Delay 644C LD B,$0C Set the delay count to 0C.
644E CALL Delay Pause using Delay.
6451 CALL NewGame_ResetCups Call NewGame_ResetCups to reset the cups and set up a new car, which returns here.
6454 LD SP,$5E00 Set the stack pointer to 5E00.
6457 JP MainLoop_NewPass Jump to MainLoop_NewPass.
Prev: 63DA Up: Map Next: 645A