![]()  | 
Routines | 
| Prev: 63DA | Up: Map | Next: 645A | 
| 
 
Used by the routine at 702A.
 
 | 
||||
| 
 
Calculate number of points to award.
 
 | 
||||
| HandlerCup | 63FF | LD A,($5E3C) | A=Cups_Collected. | |
| 6402 | INC A | A=(A + 01) * 02 with BCD conversion. | ||
| 6403 | ADD A,A | |||
| 6404 | DAA | |||
| 
 
Adds points to score.
 
 | 
||||
| 6405 | LD B,A | BC=number of points to award. | ||
| 6406 | LD C,$00 | |||
| 6408 | CALL AddPointsToScore | Call 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) | A=Cups_Collected. | ||
| 6410 | CP $08 | If A is less than 08 jump to DisplayCupsCollected. | ||
| 6412 | JR C,DisplayCupsCollected | |||
| 
 
All cups have been collected, display the "congratulations" messaging.
 
 | 
||||
| 6414 | CALL SetDayAttributes | Call SetDayAttributes. | ||
| 6417 | CALL CreateWindow | Call CreateWindow. | ||
| 641A | CALL DisplayCongratsMessaging | Call DisplayCongratsMessaging. | ||
| 
 
Writes the line "YOUR TIME WAS".
 
 | 
||||
| 641D | LD HL,$5868 | HL=5868 (screen location). | ||
| 6420 | LD DE,$63E3 | DE=Message_YourTime. | ||
| 6423 | CALL MenuWriteText | Call MenuWriteText. | ||
| 
 
Set HL to where the time itself will display.
 
 | 
||||
| 6426 | LD HL,$6880 | HL=6880 (screen location). | ||
| 6429 | CALL ScreenAddress | Call ScreenAddress. | ||
| 642C | CALL DisplayTime_Minutes | Call DisplayTime_Minutes. | ||
| 
 
Has a new "Best Time" been made?
 
 | 
||||
| 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 | Call DisplayBestTime. | ||
| 6438 | LD HL,$5E00 | HL=BestTime_1. | ||
| 643B | LD DE,$5E31 | DE=Time_1. | ||
| 643E | LD B,$03 | B=03 (counter). | ||
| BestTime_Compare | 6440 | LD A,(DE) | Compare DE against HL. | |
| 6441 | CP (HL) | |||
| 6442 | JR C,BestTime_Update | If it's higher than A then jump to BestTime_Update. | ||
| 6444 | JR Z,BestTime_Compare_Next | If zero then jump to BestTime_Compare_Next. | ||
| 6446 | JR HandlerCup_Delay | Jump to HandlerCup_Delay. | ||
| BestTime_Compare_Next | 6448 | INC HL | Move onto the next BestTime digit. | |
| 6449 | INC DE | Move onto the next Time digit. | ||
| 644A | DJNZ BestTime_Compare | Decrease counter by one and loop back to BestTime_Compare until counter is zero. | ||
| 
 
Create a short pause.
 
 | 
||||
| HandlerCup_Delay | 644C | LD B,$0C | B=0C. | |
| 644E | CALL Delay | Call Delay. | ||
| 6451 | CALL GameInit_0 | Call GameInit_0. | ||
| 6454 | LD SP,$5E00 | Set the stack pointer to 5E00. | ||
| 6457 | JP StartGame_0 | Jump to StartGame_0. | ||
| Prev: 63DA | Up: Map | Next: 645A |