diff --git a/.gitattributes b/.gitattributes index d070aff1099..40b389e1f0c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7539,6 +7539,8 @@ src/mess/video/pc_t1t.h svneol=native#text/plain src/mess/video/pcw.c svneol=native#text/plain src/mess/video/pcw16.c svneol=native#text/plain src/mess/video/pdp1.c svneol=native#text/plain +src/mess/video/pds30_cb264.c svneol=native#text/plain +src/mess/video/pds30_cb264.h svneol=native#text/plain src/mess/video/pecom.c svneol=native#text/plain src/mess/video/pet.c svneol=native#text/plain src/mess/video/pk8020.c svneol=native#text/plain diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index dec4324691b..7a67f8be3b9 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -69,6 +69,7 @@ #include "video/nubus_wsportrait.h" #include "machine/nubus_asntmc3b.h" #include "video/nubus_m2video.h" +#include "video/pds30_cb264.h" #include "includes/mac.h" #include "mac.lh" @@ -664,6 +665,7 @@ static ADDRESS_MAP_START(macse30_map, AS_PROGRAM, 32, mac_state ) AM_RANGE(0x50040000, 0x50041fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffff) AM_MIRROR(0x00f00000) // mirror AM_RANGE(0xfe000000, 0xfe00ffff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xfee00000, 0xfee0ffff) AM_RAM AM_SHARE("vram") AM_MIRROR(0x000f0000) AM_RANGE(0xfeffe000, 0xfeffffff) AM_ROM AM_REGION("se30vrom", 0x0) ADDRESS_MAP_END @@ -857,6 +859,10 @@ static SLOT_INTERFACE_START(mac_nubus_cards) SLOT_INTERFACE("enetnb", NUBUS_APPLEENET) /* Apple NuBus Ethernet */ SLOT_INTERFACE_END +static SLOT_INTERFACE_START(mac_pds030_cards) + SLOT_INTERFACE("cb264", PDS030_CB264SE30) +SLOT_INTERFACE_END + /*************************************************************************** MACHINE DRIVERS ***************************************************************************/ @@ -1285,6 +1291,9 @@ static MACHINE_CONFIG_START( macse30, mac_state ) MCFG_SCSIDEV_ADD("scsi:harddisk2", SCSIHD, SCSI_ID_5) MCFG_NCR5380_ADD("scsi:ncr5380", C7M, macplus_5380intf) + MCFG_NUBUS_BUS_ADD("pds", "maincpu", nubus_intf) + MCFG_NUBUS_SLOT_ADD("pds","pds030", mac_pds030_cards, NULL, NULL) + MCFG_SWIM_ADD("fdc", mac_iwm_interface) MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(mac_floppy_interface) diff --git a/src/mess/machine/nubus.c b/src/mess/machine/nubus.c index 5a36775e20a..72744f41dd7 100644 --- a/src/mess/machine/nubus.c +++ b/src/mess/machine/nubus.c @@ -297,17 +297,28 @@ void device_nubus_card_interface::static_set_nubus_tag(device_t &device, const c void device_nubus_card_interface::set_nubus_device() { - // extract the slot number from the last digit of the slot tag - int tlen = strlen(m_nubus_slottag); + 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_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) { diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index 0d416f4e547..aaf0b6d9665 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -114,6 +114,7 @@ UINT32 mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bit int y, x, b; video_base = m_screen_buffer ? 0x8000 : 0; + video_base += (MAC_H_VIS/8); video_ram = (const UINT16 *) &m_vram[video_base/4]; for (y = 0; y < MAC_V_VIS; y++) diff --git a/src/mess/video/pds30_cb264.c b/src/mess/video/pds30_cb264.c new file mode 100644 index 00000000000..2554e964e9a --- /dev/null +++ b/src/mess/video/pds30_cb264.c @@ -0,0 +1,326 @@ +/*************************************************************************** + + RasterOps ColorBoard 264/SE30 video card emulation + +***************************************************************************/ + +#include "emu.h" +#include "video/pds30_cb264.h" + +#define CB264SE30_SCREEN_NAME "cb264_screen" +#define CB264SE30_ROM_REGION "cb264_rom" + +#define VRAM_SIZE (0x200000) + +MACHINE_CONFIG_FRAGMENT( cb264se30 ) + MCFG_SCREEN_ADD( CB264SE30_SCREEN_NAME, RASTER) + MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_cb264se30_device, screen_update) + MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) + MCFG_SCREEN_SIZE(1024,768) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) +MACHINE_CONFIG_END + +ROM_START( cb264se30 ) + ROM_REGION(0x8000, CB264SE30_ROM_REGION, 0) + ROM_LOAD( "0002-2019_10-02-90.bin", 0x000000, 0x008000, CRC(5b5b2fab) SHA1(0584deb38b402718f2abef456b0035b34fddb473) ) // EPROM label "264/30 V1.3 0002-2019 10/02/90" +ROM_END + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type PDS030_CB264SE30 = &device_creator; + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor nubus_cb264se30_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cb264se30 ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *nubus_cb264se30_device::device_rom_region() const +{ + return ROM_NAME( cb264se30 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// nubus_cb264se30_device - constructor +//------------------------------------------------- + +nubus_cb264se30_device::nubus_cb264se30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, PDS030_CB264SE30, "RasterOps Colorboard 264/SE30", tag, owner, clock), + device_nubus_card_interface(mconfig, *this) +{ + m_shortname = "pd3_c264"; +} + +nubus_cb264se30_device::nubus_cb264se30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, type, name, tag, owner, clock), + device_nubus_card_interface(mconfig, *this) +{ + m_shortname = "pd3_c264"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nubus_cb264se30_device::device_start() +{ + UINT32 slotspace; + + // set_nubus_device makes m_slot valid + set_nubus_device(); + install_declaration_rom(this, CB264SE30_ROM_REGION); + + slotspace = get_slotspace(); + +// printf("[cb264se30 %p] slotspace = %x\n", this, slotspace); + + m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); + m_vram32 = (UINT32 *)m_vram; + + m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_cb264se30_device::vram_r), this), write32_delegate(FUNC(nubus_cb264se30_device::vram_w), this)); + m_nubus->install_device(slotspace+0xf00000, slotspace+0xfeffff, read32_delegate(FUNC(nubus_cb264se30_device::cb264se30_r), this), write32_delegate(FUNC(nubus_cb264se30_device::cb264se30_w), this)); + + m_timer = timer_alloc(0, NULL); + m_screen = NULL; // can we look this up now? +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void nubus_cb264se30_device::device_reset() +{ + m_count = 0; + m_clutoffs = 0; + m_vbl_disable = 1; + m_mode = 4; + memset(m_vram, 0, VRAM_SIZE); + memset(m_palette, 0, sizeof(m_palette)); + + m_palette[0] = MAKE_RGB(255, 255, 255); + m_palette[0x80] = MAKE_RGB(0, 0, 0); +} + + +void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + if (!m_vbl_disable) + { + raise_slot_irq(); + } + + m_timer->adjust(m_screen->time_until_pos(479, 0), 0); +} + +/*************************************************************************** + + CB264 section + +***************************************************************************/ + +UINT32 nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT32 *scanline; + int x, y; + UINT8 pixels, *vram; + + // first time? kick off the VBL timer + if (!m_screen) + { + m_screen = &screen; + m_timer->adjust(m_screen->time_until_pos(479, 0), 0); + } + + vram = m_vram + (8*1024); + + switch (m_mode) + { + case 0: // 1 bpp? + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 640/8; x++) + { + pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[(pixels&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)]; + } + } + break; + + case 1: // 2 bpp + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 640/4; x++) + { + pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[(pixels&0xc0)]; + *scanline++ = m_palette[((pixels<<2)&0xc0)]; + *scanline++ = m_palette[((pixels<<4)&0xc0)]; + *scanline++ = m_palette[((pixels<<6)&0xc0)]; + } + } + break; + + case 2: // 4 bpp + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < 640/2; x++) + { + pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[(pixels&0xf0)]; + *scanline++ = m_palette[((pixels&0x0f)<<4)]; + } + } + break; + + case 3: // 8 bpp + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + + for (x = 0; x < 640; x++) + { + pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_palette[pixels]; + } + } + break; + + case 4: // 24 bpp + { + UINT32 *vram32 = (UINT32 *)m_vram; + UINT32 *base; + + for (y = 0; y < 480; y++) + { + scanline = &bitmap.pix32(y); + base = &vram32[y * 1024]; + for (x = 0; x < 640; x++) + { + *scanline++ = *base++; + } + } + } + break; + + default: + fatalerror("cb264se30: unknown video mode %d\n", m_mode); + break; + } + return 0; +} + +WRITE32_MEMBER( nubus_cb264se30_device::cb264se30_w ) +{ + switch (offset) + { + case 0x38003: // mode +// if (data != 0x08000000) printf("%08x to mode\n", data); + switch (data & 0xff000000) + { + case 0x38000000: + m_mode = 0; + break; + + case 0x39000000: + m_mode = 1; + break; + + case 0x3a000000: + m_mode = 2; + break; + + case 0x3b000000: + m_mode = 3; + break; + + case 0x3f000000: + m_mode = 4; + break; + } + break; + + case 0x38000: + if (mem_mask == 0xff000000) + { + // printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc()); + m_clutoffs = (data>>24)&0xff; + } + else if (mem_mask == 0x0000ff00) + { + m_colors[m_count++] = (data>>8) & 0xff; + + if (m_count == 3) + { +// printf("RAMDAC: color %02x = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); + m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); + m_clutoffs++; + if (m_clutoffs > 255) + { + m_clutoffs = 0; + } + m_count = 0; + } + } + break; + + case 0x2c017: // VBL control + if (data & 0x06000000) + { + m_vbl_disable = 0; + lower_slot_irq(); + } + else + { + m_vbl_disable = 1; + } + break; + + default: +// printf("cb264se30_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); + break; + } +} + +READ32_MEMBER( nubus_cb264se30_device::cb264se30_r ) +{ + return 0; +} + +WRITE32_MEMBER( nubus_cb264se30_device::vram_w ) +{ + COMBINE_DATA(&m_vram32[offset]); +} + +READ32_MEMBER( nubus_cb264se30_device::vram_r ) +{ + return m_vram32[offset]; +} diff --git a/src/mess/video/pds30_cb264.h b/src/mess/video/pds30_cb264.h new file mode 100644 index 00000000000..a9cd62017ba --- /dev/null +++ b/src/mess/video/pds30_cb264.h @@ -0,0 +1,53 @@ +#pragma once + +#ifndef __NUBUS_CB264SE30_H__ +#define __NUBUS_CB264SE30_H__ + +#include "emu.h" +#include "machine/nubus.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> nubus_cb264se30_device + +class nubus_cb264se30_device : + public device_t, + public device_nubus_card_interface +{ +public: + // construction/destruction + nubus_cb264se30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + nubus_cb264se30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + DECLARE_READ32_MEMBER(cb264se30_r); + DECLARE_WRITE32_MEMBER(cb264se30_w); + DECLARE_READ32_MEMBER(vram_r); + DECLARE_WRITE32_MEMBER(vram_w); + +public: + UINT8 *m_vram; + UINT32 *m_vram32; + UINT32 m_mode, m_vbl_disable, m_toggle; + UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs; + screen_device *m_screen; + emu_timer *m_timer; +}; + + +// device type definition +extern const device_type PDS030_CB264SE30; + +#endif /* __NUBUS_CB264SE30_H__ */