tangled
alpha
login
or
join now
jcs.org
/
pce
0
fork
atom
fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork
atom
overview
issues
pulls
pipelines
cpm80: Simplify emulator speed setting
Hampa Hug
5 years ago
da487e0e
8e645c2a
+29
-19
2 changed files
expand all
collapse all
unified
split
src
arch
cpm80
cpm80.c
msg.c
+4
-18
src/arch/cpm80/cpm80.c
reviewed
···
3
3
*****************************************************************************/
4
4
5
5
/*****************************************************************************
6
6
-
* File name: src/arch/sim8080/sim8080.c *
6
6
+
* File name: src/arch/cpm80/cpm80.c *
7
7
* Created: 2012-11-28 by Hampa Hug <hampa@hampa.ch> *
8
8
-
* Copyright: (C) 2012-2020 Hampa Hug <hampa@hampa.ch> *
8
8
+
* Copyright: (C) 2012-2021 Hampa Hug <hampa@hampa.ch> *
9
9
*****************************************************************************/
10
10
11
11
/*****************************************************************************
···
174
174
if (ini_get_uint32 (sct, "clock", &clock, 0)) {
175
175
ini_get_uint16 (sct, "speed", &speed, 1);
176
176
177
177
-
if (speed <= 4) {
178
178
-
clock = 1000000UL * speed;
179
179
-
}
180
180
-
else {
181
181
-
clock = 8000000UL * (speed - 4);
182
182
-
}
177
177
+
clock = 1000000UL * speed;
183
178
184
179
sim->speed = speed;
185
180
}
···
476
471
477
472
void c80_set_speed (cpm80_t *sim, unsigned speed)
478
473
{
479
479
-
unsigned long clk;
480
480
-
481
474
sim->speed = speed;
482
475
483
483
-
if (speed <= 4) {
484
484
-
clk = 1000000UL * speed;
485
485
-
}
486
486
-
else {
487
487
-
clk = 8000000UL * (speed - 4);
488
488
-
}
489
489
-
490
490
-
c80_set_clock (sim, clk);
476
476
+
c80_set_clock (sim, 1000000UL * speed);
491
477
}
492
478
493
479
static
+25
-1
src/arch/cpm80/msg.c
reviewed
···
5
5
/*****************************************************************************
6
6
* File name: src/arch/cpm80/msg.c *
7
7
* Created: 2012-11-30 by Hampa Hug <hampa@hampa.ch> *
8
8
-
* Copyright: (C) 2012-2020 Hampa Hug <hampa@hampa.ch> *
8
8
+
* Copyright: (C) 2012-2021 Hampa Hug <hampa@hampa.ch> *
9
9
*****************************************************************************/
10
10
11
11
/*****************************************************************************
···
105
105
return (1);
106
106
}
107
107
108
108
+
if (v > 4) {
109
109
+
v = 8 * (v - 4);
110
110
+
}
111
111
+
108
112
c80_set_speed (sim, v);
113
113
+
114
114
+
return (0);
115
115
+
}
116
116
+
117
117
+
static
118
118
+
int c80_set_msg_emu_cpu_speed_double (cpm80_t *sim, const char *msg, const char *val)
119
119
+
{
120
120
+
c80_set_speed (sim, 2 * sim->speed);
121
121
+
122
122
+
return (0);
123
123
+
}
124
124
+
125
125
+
static
126
126
+
int c80_set_msg_emu_cpu_speed_half (cpm80_t *sim, const char *msg, const char *val)
127
127
+
{
128
128
+
if (sim->speed > 1) {
129
129
+
c80_set_speed (sim, sim->speed / 2);
130
130
+
}
109
131
110
132
return (0);
111
133
}
···
252
274
{ "emu.con.write", c80_set_msg_emu_con_write },
253
275
{ "emu.cpu.model", c80_set_msg_emu_cpu_model },
254
276
{ "emu.cpu.speed", c80_set_msg_emu_cpu_speed },
277
277
+
{ "emu.cpu.speed.double", c80_set_msg_emu_cpu_speed_double },
278
278
+
{ "emu.cpu.speed.half", c80_set_msg_emu_cpu_speed_half },
255
279
{ "emu.cpu.speed.step", c80_set_msg_emu_cpu_speed_step },
256
280
{ "emu.disk.commit", c80_set_msg_emu_disk_commit },
257
281
{ "emu.disk.eject", c80_set_msg_emu_disk_eject },