![]() |
Routines |
| Prev: 26327 | Up: Map | Next: 26440 |
|
Used by the routine at UpdateBloomingFlower.
Writes the attributes of the open flower into the attribute buffer, using the table at FlowerAttributes, which is nine cells wide and seven cells high. The colour of the centre of the flower changes from yellow to magenta, unless the level is a multiple of four (and not the first level), which are the levels that award an extra life.
|
||||||||
| ColouriseFlower | 26382 | LD A,(IX+1) | L=the X position of the flower - 32. | |||||
| 26385 | SUB 32 | |||||||
| 26387 | LD L,A | |||||||
| 26388 | LD A,(IX+2) | H=the Y position of the flower - 48. | ||||||
| 26391 | SUB 48 | |||||||
| 26393 | LD H,A | |||||||
| 26394 | CALL AttributeAddress | Convert the position to an attribute buffer address using AttributeAddress. | ||||||
| 26397 | LD DE,26440 | DE=FlowerAttributes. | ||||||
| 26400 | LD BC,2311 | B=9 (the number of columns) and C=7 (the number of rows). | ||||||
| ColouriseFlower_Row | 26403 | PUSH BC | Stash the column and row counters on the stack. | |||||
| 26404 | PUSH HL | Stash the attribute address on the stack. | ||||||
| ColouriseFlower_Column | 26405 | LD A,(24119) | Jump to ColouriseFlower_Replace if this is the first level (ActivePlayer_Level is zero). | |||||
| 26408 | AND A | |||||||
| 26409 | JR Z,ColouriseFlower_Replace | |||||||
| 26411 | AND 3 | Jump to ColouriseFlower_Replace if the level is not a multiple of four. | ||||||
| 26413 | JR NZ,ColouriseFlower_Replace | |||||||
| ColouriseFlower_Write | 26415 | LD A,(DE) | A=the attribute from the table. | |||||
| ColouriseFlower_Store | 26416 | LD (HL),A | Write it to the attribute buffer. | |||||
| 26417 | INC HL | Move onto the next attribute buffer cell. | ||||||
| 26418 | INC DE | Move onto the next attribute in the table. | ||||||
| 26419 | DJNZ ColouriseFlower_Column | Decrease the column counter by one and loop back to ColouriseFlower_Column until the row has been coloured. | ||||||
| 26421 | POP HL | Restore the attribute address from the stack. | ||||||
| 26422 | LD BC,32 | BC=32 (the size of a row). | ||||||
| 26425 | ADD HL,BC | Move down one row. | ||||||
| 26426 | POP BC | Restore the column and row counters from the stack. | ||||||
| 26427 | DEC C | Decrease the row counter by one. | ||||||
| 26428 | JR NZ,ColouriseFlower_Row | Loop back to ColouriseFlower_Row until all of the rows have been coloured. | ||||||
| 26430 | RET | Return. | ||||||
|
For any other level, the yellow in the centre of the flower is replaced.
|
||||||||
| ColouriseFlower_Replace | 26431 | LD A,(DE) | A=the attribute from the table. | |||||
| 26432 | CP 94 | Jump to ColouriseFlower_Store if it is not 94 (yellow on magenta). | ||||||
| 26434 | JR NZ,ColouriseFlower_Store | |||||||
| 26436 | LD A,91 | A=91 (magenta on magenta). | ||||||
| 26438 | JR ColouriseFlower_Store | Jump to ColouriseFlower_Store. | ||||||
| Prev: 26327 | Up: Map | Next: 26440 |