Skip to contentSkip to conversation

Z80 emulation updated again!

PATCH In review Stuart Brady 11 participants 27 messages May 31, 2009 – Dec 29, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Z80 emulation updated again!

Hi!

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. Significant changes since Ulrich Hecht's updated version are as follows:

* Converted CPU emulation core to TCG
* Fixed emulation of 'bright' display attribute
* Fixed display output for pixel formats besides 32-bit RGB
* Improved keyboard handling, with support for cursor keys, etc.
* Removed dead code
* Now supports libspectrum 0.5 (for snapshot loading)
* Numerous cleanups

The emulation has not yet been optimised, but should achieve something between 100 and 200 times the performance of real hardware.

Thanks go to Ulrich for adding support for snapshot loading, and for porting the 'HALT' hack from xz80, in his updated version!

BTW, I have also written some experimental 128K emulation -- however, this only achieves ~10 times the speed of real hardware, as the 128K makes heavy use of bank switching.

I can split the patch up if wanted, although only 44 insertions are in existing files.

Cheers,

Signature · 27 lines
Stuart Brady

diffstat:
 Makefile                        |    3 
 Makefile.target                 |   13 
 configure                       |   16 
 cpu-exec.c                      |   10 
 dis-asm.h                       |    1 
 disas.c                         |    2 
 hw/pixel_ops_dup.h              |   61 +
 hw/zx_glyphs.h                  |   37 
 hw/zx_key_template.h            |   50 +
 hw/zx_spectrum.c                |  443 +++++++++
 hw/zx_video.c                   |  375 ++++++++
 hw/zx_video.h                   |    8 
 target-z80/TODO                 |   13 
 target-z80/cpu.h                |  259 +++++
 target-z80/exec.h               |  196 ++++
 target-z80/genreg_template.h    |   65 +
 target-z80/genreg_template_af.h |   83 +
 target-z80/helper.c             |  211 ++++
 target-z80/helper.h             |   89 +
 target-z80/machine.c            |   11 
 target-z80/op_helper.c          |  947 ++++++++++++++++++++
 target-z80/translate.c          | 1834 ++++++++++++++++++++++++++++++++++++++++
 z80-dis.c                       |  621 +++++++++++++
 23 files changed, 5347 insertions(+), 1 deletion(-)
Makefile +2 -1
index d7b9985..3ef706b 100644
@@ -271,7 +271,7 @@ ifdef INSTALL_BLOBS
 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
 video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
 pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
-bamboo.dtb
+bamboo.dtb zx-rom.bin
 else
 BLOBS=
 endif
@@ -386,6 +386,7 @@ tarbin:
 	$(bindir)/qemu-system-sh4 \
 	$(bindir)/qemu-system-sh4eb \
 	$(bindir)/qemu-system-sparc \
+	$(bindir)/qemu-system-z80 \
 	$(bindir)/qemu-i386 \
 	$(bindir)/qemu-x86_64 \
 	$(bindir)/qemu-alpha \
Makefile.target +13 -0
index 445d55f..a97ca05 100644
@@ -168,6 +168,12 @@ LIBOBJS+= mmu.o
 endif
 endif
 
+ifeq ($(TARGET_BASE_ARCH), z80)
+ifdef CONFIG_LIBSPECTRUM
+LIBS+=-lspectrum
+endif
+endif
+
 # NOTE: the disassembler code is only needed for debugging
 LIBOBJS+=disas.o
 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
@@ -212,6 +218,9 @@ endif
 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
 LIBOBJS+=s390-dis.o
 endif
+ifeq ($(findstring z80, $(TARGET_ARCH) $(ARCH)),z80)
+LIBOBJS+=z80-dis.o
+endif
 
 # libqemu
 
@@ -686,6 +695,10 @@ ifeq ($(TARGET_BASE_ARCH), m68k)
 OBJS+= an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
 OBJS+= m68k-semi.o dummy_m68k.o
 endif
+ifeq ($(TARGET_BASE_ARCH), z80)
+OBJS+= zx_spectrum.o zx_video.o dma.o
+OBJS+= serial.o i8259.o
+endif
 ifdef CONFIG_COCOA
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
 ifdef CONFIG_COREAUDIO
configure +16 -0
index 21c0633..fdd9493 100755
@@ -163,6 +163,7 @@ bigendian="no"
 mingw32="no"
 EXESUF=""
 slirp="yes"
+libspectrum="no"
 vde="yes"
 fmod_lib=""
 fmod_inc=""
@@ -397,6 +398,8 @@ for opt do
   ;;
   --disable-sdl) sdl="no"
   ;;
+  --enable-libspectrum) libspectrum="yes"
+  ;;
   --fmod-lib=*) fmod_lib="$optarg"
   ;;
   --fmod-inc=*) fmod_inc="$optarg"
@@ -595,6 +598,7 @@ echo "  --disable-strip          disable stripping binaries"
 echo "  --disable-werror         disable compilation abort on warning"
 echo "  --disable-sdl            disable SDL"
 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
+echo "  --enable-libspectrum     enable ZX Spectrum snapshot loading"
 echo "  --audio-drv-list=LIST    set audio drivers list:"
 echo "                           Available drivers: $audio_possible_drivers"
 echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
@@ -694,6 +698,7 @@ ppc64-softmmu \
 sh4-softmmu \
 sh4eb-softmmu \
 sparc-softmmu \
+z80-softmmu \
 "
     fi
 # the following are Linux specific
@@ -1355,6 +1360,7 @@ fi
 if test -n "$sparc_cpu"; then
     echo "Target Sparc Arch $sparc_cpu"
 fi
+echo "libspec. support  $libspectrum"
 echo "kqemu support     $kqemu"
 echo "xen support       $xen"
 echo "brlapi support    $brlapi"
@@ -1595,6 +1601,10 @@ if test "$mixemu" = "yes" ; then
   echo "CONFIG_MIXEMU=yes" >> $config_mak
   echo "#define CONFIG_MIXEMU 1" >> $config_h
 fi
+if test "$libspectrum" = "yes" ; then
+  echo "CONFIG_LIBSPECTRUM=yes" >> $config_mak
+  echo "#define CONFIG_LIBSPECTRUM 1" >> $config_h
+fi
 if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS=yes" >> $config_mak
   echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
@@ -2038,6 +2048,12 @@ case "$target_cpu" in
     echo "#define TARGET_ABI32 1" >> $config_h
     target_phys_bits=64
   ;;
+  z80)
+    echo "TARGET_ARCH=z80" >> $config_mak
+    echo "#define TARGET_ARCH \"z80\"" >> $config_h
+    echo "#define TARGET_Z80 1" >> $config_h
+    target_phys_bits=32
+  ;;
   *)
     echo "Unsupported target CPU"
     exit 1
cpu-exec.c +10 -0
index 8734337..d614c42 100644
@@ -250,6 +250,7 @@ int cpu_exec(CPUState *env1)
 #elif defined(TARGET_MIPS)
 #elif defined(TARGET_SH4)
 #elif defined(TARGET_CRIS)
