![]() |
Routines |
| Prev: 41289 | Up: Map | Next: 41357 |
|
Used by the routines at PrintText, UpdateStarLayer, DrawShipTop, FillAttributes, CopyAttributes and ColourSegment.
Finds the address in the attribute file of a pixel position. The vertical position is the number of the row of pixels, counted from the top of the screen.
|
||||||||||||||
| AttributeAddress | 41328 | PUSH BC | Stash BC on the stack. | |||||||||||
| 41329 | LD A,L | Fetch the horizontal position. | ||||||||||||
| 41330 | RRC A | Divide it by eight. | ||||||||||||
| 41332 | RRC A | |||||||||||||
| 41334 | RRC A | |||||||||||||
| 41336 | AND %00011111 | Keep the five bits of the column. | ||||||||||||
| 41338 | LD L,A | Store it in L. | ||||||||||||
| 41339 | LD A,H | Fetch the vertical position. | ||||||||||||
| 41340 | RLC A | Multiply it by four. | ||||||||||||
| 41342 | RLC A | |||||||||||||
| 41344 | LD C,A | Keep a copy. | ||||||||||||
| 41345 | AND %11100000 | Keep the bits that give the row of the cell. | ||||||||||||
| 41347 | OR L | Combine them with the column. | ||||||||||||
| 41348 | LD L,A | Store the low byte of the address. | ||||||||||||
| 41349 | LD A,C | Fetch the multiplied vertical position. | ||||||||||||
| 41350 | AND %00000011 | Keep the bits that give the third of the screen. | ||||||||||||
| 41352 | OR %01011000 | Add the address of the attribute file. | ||||||||||||
| 41354 | LD H,A | Store the high byte of the address. | ||||||||||||
| 41355 | POP BC | Bring BC back off the stack. | ||||||||||||
| 41356 | RET | Return. | ||||||||||||
| Prev: 41289 | Up: Map | Next: 41357 |