blob: e01cb528ebfa2d09efc3c75ef577a77a58400150 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*********************************************************************
pc_turbo.c
The PC "turbo" button
**********************************************************************/
#include "emu.h"
#include "pc_turbo.h"
struct pc_turbo_info
{
device_t *cpu;
const char *port;
int mask;
int cur_val;
double off_speed;
double on_speed;
};
static TIMER_CALLBACK(pc_turbo_callback)
{
struct pc_turbo_info *ti = (struct pc_turbo_info *) ptr;
int val;
val = machine.root_device().ioport(ti->port)->read() & ti->mask;
if (val != ti->cur_val)
{
ti->cur_val = val;
ti->cpu->set_clock_scale(val ? ti->on_speed : ti->off_speed);
}
}
int pc_turbo_setup(running_machine &machine, device_t *cpu, const char *port, int mask, double off_speed, double on_speed)
{
struct pc_turbo_info *ti;
ti = auto_alloc(machine, struct pc_turbo_info);
ti->cpu = cpu;
ti->port = port;
ti->mask = mask;
ti->cur_val = -1;
ti->off_speed = off_speed;
ti->on_speed = on_speed;
machine.scheduler().timer_pulse(attotime::from_msec(100), FUNC(pc_turbo_callback), 0, ti);
return 0;
}
|