On Fri, Jan 02, 2009 at 02:30:25PM -0600, Jules Richardson wrote:
Basically they were wondering what the internals of
the Z80's instruction
fetch were, given that some instructions are multiple bytes in length, but
there's only a single-byte instruction register.
Speaking from memory (fairly recent memory as it happens, from writing
an emulator) there are two types of multi-byte instruction:
1. one byte instruction + data (eg a value to load into a register)
2. prefix byte(s) + one byte instruction (+ data for some instructions)
The prefix bytes either:
1. effectively swap the HL and IX or IY register
(the DD and FD prefixes)
2. change to a different instruction set
(the CB and ED prefixes)
3. are insane and look suspiciously like the state machine doing a
fandango (the DD CB and FD CB prefixes). AFAIK Zilog never documented
any of these.
That last case includes instructions like "attempt to reset bit 3 of the
byte at (IX+42) and also put the result in register B, even if the new
byte cannot be written at the said address".
See this excellent page on how to decode an instruction byte,
specifically these sections for the various prefix bytes:
http://www.z80.info/decoding.htm#cb
http://www.z80.info/decoding.htm#ed
http://www.z80.info/decoding.htm#dd
--
David Cantrell | Godless Liberal Elitist
Us Germans take our humour very seriously
-- German cultural attache talking to the Today Programme,
about the German supposed lack of a sense of humour, 29 Aug 2001