diff --git a/machines/machinecatalyst.cpp b/machines/machinecatalyst.cpp index 7fc6976..99ae9c3 100644 --- a/machines/machinecatalyst.cpp +++ b/machines/machinecatalyst.cpp @@ -76,8 +76,22 @@ int initialize_catalyst(std::string& id) // allocate and map physical RAM platinum_obj->map_phys_ram(); - // init virtual CPU and request MPC601 - ppc_cpu_init(platinum_obj, PPC_VER::MPC601, 7833600ULL); + std::string cpu = GET_STR_PROP("cpu"); + if (cpu == "601") { + // init virtual CPU and request MPC601 + ppc_cpu_init(platinum_obj, PPC_VER::MPC601, 7833600ULL); + } + else if (cpu == "750") { + // configure CPU clocks + uint64_t bus_freq = 50000000ULL; + uint64_t timebase_freq = bus_freq / 4; + + // initialize virtual CPU and request MPC750 CPU aka G3 + ppc_cpu_init(platinum_obj, PPC_VER::MPC750, timebase_freq); + + // set CPU PLL ratio to 3.5 + ppc_state.spr[SPR::HID1] = 0xE << 28; + } return 0; } @@ -93,6 +107,8 @@ static const PropMap pm7200_settings = { new IntProperty( 0, vector({0, 4, 8, 16, 32, 64, 128}))}, {"emmo", new BinProperty(0)}, + {"cpu", + new StrProperty("601", vector({"601", "750"}))}, }; static vector pm7200_devices = { diff --git a/machines/machinefactory.cpp b/machines/machinefactory.cpp index ae1bcbe..3e1ee7d 100644 --- a/machines/machinefactory.cpp +++ b/machines/machinefactory.cpp @@ -97,6 +97,7 @@ static const map PropHelp = { {"vci_F", "insert a VCI device 0x0F"}, {"serial_backend", "specifies the backend for the serial port"}, {"emmo", "enables/disables factory HW tests during startup"}, + {"cpu", "specifies CPU"}, }; bool MachineFactory::add(const string& machine_id, MachineDescription desc) diff --git a/machines/machinetnt.cpp b/machines/machinetnt.cpp index 5fd8ac0..4e78ae1 100644 --- a/machines/machinetnt.cpp +++ b/machines/machinetnt.cpp @@ -99,14 +99,27 @@ int initialize_tnt(std::string& id) memctrl_obj->map_phys_ram(); // init virtual CPU - if (id == "pm7300") + std::string cpu = GET_STR_PROP("cpu"); + if (cpu == "604e") ppc_cpu_init(memctrl_obj, PPC_VER::MPC604E, 12500000ULL); - else + else if (cpu == "601") ppc_cpu_init(memctrl_obj, PPC_VER::MPC601, 7833600ULL); + else if (cpu == "750") { + // configure CPU clocks + uint64_t bus_freq = 50000000ULL; + uint64_t timebase_freq = bus_freq / 4; + + // initialize virtual CPU and request MPC750 CPU aka G3 + ppc_cpu_init(memctrl_obj, PPC_VER::MPC750, timebase_freq); + + // set CPU PLL ratio to 3.5 + ppc_state.spr[SPR::HID1] = 0xE << 28; + } return 0; } +template static const PropMap pm7500_settings = { {"rambank1_size", new IntProperty(16, vector({4, 8, 16, 32, 64, 128}))}, @@ -122,6 +135,12 @@ static const PropMap pm7500_settings = { new BinProperty(0)}, {"has_mesh", new BinProperty(1)}, + {"cpu", + new StrProperty( + cpu == PPC_VER::MPC601 ? "601" : + cpu == PPC_VER::MPC604 ? "604" : + cpu == PPC_VER::MPC604E ? "604e" : + "604e", vector({"601", "604", "604e", "750"}))}, }; static vector pm7500_devices = { @@ -132,7 +151,7 @@ static const MachineDescription pm7300_descriptor = { .name = "pm7300", .description = "Power Macintosh 7300", .devices = pm7500_devices, - .settings = pm7500_settings, + .settings = pm7500_settings, .init_func = &initialize_tnt }; @@ -140,7 +159,7 @@ static const MachineDescription pm7500_descriptor = { .name = "pm7500", .description = "Power Macintosh 7500", .devices = pm7500_devices, - .settings = pm7500_settings, + .settings = pm7500_settings, .init_func = &initialize_tnt };