Mercurial > repos > blastem
comparison ztestrun.c @ 1748:48a43dff4dc0
Added init functions to z80_util.c so new Z80 core is closer to a drop in replacement for the old one
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 07 Feb 2019 09:43:25 -0800 |
parents | 9ab64ef5cba0 |
children | 0a26f3657295 10c7f1e44c47 |
comparison
equal
deleted
inserted
replaced
1747:89ddf41a50bb | 1748:48a43dff4dc0 |
---|---|
94 if (fread(z80_ram, 1, filesize, f) != filesize) { | 94 if (fread(z80_ram, 1, filesize, f) != filesize) { |
95 fprintf(stderr, "error reading %s\n",fname); | 95 fprintf(stderr, "error reading %s\n",fname); |
96 exit(1); | 96 exit(1); |
97 } | 97 } |
98 fclose(f); | 98 fclose(f); |
99 init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF); | |
100 context = init_z80_context(&opts); | |
99 #ifdef NEW_CORE | 101 #ifdef NEW_CORE |
100 memset(&opts, 0, sizeof(opts)); | |
101 opts.gen.memmap = z80_map; | |
102 opts.gen.memmap_chunks = 2; | |
103 opts.gen.address_mask = 0xFFFF; | |
104 opts.gen.max_address = 0xFFFF; | |
105 opts.gen.clock_divider = 1; | |
106 context = calloc(1, sizeof(z80_context)); | |
107 context->opts = &opts; | |
108 z80_execute(context, 1000); | 102 z80_execute(context, 1000); |
109 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", | 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", |
110 context->main[7], context->main[0], context->main[1], | 104 context->main[7], context->main[0], context->main[1], |
111 context->main[2], context->main[3], | 105 context->main[2], context->main[3], |
112 (context->main[4] << 8) | context->main[5], | 106 (context->main[4] << 8) | context->main[5], |
122 printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n", | 116 printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\n", |
123 context->alt[7], context->alt[0], context->alt[1], | 117 context->alt[7], context->alt[0], context->alt[1], |
124 context->alt[2], context->alt[3], | 118 context->alt[2], context->alt[3], |
125 (context->alt[4] << 8) | context->alt[5]); | 119 (context->alt[4] << 8) | context->alt[5]); |
126 #else | 120 #else |
127 init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF); | |
128 context = init_z80_context(&opts); | |
129 //Z80 RAM | 121 //Z80 RAM |
130 context->mem_pointers[0] = z80_ram; | 122 context->mem_pointers[0] = z80_ram; |
131 if (retranslate) { | 123 if (retranslate) { |
132 //run core long enough to translate code | 124 //run core long enough to translate code |
133 z80_run(context, 1); | 125 z80_run(context, 1); |