Prev: 44483 Up: Map Next: 44557
44522: Draw Sector Map
Colours the map of the sectors that is shown in the panel. Each of the nine sectors is a block of two by two attributes, and its colour depends on the state of the sector.
DrawSectorMap 44522 LD HL,38526 Point HL at the table of sector states.
44525 LD B,9 There are nine sectors.
DrawSectorMap_Next 44527 LD E,(HL) Fetch the state of the sector...
44528 LD D,0 ...and clear D.
44530 PUSH HL Save the address of the state.
44531 LD HL,44581 Point HL at SectorStateAttributes.
44534 ADD HL,DE Add the state.
44535 LD A,(HL) Fetch the attribute.
44536 PUSH BC Save the counter.
44537 LD C,B Fetch the counter into C...
44538 DEC C ...and take one off.
44539 LD B,0 Clear the high byte of the counter.
44541 LD HL,44572 Point HL at SectorMapOffsets.
44544 ADD HL,BC Add the number of the sector.
44545 LD C,(HL) Fetch the offset into C.
44546 LD B,1 Use 256 as the high byte of the offset.
44548 CALL ColourSectorSquare Colour the sector using ColourSectorSquare.
44551 POP BC Restore the counter...
44552 POP HL ...and the address of the state.
44553 INC HL Move on to the next state.
44554 DJNZ DrawSectorMap_Next Loop back until all nine sectors have been drawn.
44556 RET Return.
Prev: 44483 Up: Map Next: 44557