From fd41cafc4b6b7b66005691f5e993aaaf920ec3fc Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Sun, 7 Aug 2022 15:23:32 +0200 Subject: [PATCH] New machine: Power Macintosh 7500. --- machines/machinetnt.cpp | 105 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 machines/machinetnt.cpp diff --git a/machines/machinetnt.cpp b/machines/machinetnt.cpp new file mode 100644 index 0000000..a6c7a0e --- /dev/null +++ b/machines/machinetnt.cpp @@ -0,0 +1,105 @@ +/* +DingusPPC - The Experimental PowerPC Macintosh emulator +Copyright (C) 2018-22 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 Constructs a TNT (Power Macintosh 7500, 8500 etc) machine. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +int initialize_tnt(std::string& id) +{ + HammerheadCtrl* memctrl_obj; + + PCIHost *pci_host = dynamic_cast(gMachineObj->get_comp_by_name("Bandit1")); + + // connect GrandCentral I/O controller to the PCI1 bus + pci_host->pci_register_device( + 32, dynamic_cast(gMachineObj->get_comp_by_name("GrandCentral"))); + + // get video PCI controller object + PCIHost *vci_host = dynamic_cast(gMachineObj->get_comp_by_name("Chaos")); + + // connect built-in video device to the VCI bus + vci_host->pci_register_device( + 1, dynamic_cast(gMachineObj->get_comp_by_name("ControlVideo"))); + + // get (raw) pointer to the memory controller + memctrl_obj = dynamic_cast(gMachineObj->get_comp_by_name("Hammerhead")); + + // allocate ROM region + if (!memctrl_obj->add_rom_region(0xFFC00000, 0x400000)) { + LOG_F(ERROR, "Could not allocate ROM region!\n"); + return -1; + } + + // plug 8MB RAM DIMM into slot #0 + memctrl_obj->insert_ram_dimm(2, DRAM_CAP_16MB); + + // allocate and map physical RAM + memctrl_obj->map_phys_ram(); + + // add single SCSI bus + gMachineObj->add_device("SCSI0", std::unique_ptr(new ScsiBus())); + + // init virtual CPU and request MPC601 + ppc_cpu_init(memctrl_obj, PPC_VER::MPC601, 7833600ULL); + + return 0; +} + +static const PropMap pm7500_settings = { + {"rambank1_size", + new IntProperty(16, vector({4, 8, 16, 32, 64, 128}))}, + {"rambank2_size", + new IntProperty( 0, vector({0, 4, 8, 16, 32, 64, 128}))}, + {"rambank3_size", + new IntProperty( 0, vector({0, 4, 8, 16, 32, 64, 128}))}, + {"rambank4_size", + new IntProperty( 0, vector({0, 4, 8, 16, 32, 64, 128}))}, + {"gfxmem_size", + new IntProperty( 1, vector({1, 2, 4}))}, + {"emmo", + new BinProperty(0)}, +}; + +static vector pm7500_devices = { + "Hammerhead", "Bandit1", "Chaos", "GrandCentral", "ControlVideo" +}; + +static const MachineDescription pm7500_descriptor = { + .name = "pm7500", + .description = "Power Macintosh 7500", + .devices = pm7500_devices, + .settings = pm7500_settings, + .init_func = &initialize_tnt +}; + +REGISTER_MACHINE(pm7500, pm7500_descriptor);