Routines |
Prev: FAEF | Up: Map | Next: FB2A |
Used by the routine at F9F5.
|
||||||||
FAF0 | PUSH IX | Store IX. | ||||||
FAF2 | LD IX,$80A9 | Point IX at the lightning bolts table. (80A9) | ||||||
FAF6 | PUSH AF | Store AF. | ||||||
FAF7 | LD A,(IX+$00) | Is the lightning bolt here active? | ||||||
FAFA | CP $FF | |||||||
FAFC | JR Z,$FB05 | Jump forward if it isn't. | ||||||
FAFE | CALL $EF88 | Otherwise move to the next entry. | ||||||
FB01 | INC IX | |||||||
FB03 | JR $FAF7 | |||||||
Create a lightning bolt here and set it moving in a random direction.
|
||||||||
FB05 | LD (IX+$00),E | Put the x co-ordinate in E. | ||||||
FB08 | LD (IX+$01),D | Put the y co-ordinate in D. | ||||||
FB0B | LD A,R | Copy R to A to get a pseudo-random number. | ||||||
FB0D | AND $02 | Select bit 2 and subtract that value, giving a random number that's 0 or FE. | ||||||
FB0F | DEC A | |||||||
FB10 | ADD A,A | Double the value. | ||||||
FB11 | LD (IX+$02),A | Set that as the next change in direction. | ||||||
FB14 | LD A,R | Copy R to A to get a pseudo-random number. | ||||||
FB16 | AND $02 | Select bit 2 and shift right, giving a random number that's 0 or 1. | ||||||
FB18 | RRA | |||||||
FB19 | LD C,A | Store this value in C. | ||||||
FB1A | LD A,R | Copy R to A to get a pseudo-random number. | ||||||
FB1C | AND $01 | Select bit 1. | ||||||
FB1E | SUB C | Subtract C, giving a random number that's 1, 0 or FF. | ||||||
FB1F | ADD A,A | Double this (giving 2, 0 or FE). | ||||||
FB20 | LD (IX+$03),A | Set this as the Y offset | ||||||
FB23 | POP AF | Restore AF. | ||||||
FB24 | LD (IX+$04),A | Set the object ID. | ||||||
FB27 | POP IX | Restore IX and return. | ||||||
FB29 | RET |
Prev: FAEF | Up: Map | Next: FB2A |