Routines
| Prev: BE72 | Up: Map | Next: BF08 |
BE91: Check one piece of evidence (NZ if it holds)
|
See the case table at 9965 for the four kinds. Marks it done (bit 1 set, bit 0 clear) when it holds.
How it works:
1. If the evidence is already marked done (bit 1 of its flags), it holds: finish.
2. The top two bits of the flags give the kind. Kind 0: both things named in the record must have been seen by the player (bit 7 of their +6 flags); if so it holds. Kind $80 is a marker that only some other routine can set, so it never holds by itself.
3. Kind $40: both things must have been examined (bit 6 of +6). Then, as for kind $C0 (which has no test of its own), it holds only if it has no children, or if all of its children hold (BF08).
4. When it holds, mark it done (bit 1 set, bit 0 clear) and return NZ.
|
||||||||||||
| BE91 | BIT 1,(IX+$03) | Test bit 1 of byte +3 of the record at IX - Already done? | ||||||||||
| BE95 | JR NZ,$BE72 | If bit 1 of byte +3 of the record at IX is set, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BE97 | LD A,(IX+$03) | Read byte +3 of the record at IX into A - Which kind of test? | ||||||||||
| BE9A | AND $C0 | Keep only bits 6, 7 of A (mask $C0) | ||||||||||
| BE9C | CP $00 | Compare A with $00 | ||||||||||
| BE9E | JR NZ,$BECD | If A differs from $00, jump on to BECD | ||||||||||
| BEA0 | LD A,(IX+$00) | Read the first byte of the record at IX into A - Seen: the first thing... | ||||||||||
| BEA3 | PUSH IX | Save IX on the stack | ||||||||||
| BEA5 | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||
| BEA8 | BIT 7,(IX+$06) | Test bit 7 of byte +6 of the record at IX | ||||||||||
| BEAC | POP IX | Restore IX from the stack | ||||||||||
| BEAE | JR Z,$BE72 | If the zero flag is set, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BEB0 | LD A,(IX+$02) | Read byte +2 of the record at IX into A - ...and the second | ||||||||||
| BEB3 | PUSH IX | Save IX on the stack | ||||||||||
| BEB5 | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||
| BEB8 | BIT 7,(IX+$06) | Test bit 7 of byte +6 of the record at IX | ||||||||||
| BEBC | POP IX | Restore IX from the stack | ||||||||||
| BEBE | JR Z,$BE72 | If the zero flag is set, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BEC0 | SET 1,(IX+$03) | Set bit 1 of byte +3 of the record at IX - It holds: mark it done | ||||||||||
| BEC4 | RES 0,(IX+$03) | Clear bit 0 of byte +3 of the record at IX | ||||||||||
| BEC8 | OR $01 | Set bit 0 of A | ||||||||||
| BECA | JP $BE72 | Go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BECD | CP $80 | Compare A with $80 - Kind $80: never by itself | ||||||||||
| BECF | JR Z,$BE72 | If A equals $80, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BED1 | CP $40 | Compare A with $40 - Kind $40: examined? | ||||||||||
| BED3 | JR NZ,$BEF6 | If A differs from $40, skip ahead to BEF6 | ||||||||||
| BED5 | LD A,(IX+$00) | Read the first byte of the record at IX into A - The first thing... | ||||||||||
| BED8 | PUSH IX | Save IX on the stack | ||||||||||
| BEDA | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||
| BEDD | BIT 6,(IX+$06) | Test bit 6 of byte +6 of the record at IX | ||||||||||
| BEE1 | POP IX | Restore IX from the stack | ||||||||||
| BEE3 | JR Z,$BE72 | If the zero flag is set, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BEE5 | LD A,(IX+$02) | Read byte +2 of the record at IX into A - ...and the second | ||||||||||
| BEE8 | PUSH IX | Save IX on the stack | ||||||||||
| BEEA | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||
| BEED | BIT 6,(IX+$06) | Test bit 6 of byte +6 of the record at IX | ||||||||||
| BEF1 | POP IX | Restore IX from the stack | ||||||||||
| BEF3 | JP Z,$BE72 | If the zero flag is set, go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| BEF6 | BIT 2,(IX+$03) | Test bit 2 of byte +3 of the record at IX - Children to check as well? | ||||||||||
| BEFA | JR Z,$BEC0 | If bit 2 of byte +3 of the record at IX is clear, go back to BEC0 | ||||||||||
| BEFC | PUSH IX | Save IX on the stack - All of them | ||||||||||
| BEFE | CALL $BF08 | Call the routine "Check every piece of evidence in the group after IX..." (BF08) | ||||||||||
| BF01 | POP IX | Restore IX from the stack | ||||||||||
| BF03 | JR NZ,$BEC0 | If the zero flag is clear, go back to BEC0 | ||||||||||
| BF05 | JP $BE72 | Go back to the routine "Step IX over a whole group of case records" (BE72) | ||||||||||
| Prev: BE72 | Up: Map | Next: BF08 |