Changes

Jump to: navigation, search

Z80 - undocumented opcodes

1,041 bytes added, 02:23, 10 December 2012
/* DD and FD prefixes */
== DD and FD prefixes ==
The &DD/or &FD prefixes replace are documented as causing operations using the 16-bit register HL to instead work with either of the 16-bit indexing registers L, H IX or IY; if the operations access a memory location (''i.e.'' normally LD A,(HL with IXL), ''etc.''), the opcodes must additionally include an extra byte that specifies a signed displacement (-128 to +127) from IX/IY. However, Zilog have not documented the fact that these prefixes also affect opcodes that usually refer to the 8-bit components of HL, ''i.e.'' H and L. Thus, one gains access to the additional registers IXH, IXL, IYH, and IYL, for almost all commands that normally use H or L. It is even possible to do things like LD IXH,IXL. These registers can be useful in routines that must process and/IYH or store a lot of numbers. Thankfully, they are not as slow as their 16-bit counterparts: whereas access to (IX/IY+d) is usually slower by 3 NOPs than the equivalent operation upon (HL), using the 8-bit components is (like PUSH IX, ''etc.'') only 1 NOP slower, and this is only due to the need to parse the prefixing byte.  
<pre>DB #DD:LD H,A -&gt; LD IXH,A
DB #FD:LD B,L -&gt; LD B,IYL
</pre>
Note: These registers are called LX, LY, HX , and HY in the by [[WinAPE ]]'s debugger, although its assembleruses the names given above.
== ED prefix ==
25
edits