![]() |
Routines |
| Prev: D811 | Up: Map | Next: D848 |
|
Finds the address on the screen of the byte that holds a pixel.
|
||||||||||||||
|
Build the display-file address from the pixel X and Y.
|
||||||||||||||
| CalculateScreenAddress | D826 | LD A,C | Fetch the pixel X coordinate and move it right by three bits. | |||||||||||
| D827 | RRCA | |||||||||||||
| D828 | RRCA | |||||||||||||
| D829 | RRCA | |||||||||||||
| D82A | AND %00011111 | Keep the byte of the line. | ||||||||||||
| D82C | LD E,A | Stash it in E. | ||||||||||||
| D82D | LD A,B | Fetch the pixel Y coordinate, inverted to get the line from the top. | ||||||||||||
| D82E | CPL | |||||||||||||
| D82F | AND %00000111 | Keep the line within the character row. | ||||||||||||
| D831 | EX AF,AF' | Stash it in the alternate A. | ||||||||||||
| D832 | LD A,B | Invert the pixel Y coordinate again and move it left by two bits. | ||||||||||||
| D833 | CPL | |||||||||||||
| D834 | RLCA | |||||||||||||
| D835 | RLCA | |||||||||||||
| D836 | AND %11100000 | Keep the character row within the third, in the high bits. | ||||||||||||
| D838 | OR E | Add the byte of the line. | ||||||||||||
| D839 | LD E,A | Store the low byte of the address in E. | ||||||||||||
| D83A | LD A,B | Invert the pixel Y coordinate again. | ||||||||||||
| D83B | CPL | |||||||||||||
| D83C | RRCA | Move the third of the screen into bits 3 and 4. | ||||||||||||
| D83D | RRCA | |||||||||||||
| D83E | RRCA | |||||||||||||
| D83F | AND %00011000 | Keep it. | ||||||||||||
| D841 | LD D,A | Stash it in D. | ||||||||||||
| D842 | EX AF,AF' | Fetch the line within the character row. | ||||||||||||
| D843 | OR D | Add the third of the screen. | ||||||||||||
| D844 | ADD A,$38 | Add 38, to make the high byte of the address. | ||||||||||||
| D846 | LD D,A | Store the high byte of the address in D. | ||||||||||||
| D847 | RET | Return. | ||||||||||||
| Prev: D811 | Up: Map | Next: D848 |