Prev: B197 Up: Map Next: B264
B1A6: Make the current character jump
Used by the routines at AB60, AB9B and B09F.
B1A6 LD A,(IY+$3C) Is the character moving? (BCA3)
B1A9 OR A
B1AA JR NZ,$B1B2 Move forward if they are.
B1AC LD A,(IY+$41) Copy the current direction (BCA8) to the movement flag.
B1AF LD (IY+$3C),A
B1B2 LD (IY+$46),A Copy this to the jump flag. BCAD
B1B5 LD (IY+$4B),$00 Set the jump table index to 0. BCB2
This entry point is used by the routines at A92C and B09F.
B1B9 LD A,(IY+$3C) Get the direction.
B1BC CP $01 Is the character facing right?
B1BE JR Z,$B21C Move to handle that if so.
Character is jumping left.
B1C0 LD A,(IY+$4B) Get the jump table index.
B1C3 LD E,A Multiply by 3 and store in DE.
B1C4 ADD A,A
B1C5 ADD A,E
B1C6 LD E,A
B1C7 LD D,$00
B1C9 LD HL,$B264 Add the base address of the jump table (B264) to get an offset.
B1CC ADD HL,DE
B1CD LD E,(HL) Put the X offset in E.
B1CE INC HL Put the Y offset in D.
B1CF LD D,(HL)
B1D0 INC HL Put the graphic frame number in B.
B1D1 LD B,(HL)
B1D2 LD A,D
B1D3 DEC A
B1D4 BIT 7,A
B1D6 JR NZ,$B1ED
B1D8 LD A,(IY+$37)
B1DB OR A
B1DC JR NZ,$B1ED
B1DE LD A,(IY+$0A)
B1E1 AND $07
B1E3 JR NZ,$B1ED
B1E5 LD (IY+$4B),$0B
B1E9 LD B,$00
B1EB JR $B205
B1ED LD A,(IY-$3C)
B1F0 OR A
B1F1 CALL NZ,$81D4 If not, need to change direction.
B1F4 LD A,(IY+$0A)
B1F7 ADD A,D
B1F8 LD (IY+$0A),A
B1FB LD A,(IY+$05) Get the X co-ordinate.
B1FE SUB E
B1FF JR NC,$B202
B201 XOR A
Common exit point for jumping left and right.
B202 LD (IY+$05),A Set the current X co-ordinate (BC6C) to A.
B205 LD (IY+$00),B Set the current frame number (BC67) to B.
B208 INC (IY+$4B) Increment the jump table index.
B20B LD A,(IY+$4B) Have we reached the end of the table?
B20E CP $0C
B210 RET NZ Return if not.
B211 LD (IY+$3C),$00 Set flags as "not jumping"
B215 LD (IY+$46),$00
B219 JP $E315 Play a landing footstep sound and return.
Character is jumping right.
B21C LD A,(IY+$4B) Get the jump frame number.
B21F LD E,A Multiply by 3 and store in DE.
B220 ADD A,A
B221 ADD A,E
B222 LD E,A
B223 LD D,$00
B225 LD HL,$B264 Add the base address of the jump table (B264) to get an offset.
B228 ADD HL,DE
B229 LD E,(HL) Put the X offset in E.
B22A INC HL Put the Y offset in D.
B22B LD D,(HL)
B22C INC HL Put the graphic frame number in B.
B22D LD B,(HL)
B22E LD A,D
B22F DEC A
B230 BIT 7,A
B232 JR NZ,$B249
B234 LD A,(IY+$37)
B237 OR A
B238 JR NZ,$B249
B23A LD A,(IY+$0A)
B23D AND $07
B23F JR NZ,$B249
B241 LD (IY+$4B),$0B
B245 LD B,$00 Set the frame number to 0.
B247 JR $B205 Jump back to update the sequence.
B249 LD A,(IY-$3C)
B24C OR A
B24D CALL Z,$81D4 If so, need to change direction.
B250 LD A,(IY+$0A)
B253 ADD A,D
B254 LD (IY+$0A),A
B257 LD A,(IY+$05) Get the X co-ordinate.
B25A ADD A,E
B25B CP $F0
B25D JR C,$B202
B25F LD A,$F0
B261 JP $B202 Jump back and continue.
Prev: B197 Up: Map Next: B264