Just as an example, and only because it slowed me down for a moment or two...
while ((uint16_t)regs.pc != next_instruction_address) { interpret_and_disassemble(); }
next_instruction_address is uint16_t; regs.pc is int16_t.
Without the cast, in some circumstances (e.g. regs.pc = 0xff00) the while loop takes forever... why?
Because regs.pc can have a negative value and next_instruction_address can't. Hence when regs.pc is negative, they can never be equal and so the loop never terminates. Yet the bit pattern is identical... it's all a question of how it's interpreted.
And why is regs.pc signed I hear you ask? Short answer: can't remember. I think it was so some of the indexed addressing modes worked properly.
Neil