| Routines

63405: Deal with ERIC

Used by the routine at 63210. Deals with ERIC when any of the bits at 32763 (ERIC's primary status flags) are set, indicating that ERIC is doing something other than standing or walking:
Bit | Set by | Meaning if set | Handler
--- | --- | --- | ---
0 | 23887 | ERIC is jumping | 23907
1 | 23907, 28305, 29574 | Examine the secondary status flags at 32749 |
2 | 62094, 62423, 64460 | ERIC is sitting or lying down | 62178
3 | 57637 | ERIC is bending over, dropping a stinkbomb etc. | 57669
4 | 24133 | ERIC is writing on a blackboard | 24175
5 | 24247 | ERIC is firing, hitting or kissing | 24237
6 | 62815, 64460 | MR WACKER is expelling ERIC |
7 | 26175, 29896 | ERIC has been knocked over | 62094
If bit 1 at 32763 is set, we examine ERIC's secondary status flags at 32749:
Bit | Set by | Meaning if set | Handler
--- | --- | --- | ---
0 | 29462 | ERIC is riding the bike | 29278
1 | 23907 | ERIC is standing on a plant or plant pot | 64316
2 | 64242, 64259, 64316 | ERIC is stepping off a plant, a plant pot, or the stage | 64259
3 | 64259, 64316 | ERIC is falling and will land on his feet | 64416
4 | 29194, 29278, 64077 | ERIC is falling and will not land on his feet | 64460
5 | 64259 | ERIC has stepped out of the top-floor window | 23859
6 | 29194 | ERIC is falling from the saddle of the bike | 23843
7 | 29278 | ERIC is standing on the saddle of the bike | 29462
Input
H | 127
63405 | LD L,237 | HL=32749 (ERIC's secondary status flags)
63407 | BIT 5,(HL) | Has ERIC stepped out of the top-floor window?
63409 | JR Z,63418 | Jump if not
63411 | LD A,(53760) | A=ERIC's animatory state
63414 | CP 134 | 134: Is ERIC lying on his back, facing right?
63416 | JR NZ,63431 | Jump if not
63418 | LD L,251 | HL=32763 (ERIC's status flags)
63420 | BIT 6,(HL) | Is MR WACKER expelling ERIC?
63422 | RET NZ | Return if so (ERIC is incapacitated)
63423 | BIT 1,(HL) | Bit 1 at 32763 is set if we need to look at 32749
63425 | LD D,211 |
63427 | JR Z,63433 | Jump unless we need to look at 32749
63429 | LD L,237 | HL=32749 (ERIC's secondary status flags)
63431 | LD D,213 |
63433 | LD A,(HL) | Copy the contents of 32763 or 32749 to A
Now D=211 and A=(32763) if bit 1 at 32763 is reset; otherwise D=213 and A=(32749).
63434 | LD E,68 | Point DE at the appropriate entry in the table of handler routine address LSBs (at 54076 or 54588), depending on which bit of A is set
63436 | DEC E
63437 | RRCA
63438 | JR NC,63436
63440 | EX DE,HL | Transfer the table entry address to HL
63441 | LD E,(HL) | Collect the handler routine address from the table entry into DE
63442 | INC H
63443 | LD D,(HL)
63444 | EX DE,HL | Transfer this handler routine address to HL
63445 | JP (HL) | Jump to the handler routine