| Routines

30160: Determine the interval between the last message and the next

Used by the routine at 28357. Returns with the interval in A, which indicates the minimum number of subintervals of 0.64s that the current message should be displayed for.
30160 | LD A,(30153) | Collect the urgent message number from 30153
30163 | AND A | Is it 0 (no message)?
30164 | JR Z,30194 | Jump if so
30166 | LD HL,32695 | Collect the index of the current message in the queue from 32695
30169 | LD A,(HL)
30170 | INC A | A=index of the next message in the queue
30171 | AND 7
30173 | ADD A,184 | Point HL at the slot for the next message in the queue
30175 | LD L,A
30176 | LD B,7 | There are up to 7 messages ahead in the queue
30178 | LD A,(30153) | A=urgent message number
30181 | CP (HL) | Set the zero flag if the urgent message is in this slot in the queue
30182 | INC HL | Move HL along to the next slot in the message queue (or past the end of the queue and into the bullet buffers at 32704 and 32708, which is a bug)
30183 | JR NZ,30188 | Jump unless the urgent message is at this position in the queue
30185 | LD A,1 | Set A=1 so that the next message is displayed as soon as possible
30187 | RET |
30188 | DJNZ 30181 | Jump back until all messages in the queue have been checked
30190 | XOR A | Clear the urgent message number at 30153: it was not in the queue
30191 | LD (30153),A
30194 | LD A,(28612) | Collect the normal message display interval from 28612
30197 | RET |