void nubus_quadralink_device::device_start() { uint32_t slotspace; install_declaration_rom(this, QUADRALINK_ROM_REGION); slotspace = get_slotspace(); nubus().install_device(slotspace, slotspace+0xefffff, read32_delegate(FUNC(nubus_quadralink_device::dev_r), this), write32_delegate(FUNC(nubus_quadralink_device::dev_w), this)); }
void nubus_xceed30hr_device::device_start() { uint32_t slotspace; install_declaration_rom(this, XCEED30HR_ROM_REGION); slotspace = get_slotspace(); // printf("[xceed30hr %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); m_vram32 = (uint32_t *)&m_vram[0]; nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceed30hr_device::vram_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::vram_w), this)); nubus().install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_w), this)); m_timer = timer_alloc(0, nullptr); m_timer->adjust(screen().time_until_pos(479, 0), 0); }
void nubus_bootbug_device::device_start() { uint32_t slotspace; install_declaration_rom(this, BOOTBUG_ROM_REGION); slotspace = get_slotspace(); nubus().install_device(slotspace, slotspace+0xff, read32_delegate(FUNC(nubus_bootbug_device::dev_r), this), write32_delegate(FUNC(nubus_bootbug_device::dev_w), this)); }
void device_nubus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) { char bank[256]; // append an underscore and the slot name to the bank so it's guaranteed unique strcpy(bank, tag); strcat(bank, "_"); strcat(bank, m_nubus_slottag); nubus().install_bank(start, end, bank, data); }
void nubus_m2video_device::device_start() { uint32_t slotspace; install_declaration_rom(this, M2VIDEO_ROM_REGION, true, true); slotspace = get_slotspace(); // logerror("[m2video %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); m_vram32 = (uint32_t *)&m_vram[0]; nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this)); nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_m2video_device::vram_r), this), write32_delegate(FUNC(nubus_m2video_device::vram_w), this)); nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32_delegate(FUNC(nubus_m2video_device::m2video_r), this), write32_delegate(FUNC(nubus_m2video_device::m2video_w), this)); m_timer = timer_alloc(0, nullptr); m_timer->adjust(screen().time_until_pos(479, 0), 0); }
void nubus_procolor816_device::device_start() { uint32_t slotspace; install_declaration_rom(this, PROCOLOR816_ROM_REGION); slotspace = get_slotspace(); // printf("[procolor816 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); m_vram32 = (uint32_t *)&m_vram[0]; nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this)); nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this)); nubus().install_device(slotspace+0xf00000, slotspace+0xff7fff, read32_delegate(FUNC(nubus_procolor816_device::procolor816_r), this), write32_delegate(FUNC(nubus_procolor816_device::procolor816_w), this)); m_timer = timer_alloc(0, nullptr); m_timer->adjust(screen().time_until_pos(479, 0), 0); }
void nubus_lview_device::device_start() { uint32_t slotspace; install_declaration_rom(this, LVIEW_ROM_REGION); slotspace = get_slotspace(); // printf("[lview %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); m_vram32 = (uint32_t *)&m_vram[0]; nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); nubus().install_device(slotspace+0xb0000, slotspace+0xbffff, read32_delegate(FUNC(nubus_lview_device::lview_r), this), write32_delegate(FUNC(nubus_lview_device::lview_w), this)); m_timer = timer_alloc(0, nullptr); m_timer->adjust(screen().time_until_pos(599, 0), 0); }
void nubus_radiustpd_device::device_start() { uint32_t slotspace; install_declaration_rom(this, RADIUSTPD_ROM_REGION, true, true); slotspace = get_slotspace(); printf("[radiustpd %p] slotspace = %x\n", (void *)this, slotspace); m_vram.resize(VRAM_SIZE); m_vram32 = (uint32_t *)&m_vram[0]; nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this)); nubus().install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_radiustpd_device::vram_r), this), write32_delegate(FUNC(nubus_radiustpd_device::vram_w), this)); nubus().install_device(slotspace+0x80000, slotspace+0xeffff, read32_delegate(FUNC(nubus_radiustpd_device::radiustpd_r), this), write32_delegate(FUNC(nubus_radiustpd_device::radiustpd_w), this)); nubus().install_device(slotspace+0x980000, slotspace+0x9effff, read32_delegate(FUNC(nubus_radiustpd_device::radiustpd_r), this), write32_delegate(FUNC(nubus_radiustpd_device::radiustpd_w), this)); m_timer = timer_alloc(0, nullptr); m_timer->adjust(screen().time_until_pos(479, 0), 0); }
void device_nubus_card_interface::interface_pre_start() { if (!m_nubus) { if (!strncmp(m_nubus_slottag, "pds030", 6)) { m_slot = 0x9; // '030 PDS slots phantom slot as NuBus slots $9, $A, and $B } else if (!strncmp(m_nubus_slottag, "lcpds", 6)) { m_slot = 0xe; // LC PDS slots phantom slot as NuBus slot $E } else { // extract the slot number from the last digit of the slot tag int tlen = strlen(m_nubus_slottag); if (m_nubus_slottag[tlen-1] == '9') { m_slot = (m_nubus_slottag[tlen-1] - '9') + 9; } else { m_slot = (m_nubus_slottag[tlen-1] - 'a') + 0xa; } } if (m_slot < 9 || m_slot > 0xe) { fatalerror("Slot %x out of range for Apple NuBus\n", m_slot); } device_t *const bus = device().machine().device(m_nubus_tag); if (!bus) { fatalerror("Can't find NuBus device %s\n", m_nubus_tag); } m_nubus = dynamic_cast<nubus_device *>(bus); if (!m_nubus) { fatalerror("Device %s (%s) is not an instance of nubus_device\n", bus->tag(), bus->name()); } nubus().add_nubus_card(this); } }
void device_nubus_card_interface::install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb, bool reverse_rom) { bool inverted = false; uint8_t *rom = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->base(); uint32_t romlen = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->bytes(); // printf("ROM length is %x, last bytes are %02x %02x\n", romlen, rom[romlen-2], rom[romlen-1]); if (reverse_rom) { uint8_t temp; uint32_t endptr = romlen-1; for (uint32_t idx = 0; idx < romlen / 2; idx++) { temp = rom[idx]; rom[idx] = rom[endptr]; rom[endptr] = temp; endptr--; } } uint8_t byteLanes = rom[romlen-1]; // check if all bits are inverted if (rom[romlen-2] == 0xff) { byteLanes ^= 0xff; inverted = true; } #if 0 FILE *f; f = fopen("romout.bin", "wb"); fwrite(rom, romlen, 1, f); fclose(f); #endif switch (byteLanes) { case 0x0f: // easy case: all 4 lanes (still must scramble for 32-bit BE bus though) m_declaration_rom.resize(romlen); for (int i = 0; i < romlen; i++) { m_declaration_rom[BYTE4_XOR_BE(i)] = rom[i]; } break; case 0xe1: // lane 0 only m_declaration_rom.resize(romlen*4); memset(&m_declaration_rom[0], 0, romlen*4); for (int i = 0; i < romlen; i++) { m_declaration_rom[BYTE4_XOR_BE(i*4)] = rom[i]; } romlen *= 4; break; case 0xd2: // lane 1 only m_declaration_rom.resize(romlen*4); memset(&m_declaration_rom[0], 0, romlen*4); for (int i = 0; i < romlen; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+1)] = rom[i]; } romlen *= 4; break; case 0xb4: // lane 2 only m_declaration_rom.resize(romlen*4); memset(&m_declaration_rom[0], 0, romlen*4); for (int i = 0; i < romlen; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[i]; } romlen *= 4; break; case 0x78: // lane 3 only m_declaration_rom.resize(romlen*4); memset(&m_declaration_rom[0], 0, romlen*4); for (int i = 0; i < romlen; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+3)] = rom[i]; } romlen *= 4; break; case 0xc3: // lanes 0, 1 m_declaration_rom.resize(romlen*2); memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)]; m_declaration_rom[BYTE4_XOR_BE((i*4)+1)] = rom[(i*2)+1]; } romlen *= 2; break; case 0xa5: // lanes 0, 2 m_declaration_rom.resize(romlen*2); memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+0)] = rom[(i*2)]; m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)+1]; } romlen *= 2; break; case 0x3c: // lanes 2,3 m_declaration_rom.resize(romlen*2); memset(&m_declaration_rom[0], 0, romlen*2); for (int i = 0; i < romlen/2; i++) { m_declaration_rom[BYTE4_XOR_BE((i*4)+2)] = rom[(i*2)]; m_declaration_rom[BYTE4_XOR_BE((i*4)+3)] = rom[(i*2)+1]; } romlen *= 2; break; default: fatalerror("NuBus: unhandled byteLanes value %02x\n", byteLanes); } // the slot manager can supposedly handle inverted ROMs by itself, but let's do it for it anyway if (inverted) { for (int i = 0; i < romlen; i++) { m_declaration_rom[i] ^= 0xff; } } // now install the ROM uint32_t addr = get_slotspace() + 0x01000000; char bankname[128]; strcpy(bankname, "rom_"); strcat(bankname, m_nubus_slottag); addr -= romlen; // printf("Installing ROM at %x, length %x\n", addr, romlen); if (mirror_all_mb) // mirror the declaration ROM across all 16 megs of the slot space { uint32_t off = 0; while(off < 0x1000000) { nubus().install_bank(addr + off, addr+off+romlen-1, bankname, &m_declaration_rom[0]); off += romlen; } } else { nubus().install_bank(addr, addr+romlen-1, bankname, &m_declaration_rom[0]); } }