![]() |
Routines |
| Prev: B77F | Up: Map | Next: B79E |
|
Used by the routines at ChangeRoom, Take_CopperKey, Take_GoldKey, Take_JewelledKey, Throw_HoneyToBear, Throw_MeatToFalcon, Give_Frog, Kiss_Box, Kiss_Chest, Kiss_ClamWithCrowbar, Throw_MoneyToGuard, Wave_Flute, Wave_Mandolin, Play_BarrowightWithBible, Play_SerpentWithSongbird, Play_HydraWithSpear, Play_VampireWithCross, Play_KnightWithAcid, Play_DragonWithSword, Play_WitchWithWater, Kill_Chest, Oil_Plant, Oil_Ashes, Drink_WhitePotion, Fill_Gas, Take_Falcon, Take_Songbird, Play_BatWithFalcon, Read_Wand, Wave_Lyre, Play_PirateWithDagger and Action_Dig.
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 | B78F | PUSH HL | Stash HL on the stack. | |||||
| B790 | LD HL,($AECE) | Fetch the BCD score from *Score into HL. | ||||||
|
Add the points into the low score byte and adjust for BCD.
|
||||||||
| B793 | ADD A,L | Add the points in A to the low score byte in L. | ||||||
| B794 | DAA | Decimal-adjust A for a BCD score digit. | ||||||
| B795 | LD L,A | Store the adjusted low byte back in L. | ||||||
| B796 | JR NC,AddToScore_Store | Jump to AddToScore_Store if the addition did not carry. | ||||||
|
The low byte carried, so raise the high score byte.
|
||||||||
| B798 | INC H | Increase the high score byte in H by one. | ||||||
|
Write the updated score back to Score.
|
||||||||
| AddToScore_Store | B799 | LD ($AECE),HL | Store HL at Score. | |||||
| B79C | POP HL | Restore HL from the stack. | ||||||
| B79D | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: B77F | Up: Map | Next: B79E |