|  | Routines | 
| Prev: F276 | Up: Map | Next: F2F7 | 
| 
Used by the routine at 81AE.
 | ||||
| F277 | LD A,$02 | Touching Herbert reduces endurance by 2. | ||
| F279 | LD ($F26E),A | |||
| F27C | LD IX,$F270 | Point IX at the movement table. | ||
| F280 | LD BC,$F2F7 | Point BC at the bounds. | ||
| F283 | CALL $EF35 | Update object positions. | ||
| F286 | LD A,(IX+$00) | Get Herbert's current room. | ||
| F289 | CALL $AC69 | Get the "next rooms" table for this room. | ||
| F28C | INC HL | Move to the second byte in the table. | ||
| F28D | LD A,(HL) | Get the target co-ordinate. | ||
| F28E | CALL $AC5F | Get the address of the co-ordinate table. | ||
| F291 | LD A,(HL) | Get the target co-ordinate. | ||
| F292 | CP (IX-$04) | Is it Herbert's current x co-ordinate? | ||
| F295 | JR NZ,$F2C3 | Jump forward if it isn't. | ||
| F297 | DEC (IX+$01) | Decerement Herbert's tick count. | ||
| F29A | JR NZ,$F2C3 | Jump forward while it is 0. | ||
| F29C | LD A,R | Get a random number between 3 and 6. | ||
| F29E | AND $03 | |||
| F2A0 | ADD A,$03 | |||
| F2A2 | LD (IX+$01),A | Set this as the new tick count. | ||
| F2A5 | CALL $AF01 | Set the next room for Herbert to appear in. | ||
| F2A8 | CP $1F | If this is the Sewer, jump back and choose again. | ||
| F2AA | JR Z,$F2A5 | |||
| F2AC | LD (IX+$00),A | Set the new room. | ||
| F2AF | CALL $AC69 | Get the "next rooms" table for this room. | ||
| F2B2 | INC HL | Move to the second byte in the buffer. | ||
| F2B3 | LD A,(HL) | Get the target co-ordinate. | ||
| F2B4 | CALL $AC5F | Get the address of the co-ordinate table. | ||
| F2B7 | LD A,(HL) | Get the x co-ordinate. | ||
| F2B8 | ADD A,$02 | Add 2 to it. | ||
| F2BA | CP $EE | Set a ceiling of EE. | ||
| F2BC | JR C,$F2C0 | |||
| F2BE | LD A,$EE | |||
| F2C0 | LD (IX-$04),A | Set the new x co-ordinate. | ||
| 
Draw Herbert if he's visible.
 | ||||
| F2C3 | LD A,(IX+$00) | Get Herbert's current room. | ||
| F2C6 | CP (IY+$0F) | Is this the room the player is in? | ||
| F2C9 | RET NZ | Return if not. | ||
| 
Herbert is in the same room as the player, so draw him.
 | ||||
| F2CA | LD A,(IX-$02) | Get the x direction difference. | ||
| F2CD | LD BC,$4440 | Set Herbert to use object IDs 40 - 42 if he's moving right, or 44 - 46 if he is moving left. | ||
| F2D0 | CP $01 | |||
| F2D2 | JR Z,$F2D7 | |||
| F2D4 | LD BC,$4844 | |||
| F2D7 | LD A,(IX+$02) | Get Herbert's current object ID. | ||
| F2DA | ADD A,$02 | Ensure the object ID cycles between the two set values. | ||
| F2DC | CP B | |||
| F2DD | JR C,$F2E2 | |||
| F2DF | LD A,C | |||
| F2E0 | JR $F2E5 | |||
| F2E2 | CP C | |||
| F2E3 | JR C,$F2DF | |||
| F2E5 | LD (IX+$02),A | Set the new object ID for Herbert. | ||
| F2E8 | CALL $A8A0 | Draw Herbert. | ||
| F2EB | LD A,$46 | Set bright yellow on black. | ||
| F2ED | LD ($F26F),A | |||
| F2F0 | CALL $EF91 | Set the attributes for the fountain in the Town Square. | ||
| F2F3 | CALL $E329 | Check for collision detection. | ||
| F2F6 | RET | Return. | ||
| Prev: F276 | Up: Map | Next: F2F7 |