![]() |
Routines |
| Prev: E528 | Up: Map | Next: E556 |
|
Works out the address in the screen buffer of a position in the window. The buffer is 24 bytes wide.
|
||||||||||||||
|
Work out the column and 24 times the row.
|
||||||||||||||
| CalculateBufferAddress | E53A | PUSH BC | Stash BC on the stack. | |||||||||||
| E53B | SRL L | Divide the X position by eight. | ||||||||||||
| E53D | SRL L | |||||||||||||
| E53F | SRL L | |||||||||||||
| E541 | LD A,L | Keep the column, and start with the Y position. | ||||||||||||
| E542 | LD L,H | |||||||||||||
| E543 | LD H,$00 | |||||||||||||
| E545 | ADD HL,HL | Multiply the Y position by eight. | ||||||||||||
| E546 | ADD HL,HL | |||||||||||||
| E547 | ADD HL,HL | |||||||||||||
| E548 | LD C,L | Keep the result. | ||||||||||||
| E549 | LD B,H | |||||||||||||
| E54A | ADD HL,HL | Multiply by two more, and add it to get 24 times the Y position. | ||||||||||||
| E54B | ADD HL,BC | |||||||||||||
|
Add the column and the address of the buffer.
|
||||||||||||||
| E54C | LD C,A | Add the X position divided by eight. | ||||||||||||
| E54D | LD B,$00 | |||||||||||||
| E54F | ADD HL,BC | Add the column. | ||||||||||||
| E550 | LD BC,$DF02 | Add the address of the buffer. | ||||||||||||
| E553 | ADD HL,BC | |||||||||||||
| E554 | POP BC | Restore BC from the stack and return. | ||||||||||||
| E555 | RET | |||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: E528 | Up: Map | Next: E556 |