comparison blastem.c @ 338:5c34a9c39394

Re-enable frame limit, but add a command line flag to disable it
author Mike Pavone <pavone@retrodev.com>
date Wed, 15 May 2013 22:37:25 -0700
parents 87b65e5ce1ab
children 58a085cfc6bd
comparison
equal deleted inserted replaced
337:f8c6f8684cd6 338:5c34a9c39394
25 io_port gamepad_1; 25 io_port gamepad_1;
26 io_port gamepad_2; 26 io_port gamepad_2;
27 27
28 int headless = 0; 28 int headless = 0;
29 int z80_enabled = 1; 29 int z80_enabled = 1;
30 int frame_limit = 1;
30 31
31 #ifndef MIN 32 #ifndef MIN
32 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 33 #define MIN(a,b) ((a) < (b) ? (a) : (b))
33 #endif 34 #endif
34 35
195 ym_run(gen->ym, context->current_cycle); 196 ym_run(gen->ym, context->current_cycle);
196 gen->ym->current_cycle -= MCLKS_PER_FRAME/MCLKS_PER_68K; 197 gen->ym->current_cycle -= MCLKS_PER_FRAME/MCLKS_PER_68K;
197 //printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, mclks); 198 //printf("reached frame end | 68K Cycles: %d, MCLK Cycles: %d\n", context->current_cycle, mclks);
198 vdp_run_context(v_context, MCLKS_PER_FRAME); 199 vdp_run_context(v_context, MCLKS_PER_FRAME);
199 if (!headless) { 200 if (!headless) {
200 break_on_sync |= wait_render_frame(v_context); 201 break_on_sync |= wait_render_frame(v_context, frame_limit);
201 } 202 }
202 frame++; 203 frame++;
203 mclks -= MCLKS_PER_FRAME; 204 mclks -= MCLKS_PER_FRAME;
204 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME); 205 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME);
205 io_adjust_cycles(&gamepad_1, context->current_cycle, MCLKS_PER_FRAME/MCLKS_PER_68K); 206 io_adjust_cycles(&gamepad_1, context->current_cycle, MCLKS_PER_FRAME/MCLKS_PER_68K);
240 while (vdp_data_port_write(v_context, value) < 0) { 241 while (vdp_data_port_write(v_context, value) < 0) {
241 while(v_context->flags & FLAG_DMA_RUN) { 242 while(v_context->flags & FLAG_DMA_RUN) {
242 vdp_run_dma_done(v_context, MCLKS_PER_FRAME); 243 vdp_run_dma_done(v_context, MCLKS_PER_FRAME);
243 if (v_context->cycles >= MCLKS_PER_FRAME) { 244 if (v_context->cycles >= MCLKS_PER_FRAME) {
244 if (!headless) { 245 if (!headless) {
245 wait_render_frame(v_context); 246 wait_render_frame(v_context, frame_limit);
246 } 247 }
247 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME); 248 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME);
248 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K); 249 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K);
249 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K); 250 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K);
250 } 251 }
257 while (blocked) { 258 while (blocked) {
258 while(v_context->flags & FLAG_DMA_RUN) { 259 while(v_context->flags & FLAG_DMA_RUN) {
259 vdp_run_dma_done(v_context, MCLKS_PER_FRAME); 260 vdp_run_dma_done(v_context, MCLKS_PER_FRAME);
260 if (v_context->cycles >= MCLKS_PER_FRAME) { 261 if (v_context->cycles >= MCLKS_PER_FRAME) {
261 if (!headless) { 262 if (!headless) {
262 wait_render_frame(v_context); 263 wait_render_frame(v_context, frame_limit);
263 } 264 }
264 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME); 265 vdp_adjust_cycles(v_context, MCLKS_PER_FRAME);
265 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K); 266 io_adjust_cycles(&gamepad_1, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K);
266 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K); 267 io_adjust_cycles(&gamepad_2, v_context->cycles/MCLKS_PER_68K, MCLKS_PER_FRAME/MCLKS_PER_68K);
267 } 268 }
1040 if (argv[i][0] == '-') { 1041 if (argv[i][0] == '-') {
1041 switch(argv[i][1]) { 1042 switch(argv[i][1]) {
1042 case 'd': 1043 case 'd':
1043 debug = 1; 1044 debug = 1;
1044 break; 1045 break;
1046 case 'f':
1047 frame_limit = 0;
1048 break;
1045 case 'l': 1049 case 'l':
1046 address_log = fopen("address.log", "w"); 1050 address_log = fopen("address.log", "w");
1047 break; 1051 break;
1048 case 'v': 1052 case 'v':
1049 headless = 1; 1053 headless = 1;