fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation

cpm80: Simplify emulator speed setting

+29 -19
+4 -18
src/arch/cpm80/cpm80.c
··· 3 3 *****************************************************************************/ 4 4 5 5 /***************************************************************************** 6 - * File name: src/arch/sim8080/sim8080.c * 6 + * File name: src/arch/cpm80/cpm80.c * 7 7 * Created: 2012-11-28 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2020 Hampa Hug <hampa@hampa.ch> * 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 - if (speed <= 4) { 178 - clock = 1000000UL * speed; 179 - } 180 - else { 181 - clock = 8000000UL * (speed - 4); 182 - } 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 - unsigned long clk; 480 - 481 474 sim->speed = speed; 482 475 483 - if (speed <= 4) { 484 - clk = 1000000UL * speed; 485 - } 486 - else { 487 - clk = 8000000UL * (speed - 4); 488 - } 489 - 490 - c80_set_clock (sim, clk); 476 + c80_set_clock (sim, 1000000UL * speed); 491 477 } 492 478 493 479 static
+25 -1
src/arch/cpm80/msg.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/arch/cpm80/msg.c * 7 7 * Created: 2012-11-30 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2020 Hampa Hug <hampa@hampa.ch> * 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 + if (v > 4) { 109 + v = 8 * (v - 4); 110 + } 111 + 108 112 c80_set_speed (sim, v); 113 + 114 + return (0); 115 + } 116 + 117 + static 118 + int c80_set_msg_emu_cpu_speed_double (cpm80_t *sim, const char *msg, const char *val) 119 + { 120 + c80_set_speed (sim, 2 * sim->speed); 121 + 122 + return (0); 123 + } 124 + 125 + static 126 + int c80_set_msg_emu_cpu_speed_half (cpm80_t *sim, const char *msg, const char *val) 127 + { 128 + if (sim->speed > 1) { 129 + c80_set_speed (sim, sim->speed / 2); 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 + { "emu.cpu.speed.double", c80_set_msg_emu_cpu_speed_double }, 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 },