![]() |
Routines |
| Prev: ADE0 | Up: Map | Next: AE17 |
|
Used by the routines at MenuWriteText, PrepDraw23, PrepDraw2, Clear_Play_Area, Clear_Panel, Draw_Ceiling, Draw_Top_Right_Corner, Draw_Right_Wall, PrintStringColour, Draw_Ceiling_Picture, Draw_Left_Wall_Picture, Draw_Top_Left_Corner_Picture, Print_Status_Panel, Print_Depth, Print_Completion_Percentage, Draw_Lives, AddPointsToScore and Draw_Line.
Converts a pixel position into the address of the matching byte of the display file.
|
||||||||||||
| ScreenAddress | ADF8 | LD A,L | Fetch the x position. | |||||||||
| ADF9 | RRCA | Divide it by 08. | ||||||||||
| ADFA | RRCA | |||||||||||
| ADFB | RRCA | |||||||||||
| ADFC | AND $1F | Keep only five bits. | ||||||||||
| ADFE | LD L,A | Store the column in L. | ||||||||||
| ADFF | LD A,H | Fetch the y position. | ||||||||||
| AE00 | RLCA | Multiply it by 04. | ||||||||||
| AE01 | RLCA | |||||||||||
| AE02 | AND $E0 | Keep only the bits that give the character row within a third. | ||||||||||
| AE04 | OR L | Combine them with the column. | ||||||||||
| AE05 | LD L,A | Store the low byte of the address in L. | ||||||||||
| AE06 | LD A,H | Fetch the y position. | ||||||||||
| AE07 | AND $07 | Keep only the pixel line within the character. | ||||||||||
| AE09 | EX AF,AF' | Stash the line in AF'. | ||||||||||
| AE0A | LD A,H | Fetch the y position. | ||||||||||
| AE0B | RRCA | Divide it by 08. | ||||||||||
| AE0C | RRCA | |||||||||||
| AE0D | RRCA | |||||||||||
| AE0E | AND $18 | Keep only the bits that give the third of the screen. | ||||||||||
| AE10 | OR $40 | Add the start of the display file. | ||||||||||
| AE12 | LD H,A | Store the result in H. | ||||||||||
| AE13 | EX AF,AF' | Retrieve the pixel line from AF'. | ||||||||||
| AE14 | OR H | Combine it with the high byte of the address. | ||||||||||
| AE15 | LD H,A | Store the high byte of the address in H. | ||||||||||
| AE16 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: ADE0 | Up: Map | Next: AE17 |