+#elif defined(TARGET_Z80)
     /* XXXXX */
 #else
 #error unsupported target CPU
@@ -543,6 +544,12 @@ int cpu_exec(CPUState *env1)
                         do_interrupt(1);
                         next_tb = 0;
                     }
+#elif defined(TARGET_Z80)
+                    if (interrupt_request & CPU_INTERRUPT_HARD) {
+			env->interrupt_request &= ~CPU_INTERRUPT_HARD;
+                        /* TODO: Add support for NMIs */
+                        do_interrupt(env);
+                    }
 #endif
                    /* Don't use the cached interupt_request value,
                       do_interrupt may have updated the EXITTB flag. */
@@ -588,6 +595,8 @@ int cpu_exec(CPUState *env1)
                     log_cpu_state(env, 0);
 #elif defined(TARGET_CRIS)
                     log_cpu_state(env, 0);
+#elif defined(TARGET_Z80)
+                    log_cpu_state(env, 0);
 #else
 #error unsupported target CPU
 #endif
@@ -702,6 +711,7 @@ int cpu_exec(CPUState *env1)
 #elif defined(TARGET_SH4)
 #elif defined(TARGET_ALPHA)
 #elif defined(TARGET_CRIS)
+#elif defined(TARGET_Z80)
     /* XXXXX */
 #else
 #error unsupported target CPU
dis-asm.h +1 -0
index 251c490..0a00f7b 100644
@@ -402,6 +402,7 @@ extern int print_insn_ppc		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_s390		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_crisv32           PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_microblaze        PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_z80		PARAMS ((bfd_vma, disassemble_info*));
 
 #if 0
 /* Fetch the disassembler for a given BFD, if that support is available.  */
disas.c +2 -0
index af5a9ea..5ca873e 100644
@@ -198,6 +198,8 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
 #elif defined(TARGET_MICROBLAZE)
     disasm_info.mach = bfd_arch_microblaze;
     print_insn = print_insn_microblaze;
+#elif defined(TARGET_Z80)
+    print_insn = print_insn_z80;
 #else
     fprintf(out, "0x" TARGET_FMT_lx
 	    ": Asm output not supported on this arch\n", code);
hw/pixel_ops_dup.h new file +61 -0

61 lines not on this page · raw message

