bus/nubus: Minor SuperMac Spectrum improvements:

* Made the Spectrum/8 firmware selectable as a card BIOS option.
* Added a palette device for the Spectrum/8 so it can be seen in the
  graphics viewer.
* Initialise enough members of the Spectrum PDQ device class to not hang
  a debug build.
* Got the code of the Spectrum/8 and Spectrum PDQ more in line with each
  other.
This commit is contained in:
Vas Crabb 2022-06-20 10:11:56 +10:00
parent f2b3d06845
commit a050403f63
4 changed files with 75 additions and 53 deletions

View File

@ -43,9 +43,13 @@
ROM_START( spec8s3 )
ROM_DEFAULT_BIOS("ver13")
ROM_SYSTEM_BIOS( 0, "ver12", "Ver. 1.2 (1990)" )
ROM_SYSTEM_BIOS( 1, "ver13", "Ver. 1.3 (1993)" )
ROM_REGION(0x8000, SPEC8S3_ROM_REGION, 0)
ROM_LOAD( "1003067-0001d.11b.bin", 0x000000, 0x008000, CRC(12188e2b) SHA1(6552d40364eae99b449842a79843d8c0114c4c70) ) // "1003067-0001D Spec/8 Ser III // Ver. 1.2 (C)Copyright 1990 // SuperMac Technology // All Rights Reserved" 27c256 @11B
ROM_LOAD( "1003067-0001e.11b.bin", 0x000000, 0x008000, CRC(39fab193) SHA1(124c9847bf07733d131c977c4395cfbbb6470973) ) // "1003067-0001E Spec/8 Ser III // Ver. 1.3 (C)Copyright 1993 // SuperMac Technology // All Rights Reserved" NMC27C256Q @11B
ROMX_LOAD( "1003067-0001d.11b.bin", 0x000000, 0x008000, CRC(12188e2b) SHA1(6552d40364eae99b449842a79843d8c0114c4c70), ROM_BIOS(0) ) // "1003067-0001D Spec/8 Ser III // Ver. 1.2 (C)Copyright 1990 // SuperMac Technology // All Rights Reserved" 27c256 @11B
ROMX_LOAD( "1003067-0001e.11b.bin", 0x000000, 0x008000, CRC(39fab193) SHA1(124c9847bf07733d131c977c4395cfbbb6470973), ROM_BIOS(1) ) // "1003067-0001E Spec/8 Ser III // Ver. 1.3 (C)Copyright 1993 // SuperMac Technology // All Rights Reserved" NMC27C256Q @11B
ROM_END
//**************************************************************************
@ -75,6 +79,8 @@ void nubus_spec8s3_device::device_add_mconfig(machine_config &config)
screen_device &screen(SCREEN(config, SPEC8S3_SCREEN_NAME, SCREEN_TYPE_RASTER));
screen.set_screen_update(FUNC(nubus_spec8s3_device::screen_update));
screen.set_raw(64_MHz_XTAL, 332*4, 64*4, 320*4, 804, 33, 801);
PALETTE(config, m_palette).set_entries(256);
}
//-------------------------------------------------
@ -103,6 +109,7 @@ nubus_spec8s3_device::nubus_spec8s3_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
m_palette(*this, "palette"),
m_timer(nullptr),
m_mode(0), m_vbl_disable(0),
m_count(0), m_clutoffs(0),
@ -119,7 +126,7 @@ void nubus_spec8s3_device::device_start()
{
install_declaration_rom(SPEC8S3_ROM_REGION);
const uint32_t slotspace = get_slotspace();
uint32_t const slotspace = get_slotspace();
LOG("[SPEC8S3 %p] slotspace = %x\n", this, slotspace);
m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
@ -132,7 +139,7 @@ void nubus_spec8s3_device::device_start()
save_item(NAME(m_vram));
save_item(NAME(m_mode));
save_item(NAME(m_vbl_disable));
save_item(NAME(m_palette));
save_item(NAME(m_palette_val));
save_item(NAME(m_colors));
save_item(NAME(m_count));
save_item(NAME(m_clutoffs));
@ -158,7 +165,7 @@ void nubus_spec8s3_device::device_reset()
std::fill(m_vram.begin(), m_vram.end(), 0);
m_mode = 0;
m_vbl_disable = 1;
std::fill(std::begin(m_palette), std::end(m_palette), rgb_t(0));
std::fill(std::begin(m_palette_val), std::end(m_palette_val), 0);
std::fill(std::begin(m_colors), std::end(m_colors), 0);
m_count = 0;
m_clutoffs = 0;
@ -174,8 +181,8 @@ void nubus_spec8s3_device::device_reset()
m_vbl_pending = false;
m_parameter = 0;
m_palette[0] = rgb_t(255, 255, 255);
m_palette[1] = rgb_t(0, 0, 0);
m_palette_val[0] = rgb_t(255, 255, 255);
m_palette_val[1] = rgb_t(0, 0, 0);
update_crtc();
}
@ -270,14 +277,14 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
{
uint8_t const pixels = vram8[((y - vstart) * 512) + x];
*scanline++ = m_palette[(pixels << 0) & 0x80];
*scanline++ = m_palette[(pixels << 1) & 0x80];
*scanline++ = m_palette[(pixels << 2) & 0x80];
*scanline++ = m_palette[(pixels << 3) & 0x80];
*scanline++ = m_palette[(pixels << 4) & 0x80];
*scanline++ = m_palette[(pixels << 5) & 0x80];
*scanline++ = m_palette[(pixels << 6) & 0x80];
*scanline++ = m_palette[(pixels << 7) & 0x80];
*scanline++ = m_palette_val[(pixels << 0) & 0x80];
*scanline++ = m_palette_val[(pixels << 1) & 0x80];
*scanline++ = m_palette_val[(pixels << 2) & 0x80];
*scanline++ = m_palette_val[(pixels << 3) & 0x80];
*scanline++ = m_palette_val[(pixels << 4) & 0x80];
*scanline++ = m_palette_val[(pixels << 5) & 0x80];
*scanline++ = m_palette_val[(pixels << 6) & 0x80];
*scanline++ = m_palette_val[(pixels << 7) & 0x80];
}
}
else
@ -297,10 +304,10 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
{
uint8_t const pixels = vram8[((y - vstart) * 512) + x];
*scanline++ = m_palette[(pixels << 0) & 0xc0];
*scanline++ = m_palette[(pixels << 2) & 0xc0];
*scanline++ = m_palette[(pixels << 4) & 0xc0];
*scanline++ = m_palette[(pixels << 6) & 0xc0];
*scanline++ = m_palette_val[(pixels << 0) & 0xc0];
*scanline++ = m_palette_val[(pixels << 2) & 0xc0];
*scanline++ = m_palette_val[(pixels << 4) & 0xc0];
*scanline++ = m_palette_val[(pixels << 6) & 0xc0];
}
}
else
@ -320,8 +327,8 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
{
uint8_t const pixels = vram8[((y - vstart) * 512) + x];
*scanline++ = m_palette[(pixels << 0) & 0xf0];
*scanline++ = m_palette[(pixels << 4) & 0xf0];
*scanline++ = m_palette_val[(pixels << 0) & 0xf0];
*scanline++ = m_palette_val[(pixels << 4) & 0xf0];
}
}
else
@ -340,7 +347,7 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32
for (int x = 0; x < width; x++)
{
uint8_t const pixels = vram8[((y - vstart) * 1024) + x];
*scanline++ = m_palette[pixels];
*scanline++ = m_palette_val[pixels];
}
}
else
@ -448,7 +455,8 @@ void nubus_spec8s3_device::spec8s3_w(offs_t offset, uint32_t data, uint32_t mem_
const int actual_color = bitswap<8>(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
LOG("RAMDAC: color %d = %02x %02x %02x %s\n", actual_color, m_colors[0], m_colors[1], m_colors[2], machine().describe_context());
m_palette[actual_color] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_palette->set_pen_color(actual_color, rgb_t(m_colors[0], m_colors[1], m_colors[2]));
m_palette_val[actual_color] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_clutoffs = (m_clutoffs + 1) & 0xff;
m_count = 0;
}

View File

@ -7,12 +7,13 @@
#include "nubus.h"
#include "emupal.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> nubus_spec8s3_device
class nubus_spec8s3_device :
public device_t,
public device_video_interface,
@ -47,11 +48,13 @@ private:
static void crtc_w(int16_t &param, uint32_t offset, uint32_t data);
required_device<palette_device> m_palette;
emu_timer *m_timer;
std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable;
uint32_t m_palette[256], m_colors[3], m_count, m_clutoffs;
uint32_t m_palette_val[256], m_colors[3], m_count, m_clutoffs;
int16_t m_hsync, m_hstart, m_hend, m_htotal;
int16_t m_vsync, m_vstart, m_vend, m_vtotal;

View File

@ -29,17 +29,18 @@
#include "nubus_specpdq.h"
#include "screen.h"
#include <algorithm>
//#define VERBOSE 1
#include "logmacro.h"
#include <algorithm>
#define SPECPDQ_SCREEN_NAME "specpdq_screen"
#define SPECPDQ_ROM_REGION "specpdq_rom"
#define VRAM_SIZE (0x400000)
ROM_START( specpdq )
ROM_REGION(0x10000, SPECPDQ_ROM_REGION, 0)
ROM_LOAD( "specpdq.bin", 0x000000, 0x010000, CRC(82a35f78) SHA1(9511c2df47140f4279196d3b8836b53429879dd9) )
@ -93,9 +94,11 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device
device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
m_mode(0), m_vbl_disable(0), m_count(0), m_clutoffs(0), m_timer(nullptr),
m_width(0), m_height(0), m_patofsx(0), m_patofsy(0), m_vram_addr(0), m_vram_src(0),
m_palette(*this, "palette")
m_palette(*this, "palette"),
m_timer(nullptr),
m_mode(0), m_vbl_disable(0),
m_count(0), m_clutoffs(0),
m_width(0), m_height(0), m_patofsx(0), m_patofsy(0), m_vram_addr(0), m_vram_src(0)
{
set_screen(*this, SPECPDQ_SCREEN_NAME);
}
@ -106,13 +109,10 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device
void nubus_specpdq_device::device_start()
{
uint32_t slotspace;
install_declaration_rom(SPECPDQ_ROM_REGION);
slotspace = get_slotspace();
// logerror("[specpdq %p] slotspace = %x\n", this, slotspace);
uint32_t const slotspace = get_slotspace();
LOG("[specpdq %p] slotspace = %x\n", this, slotspace);
m_vram.resize(VRAM_SIZE / sizeof(uint32_t));
nubus().install_device(slotspace, slotspace+VRAM_SIZE-1, read32s_delegate(*this, FUNC(nubus_specpdq_device::vram_r)), write32s_delegate(*this, FUNC(nubus_specpdq_device::vram_w)));
@ -128,12 +128,21 @@ void nubus_specpdq_device::device_start()
void nubus_specpdq_device::device_reset()
{
std::fill(m_vram.begin(), m_vram.end(), 0);
m_mode = 0;
m_vbl_disable = 1;
std::fill(std::begin(m_palette_val), std::end(m_palette_val), 0);
std::fill(std::begin(m_colors), std::end(m_colors), 0);
m_count = 0;
m_clutoffs = 0;
m_vbl_disable = 1;
m_mode = 0;
std::fill(m_vram.begin(), m_vram.end(), 0);
memset(m_palette_val, 0, sizeof(m_palette_val));
std::fill(std::begin(m_7xxxxx_regs), std::end(m_7xxxxx_regs), 0);
m_width = 0;
m_height = 0;
m_patofsx = 0;
m_patofsy = 0;
m_vram_addr = 0;
m_vram_src = 0;
m_palette_val[0] = rgb_t(255, 255, 255);
m_palette_val[0x80] = rgb_t(0, 0, 0);
@ -264,10 +273,14 @@ void nubus_specpdq_device::specpdq_w(offs_t offset, uint32_t data, uint32_t mem_
switch (data)
{
case 0xff7fffff:
case 0xffffffff:
m_mode = 0;
break;
case 0xff7fffff:
m_mode = 1;
break;
case 0xfeffffff:
m_mode = 2;
break;
@ -282,22 +295,18 @@ void nubus_specpdq_device::specpdq_w(offs_t offset, uint32_t data, uint32_t mem_
case 0x120000: // DAC address
LOG("%08x to DAC control %s\n", data,machine().describe_context());
m_clutoffs = ((data>>8)&0xff)^0xff;
m_clutoffs = ((data >> 8) & 0xff) ^ 0xff;
break;
case 0x120001: // DAC data
m_colors[m_count++] = ((data>>8)&0xff)^0xff;
m_colors[m_count++] = ((data >> 8) & 0xff) ^ 0xff;
if (m_count == 3)
{
LOG("RAMDAC: color %d = %02x %02x %02x %s\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], machine().describe_context());
m_palette->set_pen_color(m_clutoffs, rgb_t(m_colors[0], m_colors[1], m_colors[2]));
m_palette_val[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_clutoffs++;
if (m_clutoffs > 255)
{
m_clutoffs = 0;
}
m_clutoffs = (m_clutoffs + 1) & 0xff;
m_count = 0;
}
break;

View File

@ -6,14 +6,14 @@
#pragma once
#include "nubus.h"
#include "emupal.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> nubus_specpdq_device
class nubus_specpdq_device :
public device_t,
public device_video_interface,
@ -44,16 +44,18 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<palette_device> m_palette;
emu_timer *m_timer;
std::vector<uint32_t> m_vram;
uint32_t m_mode, m_vbl_disable;
uint32_t m_palette_val[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
uint32_t m_7xxxxx_regs[0x100000/4];
int m_width, m_height, m_patofsx, m_patofsy;
uint32_t m_width, m_height, m_patofsx, m_patofsy;
uint32_t m_vram_addr, m_vram_src;
uint8_t m_fillbytes[256];
required_device<palette_device> m_palette;
};