diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/driver.s | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/driver.s b/src/driver.s index 75e56b6..7966d71 100644 --- a/src/driver.s +++ b/src/driver.s @@ -258,22 +258,26 @@ ;; iny ;; iny + ;; Allocate the rest of valid bullets from the pool. ldx #0 @rest_o_bullets: + ;; If we are already passed the amount of bytes we could allocate for + ;; bullets, then jump to enemies. If the current indexed bullet is the one + ;; we allocated as the first fixed one, then skip it. cpx #Bullets::BULLETS_POOL_CAPACITY_BYTES beq @rest_o_enemies cpx zp_first_bullet - bne @do_bullet - inx - inx - inx - cpx #Bullets::BULLETS_POOL_CAPACITY_BYTES - beq @rest_o_enemies + beq @next_bullet + @do_bullet: + ;; Ok, so the bullet has not been allocated yet and we have space for + ;; it. Is it valid? lda Bullets::zp_bullets_pool_base, x cmp #$FF beq @next_bullet + ;; Yes! Then allocate now. + lda Bullets::zp_bullets_pool_base + 1, x sta OAM::m_sprites, y iny |
