![]() |
Routines |
| Prev: A149 | Up: Map | Next: A18D |
|
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 | A170 | PUSH BC | Stash BC on the stack. | |||||||||||
| A171 | LD A,L | Fetch the horizontal position. | ||||||||||||
| A172 | RRC A | Divide it by eight. | ||||||||||||
| A174 | RRC A | |||||||||||||
| A176 | RRC A | |||||||||||||
| A178 | AND %00011111 | Keep the five bits of the column. | ||||||||||||
| A17A | LD L,A | Store it in L. | ||||||||||||
| A17B | LD A,H | Fetch the vertical position. | ||||||||||||
| A17C | RLC A | Multiply it by four. | ||||||||||||
| A17E | RLC A | |||||||||||||
| A180 | LD C,A | Keep a copy. | ||||||||||||
| A181 | AND %11100000 | Keep the bits that give the row of the cell. | ||||||||||||
| A183 | OR L | Combine them with the column. | ||||||||||||
| A184 | LD L,A | Store the low byte of the address. | ||||||||||||
| A185 | LD A,C | Fetch the multiplied vertical position. | ||||||||||||
| A186 | AND %00000011 | Keep the bits that give the third of the screen. | ||||||||||||
| A188 | OR %01011000 | Add the address of the attribute file. | ||||||||||||
| A18A | LD H,A | Store the high byte of the address. | ||||||||||||
| A18B | POP BC | Bring BC back off the stack. | ||||||||||||
| A18C | RET | Return. | ||||||||||||
| Prev: A149 | Up: Map | Next: A18D |