![]() |
Routines |
| Prev: D400 | Up: Map | Next: D463 |
|
Used by the routine at DrawTownPanel.
Draws the reward for the outlaw on the poster, from OutlawRewards for Level. It is three bytes of packed decimal digits, without the zeroes at the start. The digits are drawn from one byte before Font_Digits, so they are drawn one line lower.
|
|||||
|
Find the reward for the level.
|
|||||
| DrawReward | D423 | LD A,($A260) | Fetch Level, and keep it in C. | ||
| D426 | LD C,A | ||||
| D427 | ADD A,A | Multiply it by 03. | |||
| D428 | ADD A,C | ||||
| D429 | LD HL,$B56E | Point HL at OutlawRewards. | |||
| D42C | CALL AddAToHL | Call AddAToHL. | |||
| D42F | EX DE,HL | Put the address in DE. | |||
|
Set the screen address.
|
|||||
| D430 | LD HL,$4882 | Point HL at 4882 (in the screen buffer). | |||
| D433 | LD B,$03 | Set a count of 03 bytes. | |||
|
Skip the leading zeroes.
|
|||||
| DrawReward_Skip | D435 | LD A,(DE) | Fetch the byte. | ||
| D436 | AND %11110000 | Keep the upper digit. | |||
| D438 | JR NZ,DrawReward_Upper | Jump to DrawReward_Upper if it is not zero. | |||
| D43A | LD A,(DE) | Fetch the byte. | |||
| D43B | AND %00001111 | Keep the lower digit. | |||
| D43D | JR NZ,DrawReward_Lower | Jump to DrawReward_Lower if it is not zero. | |||
| D43F | INC DE | Move on to the next byte. | |||
| D440 | DJNZ DrawReward_Skip | Jump to DrawReward_Skip if there are any left. | |||
| D442 | RET | Return. | |||
|
Draw the upper digit.
|
|||||
| DrawReward_Upper | D443 | LD A,(DE) | Fetch the byte. | ||
| D444 | RRCA | Move the upper digit into the lower four bits. | |||
| D445 | RRCA | ||||
| D446 | RRCA | ||||
| D447 | RRCA | ||||
| D448 | AND %00001111 | Keep only bits 0-3. | |||
| D44A | PUSH BC | Stash the counter on the stack. | |||
| D44B | LD BC,$8EAF | Point BC one byte before Font_Digits. | |||
|
Draw the digit.
|
|||||
| D44E | CALL DrawTilePixels | Call DrawTilePixels. | |||
| D451 | INC L | Move on to the next column. | |||
| D452 | POP BC | Restore the counter from the stack. | |||
|
Draw the lower digit.
|
|||||
| DrawReward_Lower | D453 | PUSH BC | Stash the counter on the stack. | ||
| D454 | LD BC,$8EAF | Point BC one byte before Font_Digits. | |||
| D457 | LD A,(DE) | Fetch the byte and move to the next one. | |||
| D458 | INC DE | ||||
| D459 | AND %00001111 | Keep only bits 0-3. | |||
|
Draw the digit.
|
|||||
| D45B | CALL DrawTilePixels | Call DrawTilePixels. | |||
| D45E | INC L | Move on to the next column. | |||
| D45F | POP BC | Restore the counter from the stack. | |||
| D460 | DJNZ DrawReward_Upper | Jump to DrawReward_Upper if there are any left. | |||
| D462 | RET | Return. | |||
| Prev: D400 | Up: Map | Next: D463 |