assemblyemulationz80

Z80 Instruction Register Size


I am writing a Z80 emulator and I am confused as to how large the instruction register is.

In the Z80 manual it states that the instructions are from 1 to 4 bytes long, am I given to assume that the Z80 has a 32Bit instruction register? If not then how does it execute instructions like this?

enter image description here


Solution

  • There's no instruction register, and you don't fetch the entire instruction at once. Instead, you fetch it piece-by-piece.

    Let's walk through your example instruction:

    If you want to write a cycle-accurate emulator things get a bit more complicated, but I wouldn't recommend that if you're a beginner when it comes to emulation.