diff --git a/machines/machinepippin.cpp b/machines/machinepippin.cpp new file mode 100644 index 0000000..25ed92b --- /dev/null +++ b/machines/machinepippin.cpp @@ -0,0 +1,87 @@ +/* +DingusPPC - The Experimental PowerPC Macintosh emulator +Copyright (C) 2018-24 divingkatae and maximum + (theweirdo) spatium + +(Contact divingkatae#1017 or powermax#2286 on Discord for more info) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +/** @file Bandai/Atmark Pippin emulation. */ + +#include +#include +#include +#include +#include +#include +#include + +int initialize_pippin(std::string& id) { + LOG_F(INFO, "Building machine Pippin..."); + + PCIHost *pci_host = dynamic_cast(gMachineObj->get_comp_by_name("AspenPci1")); + + // connect GrandCentral I/O controller to the PCI1 bus + pci_host->pci_register_device(DEV_FUN(0x10,0), + dynamic_cast(gMachineObj->get_comp_by_name("GrandCentral"))); + + // get (raw) pointer to the memory controller + AspenCtrl* aspen_obj = dynamic_cast(gMachineObj->get_comp_by_name("Aspen")); + + // allocate ROM region + if (!aspen_obj->add_rom_region(0xFFC00000, 0x400000)) { + LOG_F(ERROR, "Could not allocate ROM region!"); + return -1; + } + + // configure RAM + aspen_obj->insert_ram_dimm(0, GET_INT_PROP("rambank1_size")); // soldered onboard RAM + aspen_obj->insert_ram_dimm(1, GET_INT_PROP("rambank2_size")); // soldered onboard RAM + aspen_obj->insert_ram_dimm(2, GET_INT_PROP("rambank3_size")); // RAM expansion slot + aspen_obj->insert_ram_dimm(3, GET_INT_PROP("rambank4_size")); // RAM expansion slot + + // init virtual CPU + ppc_cpu_init(aspen_obj, PPC_VER::MPC603, 16500000ULL); + + return 0; +} + +static const PropMap Pippin_Settings = { + {"rambank1_size", + new IntProperty(4, vector({4}))}, // fixed size + {"rambank2_size", + new IntProperty(1, vector({1}))}, // fixed size + {"rambank3_size", + new IntProperty(0, vector({0, 1, 4, 8, 16}))}, + {"rambank4_size", + new IntProperty(0, vector({0, 1, 4, 8, 16}))}, + {"emmo", + new BinProperty(0)}, +}; + +static vector Pippin_Devices = { + "Aspen", "AspenPci1", "ScsiMesh", "MeshTnt", "GrandCentral" +}; + +static const MachineDescription Pippin_Descriptor = { + .name = "pippin", + .description = "Bandai Pippin", + .devices = Pippin_Devices, + .settings = Pippin_Settings, + .init_func = &initialize_pippin +}; + +REGISTER_MACHINE(pippin, Pippin_Descriptor);