Mercurial > repos > blastem
comparison blastcpm.c @ 1931:374a5ae694e8 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 18 Apr 2020 11:42:53 -0700 |
parents | 0a26f3657295 |
children |
comparison
equal
deleted
inserted
replaced
1843:13abdc98379e | 1931:374a5ae694e8 |
---|---|
3 #include <stddef.h> | 3 #include <stddef.h> |
4 #include <string.h> | 4 #include <string.h> |
5 #include <time.h> | 5 #include <time.h> |
6 #include <sys/select.h> | 6 #include <sys/select.h> |
7 | 7 |
8 #ifdef USE_NATIVE | 8 #ifndef NEW_CORE |
9 #include "z80_to_x86.h" | 9 #include "z80_to_x86.h" |
10 #else | 10 #else |
11 #include "z80.h" | 11 #include "z80.h" |
12 #endif | 12 #endif |
13 #include "util.h" | 13 #include "util.h" |
17 #define START_OFF 0x100 | 17 #define START_OFF 0x100 |
18 #define OS_START 0xE400 | 18 #define OS_START 0xE400 |
19 #define OS_RESET 0xE403 | 19 #define OS_RESET 0xE403 |
20 int headless = 1; | 20 int headless = 1; |
21 | 21 |
22 #ifdef USE_NATIVE | 22 #ifndef NEW_CORE |
23 void z80_next_int_pulse(z80_context * context) | 23 void z80_next_int_pulse(z80_context * context) |
24 { | 24 { |
25 context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER; | 25 context->int_pulse_start = context->int_pulse_end = CYCLE_NEVER; |
26 } | 26 } |
27 #endif | 27 #endif |
66 uint64_t total_cycles; | 66 uint64_t total_cycles; |
67 void *exit_write(uint32_t address, void *context, uint8_t value) | 67 void *exit_write(uint32_t address, void *context, uint8_t value) |
68 { | 68 { |
69 time_t duration = time(NULL) - start; | 69 time_t duration = time(NULL) - start; |
70 z80_context *z80 = context; | 70 z80_context *z80 = context; |
71 #ifdef USE_NATIVE | 71 #ifndef NEW_CORE |
72 total_cycles += context->current_cycle; | 72 total_cycles += context->current_cycle; |
73 #else | 73 #else |
74 total_cycles += z80->cycles; | 74 total_cycles += z80->cycles; |
75 #endif | 75 #endif |
76 printf("Effective clock speed: %f MHz\n", ((double)total_cycles) / (1000000.0 * duration)); | 76 printf("Effective clock speed: %f MHz\n", ((double)total_cycles) / (1000000.0 * duration)); |
122 context = init_z80_context(&opts); | 122 context = init_z80_context(&opts); |
123 start = time(NULL); | 123 start = time(NULL); |
124 for(;;) | 124 for(;;) |
125 { | 125 { |
126 z80_run(context, 1000000); | 126 z80_run(context, 1000000); |
127 #ifdef USE_NATIVE | 127 #ifndef NEW_CORE |
128 total_cycles += context->current_cycle; | 128 total_cycles += context->current_cycle; |
129 context->current_cycle = 0; | 129 context->current_cycle = 0; |
130 #else | 130 #else |
131 total_cycles += context->cycles; | 131 total_cycles += context->cycles; |
132 context->cycles = 0; | 132 context->cycles = 0; |