![]() |
Routines |
| Prev: AE2D | Up: Map | Next: AED0 |
|
Used by the routines at StartRobot and MoveRobotHorizontally.
Shows the position of the robot on the map of the sectors. The marker is drawn with XOR, so the old marker is removed by drawing it again. Nothing is done if the robot has not moved to a different cell.
Draws a marker of three pixels by three on the map of the sectors, using XOR. Each cell of the map is one pixel on the screen.
|
||||||||||
| UpdateRobotMarker | AE67 | LD DE,($9691) | Fetch the X position of the robot... | |||||||
| AE6B | LD HL,($9693) | ...and the Y position. | ||||||||
| AE6E | LD A,($9649) | Fetch the X cell where the marker was drawn last. | ||||||||
| AE71 | CP D | Jump if the robot is in a different X cell. | ||||||||
| AE72 | JR NZ,UpdateRobotMarker_NewCell | |||||||||
| AE74 | LD A,($964B) | Fetch the Y cell where the marker was drawn last. | ||||||||
| AE77 | CP H | Return if the robot has not moved to a different cell. | ||||||||
| AE78 | RET Z | |||||||||
| UpdateRobotMarker_NewCell | AE79 | PUSH DE | Save the X position... | |||||||
| AE7A | PUSH HL | ...and the Y position. | ||||||||
| AE7B | CALL ToggleMarker | Draw the marker at the new position using ToggleMarker. | ||||||||
| AE7E | POP HL | Restore the Y position. | ||||||||
| AE7F | LD DE,($964A) | Fetch the old Y position... | ||||||||
| AE83 | LD ($964A),HL | ...and store the new one. | ||||||||
| AE86 | EX DE,HL | Put the old one in HL. | ||||||||
| AE87 | POP BC | Restore the new X position... | ||||||||
| AE88 | LD DE,($9648) | ...fetch the old one... | ||||||||
| AE8C | LD ($9648),BC | ...and store the new one. | ||||||||
| AE90 | LD A,D | Combine the cells of the old position... | ||||||||
| AE91 | OR H | ...and return if there was no marker. | ||||||||
| AE92 | RET Z | |||||||||
|
This entry point is used by the routine at UpdatePacketMarker.
This entry point draws, or removes, a marker.
|
||||||||||
| ToggleMarker | AE93 | LD A,D | Fetch the X cell... | |||||||
| AE94 | OR $C0 | ...and find the X coordinate of the marker, which is BE plus the cell. | ||||||||
| AE96 | SUB $02 | |||||||||
| AE98 | LD L,A | Keep the X coordinate of the marker. | ||||||||
| AE99 | AND $07 | Use the lowest three bits... | ||||||||
| AE9B | ADD A,A | ...to find the pre-shifted data... | ||||||||
| AE9C | OR $E0 | ...in the table of shifted bytes. | ||||||||
| AE9E | LD B,A | Keep the shifted graphic. | ||||||||
| AE9F | LD A,H | Fetch the Y cell... | ||||||||
| AEA0 | XOR $3F | Turn the Y cell upside down... | ||||||||
| AEA2 | ADD A,$39 | ...and find the Y coordinate of the marker. | ||||||||
| AEA4 | LD H,A | Keep the Y coordinate of the marker. | ||||||||
| AEA5 | CALL ScreenAddress | Find the screen address using ScreenAddress. | ||||||||
| AEA8 | LD A,$03 | There are three rows to draw. | ||||||||
| AEAA | LD DE,$AED0 | Point DE at MarkerPattern. | ||||||||
| ToggleMarker_Row | AEAD | EX AF,AF' | Save the counter. | |||||||
| AEAE | LD A,(DE) | Fetch the pattern for the row... | ||||||||
| AEAF | LD C,A | ...to use as the offset into the shifted data. | ||||||||
| AEB0 | LD A,(BC) | Fetch the shifted byte... | ||||||||
| AEB1 | XOR (HL) | ...combine it with the screen... | ||||||||
| AEB2 | LD (HL),A | ...and write it back. | ||||||||
| AEB3 | INC L | Move on to the next byte of the screen. | ||||||||
| AEB4 | INC B | Move on to the second table of shifted bytes. | ||||||||
| AEB5 | LD A,(BC) | Fetch the byte that has spilled over... | ||||||||
| AEB6 | XOR (HL) | ...combine it with the screen... | ||||||||
| AEB7 | LD (HL),A | ...and write it back. | ||||||||
| AEB8 | DEC B | Go back to the first table... | ||||||||
| AEB9 | DEC L | ...and the first byte of the screen. | ||||||||
| AEBA | LD A,H | Fetch the high byte of the screen address... | ||||||||
| AEBB | DEC H | ...and move up one line. | ||||||||
| AEBC | AND $07 | Jump if that has not moved into the character above. | ||||||||
| AEBE | JR NZ,ToggleMarker_Next | |||||||||
| AEC0 | LD A,L | Fetch the low byte of the screen address... | ||||||||
| AEC1 | SUB $20 | ...take one row of characters off it... | ||||||||
| AEC3 | LD L,A | ...and store it. | ||||||||
| AEC4 | JR C,ToggleMarker_Next | Jump if there is no row of characters above, in this third of the screen... | ||||||||
| AEC6 | LD A,H | Otherwise fetch the high byte... | ||||||||
| AEC7 | ADD A,$08 | ...add eight to it... | ||||||||
| AEC9 | LD H,A | ...and store it. | ||||||||
| ToggleMarker_Next | AECA | EX AF,AF' | Restore the counter. | |||||||
| AECB | INC DE | Move on to the next pattern. | ||||||||
| AECC | DEC A | Count down the rows. | ||||||||
| AECD | JR NZ,ToggleMarker_Row | Loop back until all three rows have been drawn. | ||||||||
| AECF | RET | Return. | ||||||||
| Prev: AE2D | Up: Map | Next: AED0 |