![]() |
Routines |
| Prev: 44502 | Up: Map | Next: 44536 |
|
Used by the routines at MenuWriteText, ColourEntity, Set_Area_Attributes, PrintStringColour, Draw_Ceiling_Picture, Draw_Left_Wall_Picture, Draw_Top_Left_Corner_Picture, Draw_Line, Handle_Stalactite and Handle_Rock_Formation.
Converts a pixel position into the address of the matching cell of the attribute buffer.
|
||||||||||||
| AttributeAddress | 44512 | PUSH BC | Stash BC on the stack. | |||||||||
| 44513 | LD A,L | Fetch the x position. | ||||||||||
| 44514 | RRCA | Divide it by 8. | ||||||||||
| 44515 | RRCA | |||||||||||
| 44516 | RRCA | |||||||||||
| 44517 | AND 31 | Keep only five bits. | ||||||||||
| 44519 | LD L,A | Store the column in L. | ||||||||||
| 44520 | LD A,H | Fetch the y position. | ||||||||||
| 44521 | RLCA | Multiply it by 4. | ||||||||||
| 44522 | RLCA | |||||||||||
| 44523 | LD C,A | Store the result in C. | ||||||||||
| 44524 | AND 224 | Keep only the bits that give the low part of the row. | ||||||||||
| 44526 | OR L | Combine them with the column. | ||||||||||
| 44527 | LD L,A | Store the low byte of the address in L. | ||||||||||
| 44528 | LD A,C | Fetch the multiplied y position. | ||||||||||
| 44529 | AND 3 | Keep only the bits that give the high part of the row. | ||||||||||
| 44531 | OR 88 | Add the start of the attribute buffer. | ||||||||||
| 44533 | LD H,A | Store the high byte of the address in H. | ||||||||||
| 44534 | POP BC | Restore BC from the stack. | ||||||||||
| 44535 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 44502 | Up: Map | Next: 44536 |