Skip to navigation

Lander on the Acorn Archimedes

Particles: DeleteParticleData

Name: DeleteParticleData [Show more] Type: Subroutine Category: Particles Summary: Delete a particle from the particle data buffer and move the last particle's data down to take its place Deep dive: Particles and particle clouds
Arguments: R10 The address in the particle data buffer of the particle to delete
.DeleteParticleData LDR R8, [R11, #particleEnd] \ Decrease the address of the end of the SUB R8, R8, #8*4 \ particle data buffer by eight words, so it STR R8, [R11, #particleEnd] \ points to the last particle's data in the \ buffer LDMIA R8, {R0-R7} \ Copy the eight bytes of particle data from STMIA R10, {R0-R7} \ the end of the buffer to the address in \ R10 MOV R7, #0 \ Zero the last word of the last particle's STR R7, [R8, #7*4] \ data, so the last particle in the buffer \ now acts as a null terminator LDR R8, [R11, #particleCount] \ Decrement the particle counter to reflect SUB R8, R8, #1 \ the new number of particles on-screen STR R8, [R11, #particleCount] B dpar1 \ Jump to the start of the main loop in \ MoveAndDrawParticles to process the next \ particle in the particle data buffer