![]() |
Routines |
Prev: FA04 | Up: Map |
The address of this uninterruptible subcommand routine is placed into bytes 0x12 and 0x13 of a character's buffer (by the routine at FAA2) when he's been hit on the head by a falling character with an x-coordinate that differs from his by 1. It controls the character from the moment he is knocked over until he has finished staggering from being dazed by the collision.
|
||||||||||
FA05 | LD A,$8A | A=0x0A (short knockout delay) + 0x80 (quick recovery) | ||||||||
FA07 | JR $FA0B | |||||||||
The address of this entry point is placed into bytes 0x12 and 0x13 of a character's buffer (by the routine at FAA2) when he's been hit on the head by a falling character with the same x-coordinate.
|
||||||||||
FA09 | LD A,$14 | A=0x14 (long knockout delay) + 0x00 (slow recovery) | ||||||||
FA0B | LD L,$14 | Initialise the character's knockout delay counter in byte 0x14 of his buffer | ||||||||
FA0D | LD (HL),A | |||||||||
FA0E | LD L,$00 | Point HL at byte 0x00 of the character's buffer | ||||||||
FA10 | LD E,(HL) | E=character's animatory state | ||||||||
FA11 | INC L | L=0x01 | ||||||||
FA12 | LD D,(HL) | D=character's x-coordinate | ||||||||
FA13 | LD L,$0D | Store the character's pre-knockout animatory state in byte 0x0D of his buffer | ||||||||
FA15 | LD (HL),E | |||||||||
FA16 | LD L,$15 | Store the character's current x-coordinate in byte 0x15 of his buffer | ||||||||
FA18 | LD (HL),D | |||||||||
FA19 | CALL $F9D2 | Knock the character over | ||||||||
FA1C | CALL $F9FD | Place the address of the following instruction into bytes 0x12 and 0x13 of the character's buffer | ||||||||
This entry point is used after the character has been knocked over and until he stands up again.
|
||||||||||
FA1F | LD L,$14 | Byte 0x14 of the character's buffer holds the knockout delay counter | ||||||||
FA21 | DEC (HL) | Decrement it | ||||||||
FA22 | LD A,(HL) | Pick up the current value in A | ||||||||
FA23 | AND $7F | Is it time for the character to stand up? | ||||||||
FA25 | RET NZ | Return if not | ||||||||
FA26 | LD A,L | A=20 | ||||||||
FA27 | BIT 7,(HL) | Is bit 7 of the knockout delay counter set? | ||||||||
FA29 | JR NZ,$FA2C | Jump if so | ||||||||
FA2B | ADD A,A | A=40 | ||||||||
FA2C | LD (HL),A | Initialise the recovery delay counter (in byte 0x14 of the character's buffer) to 40 (if the character was hit by another with the same x-coordinate) or 20 | ||||||||
FA2D | CALL $EB8C | Make the character stand up | ||||||||
FA30 | CALL $F9FD | Place the address of the following instruction into bytes 0x12 and 0x13 of the character's buffer | ||||||||
This entry point is used after the character has stood up again and while he is still dazed from the collision.
|
||||||||||
FA33 | LD L,$14 | Decrement the recovery delay counter | ||||||||
FA35 | DEC (HL) | |||||||||
FA36 | JR Z,$FA83 | Jump if it has reached 0 | ||||||||
FA38 | LD L,$00 | Point HL at byte 0x00 of the character's buffer | ||||||||
FA3A | BIT 0,(HL) | Is the character facing right? | ||||||||
FA3C | JR NZ,$FA4B | Jump if so | ||||||||
FA3E | PUSH HL | Save the character number briefly | ||||||||
FA3F | CALL $EB13 | Obtain descriptors for the character's current location | ||||||||
FA42 | POP HL | Restore the character number to H | ||||||||
FA43 | BIT 7,C | Can the character move left? | ||||||||
FA45 | JR Z,$FA50 | Jump if not | ||||||||
FA47 | BIT 6,C | Can the character move right? | ||||||||
FA49 | JR Z,$FA50 | Jump if not | ||||||||
FA4B | CALL $F17F | Get a random number in A | ||||||||
FA4E | RRCA | Rotate bit 0 into bit 7 for no apparent reason | ||||||||
FA4F | LD C,A | Bit 7 of C will be used to decide whether the character should move left next | ||||||||
This entry point is used by the routine at FA83.
|
||||||||||
FA50 | LD DE,$E9D5 | Load the address of the routine at E9D5 onto the stack | ||||||||
FA53 | PUSH DE | |||||||||
FA54 | PUSH BC | Save the direction descriptor (in C) | ||||||||
FA55 | CALL $E9C8 | Update the SRB for the character's current animatory state and location | ||||||||
FA58 | POP BC | Restore the direction descriptor to C | ||||||||
FA59 | RLC C | Set the carry flag if the character is going to move left | ||||||||
FA5B | BIT 7,A | Is the character facing right? | ||||||||
FA5D | JR NZ,$FA6D | Jump if so | ||||||||
The character is facing left.
|
||||||||||
FA5F | JR NC,$FA6F | Jump if the character is going to move right (take a step backwards) | ||||||||
The character is going to take a step forwards.
|
||||||||||
FA61 | INC A | A=character's next animatory state | ||||||||
FA62 | BIT 0,A | Is it midstride? | ||||||||
FA64 | RET NZ | Return (to E9D5) if so | ||||||||
The character has just moved from the midstride position. Adjust his x-coordinate as appropriate.
|
||||||||||
FA65 | DEC E | E=x-1 (where x is the character's x-coordinate) | ||||||||
FA66 | JR C,$FA6A | Jump if the character is moving left | ||||||||
FA68 | INC E | E=x+1 (the character is moving right) | ||||||||
FA69 | INC E | |||||||||
FA6A | AND $FB | Make sure that bit 2 of the character's animatory state is reset | ||||||||
FA6C | RET | To E9D5, to update the character's animatory state and location and update the SRB | ||||||||
The character is facing right.
|
||||||||||
FA6D | JR NC,$FA61 | Jump if the character is going to move right (take a step forwards) | ||||||||
The character is going to take a step backwards.
|
||||||||||
FA6F | DEC A | A=character's next animatory state | ||||||||
FA70 | BIT 0,A | Is it midstride? | ||||||||
FA72 | RET Z | Return (to E9D5) if not | ||||||||
FA73 | INC A | Add 4 to A (without affecting the carry flag) to obtain the correct midstride animatory state (though bit 2 may need to be reset) | ||||||||
FA74 | INC A | |||||||||
FA75 | INC A | |||||||||
FA76 | INC A | |||||||||
FA77 | JR $FA65 |
Prev: FA04 | Up: Map |