diff --git a/devices/ioctrl/grandcentral.cpp b/devices/ioctrl/grandcentral.cpp index cfad725..03e8b21 100644 --- a/devices/ioctrl/grandcentral.cpp +++ b/devices/ioctrl/grandcentral.cpp @@ -107,7 +107,7 @@ GrandCentral::GrandCentral() : PCIDevice("mac-io/grandcentral"), InterruptCtrl() this->escc->set_dma_channel(3, this->escc_b_rx_dma.get()); // connect MESH (internal SCSI) - this->mesh = dynamic_cast(gMachineObj->get_comp_by_name("MeshTnt")); + this->mesh = dynamic_cast(gMachineObj->get_comp_by_name_optional("MeshTnt")); if (this->mesh == nullptr) { LOG_F(WARNING, "%s: Mesh not found, using MeshStub instead", this->name.c_str()); this->mesh_stub = std::unique_ptr(new MeshStub()); @@ -185,7 +185,10 @@ uint32_t GrandCentral::read(uint32_t rgn_start, uint32_t offset, int size) case 7: // VIA-CUDA return this->viacuda->read((offset >> 9) & 0xF); case 8: // MESH SCSI - return this->mesh->read((offset >> 4) & 0xF); + if (this->mesh) + return this->mesh->read((offset >> 4) & 0xF); + else if (this->mesh_stub) + return this->mesh_stub->read((offset >> 4) & 0xF); case 9: // ENET-ROM return ENET_ROM[(offset >> 4) & 0x7]; case 0xA: // IOBus device #1 ; Board register 1 and bandit1 PRSNT bits @@ -232,7 +235,11 @@ uint32_t GrandCentral::read(uint32_t rgn_start, uint32_t offset, int size) //LOG_F(WARNING, "%s: Unsupported DMA channel DMA_AUDIO_IN read @%02x.%c", this->name.c_str(), offset & 0xFF, SIZE_ARG(size)); return 0; // this->snd_in_dma->reg_read(offset & 0xFF, size); case MIO_GC_DMA_SCSI_MESH: - return this->mesh_dma->reg_read(offset & 0xFF, size); + if (this->mesh_dma) { + return this->mesh_dma->reg_read(offset & 0xFF, size); + break; + } + // fallthrough default: LOG_F(WARNING, "%s: unimplemented DMA register at 0x%X", this->name.c_str(), this->base_addr + offset); @@ -289,7 +296,10 @@ void GrandCentral::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in this->viacuda->write((offset >> 9) & 0xF, value); break; case 8: // MESH SCSI - this->mesh->write((offset >> 4) & 0xF, value); + if (this->mesh) + this->mesh->write((offset >> 4) & 0xF, value); + else if (this->mesh_stub) + this->mesh_stub->write((offset >> 4) & 0xF, value); break; case 0xA: // IOBus device #1 ; Board register 1 and bandit1 PRSNT bits case 0xB: // IOBus device #2 ; RaDACal/DACula @@ -348,8 +358,11 @@ void GrandCentral::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in //this->snd_in_dma->reg_write(offset & 0xFF, value, size); break; case MIO_GC_DMA_SCSI_MESH: - this->mesh_dma->reg_write(offset & 0xFF, value, size); - break; + if (this->mesh_dma) { + this->mesh_dma->reg_write(offset & 0xFF, value, size); + break; + } + // fallthrough default: LOG_F(WARNING, "%s: unimplemented DMA register at 0x%X", this->name.c_str(), this->base_addr + offset); diff --git a/devices/ioctrl/macio.h b/devices/ioctrl/macio.h index ffd494d..f2a9a95 100644 --- a/devices/ioctrl/macio.h +++ b/devices/ioctrl/macio.h @@ -183,7 +183,7 @@ private: Swim3::Swim3Ctrl* swim3; // floppy disk controller std::unique_ptr curio_dma; - std::unique_ptr mesh_dma; + std::unique_ptr mesh_dma = nullptr; std::unique_ptr snd_out_dma; std::unique_ptr snd_in_dma; std::unique_ptr floppy_dma; diff --git a/machines/machinetnt.cpp b/machines/machinetnt.cpp index 287d57e..eff4d53 100644 --- a/machines/machinetnt.cpp +++ b/machines/machinetnt.cpp @@ -61,11 +61,11 @@ int initialize_tnt(std::string& id) // attach IOBus Device #1 0xF301A000 gMachineObj->add_device("BoardReg1", std::unique_ptr( new BoardRegister("Board Register 1", - 0x3F | // pull up all PRSNT bits - ((GET_BIN_PROP("emmo") ^ 1) << 8) | // factory tests (active low) - ((GET_BIN_PROP("has_sixty6") ^ 1) << 13) | // composite video out (active low) - (GET_BIN_PROP("has_mesh") << 14) | // fast SCSI (active high) - 0x8000U // pull up unused bits + 0x3F | // pull up all PRSNT bits + ((GET_BIN_PROP("emmo") ^ 1) << 8) | // factory tests (active low) + ((gMachineObj->get_comp_by_name_optional("Sixty6Video") == nullptr) << 13) | // composite video out (active low) + ((gMachineObj->get_comp_by_name_optional("MeshTnt") != nullptr) << 14) | // fast SCSI (active high) + 0x8000U // pull up unused bits ))); gc_obj->attach_iodevice(0, dynamic_cast(gMachineObj->get_comp_by_name("BoardReg1"))); @@ -131,10 +131,6 @@ static const PropMap pm7500_settings = { new IntProperty( 0, vector({0, 4, 8, 16, 32, 64, 128}))}, {"emmo", new BinProperty(0)}, - {"has_sixty6", - new BinProperty(0)}, - {"has_mesh", - new BinProperty(1)}, {"cpu", new StrProperty( cpu == PPC_VER::MPC601 ? "601" : @@ -144,7 +140,7 @@ static const PropMap pm7500_settings = { }; static vector pm7500_devices = { - "Hammerhead", "Bandit1", "Chaos", "ScsiMesh", "MeshTnt", "GrandCentral", "ControlVideo", "Sixty6Video" + "Hammerhead", "Bandit1", "Chaos", "ScsiMesh", "MeshTnt", "GrandCentral", "ControlVideo" }; static const MachineDescription pm7300_descriptor = {