mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
-sbus: Added preliminary cgthree support. [Ryan Holtz]
This commit is contained in:
parent
4948941213
commit
0c3074d912
@ -3040,6 +3040,8 @@ if (BUSES["SBUS"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/bus/sbus/bwtwo.cpp",
|
||||
MAME_DIR .. "src/devices/bus/sbus/bwtwo.h",
|
||||
MAME_DIR .. "src/devices/bus/sbus/cgthree.cpp",
|
||||
MAME_DIR .. "src/devices/bus/sbus/cgthree.h",
|
||||
MAME_DIR .. "src/devices/bus/sbus/sbus.cpp",
|
||||
MAME_DIR .. "src/devices/bus/sbus/sbus.h",
|
||||
}
|
||||
|
@ -82,13 +82,13 @@ uint32_t sbus_bwtwo_device::screen_update(screen_device &screen, bitmap_rgb32 &b
|
||||
|
||||
READ8_MEMBER(sbus_bwtwo_device::regs_r)
|
||||
{
|
||||
logerror("%s: regs_r (unimplemented): %08x\n", 0x400000 + offset);
|
||||
logerror("%s: regs_r (unimplemented): %08x\n", machine().describe_context(), 0x400000 + offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(sbus_bwtwo_device::regs_w)
|
||||
{
|
||||
logerror("%s: regs_w (unimplemented): %08x = %02x\n", 0x400000 + offset, data);
|
||||
logerror("%s: regs_w (unimplemented): %08x = %02x\n", machine().describe_context(), 0x400000 + offset, data);
|
||||
}
|
||||
|
||||
READ32_MEMBER(sbus_bwtwo_device::vram_r)
|
||||
|
138
src/devices/bus/sbus/cgthree.cpp
Normal file
138
src/devices/bus/sbus/cgthree.cpp
Normal file
@ -0,0 +1,138 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
/***************************************************************************
|
||||
|
||||
Sun cgthree color video controller
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cgthree.h"
|
||||
#include "screen.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(SBUS_CGTHREE, sbus_cgthree_device, "cgthree", "Sun cgthree SBus Video")
|
||||
|
||||
void sbus_cgthree_device::mem_map(address_map &map)
|
||||
{
|
||||
map(0x00000000, 0x01ffffff).rw(FUNC(sbus_cgthree_device::unknown_r), FUNC(sbus_cgthree_device::unknown_w));
|
||||
map(0x00000000, 0x000007ff).r(FUNC(sbus_cgthree_device::rom_r));
|
||||
map(0x007ff800, 0x007ff81f).rw(FUNC(sbus_cgthree_device::regs_r), FUNC(sbus_cgthree_device::regs_w));
|
||||
map(0x00800000, 0x008fd1ff).rw(FUNC(sbus_cgthree_device::vram2_r), FUNC(sbus_cgthree_device::vram2_w));
|
||||
map(0x00bff800, 0x00cfcbff).rw(FUNC(sbus_cgthree_device::vram_r), FUNC(sbus_cgthree_device::vram_w));
|
||||
}
|
||||
|
||||
ROM_START( sbus_cgthree )
|
||||
ROM_REGION32_BE(0x800, "prom", ROMREGION_ERASEFF)
|
||||
ROM_LOAD( "sunw,501-1415.bin", 0x0000, 0x0800, CRC(d1eb6f4d) SHA1(9bef98b2784b6e70167337bb27cd07952b348b5a))
|
||||
ROM_END
|
||||
|
||||
const tiny_rom_entry *sbus_cgthree_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME( sbus_cgthree );
|
||||
}
|
||||
|
||||
void sbus_cgthree_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
screen.set_screen_update(FUNC(sbus_cgthree_device::screen_update));
|
||||
screen.set_size(1152, 900);
|
||||
screen.set_visarea(0, 1152-1, 0, 900-1);
|
||||
screen.set_refresh_hz(72);
|
||||
|
||||
PALETTE(config, m_palette, 256).set_init(DEVICE_SELF, FUNC(sbus_cgthree_device::palette_init));
|
||||
}
|
||||
|
||||
sbus_cgthree_device::sbus_cgthree_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SBUS_CGTHREE, tag, owner, clock)
|
||||
, device_sbus_card_interface(mconfig, *this)
|
||||
, m_rom(*this, "prom")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
{
|
||||
}
|
||||
|
||||
void sbus_cgthree_device::device_start()
|
||||
{
|
||||
m_vram = std::make_unique<uint32_t[]>(0x100000/4);
|
||||
m_vram2 = std::make_unique<uint32_t[]>(0x100000/4);
|
||||
}
|
||||
|
||||
void sbus_cgthree_device::install_device()
|
||||
{
|
||||
m_sbus->install_device(m_base, m_base + 0x1ffffff, *this, &sbus_cgthree_device::mem_map);
|
||||
}
|
||||
|
||||
void sbus_cgthree_device::palette_init(palette_device &palette)
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
const uint8_t reversed = 255 - i;
|
||||
palette.set_pen_color(i, rgb_t(reversed, reversed, reversed));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
uint32_t sbus_cgthree_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
const pen_t *pens = m_palette->pens();
|
||||
uint8_t *vram = (uint8_t *)&m_vram2[0];
|
||||
|
||||
for (int y = 0; y < 900; y++)
|
||||
{
|
||||
uint32_t *scanline = &bitmap.pix32(y);
|
||||
for (int x = 0; x < 1152; x++)
|
||||
{
|
||||
const uint8_t pixel = vram[(y * 1152) + (BYTE4_XOR_BE(x))];
|
||||
*scanline++ = pens[pixel];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
READ32_MEMBER(sbus_cgthree_device::unknown_r)
|
||||
{
|
||||
logerror("%s: unknown_r: %08x & %08x\n", machine().describe_context(), offset << 2, mem_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(sbus_cgthree_device::unknown_w)
|
||||
{
|
||||
logerror("%s: unknown_w: %08x = %08x & %08x\n", machine().describe_context(), offset << 2, data, mem_mask);
|
||||
}
|
||||
|
||||
READ8_MEMBER(sbus_cgthree_device::regs_r)
|
||||
{
|
||||
logerror("%s: regs_r: Unimplemented: %08x\n", machine().describe_context(), 0x7ff800 + offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(sbus_cgthree_device::regs_w)
|
||||
{
|
||||
logerror("%s: regs_w: Unimplemented: %08x = %02x\n", machine().describe_context(), 0x7ff800 + offset, data);
|
||||
}
|
||||
|
||||
READ32_MEMBER(sbus_cgthree_device::rom_r)
|
||||
{
|
||||
return ((uint32_t*)m_rom->base())[offset];
|
||||
}
|
||||
|
||||
READ32_MEMBER(sbus_cgthree_device::vram_r)
|
||||
{
|
||||
return m_vram[offset];
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(sbus_cgthree_device::vram_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram[offset]);
|
||||
}
|
||||
|
||||
READ32_MEMBER(sbus_cgthree_device::vram2_r)
|
||||
{
|
||||
return m_vram2[offset];
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(sbus_cgthree_device::vram2_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram2[offset]);
|
||||
}
|
59
src/devices/bus/sbus/cgthree.h
Normal file
59
src/devices/bus/sbus/cgthree.h
Normal file
@ -0,0 +1,59 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
/***************************************************************************
|
||||
|
||||
Sun cgthree color video controller
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_SBUS_CGTHREE_H
|
||||
#define MAME_BUS_SBUS_CGTHREE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sbus.h"
|
||||
#include "emupal.h"
|
||||
|
||||
class sbus_cgthree_device : public device_t, public device_sbus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sbus_cgthree_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_sbus_slot_interface overrides
|
||||
virtual void install_device() override;
|
||||
|
||||
void palette_init(palette_device &palette);
|
||||
|
||||
DECLARE_READ32_MEMBER(unknown_r);
|
||||
DECLARE_WRITE32_MEMBER(unknown_w);
|
||||
DECLARE_READ8_MEMBER(regs_r);
|
||||
DECLARE_WRITE8_MEMBER(regs_w);
|
||||
DECLARE_READ32_MEMBER(rom_r);
|
||||
DECLARE_READ32_MEMBER(vram_r);
|
||||
DECLARE_WRITE32_MEMBER(vram_w);
|
||||
DECLARE_READ32_MEMBER(vram2_r);
|
||||
DECLARE_WRITE32_MEMBER(vram2_w);
|
||||
|
||||
private:
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void mem_map(address_map &map) override;
|
||||
|
||||
required_memory_region m_rom;
|
||||
std::unique_ptr<uint32_t[]> m_vram;
|
||||
std::unique_ptr<uint32_t[]> m_vram2; // ???
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(SBUS_CGTHREE, sbus_cgthree_device)
|
||||
|
||||
#endif // MAME_BUS_SBUS_CGTHREE_H
|
@ -7,8 +7,15 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "bwtwo.h"
|
||||
#include "cgthree.h"
|
||||
#include "sbus.h"
|
||||
|
||||
void sbus_cards(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("bwtwo", SBUS_BWTWO); /* Sun bwtwo monochrome display board */
|
||||
device.option_add("cgthree", SBUS_CGTHREE); /* Sun cgthree color display board */
|
||||
}
|
||||
|
||||
DEFINE_DEVICE_TYPE(SBUS_SLOT, sbus_slot_device, "sbus_slot", "Sun SBus Slot")
|
||||
|
||||
@ -194,4 +201,4 @@ void device_sbus_card_interface::set_sbus(sbus_device *sbus, const char *slottag
|
||||
{
|
||||
m_sbus = sbus;
|
||||
m_sbus_slottag = slottag;
|
||||
}
|
||||
}
|
||||
|
@ -155,4 +155,6 @@ protected:
|
||||
uint32_t m_base;
|
||||
};
|
||||
|
||||
void sbus_cards(device_slot_interface &device);
|
||||
|
||||
#endif // MAME_BUS_SBUS_SBUS_H
|
||||
|
@ -2134,11 +2134,6 @@ MACHINE_CONFIG_START(sun4_state::sun4c)
|
||||
MCFG_SLOT_OPTION_MACHINE_CONFIG("ncr53c90a", [this] (device_t *device) { ncr53c90a(device); })
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static void sbus_cards(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("bwtwo", SBUS_BWTWO); /* Sun bwtwo monochrome display board */
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_START(sun4_state::sun4_40)
|
||||
sun4c(config);
|
||||
|
||||
@ -2276,8 +2271,6 @@ ROM_START( sun4_300 )
|
||||
ROM_LOAD32_BYTE( "1038-09.rom", 0x00002, 0x10000, CRC(1e429d31) SHA1(498ce4d34a74ea6e3e369bb7eb9c2b87e12bd080))
|
||||
|
||||
ROM_REGION( 0x10000, "devices", ROMREGION_ERASEFF )
|
||||
// CG3 Color frame buffer (cgthree)
|
||||
ROM_LOAD( "sunw,501-1415.bin", 0x0000, 0x0800, CRC(d1eb6f4d) SHA1(9bef98b2784b6e70167337bb27cd07952b348b5a))
|
||||
|
||||
// TurboGX 8-Bit Color Frame Buffer
|
||||
ROM_LOAD( "sunw,501-2325.bin", 0x1000, 0x8000, CRC(bbdc45f8) SHA1(e4a51d78e199cd57f2fcb9d45b25dfae2bd537e4))
|
||||
|
Loading…
Reference in New Issue
Block a user