![]() |
Routines |
| Prev: C64E | Up: Map | Next: C685 |
|
A portcullis moves between the floor and 32 above it. Only one in a room moves at a time: $5BAF counts the one moving, and while it is non-zero nothing here happens. A portcullis anywhere below the top starts to rise at a random moment, on average once every 32 frames. One at the top drops at once for its first four falls after the room is entered (counted in $5BB0); after that it too waits for a 1-in-32 chance on each frame. Setting bit 0 of the type makes it type 9, handled by upd_9 while it moves.
|
||||||||
| upd_8 | C65E | CALL adj_m6_m12 | draw 12 left and 6 down | |||||
| C661 | LD HL,$5BAF | another portcullis is moving | ||||||
| C664 | LD A,(HL) | |||||||
| C665 | AND A | |||||||
| C666 | RET NZ | |||||||
| C667 | LD A,($5BAE) | on the floor ($5BAE is the floor's height): rise | ||||||
| C66A | CP (IX+$03) | |||||||
| C66D | JR Z,init_portcullis_up | |||||||
| C66F | ADD A,$1F | anywhere below the floor + 31: rise | ||||||
| C671 | CP (IX+$03) | |||||||
| C674 | JR NC,init_portcullis_up | |||||||
| C676 | LD A,($5BB0) | fewer than four falls so far: fall now | ||||||
| C679 | CP $04 | |||||||
| C67B | JR C,init_portcullis_down | |||||||
| C67D | LD A,($5BA5) | otherwise a 1-in-32 chance | ||||||
| C680 | AND $1F | |||||||
| C682 | RET NZ | |||||||
| C683 | OR $80 | $80 + 1 is stored as the count; any value from 4 up would do the same | ||||||
| Prev: C64E | Up: Map | Next: C685 |