![]() |
Routines |
Prev: 33084 | Up: Map | Next: 33203 |
Used by the routines at GameInitialise and Handler_SubGame.
|
|||||
|
|||||
Print_WorldMap | 33094 | LD IX,61440 | IX=WorldMap_Data. | ||
33098 | LD HL,24576 | HL=ShadowBuffer. | |||
33101 | LD E,255 | Set E as a bit counter/ mask. | |||
33103 | LD D,128 | D is used as a bit mask for the output. | |||
33105 | LD A,0 | Initialise A to 0 which is used for comparisons. | |||
Main loop, process the map data.
|
|||||
WorldMap_Loop | 33107 | INC IX | Increment the map data pointer by one. | ||
33109 | LD B,(IX-1) | Load the current map data byte into B. | |||
33112 | INC E | Increment the bit counter by one. | |||
33113 | JR Z,WorldMap_ExpandData | Jump to WorldMap_ExpandData if the bit counter wrapped around to zero. | |||
33115 | LD E,255 | Reset E to 255 if it didn't wrap. | |||
Expand map data into pixels.
|
|||||
WorldMap_ExpandData | 33117 | RRC E | Rotate E right (with carry). | ||
33119 | RL (HL) | Rotate the byte at *HL left one position, including the carry from the previous line. | |||
33121 | DEC B | Decrease bits remaining in the current map byte by one. | |||
33122 | SRL D | Shift the output bit mask right one position. | |||
33124 | JR Z,WorldMap_NextByte | Jump to WorldMap_NextByte if B is zero (the byte is filled). | |||
33126 | CP B | Jump to WorldMap_ExpandData if A is not equal to B. | |||
33127 | JR NZ,WorldMap_ExpandData | ||||
Move to the next map data byte.
|
|||||
33129 | JR WorldMap_Loop | Jump to WorldMap_Loop. | |||
Move to next shadow buffer byte.
|
|||||
WorldMap_NextByte | 33131 | INC HL | Increment the shadow buffer pointer by one. | ||
33132 | LD A,120 | A=120 (high byte of the shadow buffer end address). | |||
33134 | CP H | Jump to WorldMap_ClearEdge if the end of the shadow buffer has been reached. | |||
33135 | JR Z,WorldMap_ClearEdge | ||||
33137 | LD A,B | Store the remaining bits from the current map byte in A. | |||
33138 | CP 8 | Jump to WorldMap_FullByte if A is equal to/ higher than 8. | |||
33140 | JR NC,WorldMap_FullByte | ||||
33142 | CP 0 | Check if we're done with current map byte. | |||
33144 | LD D,128 | Reset the bit mask in D to 128. | |||
33146 | JR Z,WorldMap_Loop | Jump to WorldMap_Loop if we are done with the current map byte. | |||
33148 | LD A,0 | Reset A for comparison in bit manipulation loop. | |||
33150 | JR WorldMap_ExpandData | Jump to WorldMap_ExpandData. | |||
Handle full byte remaining.
|
|||||
WorldMap_FullByte | 33152 | LD (HL),E | Store the full byte in the shadow buffer. | ||
33153 | SUB 8 | Subtract 8 from the remaining bit count. | |||
33155 | LD B,A | ||||
33156 | JR WorldMap_NextByte | Jump to WorldMap_NextByte. | |||
Due to the way the decompression works, the image is left with a trailing line - this is what it would look like if we didn't clear the right edge of the map.
Clear the right edge of the map.
|
|||||
WorldMap_ClearEdge | 33158 | LD HL,24607 | HL=24607. | ||
33161 | LD DE,32 | Set the row width in DE (0032 bytes is one whole row). | |||
33164 | LD B,192 | Set a counter in B of the number of rows to process (192). | |||
WorldMap_ClearEdge_Loop | 33166 | RES 0,(HL) | Reset bit 0 of *HL. | ||
33168 | ADD HL,DE | Move to the next row. | |||
33169 | DJNZ WorldMap_ClearEdge_Loop | Decrease the row counter by one and loop back to WorldMap_ClearEdge_Loop until all rows have been processed. | |||
Copy the map to the screen buffer.
|
|||||
33171 | LD HL,24576 | Copy 6144 bytes from ShadowBuffer to the screen buffer. | |||
33174 | LD DE,16384 | ||||
33177 | LD BC,6144 | ||||
33180 | LDIR | ||||
Colour the whole of the attribute buffer INK:
YELLOW,
PAPER:
BLUE
(BRIGHT)
.
|
|||||
33182 | LD HL,22528 | HL=22528 (attribute buffer location). | |||
33185 | LD DE,22529 | DE=22529. | |||
33188 | LD BC,767 | BC=767. | |||
33191 | LD (HL),78 | Write INK: YELLOW, PAPER: BLUE (BRIGHT) to *HL. | |||
33193 | LDIR | Copy 767 more bytes to the rest of the attribute buffer. | |||
33195 | LD A,1 | Write 1 to *39372. | |||
33197 | LD (39372),A | ||||
33200 | OUT (254),A | Set the border to BLUE. | |||
33202 | RET | Return. |
Prev: 33084 | Up: Map | Next: 33203 |