![]() |
Routines |
Prev: 27029 | Up: Map | Next: 27097 |
There's a table of alien row positions at _ALIEN_ROWS_DATA. It contains 5 2-byte entries, one for each row. Each entry contains the cx,cy location for the row. They start at 5,y, where 'y' is the row down the screen which advances each completed screen.
This code also sets up the aliens UDG data, which is the alien colour and which way they are looking.
Used by the routine at start.
|
||||
init_alien_row_data | 27030 | LD A,(_ALIENS_START_ROW) | Pick up the screen row where the aliens start | |
27033 | ADD A,3 | Add 3, no obvious reason not to store this adjusted value in _ALIENS_START_ROW | ||
27035 | LD (_ALIEN_UDGS_START),A | Stash that | ||
27038 | LD HL,_ALIEN_TYPES_PER_ROW | Alien types per row, yellow, green, green, red, red | ||
27041 | LD (_ALIEN_TYPE_TEMP),HL | Stash that | ||
27044 | LD A,4 | Loop this code 5 times (really, P flag is used below) | ||
27046 | LD (_ALIEN_INIT_COUNTER),A | |||
27049 | LD IX,_ALIEN_ROWS_DATA | Get a pointer to alien row position data | ||
init_alien_row_data_0 | 27053 | LD (IX+0),5 | Byte 0 is cx, which starts as 5 chars in from left | |
27057 | INC IX | |||
27059 | LD A,(_ALIEN_UDGS_START) | Pick up starting row number | ||
27062 | LD (IX+0),A | Byte 1 is cy, which starts as row number down screen | ||
27065 | INC IX | |||
27067 | INC A | Down 2 rows (aliens are 2 UDGs high) and update starting row number | ||
27068 | INC A | |||
27069 | LD (_ALIEN_UDGS_START),A | |||
27072 | LD HL,(_ALIEN_TYPE_TEMP) | Pick up type table location again | ||
27075 | LD A,(HL) | Find alien type for this row | ||
27076 | INC HL | Update alien type ready for next row | ||
27077 | LD (_ALIEN_TYPE_TEMP),HL | |||
27080 | CALL find_alien_udg | Get UDG sprite type in A into HL | ||
27083 | CALL populate_alien_row_udgs | Prime the graphics ready for drawing. This advances IX by 704 bytes | ||
27086 | LD A,(_ALIEN_INIT_COUNTER) | Pick up counter and repeat for each row. P flag on the jump is an odd choice. | ||
27089 | DEC A | |||
27090 | LD (_ALIEN_INIT_COUNTER),A | |||
27093 | JP P,init_alien_row_data_0 | |||
27096 | RET |
Prev: 27029 | Up: Map | Next: 27097 |