summaryrefslogtreecommitdiff
path: root/ztestrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'ztestrun.c')
-rw-r--r--ztestrun.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/ztestrun.c b/ztestrun.c
index e64226a..4a59534 100644
--- a/ztestrun.c
+++ b/ztestrun.c
@@ -4,7 +4,12 @@
BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
*/
#include "z80inst.h"
+#ifdef NEW_CORE
+#include "z80.h"
+#include <string.h>
+#else
#include "z80_to_x86.h"
+#endif
#include "mem.h"
#include "vdp.h"
#include <stdio.h>
@@ -42,10 +47,12 @@ const memmap_chunk port_map[] = {
{ 0x0000, 0x100, 0xFF, 0, 0, 0, NULL, NULL, NULL, z80_unmapped_read, z80_unmapped_write}
};
+#ifndef NEW_CORE
void z80_next_int_pulse(z80_context * context)
{
context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER;
}
+#endif
int main(int argc, char ** argv)
{
@@ -89,6 +96,34 @@ int main(int argc, char ** argv)
exit(1);
}
fclose(f);
+#ifdef NEW_CORE
+ memset(&opts, 0, sizeof(opts));
+ opts.gen.memmap = z80_map;
+ opts.gen.memmap_chunks = 2;
+ opts.gen.address_mask = 0xFFFF;
+ opts.gen.max_address = 0xFFFF;
+ opts.gen.clock_divider = 1;
+ context = calloc(1, sizeof(z80_context));
+ context->opts = &opts;
+ z80_execute(context, 1000);
+ printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\nIX: %X\nIY: %X\nSP: %X\n\nIM: %d, IFF1: %d, IFF2: %d\n",
+ context->main[7], context->main[0], context->main[1],
+ context->main[2], context->main[3],
+ (context->main[4] << 8) | context->main[5],
+ context->ix,
+ context->iy,
+ context->sp, context->imode, context->iff1, context->iff2);
+ printf("Flags: SZYHXVNC\n"
+ " %d%d%d%d%d%d%d%d\n",
+ context->last_flag_result >> 7, context->zflag != 0, context->last_flag_result >> 5 & 1, context->chflags >> 3 & 1,
+ context->last_flag_result >> 3 & 1, context->pvflag != 0, context->nflag, context->chflags >> 7 & 1
+ );
+ puts("--Alternate Regs--");
+ printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n",
+ context->alt[7], context->alt[0], context->alt[1],
+ context->alt[2], context->alt[3],
+ (context->alt[4] << 8) | context->alt[5]);
+#else
init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF);
context = init_z80_context(&opts);
//Z80 RAM
@@ -122,5 +157,6 @@ int main(int argc, char ** argv)
context->alt_regs[Z80_A], context->alt_regs[Z80_B], context->alt_regs[Z80_C],
context->alt_regs[Z80_D], context->alt_regs[Z80_E],
(context->alt_regs[Z80_H] << 8) | context->alt_regs[Z80_L]);
+#endif
return 0;
}