![]() |
Routines |
| Prev: E262 | Up: Map | Next: E2C8 |
|
Used by the routine at Stage_Next_Wave.
Entry point called from Stage_Next_Wave. Reads the horizontal enemy spawn count from *HL and stores it at C42B; if zero, returns immediately. Otherwise loops B times, writing a full entity record into the entity list: the Step_Wide_Entity_Approach handler address, a random entity type in the range 34-37 a valid random screen position via Pick_Random_Spawn_Position_Y, and trailing bytes 0E 0D FF. Saves the updated entity list pointer to *Entity_List_Write_Pointer and writes the D1A4 list terminator.
|
||||
| Spawn_Horizontal_Wave_Enemies | E290 | LD A,(HL) | Load the horizontal enemy count from *HL and store it at C42B. | |
| E291 | LD ($C42B),A | |||
| E294 | INC HL | Return if the spawn count is zero. | ||
| E295 | AND A | |||
| E296 | RET Z | |||
| E297 | LD B,A | Set the spawn loop counter in B and stash the source pointer. | ||
| E298 | PUSH HL | |||
| E299 | LD HL,($C509) | Load the entity list write pointer from *Entity_List_Write_Pointer. | ||
| Spawn_Horizontal_Wave_Enemies_Record | E29C | LD DE,$CF52 | Write the Step_Wide_Entity_Approach entity handler as a little-endian word. | |
| E29F | LD (HL),E | |||
| E2A0 | INC HL | |||
| E2A1 | LD (HL),D | |||
| E2A2 | INC HL | Advance past the handler word. | ||
| E2A3 | CALL Generate_Random_Byte | Generate a random byte via Generate_Random_Byte. | ||
| E2A6 | AND %00000011 | Mask to the low 2 bits for the entity type offset. | ||
| E2A8 | ADD A,$34 | Add 34 write the entity type, and advance. | ||
| E2AA | LD (HL),A | |||
| E2AB | INC HL | |||
| E2AC | PUSH BC | Stash BC and call Pick_Random_Spawn_Position_Y to place the entity at a valid random screen position. | ||
| E2AD | CALL Pick_Random_Spawn_Position_Y | |||
| E2B0 | POP BC | |||
| E2B1 | DEC HL | Restore BC and step back one byte. | ||
| E2B2 | LD (HL),$0E | |||
| E2B4 | INC HL | Write trailing record bytes 0E 0D and FF. | ||
| E2B5 | LD (HL),$0D | |||
| E2B7 | INC HL | |||
| E2B8 | LD (HL),$FF | |||
| E2BA | INC HL | Advance HL and loop back to Spawn_Horizontal_Wave_Enemies_Record for the next entity. | ||
| E2BB | DJNZ Spawn_Horizontal_Wave_Enemies_Record | |||
| E2BD | LD ($C509),HL | Save the updated entity list pointer to *Entity_List_Write_Pointer. | ||
| E2C0 | LD DE,$D1A4 | |||
| E2C3 | LD (HL),E | |||
| E2C4 | INC HL | |||
| E2C5 | LD (HL),D | Write the list terminator D1A4 to *HL. | ||
| E2C6 | POP HL | |||
| E2C7 | RET | Return. | ||
| Prev: E262 | Up: Map | Next: E2C8 |