New machine: Catalyst (PM7200).

This commit is contained in:
Maxim Poliakovski 2022-01-17 13:58:51 +01:00
parent 0df1b2c408
commit 16bf46506a
3 changed files with 122 additions and 1 deletions

View File

@ -0,0 +1,101 @@
/*
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 <https://www.gnu.org/licenses/>.
*/
/** @file Constructs a Catalyst (Power Macintosh 7200) machine. */
#include <cpu/ppc/ppcemu.h>
#include <devices/common/pci/bandit.h>
#include <devices/common/scsi/scsi.h>
#include <devices/ioctrl/macio.h>
#include <devices/memctrl/platinum.h>
#include <devices/video/atimach64gx.h>
#include <loguru.hpp>
#include <machines/machinebase.h>
#include <machines/machineproperties.h>
#include <string>
int create_catalyst(std::string& id)
{
PlatinumCtrl* platinum_obj;
if (gMachineObj) {
LOG_F(ERROR, "Global machine object not empty!");
return -1;
}
LOG_F(INFO, "Initializing the Catalyst hardware...");
// initialize the global machine object
gMachineObj.reset(new MachineBase("Catalyst"));
// add memory controller
gMachineObj->add_component("Platinum", new PlatinumCtrl());
// add the ARBus-to-PCI bridge
gMachineObj->add_component("Bandit1", new Bandit(1, "Bandit-PCI1"));
PCIHost *pci_host = dynamic_cast<PCIHost*>(gMachineObj->get_comp_by_name("Bandit1"));
// start the sound server
gMachineObj->add_component("SoundServer", new SoundServer());
// add the GrandCentral I/O controller
gMachineObj->add_component("GrandCentral", new GrandCentral());
pci_host->pci_register_device(
32, dynamic_cast<PCIDevice*>(gMachineObj->get_comp_by_name("GrandCentral")));
// HACK: attach temporary ATI Mach64 video card
gMachineObj->add_component("AtiMach64", new AtiMach64Gx);
pci_host->pci_register_device(
4, dynamic_cast<PCIDevice*>(gMachineObj->get_comp_by_name("AtiMach64")));
// get (raw) pointer to the memory controller
platinum_obj = dynamic_cast<PlatinumCtrl*>(gMachineObj->get_comp_by_name("Platinum"));
// allocate ROM region
if (!platinum_obj->add_rom_region(0xFFC00000, 0x400000)) {
LOG_F(ERROR, "Could not allocate ROM region!\n");
return -1;
}
// plug 8MB RAM DIMM into slot #0
platinum_obj->insert_ram_dimm(0, Platinum::DRAM_CAP_8MB);
// allocate and map physical RAM
platinum_obj->map_phys_ram();
// add single SCSI bus
gMachineObj->add_component("SCSI0", new ScsiBus);
// init virtual CPU and request MPC601
ppc_cpu_init(platinum_obj, PPC_VER::MPC601, 7833600ULL);
// post-initialize all devices
if (gMachineObj->postinit_devices()) {
LOG_F(ERROR, "Could not post-initialize devices!\n");
return -1;
}
LOG_F(INFO, "Initialization complete.\n");
return 0;
}

View File

@ -69,6 +69,23 @@ static const map<uint32_t, std::tuple<string, const char*>> rom_identity = {
static const vector<string> WriteToggle = {"ON", "on", "OFF", "off"};
static const PropMap CatalystSettings = {
{"rambank1_size",
new IntProperty(16, vector<uint32_t>({4, 8, 16, 32, 64, 128}))},
{"rambank2_size",
new IntProperty( 0, vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank3_size",
new IntProperty( 0, vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank4_size",
new IntProperty( 0, vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"gfxmem_size",
new IntProperty( 1, vector<uint32_t>({1, 2, 4}))},
{"mon_id",
new StrProperty("")},
{"fdd_img",
new StrProperty("")},
};
static const PropMap GossamerSettings = {
{"rambank1_size",
new IntProperty(256, vector<uint32_t>({8, 16, 32, 64, 128, 256}))},
@ -102,7 +119,7 @@ static const PropMap PDMSettings = {
new StrProperty("HiRes12-14in", PDMBuiltinMonitorIDs)},
{"fdd_img",
new StrProperty("")},
{"fdd_wr_prot",
{"fdd_wr_prot",
new StrProperty("OFF", WriteToggle)},
};
@ -110,6 +127,7 @@ static const map<string, string> PropHelp = {
{"rambank1_size", "specifies RAM bank 1 size in MB"},
{"rambank2_size", "specifies RAM bank 2 size in MB"},
{"rambank3_size", "specifies RAM bank 3 size in MB"},
{"rambank4_size", "specifies RAM bank 4 size in MB"},
{"gfxmem_size", "specifies video memory size in MB"},
{"fdd_img", "specifies path to floppy disk image"},
{"fdd_wr_prot", "toggles floppy disks write protection"},
@ -118,6 +136,7 @@ static const map<string, string> PropHelp = {
static const map<string, tuple<PropMap, function<int(string&)>, string>> machines = {
{"pm6100", {PDMSettings, create_pdm, "PowerMacintosh 6100"}},
{"pm7200", {CatalystSettings, create_catalyst, "PowerMacintosh 7200"}},
{"pmg3", {GossamerSettings, create_gossamer, "Power Macintosh G3 (Beige)"}},
};

View File

@ -43,6 +43,7 @@ void list_machines(void);
void list_properties(void);
/* Machine-specific factory functions. */
int create_catalyst(string& id);
int create_gossamer(string& id);
int create_pdm(string& id);