|  | Routines | 
| Prev: EDC6 | Up: Map | Next: EEA2 | 
|  | ||||
| EDF7 | XOR A | Reset the "create new lightning bolts" flag. (FAEF) | ||
| EDF8 | LD ($FAEF),A | |||
| EDFB | DEC A | Set the missile as inactive. (F9F0) | ||
| EDFC | LD ($F9F0),A | |||
| 
Set the starting position as left or right, depending on which phone booth was entered.
 | ||||
| EDFF | LD (IY+$00),$6E | Set the current graphic to the space ship. (9158) | ||
| EE03 | LD A,(IY+$05) | Get the x co-ordinate. | ||
| EE06 | CP $80 | If it's less then 80 then set to 30 otherwise set it to C0. | ||
| EE08 | LD (IY+$05),$C0 | |||
| EE0C | JR NC,$EE12 | |||
| EE0E | LD (IY+$05),$30 | |||
| EE12 | LD (IY+$0A),$78 | Set the y co-ordinate to 78. | ||
| EE16 | LD HL,$F879 | Copy the initial state (F879) to the working state (80A9). | ||
| EE19 | LD DE,$80A9 | |||
| EE1C | LD BC,$003C | |||
| EE1F | LDIR | |||
| EE21 | CALL $B902 | Clear the playing area. | ||
| 
Put stars randomly on-screen.
 | ||||
| EE24 | LD HL,$4800 | Point HL at the start of the main playing area. | ||
| EE27 | LD D,$00 | Set D to 0. | ||
| EE29 | LD A,$53 | Set R to 53 used to generate a random number. | ||
| EE2B | LD R,A | |||
| EE2D | LD A,R | Put the next value of R in E, in ensuring a pseudo-random offset will be used. | ||
| EE2F | LD E,A | |||
| EE30 | LD (HL),$20 | Set bit 5, to print a dot. | ||
| EE32 | ADD HL,DE | Move to the next random place. | ||
| EE33 | LD A,H | Continue until we run out of screen and hit the attribute area. | ||
| EE34 | CP $58 | |||
| EE36 | JR NZ,$EE2D | |||
| EE38 | LD HL,$7F02 | Point HL at the background graphic. (7F02) | ||
| EE3B | LD DE,$0F04 | Set the position. | ||
| EE3E | CALL $B84B | Draw the graphic. | ||
| EE41 | CALL $B9AC | Copy the screen to the graphic buffer. | ||
| 
Run the main loop of the game.
 | ||||
| EE44 | CALL $BAB4 | Update the "{character} is in {room}" tick count, if any. | ||
| EE47 | CALL $EEA2 | Update the sprite buffers. | ||
| EE4A | CALL $F93A | Check for player's movement. | ||
| EE4D | CALL $F9F5 | Move the objects around and check for firing. | ||
| EE50 | CALL $F9F5 | |||
| EE53 | CALL $F9F5 | |||
| EE56 | CALL $F8B9 | |||
| EE59 | CALL $B9FB | Put sprites on screen. | ||
| 
See if the player is near one of the exit portals.
 | ||||
| EE5C | LD A,(IY+$05) | Get the X co-ordinate. | ||
| EE5F | LD B,A | Is it close enough to the right portal? | ||
| EE60 | SUB $24 | |||
| EE62 | CP $F8 | |||
| EE64 | JR NC,$EE6D | Jump forward if so. | ||
| EE66 | LD A,B | Is it close enough to the left portal? | ||
| EE67 | SUB $D4 | |||
| EE69 | CP $F8 | |||
| EE6B | JR C,$EE44 | Jump back if not and run the main loop again. | ||
| 
The x co-ordinate lines up with a portal, so check the y co-ordinate.
 | ||||
| EE6D | LD A,(IY+$0A) | Get the Y co-ordinate. | ||
| EE70 | SUB $7C | Is it close enough to the portal? | ||
| EE72 | CP $F8 | |||
| EE74 | JR C,$EE44 | Jump back if not and run the main loop again. | ||
| 
The player is by a portal. Work out which one it was, and drop them back into town.
 | ||||
| EE76 | LD A,B | Get the X co-ordinate previously stored in B. | ||
| EE77 | CP $80 | Is it less than 80? ie: left hand side | ||
| EE79 | JR NC,$EE85 | If it is, set the x co-ordinates as DC and the room as 01 (Stamp Street), otherwise, set the x co-ordinate as 04 and the room as 13 (Reference Road). | ||
| EE7B | LD (IY+$05),$04 | |||
| EE7F | LD (IY+$0F),$13 | |||
| EE83 | JR $EE8D | |||
| @labe | l=Space_Game_4 | |||
| EE85 | LD (IY+$05),$DC | |||
| EE89 | LD (IY+$0F),$01 | |||
| EE8D | CALL $B952 | Draw the room. | ||
| EE90 | LD (IY+$0A),$98 | Set the y co-ordinate as 98 ie: on the floor | ||
| EE94 | LD (IY+$46),$00 | Set the character as not jumping. | ||
| EE98 | LD (IY+$00),$00 | Set the frame ID back to 0. | ||
| EE9C | LD SP,$FC00 | Reset the stack to its initial place. | ||
| EE9F | JP $8194 | Jump back to the main game loop. | ||
| Prev: EDC6 | Up: Map | Next: EEA2 |