![]() |
Routines |
| Prev: 9DDE | Up: Map | Next: 9E17 |
|
Used by the routines at UpdateFoamEntity, UpdateWhirlerEntity, UpdateBatEntity, UpdateDropEntity, UpdateSaucerEntity and UpdateDomeEntity.
Increases the counter in the high nibble of field 16 of an entity by one, if it is not zero, and wraps it to zero after 08. Then plays a click of a random length.
|
||||||||
| IncreaseEntityCounter | 9DF8 | LD A,(IX+$16) | Read field 16 of the entity. | |||||
| 9DFB | LD B,A | Keep it in B. | ||||||
| 9DFC | AND %11110000 | Keep the counter. | ||||||
| 9DFE | RET Z | Return if it is zero. | ||||||
| 9DFF | ADD A,$10 | Add one to the counter. | ||||||
| 9E01 | CP $90 | Jump to IncreaseEntityCounter_Store if it is below 90. | ||||||
| 9E03 | JR C,IncreaseEntityCounter_Store | |||||||
| 9E05 | XOR A | Set the counter to zero. | ||||||
| IncreaseEntityCounter_Store | 9E06 | LD C,A | Keep the new counter in C. | |||||
| 9E07 | LD A,B | Fetch the old value of field 16. | ||||||
| 9E08 | AND %00001111 | Keep the low nibble. | ||||||
| 9E0A | OR C | Combine it with the new counter. | ||||||
| 9E0B | LD (IX+$16),A | Store it in field 16 of the entity. | ||||||
| 9E0E | LD A,($5F9A) | Fetch the low byte of the seed from RandomNumber_Seed. | ||||||
| 9E11 | AND %00111111 | Use bits 0-5. | ||||||
| 9E13 | INC A | Add one. | ||||||
| 9E14 | JP PlayClick | Jump to PlayClick to play a click. | ||||||
| Prev: 9DDE | Up: Map | Next: 9E17 |