![]() |
Routines |
| Prev: 45194 | Up: Map | Next: 45225 |
|
Used by the routines at Process_EnterForestPath, Process_CongratulationsGameOver, Process_EnterLugsCavern, Process_EnterValeOfCuchulainn, Process_EnterInnerCourtyard, Process_EnterEnchantedHills, Process_EnterDeepPoolOfWater, Process_EnterBleakMoorland, Process_EnterCrystalCavern, Process_EnterValeOfRhia, Process_EnterCauseway, Process_GetUrn, Process_GetRope, Process_GetCloak, Process_ThrowMeatToWolves, Process_GiveSaltToGuard, Process_BuyMeatFromTraderWithIron, Process_GiveRomanToDruid, Process_ThrowUrnIntoFire, Process_CaptureRoman, Process_PlaceLadderAgainstPlatform, Process_PlaceSwordOnSlab, Process_KillBear, Process_KillOxWithSword and Action_Sleep.
Adds the points in A to the two-byte BCD score at Score. The low byte is adjusted with DAA; when that addition carries, the high byte increases by one.
|
||||||||
|
Preserve HL and load the current score from Score.
|
||||||||
| AddToScore | 45210 | PUSH HL | Stash HL on the stack. | |||||
| 45211 | LD HL,(42948) | Fetch the BCD score from *Score into HL. | ||||||
|
Add the points into the low score byte and adjust for BCD.
|
||||||||
| 45214 | ADD A,L | Add the points in A to the low score byte in L. | ||||||
| 45215 | DAA | Decimal-adjust A for a BCD score digit. | ||||||
| 45216 | LD L,A | Store the adjusted low byte back in L. | ||||||
| 45217 | JR NC,AddToScore_Store | Jump to AddToScore_Store if the addition did not carry. | ||||||
|
The low byte carried, so raise the high score byte.
|
||||||||
| 45219 | INC H | Increase the high score byte in H by one. | ||||||
|
Write the updated score back to Score.
|
||||||||
| AddToScore_Store | 45220 | LD (42948),HL | Store HL at Score. | |||||
| 45223 | POP HL | Restore HL from the stack. | ||||||
| 45224 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 45194 | Up: Map | Next: 45225 |