Skip to navigation

Lander on the Acorn Archimedes

Particles: AddStaticParticleToBuffer

Name: AddStaticParticleToBuffer [Show more] Type: Subroutine Category: Particles Summary: Add a particle to the particle data buffer that starts off static, adding a random element to its velocity and lifespan counter Deep dive: Particles and particle clouds
Arguments: (R0, R1, R2) Particle coordinate R6 Particle lifespan counter (i.e. how many iterations around the main loop before the particle expires) R7 Particle flags: * Bits 0-7 = particle colour * Bit 16 set = colour fades white to red * Bit 17 set = particle is a rock * Bit 18 set = splash on impact with sea * Bit 19 set = bounce on hitting ground * Bit 20 set = apply gravity to particle * Bit 21 set = can destroy objects * Bit 23 set = splash size (big when set) * Bit 24 set = explode on hitting ground R8 Magnitude of the random element that's added to the velocity, with a larger figure giving a smaller random element; the actual range is +/- 2^(32 - R8) R9 Magnitude of the random element that's added to the particle lifespan, with a larger figure giving a smaller random element; the actual range is 0 to 2^(32 - R9) Stack Contains a value to restore into R8 at the end, and the return address
.AddStaticParticleToBuffer MOV R4, #0 \ Set R4 = 0 \ Fall into AddRisingParticleToBuffer so we \ pass a velocity of (0, 0, 0) to the \ AddMovingParticleToBuffer routine