Prev: 9F0B Up: Map Next: 9F8F
9F15: Handle FOOT MAN teleporting
Used by the routine at BC48.
9F15 LD A,(IX+$18) Return if enemy is not teleporting
9F18 OR A
9F19 RET Z
9F1A LD A,(IX+$01) Computes in HL the address into room graphic data buffer for the enemy
9F1D LD L,A
9F1E LD H,$00
9F20 ADD HL,HL
9F21 ADD HL,HL
9F22 ADD HL,HL
9F23 ADD HL,HL
9F24 ADD HL,HL
9F25 LD A,(IX+$00)
9F28 SRL A
9F2A SRL A
9F2C SRL A
9F2E LD E,A
9F2F LD D,$00
9F31 ADD HL,DE
9F32 LD DE,$E8FF
9F35 ADD HL,DE
9F36 LD A,(IX+$02) Check enemy direction and jump forward if facing right
9F39 OR A
9F3A JP Z,$9F3E
9F3D INC HL Increase address into room graphic data buffer if enemy facing left
9F3E LD C,$00 Remnant code. B overwritten in next instructions
9F40 LD B,(IX+$19)
9F43 LD IY,$9F0B Set IY to point to the address for teleporting mask data
9F47 LD A,(IX+$19) Set IY to point to the correspondent mask based on mask index from enemy configuration buffer
9F4A LD E,A
9F4B LD D,$00
9F4D ADD IY,DE
scramble FOOT MAN graphic data to simulate teleporting
9F4F LD B,(IX+$0F) Set B to the height of the sprite
9F52 PUSH BC Save BC
9F53 LD B,(IX+$0E) Set B to the width of the sprite
9F56 PUSH HL Save HL and BC
9F57 PUSH BC
9F58 CALL $A530 Scramble graphic data deom FOOT MAN sprite based on pseudo random number and mask
9F5B AND (HL)
9F5C AND (IY+$00)
9F5F LD (HL),A Set the new scrambled data
9F60 INC HL Point to the next address into room graphic data buffer
9F61 POP BC Restore BC
9F62 DJNZ $9F57 Jump back until all the width of the sprite scrambled
9F64 POP HL Restore HL
9F65 LD DE,$0020 Point HL to the next row
9F68 ADD HL,DE
9F69 POP BC Restore BC
9F6A DJNZ $9F52 Jump back until all the height of the sprite scrambled
9F6C LD A,(IX+$1A) Check type of teleporting
9F6F OR A
9F70 JP NZ,$9F80 Jump forward if teleporting into the room
teleporting out of the room
9F73 DEC (IX+$19) Decrement teleporting index
9F76 RET NZ Return if teleporting index is not zero
9F77 LD (IX+$18),$00 End teleporting out of the room
9F7B LD (IX+$0C),$00 Set sprite not visible
9F7F RET
teleporting into the room
9F80 LD A,(IX+$19) Increase teleporting index
9F83 INC A
9F84 LD (IX+$19),A
9F87 CP $0A Return if teleporting has not finished
9F89 RET NZ
9F8A LD (IX+$18),$00 End teleporting into the room
9F8E RET
Prev: 9F0B Up: Map Next: 9F8F