Z-80 code question about a loop that depends on the contents of the refresh register

Maciej W. Rozycki macro at linux-mips.org
Fri Dec 30 12:45:55 CST 2016

On Wed, 14 Dec 2016, Tony Duell wrote:

> What I need to do is find exactly how the flags are set by the
> LD A,R

 It's been long since I did anything with the Z80, but offhand all flags 
are set as with ALU operations according to the value loaded into the 
accumulator (same with LD A,I, but not the reverse loads IIRC).  These are 
the only Z80 LD instructions that set the flags.

 If help is still needed with interpreting this piece of code I can reach 
out for documentation and refresh old memory.

 BTW, as a side effect of incomplete instruction decoding and the lack of 
trapping on unimplemented operations the Z80 had a number of undocumented 
operations available, which however were reliable across different silicon 
manufactured and eventually got figured out and documented.  Some software 
relied on correct execution of these operations and may require an 
accurate emulator implementation to run correctly.

 XZX is one emulator I know of that has claimed support for all these 
operations in its core processor support (I and R registers should also be 
correctly handled); otherwise emulating Sinclair ZX Spectrum class systems 
and running as an X11 client on various *nix systems.  I haven't used it 
for years now though and have no idea whether it has been maintained 
beyond 1997 which is when the version I still have around has been 


More information about the cctech mailing list