![]() |
Routines |
| Prev: D120 | Up: Map | Next: D157 |
|
Used by the routines at UpdateLightYears, DisplayObjectsCarried, CopyAreaToScreen and DrawChangedObjects.
Finds the address on the screen of the byte that holds a pixel. The pixel y position is from the bottom of the screen.
|
||||||||||||||
|
Work out the byte from the position.
|
||||||||||||||
| CalculateScreenAddress | D135 | LD A,C | Divide C by eight. | |||||||||||
| D136 | RRCA | |||||||||||||
| D137 | RRCA | |||||||||||||
| D138 | RRCA | |||||||||||||
| D139 | AND %00011111 | Keep bits 0 to 4. | ||||||||||||
| D13B | LD E,A | Copy it to E. | ||||||||||||
| D13C | LD A,B | Fetch B and invert it. | ||||||||||||
| D13D | CPL | |||||||||||||
| D13E | AND %00000111 | Keep bits 0 to 2. | ||||||||||||
| D140 | EX AF,AF' | Copy it to A'. | ||||||||||||
| D141 | LD A,B | Fetch B and invert it. | ||||||||||||
| D142 | CPL | |||||||||||||
| D143 | RLCA | Move the character row into bits 5 to 7. | ||||||||||||
| D144 | RLCA | |||||||||||||
| D145 | AND %11100000 | Keep bits 5 to 7. | ||||||||||||
| D147 | OR E | Merge E. | ||||||||||||
| D148 | LD E,A | Copy it to E. | ||||||||||||
| D149 | LD A,B | Fetch B and invert it. | ||||||||||||
| D14A | CPL | |||||||||||||
| D14B | RRCA | Move the third into bits 3 and 4. | ||||||||||||
| D14C | RRCA | |||||||||||||
| D14D | RRCA | |||||||||||||
| D14E | AND %00011000 | Keep bits 3 and 4. | ||||||||||||
| D150 | LD D,A | Copy it to D. | ||||||||||||
| D151 | EX AF,AF' | Fetch A'. | ||||||||||||
| D152 | OR D | Merge D. | ||||||||||||
| D153 | ADD A,$38 | Add 38. | ||||||||||||
| D155 | LD D,A | Copy it to D. | ||||||||||||
| D156 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: D120 | Up: Map | Next: D157 |