![]() |
Routines |
| Prev: AF1D | Up: Map | Next: AF72 |
|
Used by the routines at WaitForFrame and StartGameSequence.
Moves the lights that travel around the frame of the screen, and starts a new one when it is asked to. This is done every frame. There are eight lights, each of which is a type, a delay, and the address of the attribute that it is in. The lights follow the cells of the frame, which have an attribute of 48, and a light finishes when it gets back to the top left of the frame.
|
||||||||||||
| MoveLights | AF25 | LD B,$08 | There are eight lights. | |||||||||
| AF27 | LD HL,$AF8E | Point HL at Lights. | ||||||||||
| AF2A | LD DE,$0004 | Each light is four bytes long. | ||||||||||
| AF2D | AND A | Jump to check whether any lights are in use if a new light is not wanted. | ||||||||||
| AF2E | JR Z,CheckLights | |||||||||||
| MoveLights_FindFree | AF30 | LD A,(HL) | Fetch the type of the light. | |||||||||
| AF31 | AND A | Jump to start a new light if the slot is not in use. | ||||||||||
| AF32 | JR Z,StartLight | |||||||||||
| AF34 | ADD HL,DE | Move on to the next light. | ||||||||||
| AF35 | DJNZ MoveLights_FindFree | Loop back until all of the lights have been tried. | ||||||||||
|
This entry point is used by the routines at StartLight and CheckLights.
|
||||||||||||
| MoveLights_Update | AF37 | LD IX,$AF8E | Point IX at the first light. | |||||||||
|
This entry point is used by the routine at NextLight.
|
||||||||||||
| MoveLights_Light | AF3B | LD A,($9617) | Fetch the random number... | |||||||||
| AF3E | LD C,A | ...and keep it in C. | ||||||||||
| AF3F | LD A,R | Add a number from the memory refresh register... | ||||||||||
| AF41 | ADD A,C | |||||||||||
| AF42 | LD ($9617),A | ...and store the new random number. | ||||||||||
| AF45 | LD A,(IX+$00) | Fetch the type of the light. | ||||||||||
| AF48 | AND A | Jump to the next light if it is not in use. | ||||||||||
| AF49 | JR Z,NextLight | |||||||||||
| AF4B | LD A,(IX+$01) | Fetch the delay of the light. | ||||||||||
| AF4E | AND A | Jump if it has run out. | ||||||||||
| AF4F | JR Z,MoveLights_NextLight | |||||||||||
| AF51 | DEC A | Take one off the delay... | ||||||||||
| AF52 | LD (IX+$01),A | ...and store it. | ||||||||||
| MoveLights_NextLight | AF55 | LD E,(IX+$02) | Fetch the address of the attribute of the light... | |||||||||
| AF58 | LD D,(IX+$03) | ...into DE. | ||||||||||
| AF5B | XOR A | Clear the flag that says that the light has turned. | ||||||||||
| AF5C | LD ($9629),A | |||||||||||
| AF5F | LD HL,$AF7A | Point HL at NextLight... | ||||||||||
| AF62 | PUSH HL | ...and make the routine return there when it has finished. | ||||||||||
| AF63 | LD A,(IX+$00) | Fetch the type of the light... | ||||||||||
| AF66 | RRCA | ...and turn it into the direction that it is heading in. | ||||||||||
| AF67 | RRCA | |||||||||||
| AF68 | RRCA | |||||||||||
| AF69 | AND $03 | Keep the direction... | ||||||||||
| AF6B | LD L,A | ...and use it as the index into the table. | ||||||||||
| AF6C | LD BC,$AF72 | Point BC at LightHandlers. | ||||||||||
| AF6F | JP MainLoop_Dispatch_Table | ...and jump to the routine for the direction, using MainLoop_Dispatch_Table. | ||||||||||
| Prev: AF1D | Up: Map | Next: AF72 |