| The Hobbit (v1.0) | Routines |
| Prev: 9CA8 | Up: Map | Next: 9D12 |
|
Returns in A the number of visible objects (bit 7 of their flags set) held directly by object A.
|
||||||||||||
| 9CEC | PUSH IX | Save the caller's IX, IY and BC | ||||||||||
| 9CEE | PUSH IY | |||||||||||
| 9CF0 | PUSH BC | |||||||||||
| 9CF1 | LD B,$00 | B will be the running count, starting at 0 | ||||||||||
| 9CF3 | LD IX,$BF50 | IX = just before the start of the object index, so the first search below lands on its very first entry | ||||||||||
| 9CF7 | CALL $9B04 | Look at the next object; IY = its own record | ||||||||||
| 9CFA | JR Z,$9D0B | Have we run out of objects? | ||||||||||
| 9CFC | CP (IY+$01) | No: is this object held by the one whose contents we are counting? | ||||||||||
| 9CFF | JR NZ,$9CF7 | It is not: try the next one | ||||||||||
| 9D01 | BIT 7,(IY+$07) | It is: is it visible (not, say, a locked-away thing nobody can see)? | ||||||||||
| 9D05 | JR Z,$9CF7 | No: do not count it | ||||||||||
| 9D07 | INC B | Yes: one more to the count | ||||||||||
| 9D08 | JP $9CF7 | Look for more | ||||||||||
| 9D0B | LD A,B | A = the final count | ||||||||||
| 9D0C | POP BC | Restore the caller's IY and BC | ||||||||||
| 9D0D | POP IY | Restore IY | ||||||||||
| 9D0F | POP IX | Restore the caller's IX | ||||||||||
| 9D11 | RET | |||||||||||
| Prev: 9CA8 | Up: Map | Next: 9D12 |