![]() |
Routines |
| Prev: 44829 | Up: Map | Next: 44914 |
|
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 72, and a light finishes when it gets back to the top left of the frame.
|
||||||||||||
| MoveLights | 44837 | LD B,8 | There are eight lights. | |||||||||
| 44839 | LD HL,44942 | Point HL at Lights. | ||||||||||
| 44842 | LD DE,4 | Each light is four bytes long. | ||||||||||
| 44845 | AND A | Jump to check whether any lights are in use if a new light is not wanted. | ||||||||||
| 44846 | JR Z,CheckLights | |||||||||||
| MoveLights_FindFree | 44848 | LD A,(HL) | Fetch the type of the light. | |||||||||
| 44849 | AND A | Jump to start a new light if the slot is not in use. | ||||||||||
| 44850 | JR Z,StartLight | |||||||||||
| 44852 | ADD HL,DE | Move on to the next light. | ||||||||||
| 44853 | 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 | 44855 | LD IX,44942 | Point IX at the first light. | |||||||||
|
This entry point is used by the routine at NextLight.
|
||||||||||||
| MoveLights_Light | 44859 | LD A,(38423) | Fetch the random number... | |||||||||
| 44862 | LD C,A | ...and keep it in C. | ||||||||||
| 44863 | LD A,R | Add a number from the memory refresh register... | ||||||||||
| 44865 | ADD A,C | |||||||||||
| 44866 | LD (38423),A | ...and store the new random number. | ||||||||||
| 44869 | LD A,(IX+0) | Fetch the type of the light. | ||||||||||
| 44872 | AND A | Jump to the next light if it is not in use. | ||||||||||
| 44873 | JR Z,NextLight | |||||||||||
| 44875 | LD A,(IX+1) | Fetch the delay of the light. | ||||||||||
| 44878 | AND A | Jump if it has run out. | ||||||||||
| 44879 | JR Z,MoveLights_NextLight | |||||||||||
| 44881 | DEC A | Take one off the delay... | ||||||||||
| 44882 | LD (IX+1),A | ...and store it. | ||||||||||
| MoveLights_NextLight | 44885 | LD E,(IX+2) | Fetch the address of the attribute of the light... | |||||||||
| 44888 | LD D,(IX+3) | ...into DE. | ||||||||||
| 44891 | XOR A | Clear the flag that says that the light has turned. | ||||||||||
| 44892 | LD (38441),A | |||||||||||
| 44895 | LD HL,44922 | Point HL at NextLight... | ||||||||||
| 44898 | PUSH HL | ...and make the routine return there when it has finished. | ||||||||||
| 44899 | LD A,(IX+0) | Fetch the type of the light... | ||||||||||
| 44902 | RRCA | ...and turn it into the direction that it is heading in. | ||||||||||
| 44903 | RRCA | |||||||||||
| 44904 | RRCA | |||||||||||
| 44905 | AND 3 | Keep the direction... | ||||||||||
| 44907 | LD L,A | ...and use it as the index into the table. | ||||||||||
| 44908 | LD BC,44914 | Point BC at LightHandlers. | ||||||||||
| 44911 | JP MainLoop_Dispatch_Table | ...and jump to the routine for the direction, using MainLoop_Dispatch_Table. | ||||||||||
| Prev: 44829 | Up: Map | Next: 44914 |