![]() |
Routines |
| Prev: 41021 | Up: Map | Next: 41064 |
|
Used by the routines at Destroy_Creature and Handle_Collectable.
Adds to the score (see Score) and prints the new score at the top of the screen.
The amount is a pair of BCD bytes: B holds the hundreds and C the units. One is taken off C before it is added, so when C is not zero the score goes up by B hundreds plus C minus one. When C is 0 it goes up by B hundreds plus 99.
|
||||||||||||||
| AddPointsToScore | 41029 | LD HL,36597 | Point at the low byte of the score (Score_Low_Byte). | |||||||||||
| 41032 | XOR A | Clear A (which also clears the carry flag). | ||||||||||||
| 41033 | LD A,C | Fetch the low byte of the amount. | ||||||||||||
| 41034 | DEC A | Subtract one, in BCD. | ||||||||||||
| 41035 | DAA | |||||||||||||
| 41036 | ADD A,(HL) | Add the low byte of the score and adjust the result to a BCD value. | ||||||||||||
| 41037 | DAA | |||||||||||||
| 41038 | LD (HL),A | Store the new low byte of the score. | ||||||||||||
| 41039 | DEC HL | Move on to the middle byte of the score. | ||||||||||||
| 41040 | LD A,(HL) | Fetch the middle byte of the score. | ||||||||||||
| 41041 | ADC A,B | Add the high byte of the amount and the carry. | ||||||||||||
| 41042 | DAA | Adjust the result to a BCD value. | ||||||||||||
| 41043 | LD (HL),A | Store the new middle byte of the score. | ||||||||||||
| 41044 | DEC HL | Move on to the high byte of the score. | ||||||||||||
| 41045 | LD A,(HL) | Fetch the high byte of the score. | ||||||||||||
| 41046 | ADC A,0 | Add the carry. | ||||||||||||
| 41048 | DAA | Adjust the result to a BCD value. | ||||||||||||
| 41049 | LD (HL),A | Store the new high byte of the score. | ||||||||||||
| 41050 | LD HL,48 | Set the x position to 48 and the y position to 0 (48). | ||||||||||||
| 41053 | LD DE,36595 | Point at the score (Score). | ||||||||||||
| 41056 | LD B,3 | Set the number of digits to print to 3. | ||||||||||||
| 41058 | CALL ScreenAddress | Convert the position into a screen address. | ||||||||||||
| 41061 | JP Print_Status_Panel_Digits | Jump to Print_Status_Panel_Digits to print the digits. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 41021 | Up: Map | Next: 41064 |