Deathchase | Routines |
Prev: 6150 | Up: Map | Next: 628D |
Used by the routine at 663D.
|
||||
61F3 | LD A,($5DC8) | See what enemy bikes are still in play | ||
61F6 | BIT 0,A | Is enemy bike 1 running? | ||
61F8 | JR NZ,$61FF | Jump forward if it is | ||
61FA | BIT 1,A | Is enemy bike 2 running? | ||
61FC | JR NZ,$6221 | Jump forward if it is | ||
61FE | RET | No bikes, nothing to do | ||
61FF | LD HL,$5DC8 | Set bit 3 to denote more work to do | ||
6202 | SET 3,(HL) | |||
6204 | LD HL,$5DC6 | Modify the checking code to work with bike 1 | ||
6207 | LD ($6244),HL | |||
620A | LD ($6262),HL | |||
620D | LD HL,$5DC4 | |||
6210 | LD ($6253),HL | |||
6213 | LD ($6282),HL | |||
6216 | LD HL,$5DC2 | |||
6219 | LD ($6265),HL | |||
621C | LD ($6278),HL | |||
621F | JR $6243 | |||
6221 | LD HL,$5DC8 | Flag as no more bike checking to do after this | ||
6224 | RES 3,(HL) | |||
6226 | LD HL,$5DC7 | Modify the checking code to work with bike 2 | ||
6229 | LD ($6244),HL | |||
622C | LD ($6262),HL | |||
622F | LD HL,$5DC5 | |||
6232 | LD ($6253),HL | |||
6235 | LD ($6282),HL | |||
6238 | LD HL,$5DC3 | |||
623B | LD ($6265),HL | |||
623E | LD ($6278),HL | |||
6241 | JR $6243 | |||
6243 | LD A,($5DC6) | Get the bike's position | ||
6246 | CP $C8 | Is it below -38? | ||
6248 | JR C,$624C | Jump if not | ||
624A | LD A,$00 | ... otherwise reset to 0 | ||
624C | CP $21 | Is it above 21? | ||
624E | JR C,$6252 | Jump if not | ||
6250 | LD A,$20 | ... otherwise reset to 20 | ||
6252 | LD HL,$5DC4 | Get the position to change the bike by and adjust it | ||
6255 | ADD A,(HL) | |||
6256 | LD HL,$5DE8 | Is the bike moving? | ||
6259 | BIT 0,(HL) | |||
625B | JR Z,$6261 | Jump forward if it isn't | ||
625D | LD HL,$5DDF | Adjust the enemy bike position to suit our next position | ||
6260 | SUB (HL) | if we are turning left or right | ||
6261 | LD ($5DC6),A | Store new bike position | ||
6264 | LD HL,$5DC2 | Get the number of frames before bike should turn | ||
6267 | DEC (HL) | Decrement it | ||
6268 | XOR A | Is it 0? | ||
6269 | CP (HL) | |||
626A | JR NZ,$6284 | Jump forward if it isn't | ||
626C | CALL $6491 | Get a random number | ||
626F | AND $1C | Take bits 2-4 and store it in B plus 1 | ||
6271 | SRL A | |||
6273 | SRL A | |||
6275 | LD B,A | |||
6276 | INC B | |||
6277 | LD HL,$5DC2 | Repopulate the frame counter | ||
627A | LD (HL),B | |||
627B | AND $03 | If all bits are set, don't change direction | ||
627D | CP $03 | |||
627F | RET Z | |||
6280 | DEC A | Adjust the bike's position | ||
6281 | LD ($5DC4),A | |||
6284 | LD A,($5DC8) | Is there another bike to look at? | ||
6287 | BIT 3,A | |||
6289 | JP NZ,$61FA | Go back and adjust that if so | ||
628C | RET | Otherwise all done |
Prev: 6150 | Up: Map | Next: 628D |