![]() |
Routines |
| Prev: 27183 | Up: Map | Next: 27240 |
|
Prints flag B as a decimal number followed by a space. Zero is a single digit; any other value is two digits.
|
||||||||
| PrintFlag | 27196 | CALL FlagAddress | Call FlagAddress. | |||||
| 27199 | LD A,(HL) | Fetch the flag. | ||||||
| 27200 | OR A | Jump to PrintFlag_High if it is zero. | ||||||
| 27201 | JR Z,PrintFlag_High | |||||||
| 27203 | LD B,A | Count the flag in B. | ||||||
|
Count the flag into two decimal digits.
|
||||||||
| 27204 | XOR A | Start the decimal byte at 0. | ||||||
|
Count one decimal step.
|
||||||||
| PrintFlag_Tens | 27205 | INC A | Increment the decimal byte. | |||||
| 27206 | DAA | Keep it as two decimal digits with DAA. |
||||||
| 27207 | DJNZ PrintFlag_Tens | Jump to PrintFlag_Tens until the flag has been counted. | ||||||
|
Print the tens digit unless the flag is zero.
|
||||||||
| PrintFlag_High | 27209 | PUSH AF | Stash the decimal byte on the stack. | |||||
| 27210 | OR A | Jump to PrintFlag_Units if the flag is zero. | ||||||
| 27211 | JR Z,PrintFlag_Units | |||||||
| 27213 | SRL A | Move the tens digit into the low nibble. | ||||||
| 27215 | SRL A | |||||||
| 27217 | SRL A | |||||||
| 27219 | SRL A | |||||||
|
Add 48 so the tens digit is an ASCII character.
|
||||||||
| 27221 | ADD A,48 | Print the tens digit using PrintCharacter. | ||||||
| 27223 | CALL PrintCharacter | |||||||
|
Print the units digit.
|
||||||||
| PrintFlag_Units | 27226 | POP AF | Restore the decimal byte from the stack. | |||||
| 27227 | AND %00001111 | Keep only bits 0-3. | ||||||
| 27229 | ADD A,48 | Print the units digit using PrintCharacter. | ||||||
| 27231 | CALL PrintCharacter | |||||||
| 27234 | LD A,32 | Print a following space using PlotCharacter. | ||||||
| 27236 | CALL PlotCharacter | |||||||
| 27239 | RET | Return. | ||||||
| Prev: 27183 | Up: Map | Next: 27240 |