|  | Routines | 
| Prev: C03A | Up: Map | Next: C0E0 | 
| 
Used by the routine at C620.
 | ||||
| C05A | LD A,(IX+$11) | Jump forward if emeny is not moving up | ||
| C05D | OR A | |||
| C05E | JP NZ,$C0C4 | |||
| C061 | LD A,(IX+$01) | Decrement y-position based on speed | ||
| C064 | SUB (IX+$12) | |||
| C067 | LD (IX+$01),A | |||
| C06A | CALL $C72B | Obtain into HL the tile type address pointer under the entity | ||
| C06D | LD DE,$0040 | Point HL to the top of the entity | ||
| C070 | AND A | |||
| C071 | SBC HL,DE | |||
| C073 | CALL $D06C | Check is tile type is wall | ||
| C076 | JP Z,$C0BB | Jump if it's a wall | ||
| C079 | INC HL | Increment HL | ||
| C07A | CALL $D06C | Check is tile type is wall | ||
| C07D | JP Z,$C0BB | Jump if it's a wall | ||
| 
check enemy moving beyond bounds
 | ||||
| C080 | JP Z,$C0C4 | never jump! | ||
| C083 | LD A,(IX+$01) | is y-position less than $18 | ||
| C086 | CP $18 | |||
| C088 | JP C,$C0BB | Jump if so and change enemy state to move down | ||
| C08B | CP $A8 | is y-position greather than $A8 | ||
| C08D | JP NC,$C0B2 | Jump if so and change enemy state to move up | ||
| C090 | CALL $A375 | Set A a pseudo-random number | ||
| C093 | CP $07 | random number is less than $07 | ||
| C095 | JP C,$C0A9 | Jump to change direction | ||
| C098 | LD A,(IX+$09) | return if enemy is a MINE LAYER | ||
| C09B | CP $0D | |||
| C09D | RET Z | |||
| 
increment speed for POD
 | ||||
| C09E | LD A,(IX+$12) | increment speed for POD | ||
| C0A1 | INC A | |||
| C0A2 | CP $05 | if speed is $05 don't increment a return | ||
| C0A4 | RET Z | |||
| C0A5 | LD (IX+$12),A | Set the new speed for the enemy | ||
| C0A8 | RET | |||
| 
change enemy horizontal direction
 | ||||
| C0A9 | LD A,(IX+$02) | change enemy horizontal direction | ||
| C0AC | XOR $01 | |||
| C0AE | LD (IX+$02),A | |||
| C0B1 | RET | |||
| 
enemy change direction to moves up
 | ||||
| C0B2 | LD (IX+$11),$00 | Set enemy direction up | ||
| C0B6 | LD (IX+$12),$01 | Set enemy speed | ||
| C0BA | RET | |||
| 
enemy change direction to moves down
 | ||||
| C0BB | LD (IX+$11),$01 | Set enemy direction down | ||
| C0BF | LD (IX+$12),$01 | Set enemy speed | ||
| C0C3 | RET | |||
| 
enemy moves down
 | ||||
| C0C4 | LD A,(IX+$01) | Increment y-position based on speed | ||
| C0C7 | ADD A,(IX+$12) | |||
| C0CA | LD (IX+$01),A | |||
| C0CD | CALL $C72B | Obtain into HL the tile type address pointer under the entity | ||
| C0D0 | CALL $D06C | Check is tile type is wall | ||
| C0D3 | JP Z,$C0B2 | Jump back if it's a wall | ||
| C0D6 | INC HL | Increment HL | ||
| C0D7 | CALL $D06C | Check is tile type is wall | ||
| C0DA | JP Z,$C0B2 | Jump back if it's a wall | ||
| C0DD | JP $C080 | Jump back and check enemy moving beyond screen boundary | ||
| Prev: C03A | Up: Map | Next: C0E0 |