hw/zx_glyphs.h new file +37 -0
new file mode 100644
index 0000000..dd1ade2
@@ -0,0 +1,37 @@
+#if DEPTH == 8
+#define BPP 1
+#elif DEPTH == 16
+#define BPP 2
+#elif DEPTH == 32
+#define BPP 4
+#else
+#error unsupport depth
+#endif
+
+static inline void glue(zx_draw_glyph_line_, DEPTH)(uint8_t *d,
+                                                    uint32_t font_data,
+                                                    uint32_t xorcol,
+                                                    uint32_t bgcol)
+{
+#if BPP == 1
+    ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
+    ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
+#elif BPP == 2
+    ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;
+    ((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;
+    ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;
+    ((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
+#else
+    ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
+    ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
+#endif
+}
+
+#undef DEPTH
+#undef BPP
hw/zx_key_template.h new file +50 -0

50 lines not on this page · raw message

hw/zx_spectrum.c new file +443 -0

443 lines not on this page · raw message

hw/zx_video.c new file +375 -0

375 lines not on this page · raw message

hw/zx_video.h new file +8 -0
new file mode 100644
index 0000000..b53dc36
@@ -0,0 +1,8 @@
+#ifndef HW_ZX_VIDEO_H
+#define HW_ZX_VIDEO_H
+/* ZX Spectrum Video */
+
+void zx_video_init(ram_addr_t zx_vram_offset);
+void zx_video_do_retrace(void);
+
+#endif
target-z80/TODO new file +13 -0
new file mode 100644
index 0000000..7698cd2
@@ -0,0 +1,13 @@
+TODO
+----
+
+- remove unused x86 code
+- allow execution from video RAM
+- don't accept interrupts immediately after EI
+- emulate I and R registers
+- GDB support
+- CP/M emulation
+- R800 emulation:
+  - TST instruction
+  - MULUB/MULUW flags
+  - flags 3 and 5
target-z80/cpu.h new file +259 -0

259 lines not on this page · raw message

target-z80/exec.h new file +196 -0

196 lines not on this page · raw message

target-z80/genreg_template.h new file +65 -0

65 lines not on this page · raw message

target-z80/genreg_template_af.h new file +83 -0

83 lines not on this page · raw message

target-z80/helper.c new file +211 -0

211 lines not on this page · raw message

target-z80/helper.h new file +89 -0

89 lines not on this page · raw message

target-z80/machine.c new file +11 -0
new file mode 100644
index 0000000..1be1c35
@@ -0,0 +1,11 @@
+#include "hw/hw.h"
+#include "hw/boards.h"
+
+void cpu_save(QEMUFile *f, void *opaque)
+{
+}
+
+int cpu_load(QEMUFile *f, void *opaque, int version_id)
+{
+    return 0;
+}
target-z80/op_helper.c new file +947 -0

946 lines not on this page · raw message

target-z80/translate.c new file +1834 -0

1,834 lines not on this page · raw message

z80-dis.c new file +55 -0

55 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

+static int
+fetch_data (struct buffer *buf, disassemble_info * info, int n) +{
+ int r;
+
+ if (buf->n_fetch + n > 4)
+ abort ();
+
+ r = info->read_memory_func (buf->base + buf->n_fetch,
+ (unsigned char*) buf->data + buf->n_fetch,
+ n, info);
+ if (r == 0)
+ buf->n_fetch += n;
+ return !r;
+}
+
+static int
+prt (struct buffer *buf, disassemble_info * info, char *txt) +{

+  info->fprintf_func (info->stream, "%s", txt);
+  buf->n_used = buf->n_fetch;
+  return 1;

+}
+
+static int
+prt_e (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char e;
+ int target_addr;
+
+ if (fetch_data (buf, info, 1))
+ {

+      e = buf->data[1];
+      target_addr = (buf->base + 2 + e) & 0xffff;
+      buf->n_used = buf->n_fetch;
+      info->fprintf_func (info->stream, "%s0x%04x", txt, target_addr);

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+
+static int
+jr_cc (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt, TXTSIZ, txt, cc_str[(buf->data[0] >> 3) & 3]);
+ return prt_e (buf, info, mytxt);
+}
+
+static int
+prt_nn (struct buffer *buf, disassemble_info * info, char *txt) +{
+ int nn;
+ unsigned char *p;
+
+ p = (unsigned char*) buf->data + buf->n_fetch;
+ if (fetch_data (buf, info, 2))
+ {

+      nn = p[0] + (p[1] << 8);
+      info->fprintf_func (info->stream, txt, nn);
+      buf->n_used = buf->n_fetch;

+ }
+ else
+ buf->n_used = -1;
+ return buf->n_used;
+}
+
+static int
+prt_rr_nn (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt, TXTSIZ, txt, rr_str[(buf->data[0] >> 4) & 3]);
+ return prt_nn (buf, info, mytxt);
+}
+
+static int
+prt_rr (struct buffer *buf, disassemble_info * info, char *txt) +{
+ info->fprintf_func (info->stream, "%s%s", txt,
+ rr_str[(buf->data[buf->n_fetch - 1] >> 4) & 3]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+static int
+prt_n (struct buffer *buf, disassemble_info * info, char *txt) +{
+ int n;
+ unsigned char *p;
+
+ p = (unsigned char*) buf->data + buf->n_fetch;
+
+ if (fetch_data (buf, info, 1))
+ {

+      n = p[0];
+      info->fprintf_func (info->stream, txt, n);
+      buf->n_used = buf->n_fetch;

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+
+static int
+ld_r_n (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt, TXTSIZ, txt, r_str[(buf->data[0] >> 3) & 7]);
+ return prt_n (buf, info, mytxt);
+}
+
+static int
+prt_r (struct buffer *buf, disassemble_info * info, char *txt) +{
+ info->fprintf_func (info->stream, txt,
+ r_str[(buf->data[buf->n_fetch - 1] >> 3) & 7]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+static int
+ld_r_r (struct buffer *buf, disassemble_info * info, char *txt) +{
+ info->fprintf_func (info->stream, txt,
+ r_str[(buf->data[buf->n_fetch - 1] >> 3) & 7],
+ r_str[buf->data[buf->n_fetch - 1] & 7]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+static int
+arit_r (struct buffer *buf, disassemble_info * info, char *txt) +{
+ info->fprintf_func (info->stream, txt,
+ arit_str[(buf->data[buf->n_fetch - 1] >> 3) & 7],
+ r_str[buf->data[buf->n_fetch - 1] & 7]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+static int
+prt_cc (struct buffer *buf, disassemble_info * info, char *txt) +{
+ info->fprintf_func (info->stream, "%s%s", txt,
+ cc_str[(buf->data[0] >> 3) & 7]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+static int
+pop_rr (struct buffer *buf, disassemble_info * info, char *txt) +{
+ static char *rr_stack[] = { "bc","de","hl","af"};
+
+ info->fprintf_func (info->stream, "%s %s", txt,
+ rr_stack[(buf->data[0] >> 4) & 3]);
+ buf->n_used = buf->n_fetch;
+ return buf->n_used;
+}
+
+
+static int
+jp_cc_nn (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt,TXTSIZ,
+ "%s%s,0x%%04x", txt, cc_str[(buf->data[0] >> 3) & 7]);
+ return prt_nn (buf, info, mytxt);
+}
+
+static int
+arit_n (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt,TXTSIZ, txt, arit_str[(buf->data[0] >> 3) & 7]);
+ return prt_n (buf, info, mytxt);
+}
+
+static int
+rst (struct buffer *buf, disassemble_info * info, char *txt) +{

+  info->fprintf_func (info->stream, txt, buf->data[0] & 0x38);
+  buf->n_used = buf->n_fetch;
+  return buf->n_used;

+}
+
+

+static int
+cis (struct buffer *buf, disassemble_info * info, char *txt ATTRIBUTE_UNUSED) +{

+  static char * opar[] = { "ld", "cp", "in", "out" };
+  char * op;
+  char c;
+
+  c = buf->data[1];
+  op = ((0x13 & c) == 0x13) ? "ot" : (opar[c & 3]);
+  info->fprintf_func (info->stream,
+		      "%s%c%s", op,
+		      (c & 0x08) ? 'd' : 'i',
+		      (c & 0x10) ? "r" : "");

+ buf->n_used = 2;
+ return buf->n_used;
+}
+
+static int
+dump (struct buffer *buf, disassemble_info * info, char *txt) +{
+ int i;
+
+ info->fprintf_func (info->stream, "defb ");
+ for (i = 0; txt[i]; ++i)
+ info->fprintf_func (info->stream, i ? ", 0x%02x" : "0x%02x",
+ (unsigned char) buf->data[i]);
+ buf->n_used = i;
+ return buf->n_used;
+}
+

+/* Table to disassemble machine codes with prefix 0xED. */ +struct tab_elt opc_ed[] =
+{

+  { 0x70, 0xFF, prt, "in f,(c)" },
+  { 0x70, 0xFF, dump, "xx" },
+  { 0x40, 0xC7, prt_r, "in %s,(c)" },
+  { 0x71, 0xFF, prt, "out (c),0" },
+  { 0x70, 0xFF, dump, "xx" },
+  { 0x41, 0xC7, prt_r, "out (c),%s" },
+  { 0x42, 0xCF, prt_rr, "sbc hl," },
+  { 0x43, 0xCF, prt_rr_nn, "ld (0x%%04x),%s" },
+  { 0x44, 0xFF, prt, "neg" },
+  { 0x45, 0xFF, prt, "retn" },
+  { 0x46, 0xFF, prt, "im 0" },
+  { 0x47, 0xFF, prt, "ld i,a" },
+  { 0x4A, 0xCF, prt_rr, "adc hl," },
+  { 0x4B, 0xCF, prt_rr_nn, "ld %s,(0x%%04x)" },
+  { 0x4D, 0xFF, prt, "reti" },
+  { 0x56, 0xFF, prt, "im 1" },
+  { 0x57, 0xFF, prt, "ld a,i" },
+  { 0x5E, 0xFF, prt, "im 2" },
+  { 0x67, 0xFF, prt, "rrd" },
+  { 0x6F, 0xFF, prt, "rld" },
+  { 0xA0, 0xE4, cis, "" },
+  { 0xC3, 0xFF, prt, "muluw hl,bc" },
+  { 0xC5, 0xE7, prt_r, "mulub a,%s" },
+  { 0xF3, 0xFF, prt, "muluw hl,sp" },
+  { 0x00, 0x00, dump, "xx" }

+};
+
+static int
+pref_ed (struct buffer * buf, disassemble_info * info,
+ char* txt ATTRIBUTE_UNUSED)
+{
+ struct tab_elt *p;
+
+ if (fetch_data(buf, info, 1))
+ {
+ for (p = opc_ed; p->val != (buf->data[1] & p->mask); ++p)
+ ;
+ p->fp (buf, info, p->text);
+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+

+/* Instruction names for the instructions addressing single bits. */ +static char *cb1_str[] = { "", "bit", "res", "set"};
+/* Instruction names for shifts and rotates. */
+static char *cb2_str[] =
+{
+ "rlc", "rrc", "rl", "rr", "sla", "sra", "sli", "srl"
+};
+
+static int
+pref_cb (struct buffer * buf, disassemble_info * info,
+ char* txt ATTRIBUTE_UNUSED)
+{
+ if (fetch_data (buf, info, 1))
+ {
+ buf->n_used = 2;
+ if ((buf->data[1] & 0xc0) == 0)
+ info->fprintf_func (info->stream, "%s %s",
+ cb2_str[(buf->data[1] >> 3) & 7],
+ r_str[buf->data[1] & 7]);
+ else
+ info->fprintf_func (info->stream, "%s %d,%s",

+			    cb1_str[(buf->data[1] >> 6) & 3],
+			    (buf->data[1] >> 3) & 7,
+			    r_str[buf->data[1] & 7]);

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+

+static int
+addvv (struct buffer * buf, disassemble_info * info, char* txt) +{
+ info->fprintf_func (info->stream, "add %s,%s", txt, txt); +
+ return buf->n_used = buf->n_fetch;
+}
+
+static int
+ld_v_v (struct buffer * buf, disassemble_info * info, char* txt) +{
+ char mytxt[TXTSIZ];
+
+ snprintf (mytxt, TXTSIZ, "ld %s%%s,%s%%s", txt, txt);
+ return ld_r_r (buf, info, mytxt);
+}
+
+static int
+prt_d (struct buffer *buf, disassemble_info * info, char *txt) +{
+ int d;
+ signed char *p;
+
+ p = buf->data + buf->n_fetch;
+
+ if (fetch_data (buf, info, 1))
+ {

+      d = p[0];
+      info->fprintf_func (info->stream, txt, d);
+      buf->n_used = buf->n_fetch;

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+
+static int
+prt_d_n (struct buffer *buf, disassemble_info * info, char *txt) +{

+  char mytxt[TXTSIZ];
+  int d;
+  signed char *p;

+
+ p = buf->data + buf->n_fetch;
+
+ if (fetch_data (buf, info, 1))
+ {

+      d = p[0];
+      snprintf (mytxt, TXTSIZ, txt, d);
+      return prt_n (buf, info, mytxt);

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+
+static int
+arit_d (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+ signed char c;
+

+  c = buf->data[buf->n_fetch - 1];
+  snprintf (mytxt, TXTSIZ, txt, arit_str[(c >> 3) & 7]);
+  return prt_d (buf, info, mytxt);

+}
+
+static int
+ld_r_d (struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+ signed char c;
+

+  c = buf->data[buf->n_fetch - 1];
+  snprintf (mytxt, TXTSIZ, txt, r_str[(c >> 3) & 7]);
+  return prt_d (buf, info, mytxt);

+}
+
+static int
+ld_d_r(struct buffer *buf, disassemble_info * info, char *txt) +{
+ char mytxt[TXTSIZ];
+ signed char c;
+

+  c = buf->data[buf->n_fetch - 1];
+  snprintf (mytxt, TXTSIZ, txt, r_str[c & 7]);
+  return prt_d (buf, info, mytxt);

+}
+
+static int
+pref_xd_cb (struct buffer * buf, disassemble_info * info, char* txt) +{
+ if (fetch_data (buf, info, 2))
+ {

+      int d;
+      char arg[TXTSIZ];
+      signed char *p;
+
+      buf->n_used = 4;
+      p = buf->data;
+      d = p[2];

+
+ if (((p[3] & 0xC0) == 0x40) || ((p[3] & 7) == 0x06))
+ snprintf (arg, TXTSIZ, "(%s%+d)", txt, d);
+ else
+ snprintf (arg, TXTSIZ, "(%s%+d),%s", txt, d, r_str[p[3] & 7]);
+
+ if ((p[3] & 0xc0) == 0)
+ info->fprintf_func (info->stream, "%s %s",
+ cb2_str[(buf->data[3] >> 3) & 7],
+ arg);
+ else
+ info->fprintf_func (info->stream, "%s %d,%s",

+			    cb1_str[(buf->data[3] >> 6) & 3],
+			    (buf->data[3] >> 3) & 7,
+			    arg);

+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+

+/* Table to disassemble machine codes with prefix 0xDD or 0xFD. */ +static struct tab_elt opc_ind[] =
+{

+  { 0x24, 0xF7, prt_r, "inc %s%%s" },
+  { 0x25, 0xF7, prt_r, "dec %s%%s" },
+  { 0x26, 0xF7, ld_r_n, "ld %s%%s,0x%%%%02x" },
+  { 0x21, 0xFF, prt_nn, "ld %s,0x%%04x" },
+  { 0x22, 0xFF, prt_nn, "ld (0x%%04x),%s" },
+  { 0x2A, 0xFF, prt_nn, "ld %s,(0x%%04x)" },
+  { 0x23, 0xFF, prt, "inc %s" },
+  { 0x2B, 0xFF, prt, "dec %s" },
+  { 0x29, 0xFF, addvv, "%s" },
+  { 0x09, 0xCF, prt_rr, "add %s," },
+  { 0x34, 0xFF, prt_d, "inc (%s%%+d)" },
+  { 0x35, 0xFF, prt_d, "dec (%s%%+d)" },
+  { 0x36, 0xFF, prt_d_n, "ld (%s%%+d),0x%%%%02x" },
+
+  { 0x76, 0xFF, dump, "h" },
+  { 0x46, 0xC7, ld_r_d, "ld %%s,(%s%%%%+d)" },
+  { 0x70, 0xF8, ld_d_r, "ld (%s%%%%+d),%%s" },
+  { 0x64, 0xF6, ld_v_v, "%s" },
+  { 0x60, 0xF0, ld_r_r, "ld %s%%s,%%s" },
+  { 0x44, 0xC6, ld_r_r, "ld %%s,%s%%s" },

+
+ { 0x86, 0xC7, arit_d, "%%s(%s%%%%+d)" },
+ { 0x84, 0xC6, arit_r, "%%s%s%%s" },
+

+  { 0xE1, 0xFF, prt, "pop %s" },
+  { 0xE5, 0xFF, prt, "push %s" },
+  { 0xCB, 0xFF, pref_xd_cb, "%s" },
+  { 0xE3, 0xFF, prt, "ex (sp),%s" },
+  { 0xE9, 0xFF, prt, "jp (%s)" },
+  { 0xF9, 0xFF, prt, "ld sp,%s" },
+  { 0x00, 0x00, dump, "?" },

+} ;
+
+static int
+pref_ind (struct buffer * buf, disassemble_info * info, char* txt) +{
+ if (fetch_data (buf, info, 1))
+ {
+ char mytxt[TXTSIZ];
+ struct tab_elt *p;
+
+ for (p = opc_ind; p->val != (buf->data[1] & p->mask); ++p)
+ ;
+ snprintf (mytxt, TXTSIZ, p->text, txt);
+ p->fp (buf, info, mytxt);
+ }
+ else
+ buf->n_used = -1;
+
+ return buf->n_used;
+}
+
+/* Table to disassemble machine codes without prefix. */ +static struct tab_elt opc_main[] =
+{

+  { 0x00, 0xFF, prt, "nop" },
+  { 0x01, 0xCF, prt_rr_nn, "ld %s,0x%%04x" },
+  { 0x02, 0xFF, prt, "ld (bc),a" },
+  { 0x03, 0xCF, prt_rr, "inc " },
+  { 0x04, 0xC7, prt_r, "inc %s" },
+  { 0x05, 0xC7, prt_r, "dec %s" },
+  { 0x06, 0xC7, ld_r_n, "ld %s,0x%%02x" },
+  { 0x07, 0xFF, prt, "rlca" },
+  { 0x08, 0xFF, prt, "ex af,af'" },
+  { 0x09, 0xCF, prt_rr, "add hl," },
+  { 0x0A, 0xFF, prt, "ld a,(bc)" },
+  { 0x0B, 0xCF, prt_rr, "dec " },
+  { 0x0F, 0xFF, prt, "rrca" },
+  { 0x10, 0xFF, prt_e, "djnz " },
+  { 0x12, 0xFF, prt, "ld (de),a" },
+  { 0x17, 0xFF, prt, "rla" },
+  { 0x18, 0xFF, prt_e, "jr "},
+  { 0x1A, 0xFF, prt, "ld a,(de)" },
+  { 0x1F, 0xFF, prt, "rra" },
+  { 0x20, 0xE7, jr_cc, "jr %s,"},
+  { 0x22, 0xFF, prt_nn, "ld (0x%04x),hl" },
+  { 0x27, 0xFF, prt, "daa"},
+  { 0x2A, 0xFF, prt_nn, "ld hl,(0x%04x)" },
+  { 0x2F, 0xFF, prt, "cpl" },
+  { 0x32, 0xFF, prt_nn, "ld (0x%04x),a" },
+  { 0x37, 0xFF, prt, "scf" },
+  { 0x3A, 0xFF, prt_nn, "ld a,(0x%04x)" },
+  { 0x3F, 0xFF, prt, "ccf" },

+
+ { 0x76, 0xFF, prt, "halt" },
+ { 0x40, 0xC0, ld_r_r, "ld %s,%s"},
+
+ { 0x80, 0xC0, arit_r, "%s%s" },
+

+  { 0xC0, 0xC7, prt_cc, "ret " },
+  { 0xC1, 0xCF, pop_rr, "pop" },
+  { 0xC2, 0xC7, jp_cc_nn, "jp " },
+  { 0xC3, 0xFF, prt_nn, "jp 0x%04x" },
+  { 0xC4, 0xC7, jp_cc_nn, "call " },
+  { 0xC5, 0xCF, pop_rr, "push" },
+  { 0xC6, 0xC7, arit_n, "%s0x%%02x" },
+  { 0xC7, 0xC7, rst, "rst 0x%02x" },
+  { 0xC9, 0xFF, prt, "ret" },
+  { 0xCB, 0xFF, pref_cb, "" },
+  { 0xCD, 0xFF, prt_nn, "call 0x%04x" },
+  { 0xD3, 0xFF, prt_n, "out (0x%02x),a" },
+  { 0xD9, 0xFF, prt, "exx" },
+  { 0xDB, 0xFF, prt_n, "in a,(0x%02x)" },
+  { 0xDD, 0xFF, pref_ind, "ix" },
+  { 0xE3, 0xFF, prt, "ex (sp),hl" },
+  { 0xE9, 0xFF, prt, "jp (hl)" },
+  { 0xEB, 0xFF, prt, "ex de,hl" },
+  { 0xED, 0xFF, pref_ed, ""},
+  { 0xF3, 0xFF, prt, "di" },
+  { 0xF9, 0xFF, prt, "ld sp,hl" },
+  { 0xFB, 0xFF, prt, "ei" },
+  { 0xFD, 0xFF, pref_ind, "iy" },
+  { 0x00, 0x00, prt, "????" },

+} ;
+
+int
+print_insn_z80 (bfd_vma addr, disassemble_info * info) +{
+ struct buffer buf;
+ struct tab_elt *p;
+

+  buf.base = addr;
+  buf.n_fetch = 0;
+  buf.n_used = 0;

+
+ if (! fetch_data (& buf, info, 1))
+ return -1;
+
+ for (p = opc_main; p->val != (buf.data[0] & p->mask); ++p)
+ ;
+ p->fp (& buf, info, p->text);
+
+ return buf.n_used;
+}

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 20 lines · Stuart Brady

Hi!

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. Significant changes since Ulrich Hecht's updated version are as follows:

* Converted CPU emulation core to TCG
* Fixed emulation of 'bright' display attribute
* Fixed display output for pixel formats besides 32-bit RGB
* Improved keyboard handling, with support for cursor keys, etc.
* Removed dead code
* Now supports libspectrum 0.5 (for snapshot loading)
* Numerous cleanups

The emulation has not yet been optimised, but should achieve something between 100 and 200 times the performance of real hardware.

Thanks go to Ulrich for adding support for snapshot loading, and for porting the 'HALT' hack from xz80, in his updated version!

Quoted 6 lines

BTW, I have also written some experimental 128K emulation -- however, this only achieves ~10 times the speed of real hardware, as the 128K makes heavy use of bank switching.

I can split the patch up if wanted, although only 44 insertions are in existing files.

Since this just came up again - are you still working on this? It's be a shame to see this target bitrot to extinction. Also, do you think it's a valuable target to have in upstream qemu? If so, please create a proper patch set out of it, so it can be reviewed.

Alex

#2 lore raw

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 6 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance (chosen for school use in Baden-Württemberg in the early 2000s). There was an assembler toolchain integrated with Zilog Studio on Windows iirc. Apparently there's also an open source C compiler toolchain at [2] for these and other targets.
No Linux that I'm aware of. ;)

Cheers,
Andreas

[1] http://en.wikipedia.org/wiki/TI-83_series
[2] http://www.z88dk.org/

#3 lore raw
Quoted 4 lines · Andreas Färber

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 2 lines · Stuart Brady
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance (chosen for school use in Baden-Württemberg in the early 2000s). There was an assembler toolchain integrated with Zilog Studio on Windows iirc. Apparently there's also an open source C compiler toolchain at [2] for these and other targets.
No Linux that I'm aware of. ;)

Heh ;). You make it sound as if qemu was a Linux emulator. The general I/O framework is heavily geared towards server and desktop use. The main use case of the Z80 that I'm aware of is the GameBoy. Not sure that one fits in there too well :).

The Spectrum however does fit the desktop case, so it certainly has my blessings.

Alex

#4 lore raw

Am 21.12.2010 um 01:10 schrieb Alexander Graf:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 5 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance

The general I/O framework is heavily geared towards server and desktop use. The main use case of the Z80 that I'm aware of is the GameBoy. Not sure that one fits in there too well :).

The Spectrum however does fit the desktop case, so it certainly has my blessings.

Knowing the ZX Spectrum only from the attic, I agree that emulating game consoles is not the primary purpose or strength of QEMU. (Although I wouldn't mind if someone wanted to contribute a PS3 machine for Cell B.E. emulation!)

Fwiw mips, arm, m68k, cris, microblaze seem to form a growing third category of QEMU targets though, embedded systems.

Andreas

#5 lore raw

Hi all,

The Z80 CPU and its variants and clones are not only used in dozens of computers (ranging from a full range of CP/M compatible ones, and minicomputers mostly seen as general public as gaming devices -Amstrad, Speccy-), but also in hunders of embedded systems and even on Adaptec SCSI cards.

I vote for inclusion on mainstream 100%, and maybe from that code an i8080 emulation can be easily extracted to cover the rest of 80s desktop/minis/micros ?

Regards,
Natalia Portillo

#6 lore raw
Quoted 8 lines · Natalia Portillo

Hi all,

The Z80 CPU and its variants and clones are not only used in dozens of computers (ranging from a full range of CP/M compatible ones, and minicomputers mostly seen as general public as gaming devices -Amstrad, Speccy-), but also in hunders of embedded systems and even on Adaptec SCSI cards.

Quoted 4 lines

I vote for inclusion on mainstream 100%, and maybe from that code an i8080 emulation can be easily extracted to cover the rest of 80s desktop/minis/micros ?

This is a really interesting discussion which goes to the heart of QEMU's identity. A contemporary emulation and virtualisation platform (modern embedded, KVM etc)? An emulation platform for retro-computing nostalgia?
How about as a unifying platform for MAME?

No reason of course it can't be both, unless those roles start pulling in competing directions.

Commercially my company is an active user and supporter of MicroBlaze and PPC440 platforms, while personally the Sinclair Spectrum was my first ever home computing experience and will always have a special place in my geek heart. So, I vote 'both'!

John

Signature · 3 lines
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
#7 lore raw

Am 21.12.2010 um 03:47 schrieb John Williams:

Quoted 1 line

This is a really interesting discussion which goes to the heart of QEMU's identity.

Right...

Quoted 1 line

A contemporary emulation and virtualisation platform (modern embedded, KVM etc)? An emulation platform for retro-computing nostalgia? How about as a unifying platform for MAME?

The way I see it, QEMU has shifted from the "packaged" desktop emulation to a much more diversified emulation platform, say, a library of qdev devices of which boards are pieced together. So if someone contributes one particular machine, its devices can likely find reuse for other boards and archs as well. In the PReP case, for example the 40p's i82378.

In the case at hands, I was seeing possible reuse for target-z80/ bits beyond nostalgia.

QEMU can be a backend for many use cases as long as cycle-accurateness is not needed. The (lack of) frontends are its weekness though, which I guess makes it unsuitable for gaming. Game emulators on the contrary often oppose attempts to add more serious emulation features (e.g., LPT printing support in DOSBox).

Cheers,
Andreas

#8 lore raw
In reply to Natalia Portillo

Am 21.12.2010 03:38, schrieb Natalia Portillo:

Quoted 10 lines

Hi all,

The Z80 CPU and its variants and clones are not only used in dozens of computers (ranging from a full range of CP/M compatible ones, and minicomputers mostly seen as general public as gaming devices -Amstrad, Speccy-), but also in hunders of embedded systems and even
on Adaptec SCSI cards.

I vote for inclusion on mainstream 100%, and maybe from that code an i8080 emulation can be easily extracted to cover the rest of 80s desktop/minis/micros ?

Regards,
Natalia Portillo

I support this inclusion, too.
Maybe I'll even add a system emulation for TRS-80 one day.

Regards,
Stefan Weil

#9 lore raw

[Qemu-devel] QEMU forks survey

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

- hpoussin.git ppc contains the 40p machine that I'm reviewing for upstream inclusion currently.

* qemu-loongson.git I guess was fully upstreamed recently?

* ar7.git: Stefan, what's the state and scope of your work? What about TCI?

Apparently abandoned (no recent activity):
* avr32.git
* es40.git (alpha)
* hppa.git
* openrisc.git
* mmix.git

Unclear to me:
* mini2440.git
* qemu-JZ.git

http://wiki.qemu.org/Links

- OpenSolaris support was merged so can be disregarded.

* I heard from François that one of the downstreams has added support for the arm Beagle board? Maemo?

There's also many more forks on gitorious.com and github.com...

Andreas

#10 lore raw

Re: [Qemu-devel] QEMU forks survey

Quoted 22 lines · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

- hpoussin.git ppc contains the 40p machine that I'm reviewing for upstream inclusion currently.

* qemu-loongson.git I guess was fully upstreamed recently?

* ar7.git: Stefan, what's the state and scope of your work? What about TCI?

Apparently abandoned (no recent activity):
* avr32.git
* es40.git (alpha)
* hppa.git
* openrisc.git
* mmix.git

Unclear to me:
* mini2440.git
* qemu-JZ.git

Quoted 8 lines

http://wiki.qemu.org/Links

- OpenSolaris support was merged so can be disregarded.

* I heard from François that one of the downstreams has added support for the arm Beagle board? Maemo?

There's also many more forks on gitorious.com and github.com...

* s390x emulation

I'm currently working on that one. Already did some cleanups to the code and am now trying to get a kernel booting.

Alex

#11 lore raw

Re: [Qemu-devel] QEMU forks survey

In reply to Andreas Färber
Quoted 5 lines · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

* I heard from François that one of the downstreams has added support for the arm Beagle board? Maemo?

Yes (well it's Meego these days):
http://meego.gitorious.org/qemu-maemo/qemu

That fork includes OMAP3 support (needed for beagle) and also a large set of bugfixes for various ARM TCG issues which I've been trying to get reviewed and into upstream. (If anybody has suggestions on the best way to move forward with that I'd welcome them. So far I have been working on the "start at one end, test and submit patch series" basis...)

-- PMM

#12 lore raw

Re: [Qemu-devel] QEMU forks survey

Peter,

Am 21.12.2010 um 20:04 schrieb Peter Maydell:

Quoted 7 lines

http://meego.gitorious.org/qemu-maemo/qemu

That fork includes OMAP3 support (needed for beagle) and also a large set of bugfixes for various ARM TCG issues which I've been trying to get reviewed and into upstream. (If anybody has suggestions on the best way to move forward with that I'd welcome them. So far I have been working on the "start at one end, test and submit patch series" basis...)

Your work is much appreciated. ARM patches seem to have been neglected for some time.

My suggestion would be to set up an official feature repository somewhere (like Kevin's "block" branch) and queue the patches there for Anthony or someone to pull and to let downstreams rebase against that. If you don't get review comments within, say, two weeks, just queue them for the next pull. That should keep things moving.

You should also submit a patch to add yourself to MAINTAINERS [1] to be cc'ed on future ARM patches.

Regards,
Andreas

[1] While the file header documents the 'T:' section, nobody seems to be using it yet. Would be nice to document that info there as well.

#13 lore raw

Re: [Qemu-devel] QEMU forks survey

In reply to Andreas Färber
Quoted 19 lines · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

- hpoussin.git ppc contains the 40p machine that I'm reviewing for upstream inclusion currently.

* qemu-loongson.git I guess was fully upstreamed recently?

* ar7.git: Stefan, what's the state and scope of your work? What about TCI?

Apparently abandoned (no recent activity):
* avr32.git
* es40.git (alpha)
* hppa.git
* openrisc.git
* mmix.git

Quoted 2 lines

Unclear to me:
* mini2440.git

I did that fully working mini2440 port, since last year or so. that include s3c2440 and many associated peripherals. Unfortunately it's hard to follow qemu's tree and I decided to keep my port as is instead of constantly trying to keep it up to date... I still use it a lot tho...

Michael

#14 lore raw

Re: [Qemu-devel] QEMU forks survey

In reply to Andreas Färber
Quoted 1 line · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

There is also a 68k trunk around IIRC:
http://gitorious.org/qemu-m68k/qemu-m68k

Quoted 1 line

* I heard from François that one of the downstreams has added support for the arm Beagle board? Maemo?

Yes it seemed to start booting Haiku's loader built for overo btw (also an OMAP IIRC).

François.

#15 lore raw

Re: [Qemu-devel] QEMU forks survey

In reply to Andreas Färber

Am 21.12.2010 19:28, schrieb Andreas Färber:

Quoted 10 lines

Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

- hpoussin.git ppc contains the 40p machine that I'm reviewing for upstream inclusion currently.

* qemu-loongson.git I guess was fully upstreamed recently?

* ar7.git: Stefan, what's the state and scope of your work? What about TCI?

ar7.git (see http://wiki.qemu.org/User:Stefan_Weil) contains

* mips ar7 emulation (telekom sinus dsl and avm fritz box), working. This was my first qemu application used to debug openwrt ar7 code, and I still run it often.

* tci, working (I'm still looking for new hosts to run tests), disassembler is work in progress (but maybe less important for tci).

* several arm based system emulations (partially collected from qemu-devel, qdev support / bug fixes / updates / enhancements from me)

* new ethernet drivers

Regards,
Stefan

Quoted 23 lines

Apparently abandoned (no recent activity):
* avr32.git
* es40.git (alpha)
* hppa.git
* openrisc.git
* mmix.git

Unclear to me:
* mini2440.git
* qemu-JZ.git

http://wiki.qemu.org/Links

- OpenSolaris support was merged so can be disregarded.

* I heard from François that one of the downstreams has added support for the arm Beagle board? Maemo?

There's also many more forks on gitorious.com and github.com...

Andreas

#17 lore raw

Re: [Qemu-devel] QEMU forks survey

Am 22.12.2010 um 08:47 schrieb Bastien ROUCARIES:

Quoted 9 lines

On Tue, Dec 21, 2010 at 7:28 PM, Andreas Färber <[email protected]

Quoted 5 lines

wrote:
Since Christmas and the New Year with its good intensions are approaching, apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

They are also the gold plateform aka the android qemu port (see a previous thread)

Thanks. I'd like to document all these on wiki.qemu.org in some form. Unfortunately the site failed to email me a new password, so that'll have to wait another 24h...

Andreas

#18 lore raw

Re: [Qemu-devel] QEMU forks survey

Quoted 9 lines · Andreas Färber

Am 22.12.2010 um 08:47 schrieb Bastien ROUCARIES:

Quoted 7 lines
Quoted 5 lines · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching,
apart from z80 there's some more feature forks around:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

http://repo.or.cz/w/qemu.git/forks?o=age

They are also the gold plateform aka the android qemu port (see a previous thread)

Thanks. I'd like to document all these on wiki.qemu.org in some form. Unfortunately the site failed to email me a new password, so that'll have to wait another 24h...

Any news ?

Bastien

#19 lore raw

Re: [Qemu-devel] QEMU forks survey

Am 26.12.2010 um 23:19 schrieb Bastien ROUCARIES:

Quoted 14 lines

On Wed, Dec 22, 2010 at 4:28 PM, Andreas Färber <[email protected]

Quoted 13 lines

wrote:
Am 22.12.2010 um 08:47 schrieb Bastien ROUCARIES:

Quoted 10 lines

On Tue, Dec 21, 2010 at 7:28 PM, Andreas Färber <[email protected]

Quoted 1 line
Quoted 6 lines · wrote:

Since Christmas and the New Year with its good intensions are approaching,
apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

They are also the gold plateform aka the android qemu port (see a previous thread)

Thanks. I'd like to document all these on wiki.qemu.org in some form. Unfortunately the site failed to email me a new password, so that'll have to wait another 24h...

Any news ?

No luck on my side, and Anthony seems to be on holiday.
But it's a Wiki. :) Feel free to add to the feature pages, with pointers to the repositories where they're available.

Andreas

#20 lore raw

Re: [Qemu-devel] QEMU forks survey

Am 27.12.2010 00:44, schrieb Andreas Färber:

Quoted 21 lines

Am 26.12.2010 um 23:19 schrieb Bastien ROUCARIES:

Quoted 19 lines · Andreas Färber
Quoted 17 lines

Am 22.12.2010 um 08:47 schrieb Bastien ROUCARIES:

Quoted 11 lines
Quoted 6 lines · Andreas Färber

Since Christmas and the New Year with its good intensions are approaching,
apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

They are also the gold plateform aka the android qemu port (see a previous thread)

Thanks. I'd like to document all these on wiki.qemu.org in some form. Unfortunately the site failed to email me a new password, so that'll have to wait another 24h...

Quoted 6 lines
Quoted 1 line

Any news ?

No luck on my side, and Anthony seems to be on holiday.
But it's a Wiki. :) Feel free to add to the feature pages, with pointers to the repositories where they're available.

Andreas

There are already some links here:

http://wiki.qemu.org/Links#Alternate_QEMU_repositories

Regards,
Stefan

#21 lore raw

Re: [Qemu-devel] QEMU forks survey

Am 27.12.2010 um 09:08 schrieb Stefan Weil:

Quoted 29 lines

Am 27.12.2010 00:44, schrieb Andreas Färber:

Quoted 28 lines

Am 26.12.2010 um 23:19 schrieb Bastien ROUCARIES:

Quoted 14 lines

On Wed, Dec 22, 2010 at 4:28 PM, Andreas Färber <[email protected]

Quoted 13 lines

wrote:
Am 22.12.2010 um 08:47 schrieb Bastien ROUCARIES:

Quoted 10 lines

On Tue, Dec 21, 2010 at 7:28 PM, Andreas Färber <[email protected]

Quoted 1 line
Quoted 6 lines · wrote:

Since Christmas and the New Year with its good intensions are approaching,
apart from z80 there's some more feature forks around:

http://repo.or.cz/w/qemu.git/forks?o=age

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

They are also the gold plateform aka the android qemu port (see a previous thread)

Thanks. I'd like to document all these on wiki.qemu.org in some form. Unfortunately the site failed to email me a new password, so that'll have to wait another 24h...

Any news ?

No luck on my side, and Anthony seems to be on holiday.
But it's a Wiki. :) Feel free to add to the feature pages, with pointers to the repositories where they're available.

Quoted 6 lines
Quoted 1 line

Andreas

There are already some links here:

http://wiki.qemu.org/Links#Alternate_QEMU_repositories

Yes, some, but neither complete nor fully up-to-date, as demonstrated earlier in this thread.

We can either extend that list to include more feature information or add separate feature pages with details. I intended both.

Andreas

#22 lore raw
In reply to Andreas Färber
Quoted 15 lines · Andreas Färber

Am 21.12.2010 um 01:10 schrieb Alexander Graf:

Quoted 13 lines · Andreas Färber
Quoted 11 lines

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 6 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance

Quoted 8 lines
Quoted 3 lines

The general I/O framework is heavily geared towards server and desktop use. The main use case of the Z80 that I'm aware of is the GameBoy. Not sure that one fits in there too well :).

The Spectrum however does fit the desktop case, so it certainly has my blessings.

Knowing the ZX Spectrum only from the attic, I agree that emulating game consoles is not the primary purpose or strength of QEMU. (Although I wouldn't mind if someone wanted to contribute a PS3 machine for Cell B.E. emulation!)

Fwiw mips, arm, m68k, cris, microblaze seem to form a growing third category of QEMU targets though, embedded systems.

Oh, sure. I'd count in embedded systems here too. My main point was that we don't have frameworks to deal with Joysticks, 3D or other stuff real game system emulation would need.

To be honest, maybe creating a library out of the CPU emulation code that projects like MAME could then use might prove more beneficial. I've thought about this for plenty other projects too. GBA emulation could use ARM TCG, Dolphin could use PPC TCG, etc. But none of these actually require our device model - they already have their own.

Alex

#23 lore raw
Quoted 20 lines · Alexander Graf
Quoted 17 lines · Andreas Färber

Am 21.12.2010 um 01:10 schrieb Alexander Graf:

Quoted 15 lines · Andreas Färber
Quoted 11 lines

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 6 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance

The general I/O framework is heavily geared towards server and desktop use. The main use case of the Z80 that I'm aware of is the GameBoy. Not sure that one fits in there too well :).

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

The Spectrum however does fit the desktop case, so it certainly has my blessings.

Knowing the ZX Spectrum only from the attic, I agree that emulating game consoles is not the primary purpose or strength of QEMU. (Although I wouldn't mind if someone wanted to contribute a PS3 machine for Cell B.E. emulation!)

Fwiw mips, arm, m68k, cris, microblaze seem to form a growing third category of QEMU targets though, embedded systems.

Oh, sure. I'd count in embedded systems here too. My main point was that we don't have frameworks to deal with Joysticks, 3D or other stuff real game system emulation would need.

With the emulation of the ancient machine based game platform it is even more complicated: games expect some certain timings from the CPU, graphic and sound cards. So, I'm not sure if TCG can be used for it.

Quoted 7 lines

To be honest, maybe creating a library out of the CPU emulation code that projects like MAME could then use might prove more beneficial. I've thought about this for plenty other projects too. GBA emulation could use ARM TCG, Dolphin could use PPC TCG, etc. But none of these actually require our device model - they already have their own.

Alex

Signature · 4 lines
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/
#24 lore raw
Quoted 26 lines · Artyom Tarasenko
Quoted 25 lines · Alexander Graf
Quoted 22 lines · Andreas Färber

Am 21.12.2010 um 01:10 schrieb Alexander Graf:

Quoted 9 lines · Andreas Färber
Quoted 8 lines

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 5 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

[...] do you think it's a valuable target to have in upstream qemu?

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance

The general I/O framework is heavily geared towards server and desktop use. The main use case of the Z80 that I'm aware of is the GameBoy. Not sure that one fits in there too well :).

The Spectrum however does fit the desktop case, so it certainly has my blessings.

Knowing the ZX Spectrum only from the attic, I agree that emulating game consoles is not the primary purpose or strength of QEMU. (Although I wouldn't mind if someone wanted to contribute a PS3 machine for Cell B.E. emulation!)

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Fwiw mips, arm, m68k, cris, microblaze seem to form a growing third category of QEMU targets though, embedded systems.

Oh, sure. I'd count in embedded systems here too. My main point was that we don't have frameworks to deal with Joysticks, 3D or other stuff real game system emulation would need.

With the emulation of the ancient machine based game platform it is even more complicated: games expect some certain timings from the CPU, graphic and sound cards. So, I'm not sure if TCG can be used for it.

Yup, old ones probably won't work. More recent ones should. Uli actually did create a GBA emulator using TCG a few years back, so it definitely does work for some stuff. I'm fairly sure that the more recent the systems become, the more event driven they also are - which is good for dynamic recompilation.

Either way, those really don't belong inside the Qemu source tree IMHO as development models don't match in general. Instead, a libtcg would be a lot more fitting for those cases.

Alex

#25 lore raw
In reply to Andreas Färber
Quoted 9 lines · Andreas Färber

Am 20.12.2010 um 23:45 schrieb Alexander Graf:

Quoted 6 lines · Stuart Brady
Quoted 3 lines

Here's an update of the Z80 system emulator, which currently emulates the ZX Spectrum only. [...]

[...] do you think it's a valuable target to have in upstream qemu?

Quoted 7 lines

The z80 was also used in the more modern TI-83 Plus programmable calculator [1], for instance (chosen for school use in Baden-Württemberg in the early 2000s). There was an assembler toolchain integrated with Zilog Studio on Windows iirc.
Apparently there's also an open source C compiler toolchain at [2] for these and other targets.
No Linux that I'm aware of. ;)

But there are UZI and UZIX - unix like environments with TCP/IP stack and Bourne Shell.
UZIX requires a MSX2 computer though.

Signature · 4 lines
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/
#26 lore raw
In reply to Alexander Graf
Quoted 2 lines · Alexander Graf

Since this just came up again - are you still working on this? It's be a shame to see this target bitrot to extinction. Also, do you think it's a valuable target to have in upstream qemu? If so, please create a proper patch set out of it, so it can be reviewed.

I've placed a page on the status of this at:

* http://wiki.qemu.org/Features/Z80

There are quite a few items on the TODO list that I feel would need to be one for the target to be suitable for inclusion. In particular, execution from RAM that might be used for video is essential, but I'm not really sure how to deal with that. Also, not implementing flags optimisation would be somewhat silly, really...

I feel that the main emphasis of a Z80 target would be on systems running CP/M, or for CP/M user emulation.

For gaming and similar, most emulators can get by just fine without dynamic translation, and dedicated emulators seem to do a better job anyway (regarding UI, accuracy of emulation, and feature-completeness), so whilst it'd be interesting to see whether dynamic translation could help to reduce power consumption on mobile devices, this would more likely be a matter of integrating TCG into existing emulators.

I won't let the Z80 target bitrot too badly, and do plan to merge back into the fork pretty soon... but there's still quite a bit to do.

Cheers,

Signature · 1 line
Stuart Brady