![]() |
Routines |
| Prev: 24264 | Up: Map | Next: 24373 |
|
Used by the routine at PopulateRoomBuffer.
Command 3: fill the attribute buffer with a single colour, then parse an overlay map to apply per-cell colour changes. The overlay uses a simple encoding:
|
||||||||||
| Command03_FillAttributes | 24283 | INC HL | Increment the room data pointer by one. | |||||||
| 24284 | LD C,(HL) | Fetch the base fill colour into C. | ||||||||
|
Fill 704 attribute cells at RoomAttributeBuffer with the base colour.
|
||||||||||
| 24285 | LD IX,55296 | IX=RoomAttributeBuffer. | ||||||||
| 24289 | LD DE,704 | DE=0704. | ||||||||
| FillAttributes_Loop | 24292 | LD (IX+0),C | Write C to *IX+0. | |||||||
| 24295 | INC IX | Increment IX by one. | ||||||||
| 24297 | DEC DE | Decrease DE by one. | ||||||||
| 24298 | LD A,E | Jump back to FillAttributes_Loop until DE is zero. | ||||||||
| 24299 | OR D | |||||||||
| 24300 | JR NZ,FillAttributes_Loop | |||||||||
|
Now parse the attribute overlay data to apply per-cell changes on top of the base fill colour.
|
||||||||||
| FillAttributes_Overlay | 24302 | INC HL | Increment HL by one. | |||||||
| 24303 | LD DE,705 | DE=0705. | ||||||||
| 24306 | LD IX,55296 | IX=RoomAttributeBuffer. | ||||||||
| FillAttributes_Overlay_Loop | 24310 | LD A,(HL) | A=*HL. | |||||||
| 24311 | CP 18 | Jump to FillAttributes_Skip if A is 18 (skip command). | ||||||||
| 24313 | JR Z,FillAttributes_Skip | |||||||||
| 24315 | CP 27 | Jump to FillAttributes_Repeat if A is 27 (repeat command). | ||||||||
| 24317 | JR Z,FillAttributes_Repeat | |||||||||
| 24319 | CP 36 | Jump to Room_Attributes_End if A is 36 (end of attribute data). | ||||||||
| 24321 | JR Z,Room_Attributes_End | |||||||||
|
Otherwise, write this byte directly as a single attribute value.
|
||||||||||
| 24323 | LD C,(HL) | C=*HL. | ||||||||
| 24324 | LD (IX+0),C | Write C to *IX+0. | ||||||||
| 24327 | DEC DE | Decrease DE by one. | ||||||||
| 24328 | INC IX | Increment IX by one. | ||||||||
| 24330 | LD A,E | Jump to PopulateRoomBuffer_Error if DE is zero. | ||||||||
| 24331 | OR D | |||||||||
| 24332 | JP Z,PopulateRoomBuffer_Error | |||||||||
| 24335 | INC HL | Increment HL by one. | ||||||||
| 24336 | JR FillAttributes_Overlay_Loop | Jump to FillAttributes_Overlay_Loop. | ||||||||
|
Attribute overlay command 18: skip over a number of attribute cells.
The following byte gives the skip count.
|
||||||||||
| FillAttributes_Skip | 24338 | INC HL | Increment HL by one. | |||||||
| 24339 | LD B,(HL) | Fetch the skip count into B. | ||||||||
| FillAttributes_Skip_Loop | 24340 | INC IX | Increment IX by one. | |||||||
| 24342 | DEC DE | Decrease DE by one. | ||||||||
| 24343 | LD A,E | Jump to PopulateRoomBuffer_Error if DE is zero. | ||||||||
| 24344 | OR D | |||||||||
| 24345 | JP Z,PopulateRoomBuffer_Error | |||||||||
| 24348 | DJNZ FillAttributes_Skip_Loop | Decrease the skip counter by one and loop back to FillAttributes_Skip_Loop until done. | ||||||||
| 24350 | INC HL | Increment HL by one. | ||||||||
| 24351 | JR FillAttributes_Overlay_Loop | Jump to FillAttributes_Overlay_Loop. | ||||||||
|
Attribute overlay command 27: repeat a colour value a number of times. The following two bytes give the repeat count and colour value.
|
||||||||||
| FillAttributes_Repeat | 24353 | INC HL | Increment HL by one. | |||||||
| 24354 | LD B,(HL) | Fetch the repeat count into B. | ||||||||
| 24355 | INC HL | Increment HL by one. | ||||||||
| 24356 | LD C,(HL) | Fetch the colour value into C. | ||||||||
| 24357 | INC HL | Increment HL past the colour value byte. | ||||||||
| FillAttributes_Repeat_Loop | 24358 | LD (IX+0),C | Write C to *IX+0. | |||||||
| 24361 | INC IX | Increment IX by one. | ||||||||
| 24363 | DEC DE | Decrease DE by one. | ||||||||
| 24364 | LD A,E | Jump to PopulateRoomBuffer_Error if DE is zero. | ||||||||
| 24365 | OR D | |||||||||
| 24366 | JP Z,PopulateRoomBuffer_Error | |||||||||
| 24369 | DJNZ FillAttributes_Repeat_Loop | Decrease the repeat counter by one and loop back to FillAttributes_Repeat_Loop until done. | ||||||||
| 24371 | JR FillAttributes_Overlay_Loop | Jump to FillAttributes_Overlay_Loop. | ||||||||
| Prev: 24264 | Up: Map | Next: 24373 |