Mercurial > repos > blastem
comparison ztestrun.c @ 1769:8fe162bdb038 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 01 Mar 2019 14:17:29 -0800 |
parents | 48a43dff4dc0 |
children | 0a26f3657295 10c7f1e44c47 |
comparison
equal
deleted
inserted
replaced
1768:63256371046f | 1769:8fe162bdb038 |
---|---|
2 Copyright 2013 Michael Pavone | 2 Copyright 2013 Michael Pavone |
3 This file is part of BlastEm. | 3 This file is part of BlastEm. |
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. | 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. |
5 */ | 5 */ |
6 #include "z80inst.h" | 6 #include "z80inst.h" |
7 #ifdef NEW_CORE | |
8 #include "z80.h" | |
9 #include <string.h> | |
10 #else | |
7 #include "z80_to_x86.h" | 11 #include "z80_to_x86.h" |
12 #endif | |
8 #include "mem.h" | 13 #include "mem.h" |
9 #include "vdp.h" | 14 #include "vdp.h" |
10 #include <stdio.h> | 15 #include <stdio.h> |
11 #include <stdlib.h> | 16 #include <stdlib.h> |
12 #include <stddef.h> | 17 #include <stddef.h> |
40 | 45 |
41 const memmap_chunk port_map[] = { | 46 const memmap_chunk port_map[] = { |
42 { 0x0000, 0x100, 0xFF, 0, 0, 0, NULL, NULL, NULL, z80_unmapped_read, z80_unmapped_write} | 47 { 0x0000, 0x100, 0xFF, 0, 0, 0, NULL, NULL, NULL, z80_unmapped_read, z80_unmapped_write} |
43 }; | 48 }; |
44 | 49 |
50 #ifndef NEW_CORE | |
45 void z80_next_int_pulse(z80_context * context) | 51 void z80_next_int_pulse(z80_context * context) |
46 { | 52 { |
47 context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER; | 53 context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER; |
48 } | 54 } |
55 #endif | |
49 | 56 |
50 int main(int argc, char ** argv) | 57 int main(int argc, char ** argv) |
51 { | 58 { |
52 long filesize; | 59 long filesize; |
53 uint8_t *filebuf; | 60 uint8_t *filebuf; |
89 exit(1); | 96 exit(1); |
90 } | 97 } |
91 fclose(f); | 98 fclose(f); |
92 init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF); | 99 init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF); |
93 context = init_z80_context(&opts); | 100 context = init_z80_context(&opts); |
101 #ifdef NEW_CORE | |
102 z80_execute(context, 1000); | |
103 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", | |
104 context->main[7], context->main[0], context->main[1], | |
105 context->main[2], context->main[3], | |
106 (context->main[4] << 8) | context->main[5], | |
107 context->ix, | |
108 context->iy, | |
109 context->sp, context->imode, context->iff1, context->iff2); | |
110 printf("Flags: SZYHXVNC\n" | |
111 " %d%d%d%d%d%d%d%d\n", | |
112 context->last_flag_result >> 7, context->zflag != 0, context->last_flag_result >> 5 & 1, context->chflags >> 3 & 1, | |
113 context->last_flag_result >> 3 & 1, context->pvflag != 0, context->nflag != 0, context->chflags >> 7 & 1 | |
114 ); | |
115 puts("--Alternate Regs--"); | |
116 printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n", | |
117 context->alt[7], context->alt[0], context->alt[1], | |
118 context->alt[2], context->alt[3], | |
119 (context->alt[4] << 8) | context->alt[5]); | |
120 #else | |
94 //Z80 RAM | 121 //Z80 RAM |
95 context->mem_pointers[0] = z80_ram; | 122 context->mem_pointers[0] = z80_ram; |
96 if (retranslate) { | 123 if (retranslate) { |
97 //run core long enough to translate code | 124 //run core long enough to translate code |
98 z80_run(context, 1); | 125 z80_run(context, 1); |
120 puts("--Alternate Regs--"); | 147 puts("--Alternate Regs--"); |
121 printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n", | 148 printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n", |
122 context->alt_regs[Z80_A], context->alt_regs[Z80_B], context->alt_regs[Z80_C], | 149 context->alt_regs[Z80_A], context->alt_regs[Z80_B], context->alt_regs[Z80_C], |
123 context->alt_regs[Z80_D], context->alt_regs[Z80_E], | 150 context->alt_regs[Z80_D], context->alt_regs[Z80_E], |
124 (context->alt_regs[Z80_H] << 8) | context->alt_regs[Z80_L]); | 151 (context->alt_regs[Z80_H] << 8) | context->alt_regs[Z80_L]); |
152 #endif | |
125 return 0; | 153 return 0; |
126 } | 154 } |