![]() |
Routines |
Prev: 31107 | Up: Map | Next: 31198 |
This is looking at the alien row data and working out where on screen to draw the row. It needs to look at the left side space, the number of aliens still left in this row, and the right side space. It also works out if the next row draw has to draw the alien's facing left or right and sets the UDG pointer appropriately.
Routine at 31119
Used by the routines at bullet_alien_coll_xaxis, move_aliens, move_one_row_aliens_down and init_draw_aliens.
|
||||||||
prep_alien_row_data | 31119 | LD (_ALIEN_ROW_PTR),IX | Stash IX | |||||
31123 | LD C,(IX+0) | Put alien row cypos,cxpos into next alien row to draw | ||||||
31126 | LD B,(IX+1) | |||||||
31129 | LD (_NEXT_ALIEN_ROW_TO_DRAW),BC | |||||||
31133 | LD A,(_LEFTMOST_ACTIVE_ALIEN_COL) | Pick up left most colum to draw | ||||||
31136 | INC A | Multiply by 2 because aliens are 2 chars wide | ||||||
31137 | SLA A | |||||||
31139 | LD C,A | Set IX to point to this row's alien UDG data | ||||||
31140 | LD B,0 | |||||||
31142 | ADD IX,BC | |||||||
31144 | LD A,(_NEXT_ALIEN_ROW_TO_DRAW) | cy in A | ||||||
31147 | RRA | Rotate bottom bit into carry | ||||||
31148 | JR NC,prep_alien_row_data_0 | Every other draw we switch the alien graphics look left/right UDG selection | ||||||
31150 | LD BC,352 | |||||||
31153 | ADD IX,BC | |||||||
prep_alien_row_data_0 | 31155 | LD (_ALIEN_SPRITE_DATA_PTR),IX | That's the graphics data to use | |||||
31159 | LD A,(_NEXT_ALIEN_ROW_TO_DRAW) | Put row cy in B | ||||||
31162 | LD B,A | |||||||
31163 | LD A,(_LEFTMOST_ACTIVE_ALIEN_COL) | Pick up leftmost alien and double it to get width in chars. | ||||||
31166 | SLA A | |||||||
31168 | ADD A,B | Add that to leftmost alien pos | ||||||
31169 | LD (_ALIEN_ROW_LEFT_MARGIN),A | That's the left margin for this row | ||||||
31172 | LD A,(_LEFTMOST_ACTIVE_ALIEN_COL) | Pick up left most active alien column and the rightmost active alien column. Subtract one from the other and double it because aliens are 2 chars wide. | ||||||
31175 | LD B,A | |||||||
31176 | LD A,(_RIGHTMOST_ACTIVE_ALIEN_COL) | |||||||
31179 | SUB B | |||||||
31180 | SLA A | |||||||
31182 | LD (_ALIEN_ROW_BANK_WIDTH),A | That's the width of the row | ||||||
31185 | LD B,A | Put width in B | ||||||
31186 | LD A,(_ALIEN_ROW_LEFT_MARGIN) | Pick up the width of the space on the left and add the width of the aliens in the row. Subtract screen width and negate, gives the remainder space for the right side. | ||||||
31189 | ADD A,B | |||||||
31190 | SUB 32 | |||||||
31192 | NEG | |||||||
31194 | LD (_ALIEN_ROW_RIGHT_MARGIN),A | |||||||
31197 | RET |
Prev: 31107 | Up: Map | Next: 31198 |