![]() |
Routines |
| Prev: 44479 | Up: Map | Next: 44522 |
|
Used by the routine at AttackSector.
Changes the sector that is shown as being under attack, and then draws the map of the sectors. The code of a sector has the row in bits 6 and 7 and the column in bits 1 and 2; a row or column of 3 means that there is no sector. The flag that says the old sector is under attack is cleared.
|
||||||||
| SetAttackedSector | 44483 | LD HL,38471 | Point HL at the code of the sector that is under attack. | |||||
| 44486 | LD A,(HL) | Fetch the old code... | ||||||
| 44487 | LD (HL),C | ...and store the new one. | ||||||
| 44488 | CP C | Jump to draw the map if the code has not changed. | ||||||
| 44489 | JR Z,DrawSectorMap | |||||||
| 44491 | LD C,A | Keep the old code. | ||||||
| 44492 | AND 6 | Keep the column of the old sector... | ||||||
| 44494 | CP 6 | Jump to draw the map if the old code was not a sector. | ||||||
| 44496 | JR Z,DrawSectorMap | |||||||
| 44498 | RRCA | Halve the column... | ||||||
| 44499 | LD D,A | ...and keep it in D. | ||||||
| 44500 | LD A,C | Fetch the old code again... | ||||||
| 44501 | RLCA | ...and move the row into the low bits. | ||||||
| 44502 | RLCA | |||||||
| 44503 | AND 3 | Keep the row. | ||||||
| 44505 | CP 3 | Jump to draw the map if the old code was not a sector. | ||||||
| 44507 | JR Z,DrawSectorMap | |||||||
| 44509 | LD E,A | Keep the row. | ||||||
| 44510 | RLCA | Double the row... | ||||||
| 44511 | ADD A,E | ...add the row again, to multiply it by three... | ||||||
| 44512 | ADD A,D | ...add the column... | ||||||
| 44513 | LD E,A | ...and keep the number of the old sector in E. | ||||||
| 44514 | LD D,0 | Clear the high byte of the sector number. | ||||||
| 44516 | LD HL,38526 | Point HL at SectorStates. | ||||||
| 44519 | ADD HL,DE | Add the number of the sector. | ||||||
| 44520 | RES 2,(HL) | Clear the flag that says that the sector is under attack. | ||||||
| Prev: 44479 | Up: Map | Next: 44522 |