src/emu/cpuexec.c
| r1719 | r1720 | |
| 163 | 163 | |
| 164 | 164 | void cpuexec_init(running_machine *machine) |
| 165 | 165 | { |
| 166 | int numscreens = video_screen_count(machine->config); |
| 166 | 167 | int cpunum; |
| 167 | 168 | |
| 168 | 169 | /* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now |
| 169 | 170 | from the visible area */ |
| 170 | | if (machine->screen[0].vblank == 0 && !machine->screen[0].oldstyle_vblank_supplied) |
| 171 | if (numscreens > 0 && machine->screen[0].vblank == 0 && !machine->screen[0].oldstyle_vblank_supplied) |
| 171 | 172 | machine->screen[0].vblank = (machine->screen[0].refresh / machine->screen[0].height) * (machine->screen[0].height - (machine->screen[0].visarea.max_y + 1 - machine->screen[0].visarea.min_y)); |
| 172 | 173 | |
| 173 | 174 | /* allocate vblank and refresh timers, and compute the initial timing */ |
| r1719 | r1720 | |
| 866 | 867 | |
| 867 | 868 | void cpu_compute_vblank_timing(running_machine *machine) |
| 868 | 869 | { |
| 869 | | refresh_period = attotime_make(0, machine->screen[0].refresh); |
| 870 | int numscreens = video_screen_count(machine->config); |
| 871 | attoseconds_t refresh_attosecs; |
| 870 | 872 | |
| 873 | refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : machine->screen[0].refresh; |
| 874 | refresh_period = attotime_make(0, refresh_attosecs); |
| 875 | |
| 871 | 876 | /* recompute the vblank period */ |
| 872 | | vblank_period = attotime_make(0, machine->screen[0].refresh / (vblank_multiplier ? vblank_multiplier : 1)); |
| 877 | vblank_period = attotime_make(0, refresh_attosecs / (vblank_multiplier ? vblank_multiplier : 1)); |
| 873 | 878 | if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE)) |
| 874 | 879 | { |
| 875 | 880 | attotime remaining = timer_timeleft(vblank_timer); |
| r1719 | r1720 | |
| 1161 | 1166 | |
| 1162 | 1167 | static void cpu_inittimers(running_machine *machine) |
| 1163 | 1168 | { |
| 1169 | int numscreens = video_screen_count(machine->config); |
| 1170 | attoseconds_t refresh_attosecs; |
| 1164 | 1171 | attotime first_time; |
| 1165 | 1172 | int cpunum, max, ipf; |
| 1166 | 1173 | |
| r1719 | r1720 | |
| 1171 | 1178 | ipf = machine->config->cpu_slices_per_frame; |
| 1172 | 1179 | if (ipf <= 0) |
| 1173 | 1180 | ipf = 1; |
| 1174 | | timeslice_period = attotime_make(0, machine->screen[0].refresh / ipf); |
| 1181 | refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : machine->screen[0].refresh; |
| 1182 | timeslice_period = attotime_make(0, refresh_attosecs / ipf); |
| 1175 | 1183 | timeslice_timer = timer_alloc(cpu_timeslicecallback, NULL); |
| 1176 | 1184 | timer_adjust_periodic(timeslice_timer, timeslice_period, 0, timeslice_period); |
| 1177 | 1185 | |
| r1719 | r1720 | |
| 1220 | 1228 | } |
| 1221 | 1229 | |
| 1222 | 1230 | /* allocate a vblank timer at the frame rate * the LCD number of interrupts per frame */ |
| 1223 | | vblank_period = attotime_make(0, machine->screen[0].refresh / vblank_multiplier); |
| 1231 | vblank_period = attotime_make(0, refresh_attosecs / vblank_multiplier); |
| 1224 | 1232 | vblank_countdown = vblank_multiplier; |
| 1225 | 1233 | |
| 1226 | 1234 | /* allocate an update timer that will be used to time the actual screen updates */ |