![]() |
Routines |
| Prev: 6A2F | Up: Map | Next: 6A68 |
|
Prints flag B as a decimal number followed by a space. Zero is a single digit; any other value is two digits.
|
||||||||
| PrintFlag | 6A3C | CALL FlagAddress | Call FlagAddress. | |||||
| 6A3F | LD A,(HL) | Fetch the flag. | ||||||
| 6A40 | OR A | Jump to PrintFlag_High if it is zero. | ||||||
| 6A41 | JR Z,PrintFlag_High | |||||||
| 6A43 | LD B,A | Count the flag in B. | ||||||
|
Count the flag into two decimal digits.
|
||||||||
| 6A44 | XOR A | Start the decimal byte at 00. | ||||||
|
Count one decimal step.
|
||||||||
| PrintFlag_Tens | 6A45 | INC A | Increment the decimal byte. | |||||
| 6A46 | DAA | Keep it as two decimal digits with DAA. |
||||||
| 6A47 | DJNZ PrintFlag_Tens | Jump to PrintFlag_Tens until the flag has been counted. | ||||||
|
Print the tens digit unless the flag is zero.
|
||||||||
| PrintFlag_High | 6A49 | PUSH AF | Stash the decimal byte on the stack. | |||||
| 6A4A | OR A | Jump to PrintFlag_Units if the flag is zero. | ||||||
| 6A4B | JR Z,PrintFlag_Units | |||||||
| 6A4D | SRL A | Move the tens digit into the low nibble. | ||||||
| 6A4F | SRL A | |||||||
| 6A51 | SRL A | |||||||
| 6A53 | SRL A | |||||||
|
Add 30 so the tens digit is an ASCII character.
|
||||||||
| 6A55 | ADD A,$30 | Print the tens digit using PrintCharacter. | ||||||
| 6A57 | CALL PrintCharacter | |||||||
|
Print the units digit.
|
||||||||
| PrintFlag_Units | 6A5A | POP AF | Restore the decimal byte from the stack. | |||||
| 6A5B | AND %00001111 | Keep only bits 0-3. | ||||||
| 6A5D | ADD A,$30 | Print the units digit using PrintCharacter. | ||||||
| 6A5F | CALL PrintCharacter | |||||||
| 6A62 | LD A,$20 | Print a following space using PlotCharacter. | ||||||
| 6A64 | CALL PlotCharacter | |||||||
| 6A67 | RET | Return. | ||||||
| Prev: 6A2F | Up: Map | Next: 6A68 |