![]() |
Routines |
| Prev: E53A | Up: Map | Next: E579 |
|
Used by the routines at PickUpItem and PrintString.
Works out the address on the screen of a position given in pixels, measured from the bottom left of the screen.
|
||||||||||||||
| CalculateScreenAddress | E556 | PUSH DE | Keep DE, and put the position in it. | |||||||||||
| E557 | EX DE,HL | |||||||||||||
| E558 | LD A,E | Work out the column from the X position. | ||||||||||||
| E559 | RRCA | |||||||||||||
| E55A | RRCA | |||||||||||||
| E55B | RRCA | |||||||||||||
| E55C | AND $1F | |||||||||||||
| E55E | LD L,A | |||||||||||||
| E55F | LD A,D | Work out the character row within a third of the screen, from the Y position measured from the top. | ||||||||||||
| E560 | CPL | |||||||||||||
| E561 | RLCA | |||||||||||||
| E562 | RLCA | |||||||||||||
| E563 | AND $E0 | |||||||||||||
| E565 | OR L | |||||||||||||
| E566 | LD L,A | |||||||||||||
| E567 | LD A,D | Work out the third of the screen. | ||||||||||||
| E568 | CPL | |||||||||||||
| E569 | RRCA | |||||||||||||
| E56A | RRCA | |||||||||||||
| E56B | RRCA | |||||||||||||
| E56C | AND $18 | |||||||||||||
| E56E | LD H,A | |||||||||||||
| E56F | LD A,D | Work out the pixel row within the character, and make the high byte of the address. | ||||||||||||
| E570 | CPL | |||||||||||||
| E571 | AND $07 | |||||||||||||
| E573 | OR H | |||||||||||||
| E574 | ADD A,$38 | |||||||||||||
| E576 | LD H,A | |||||||||||||
| E577 | POP DE | Get DE back and return. | ||||||||||||
| E578 | RET | |||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: E53A | Up: Map | Next: E579 |