Re: Good free and open source Z80 emulation code?

Skip to first unread message

M.O.B. i L.

Dec 6, 2010, 4:03:52 PM12/6/10
Philip Kendall wrote:
> On 04/12/10 21:03, M.O.B. i L. wrote:
>> This is LGPL and probably handles all undocumented instructions:
>> Filename:
> [ ... ]
> Doesn't look to me like it does:
> static opcode_fn opcode_fd_cb[256] = {
> no_op_xx, no_op_xx, no_op_xx, no_op_xx, no_op_xx, no_op_xx,
> All those opcodes have an effect.

You're probably right. I've found this page that explains what these
opcodes should do: <>.

I thought it supported all Z80 instructions because one of the
developers has made an assembler that runs on the calculator (TI-83
Plus/TI-84 Plus/Silver Edition), that supported undocumented
instructions (but perhaps not all):

Here is a quote from the manual of the assembler:
*Z80 instructions*

Mimas supports all of the Z80 instructions, both documented and
undocumented. For details of the documented instructions, see the
official Z80 documentation.

For convenience, when setting, resetting, or testing a system flag, you
can simply type the name of the flag (or select it from the System Flags
menu), omitting the IY offset. For instance, SET textInverse will be
automatically replaced with SET textInverse, (IY + textFlags).

The undocumented instructions are described below. Note, however, that
undocumented instructions will not work on the TI-Nspire, so you should
avoid using them in programs that are intended to be portable.

*IX/IY Half Registers*
The upper and lower halves of the IX and IY registers can be
manipulated independently, just as H and L can; these “half registers”
are referred to as IXH, IXL, IYH, and IYL. Half registers can be used in
all of the basic 8-bit operations (ADD, SUB, ADC, SBC, AND, OR, XOR, CP,
INC, DEC), can have constant values loaded into them, and can be loaded
to and from the A, B, C, D, and E registers.
*Shift Left Inverted*
SLIA is similar to the documented SLA, except that the low bit of
the result is set to 1 instead of 0. (SLIA arg has the same effect as
SCF followed by RL arg.) SLIA can be used with any of the same arguments
that can be used with SLA.
*Shift/Rotate/Set/Reset Bit with Copy*
The instructions SLA, SRA, SLIA, SRL, RL, RLC, RR, and RRC can be
used with two arguments, where the first is one of the registers B, C,
D, E, H, L, and A, and the second is an indexed address (either (IX+n)
or (IY+n).) The instructions SET and RES can be used with three
arguments, where the first is a bit number, the second is a register,
and the third is an indexed address. This means that a value is read
from that indexed address, the appropriate operation is performed on
that value, and the result is both written back to memory and also
copied into the given register. For instance, SLA H,(IX+2) has the same
effect as LD H,(IX+2) / SLA H / LD (IX+2),H. SET 3,H,(IX+2) has the same
effect as LD H,(IX+2) / SET 3,H / LD (IX+2),H.
*Test-Only Input*
IN (C) reads a byte from I/O port C, without storing it anywhere,
but sets or clears the sign, zero, and parity flags according to the
input value, just as the documented IN r,(C) instructions do. (IN (C)
has essentially the same effect as PUSH BC / IN B,(C) / POP BC.)
*Zero Output*
OUT (C),0 writes a zero byte to I/O port C. (OUT (C),0 has
essentially the same effect as PUSH BC / LD B,0 / OUT (C),B / POP BC.)

Reply all
Reply to author
0 new messages