Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Brilliant, that answers the first part! Any idea about the "24 wait states"? (I’m inclined to mark as "accepted" and raise another question?) Commented Nov 18, 2024 at 9:07
  • 1
    @andrewf The NOPs might be connected to setting the I register, so you might want to wait some time before splitting your question. Commented Nov 18, 2024 at 9:41
  • I wonder why the ROM’s authors didn’t just do: XOR A; LD I,A …unless to make that "less than $40" more explicit. Commented Nov 18, 2024 at 10:41
  • @andrewf: In IM2, the interrupt routine jumps to the address contained at the word at address I*256+255 (or whatever is on the data bus at the time), and by setting it to $3F, it'll point to an area filled with $FF, leading it to jump to address $FFFF where you'd normally put a JR byte (can't remember opcode) which would then - combined with the opcode for the first byte in the ROM - a DI - would lead to a relative jump some bytes backward in memory, where you would then place an absolute JP to your interrupt routine. Perhaps the author thought of this when he decided to use $3F. Commented Nov 18, 2024 at 11:11
  • 1
    @HeartWare, That crossed my mind too, but the 257 0xFFs are at 0x3800, not 0x3F00, so it would need to put 0x38 into I not `0x3F. breakintoprogram.co.uk/hardware/computers/zx-spectrum/… (Not to mention the fact that the ROM uses IM 1, not IM 2.) Commented Nov 18, 2024 at 13:33