Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AccelerateBodies:
- ; Accelerate bodies
- ld a, [wNumParticles]
- cp 2
- ret c ; Not enough bodies (need at least 2)
- ; For b backwards from len - 1 inclusive to 1 inclusive
- ld b, a
- dec b
- .outerLoop
- ; For c backwards from i - 1 inclusive to 0 inclusive
- ld c, b
- dec c
- .innerLoop
- ; b: first particle's index, c: second particle's index
- ; Get and apply forces
- ; Has c finished counting down?
- dec c
- ld a, c
- cp -1 ; Check for underflow
- jr nz, .innerLoop
- ; Has b finished counting down?
- dec b
- jr nz, .outerLoop
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement