![]() |
Routines |
| Prev: ADBF | Up: Map | Next: ADEA |
|
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 03 means that there is no sector. The flag that says the old sector is under attack is cleared.
|
||||||||
| SetAttackedSector | ADC3 | LD HL,$9647 | Point HL at the code of the sector that is under attack. | |||||
| ADC6 | LD A,(HL) | Fetch the old code... | ||||||
| ADC7 | LD (HL),C | ...and store the new one. | ||||||
| ADC8 | CP C | Jump to draw the map if the code has not changed. | ||||||
| ADC9 | JR Z,DrawSectorMap | |||||||
| ADCB | LD C,A | Keep the old code. | ||||||
| ADCC | AND $06 | Keep the column of the old sector... | ||||||
| ADCE | CP $06 | Jump to draw the map if the old code was not a sector. | ||||||
| ADD0 | JR Z,DrawSectorMap | |||||||
| ADD2 | RRCA | Halve the column... | ||||||
| ADD3 | LD D,A | ...and keep it in D. | ||||||
| ADD4 | LD A,C | Fetch the old code again... | ||||||
| ADD5 | RLCA | ...and move the row into the low bits. | ||||||
| ADD6 | RLCA | |||||||
| ADD7 | AND $03 | Keep the row. | ||||||
| ADD9 | CP $03 | Jump to draw the map if the old code was not a sector. | ||||||
| ADDB | JR Z,DrawSectorMap | |||||||
| ADDD | LD E,A | Keep the row. | ||||||
| ADDE | RLCA | Double the row... | ||||||
| ADDF | ADD A,E | ...add the row again, to multiply it by three... | ||||||
| ADE0 | ADD A,D | ...add the column... | ||||||
| ADE1 | LD E,A | ...and keep the number of the old sector in E. | ||||||
| ADE2 | LD D,$00 | Clear the high byte of the sector number. | ||||||
| ADE4 | LD HL,$967E | Point HL at SectorStates. | ||||||
| ADE7 | ADD HL,DE | Add the number of the sector. | ||||||
| ADE8 | RES 2,(HL) | Clear the flag that says that the sector is under attack. | ||||||
| Prev: ADBF | Up: Map | Next: ADEA |