diff --git a/.gitattributes b/.gitattributes index b50df7e3856..1abe2b164d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7549,6 +7549,8 @@ src/mess/machine/macadb.c svneol=native#text/plain src/mess/machine/mackbd.c svneol=native#text/plain src/mess/machine/mackbd.h svneol=native#text/plain src/mess/machine/macpci.c svneol=native#text/plain +src/mess/machine/macpds.c svneol=native#text/plain +src/mess/machine/macpds.h svneol=native#text/plain src/mess/machine/macrtc.c svneol=native#text/plain src/mess/machine/macrtc.h svneol=native#text/plain src/mess/machine/mb8795.c svneol=native#text/plain @@ -8339,6 +8341,8 @@ src/mess/video/pds30_procolor816.c svneol=native#text/plain src/mess/video/pds30_procolor816.h svneol=native#text/plain src/mess/video/pds30_sigmalview.c svneol=native#text/plain src/mess/video/pds30_sigmalview.h svneol=native#text/plain +src/mess/video/pds_tpdfpd.c svneol=native#text/plain +src/mess/video/pds_tpdfpd.h svneol=native#text/plain src/mess/video/pecom.c svneol=native#text/plain src/mess/video/pk8020.c svneol=native#text/plain src/mess/video/pmd85.c svneol=native#text/plain diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index 484e26b9721..bf2d157a3a7 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -76,6 +76,7 @@ #include "video/pds30_sigmalview.h" #include "video/pds30_30hr.h" #include "video/pds30_mc30.h" +#include "video/pds_tpdfpd.h" #include "includes/mac.h" #include "mac.lh" @@ -578,6 +579,15 @@ static ADDRESS_MAP_START(macplus_map, AS_PROGRAM, 16, mac_state ) AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) ADDRESS_MAP_END +static ADDRESS_MAP_START(macse_map, AS_PROGRAM, 16, mac_state ) + AM_RANGE(0x580000, 0x5fffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) + AM_RANGE(0x900000, 0x9fffff) AM_READ(mac_scc_r) + AM_RANGE(0xb00000, 0xbfffff) AM_WRITE(mac_scc_w) + AM_RANGE(0xd00000, 0xdfffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) + AM_RANGE(0xe80000, 0xefffff) AM_READWRITE(mac_via_r, mac_via_w) + AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) +ADDRESS_MAP_END + static ADDRESS_MAP_START(macprtb_map, AS_PROGRAM, 16, mac_state ) AM_RANGE(0x900000, 0x93ffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0c0000) AM_RANGE(0xf60000, 0xf6ffff) AM_READWRITE(mac_iwm_r, mac_iwm_w) @@ -849,6 +859,11 @@ static const struct nbbus_interface nubus_intf = DEVCB_DRIVER_LINE_MEMBER(mac_state, nubus_irq_e_w) }; +static const struct macpds_interface macpds_intf = +{ + 0 +}; + static SLOT_INTERFACE_START(mac_nubus_cards) SLOT_INTERFACE("m2video", NUBUS_M2VIDEO) /* Apple Macintosh II Video Card */ SLOT_INTERFACE("48gc", NUBUS_48GC) /* Apple 4*8 Graphics Card */ @@ -874,6 +889,10 @@ static SLOT_INTERFACE_START(mac_pds030_cards) SLOT_INTERFACE("mc30", PDS030_XCEEDMC30) // Micron/XCEED Technology MacroColor 30 SLOT_INTERFACE_END +static SLOT_INTERFACE_START(mac_sepds_cards) + SLOT_INTERFACE("radiusfpd", PDS_SEDISPLAY) // Radius Full Page Display card for SE +SLOT_INTERFACE_END + static SLOT_INTERFACE_START(mac_lcpds_cards) SLOT_INTERFACE_END @@ -977,6 +996,8 @@ static MACHINE_CONFIG_DERIVED( macplus, mac512ke ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( macse, macplus ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(macse_map) MCFG_DEVICE_REMOVE("via6522_0") MCFG_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf) @@ -985,6 +1006,26 @@ static MACHINE_CONFIG_DERIVED( macse, macplus ) MCFG_RAM_MODIFY(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("4M") MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") + + MCFG_MACKBD_REMOVE() + + MCFG_MACPDS_BUS_ADD("sepds", "maincpu", macpds_intf) + MCFG_MACPDS_SLOT_ADD("sepds", "pds", mac_sepds_cards, NULL) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( macclasc, macplus ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(macse_map) + + MCFG_DEVICE_REMOVE("via6522_0") + MCFG_VIA6522_ADD("via6522_0", 1000000, mac_via6522_adb_intf) + + /* internal ram */ + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("4M") + MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M") + + MCFG_MACKBD_REMOVE() MACHINE_CONFIG_END static MACHINE_CONFIG_START( macprtb, mac_state ) @@ -2160,7 +2201,7 @@ COMP( 1989, macse30, mac2fdhd, 0, macse30, macadb, mac_state, macse30, "A COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macadb, mac_state, maciicx, "Apple Computer", "Macintosh IIcx", 0 ) COMP( 1989, maciici, 0, 0, maciici, maciici, mac_state, maciici, "Apple Computer", "Macintosh IIci", 0 ) COMP( 1990, maciifx, 0, 0, maciifx, macadb, mac_state, maciifx, "Apple Computer", "Macintosh IIfx", GAME_NOT_WORKING ) -COMP( 1990, macclasc, 0, 0, macse, macadb, mac_state, macclassic, "Apple Computer", "Macintosh Classic", 0 ) +COMP( 1990, macclasc, 0, 0, macclasc, macadb, mac_state, macclassic, "Apple Computer", "Macintosh Classic", 0 ) COMP( 1990, maclc, 0, 0, maclc, maciici, mac_state, maclc, "Apple Computer", "Macintosh LC", GAME_IMPERFECT_SOUND ) COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, maciisi, "Apple Computer", "Macintosh IIsi", 0 ) COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, macprtb, "Apple Computer", "Macintosh PowerBook 100", GAME_NOT_WORKING ) diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index 0750cb3dd03..77b433f2e0e 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -15,6 +15,7 @@ #include "machine/egret.h" #include "machine/cuda.h" #include "machine/nubus.h" +#include "machine/macpds.h" #include "machine/ncr539x.h" #include "machine/ncr5380.h" #include "machine/mackbd.h" diff --git a/src/mess/machine/macpds.c b/src/mess/machine/macpds.c new file mode 100644 index 00000000000..49c35885e6b --- /dev/null +++ b/src/mess/machine/macpds.c @@ -0,0 +1,220 @@ +/*************************************************************************** + + macpds.c - Mac 68000 PDS implementation (SE, Portable) + + by R. Belmont + +***************************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "machine/macpds.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type MACPDS_SLOT = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// macpds_slot_device - constructor +//------------------------------------------------- +macpds_slot_device::macpds_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, MACPDS_SLOT, "Mac 68000 Processor-Direct Slot", tag, owner, clock, "macpds_slot", __FILE__), + device_slot_interface(mconfig, *this) +{ +} + +macpds_slot_device::macpds_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_slot_interface(mconfig, *this) +{ +} + +void macpds_slot_device::static_set_macpds_slot(device_t &device, const char *tag, const char *slottag) +{ + macpds_slot_device &macpds_card = dynamic_cast(device); + macpds_card.m_macpds_tag = tag; + macpds_card.m_macpds_slottag = slottag; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void macpds_slot_device::device_start() +{ + device_macpds_card_interface *dev = dynamic_cast(get_card_device()); + + if (dev) device_macpds_card_interface::static_set_macpds_tag(*dev, m_macpds_tag, m_macpds_slottag); +} + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type MACPDS = &device_creator; + +void macpds_device::static_set_cputag(device_t &device, const char *tag) +{ + macpds_device &macpds = downcast(device); + macpds.m_cputag = tag; +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void macpds_device::device_config_complete() +{ + // inherit a copy of the static data + const macpds_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } + + // or initialize to defaults if none provided + else + { + } +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// macpds_device - constructor +//------------------------------------------------- + +macpds_device::macpds_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, MACPDS, "MACPDS", tag, owner, clock, "macpds", __FILE__) +{ +} + +macpds_device::macpds_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source) +{ +} +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void macpds_device::device_start() +{ + m_maincpu = machine().device(m_cputag); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void macpds_device::device_reset() +{ +} + +void macpds_device::add_macpds_card(device_macpds_card_interface *card) +{ + m_device_list.append(*card); +} + +void macpds_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, UINT32 mask) +{ + m_maincpu = machine().device(m_cputag); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); +} + +void macpds_device::install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, UINT32 mask) +{ + m_maincpu = machine().device(m_cputag); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); +} + +void macpds_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data) +{ +// printf("install_bank: %s @ %x->%x mask %x mirror %x\n", tag, start, end, mask, mirror); + m_maincpu = machine().device(m_cputag); + address_space &space = m_maincpu->space(AS_PROGRAM); + space.install_readwrite_bank(start, end, mask, mirror, tag ); + machine().root_device().membank(tag)->set_base(data); +} + +void macpds_device::set_irq_line(int line, int state) +{ + m_maincpu->set_input_line(line, state); +} + +//************************************************************************** +// DEVICE CONFIG MACPDS CARD INTERFACE +//************************************************************************** + + +//************************************************************************** +// DEVICE MACPDS CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_macpds_card_interface - constructor +//------------------------------------------------- + +device_macpds_card_interface::device_macpds_card_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_macpds(NULL), + m_macpds_tag(NULL) +{ +} + + +//------------------------------------------------- +// ~device_macpds_card_interface - destructor +//------------------------------------------------- + +device_macpds_card_interface::~device_macpds_card_interface() +{ +} + +void device_macpds_card_interface::static_set_macpds_tag(device_t &device, const char *tag, const char *slottag) +{ + device_macpds_card_interface &macpds_card = dynamic_cast(device); + macpds_card.m_macpds_tag = tag; + macpds_card.m_macpds_slottag = slottag; +} + +void device_macpds_card_interface::set_macpds_device() +{ + m_macpds = dynamic_cast(device().machine().device(m_macpds_tag)); + m_macpds->add_macpds_card(this); +} + +void device_macpds_card_interface::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *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_macpds_slottag); + + m_macpds->install_bank(start, end, mask, mirror, bank, data); +} + +void device_macpds_card_interface::install_rom(device_t *dev, const char *romregion, UINT32 addr) +{ + astring tempstring; + UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->base(); + UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->bytes(); + char bankname[128]; + sprintf(bankname, "rom_%x", addr); + + m_macpds->install_bank(addr, addr+romlen-1, 0, 0, bankname, rom); +} + + diff --git a/src/mess/machine/macpds.h b/src/mess/machine/macpds.h new file mode 100644 index 00000000000..62e3dea66a8 --- /dev/null +++ b/src/mess/machine/macpds.h @@ -0,0 +1,137 @@ +/*************************************************************************** + + macpds.h - Mac 68000 PDS implementation (SE, Portable) + + by R. Belmont + +***************************************************************************/ + +#pragma once + +#ifndef __MACPDS_H__ +#define __MACPDS_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MACPDS_BUS_ADD(_tag, _cputag, _config) \ + MCFG_DEVICE_ADD(_tag, MACPDS, 0) \ + MCFG_DEVICE_CONFIG(_config) \ + macpds_device::static_set_cputag(*device, _cputag); +#define MCFG_MACPDS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \ + MCFG_DEVICE_ADD(_tag, MACPDS_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + macpds_slot_device::static_set_macpds_slot(*device, _nbtag, _tag); +#define MCFG_MACPDS_SLOT_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +#define MCFG_MACPDS_ONBOARD_ADD(_nbtag, _tag, _dev_type, _def_inp) \ + MCFG_DEVICE_ADD(_tag, _dev_type, 0) \ + MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \ + device_macpds_card_interface::static_set_macpds_tag(*device, _nbtag, _tag); + +#define MCFG_MACPDS_BUS_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class macpds_device; + +class macpds_slot_device : public device_t, + public device_slot_interface +{ +public: + // construction/destruction + macpds_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + macpds_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + // device-level overrides + virtual void device_start(); + + // inline configuration + static void static_set_macpds_slot(device_t &device, const char *tag, const char *slottag); +protected: + // configuration + const char *m_macpds_tag, *m_macpds_slottag; +}; + +// device type definition +extern const device_type MACPDS_SLOT; + +// ======================> macpds_interface + +struct macpds_interface +{ + int foo; +}; + +class device_macpds_card_interface; +// ======================> macpds_device +class macpds_device : public device_t, + public macpds_interface +{ +public: + // construction/destruction + macpds_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + macpds_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + // inline configuration + static void static_set_cputag(device_t &device, const char *tag); + + void add_macpds_card(device_macpds_card_interface *card); + void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, UINT32 mask=0xffffffff); + void install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, UINT32 mask=0xffffffff); + void install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data); + void set_irq_line(int line, int state); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_config_complete(); + + // internal state + cpu_device *m_maincpu; + + simple_list m_device_list; + const char *m_cputag; +}; + + +// device type definition +extern const device_type MACPDS; + +// ======================> device_macpds_card_interface + +// class representing interface-specific live macpds card +class device_macpds_card_interface : public device_slot_card_interface +{ + friend class macpds_device; +public: + // construction/destruction + device_macpds_card_interface(const machine_config &mconfig, device_t &device); + virtual ~device_macpds_card_interface(); + + device_macpds_card_interface *next() const { return m_next; } + + void set_macpds_device(); + + // helper functions for card devices + void install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb = false, bool reverse_rom = false); + void install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data); + void install_rom(device_t *dev, const char *romregion, UINT32 addr); + + // inline configuration + static void static_set_macpds_tag(device_t &device, const char *tag, const char *slottag); +public: + macpds_device *m_macpds; + const char *m_macpds_tag, *m_macpds_slottag; + device_macpds_card_interface *m_next; +}; + +#endif /* __MACPDS_H__ */ diff --git a/src/mess/video/pds_tpdfpd.c b/src/mess/video/pds_tpdfpd.c new file mode 100644 index 00000000000..944e2521bf3 --- /dev/null +++ b/src/mess/video/pds_tpdfpd.c @@ -0,0 +1,235 @@ +/*************************************************************************** + + Radius Full Page Display card for the Mac SE, assy # 632-0022-A1 + + EPROMs are marked + "(c) 1991 Radius TPD/FPD-ASIC U6 297-0204-A V 4.1 256K" and "U7" with + all other text the same. + + The SE PDS does not auto-configure like NuBus; cards have to snoop the 68k + address bus and claim spots the motherboard logic doesn't want. + + This card claims these address ranges: + 770000-77000F: Bt9014 RAMDAC + C00000-C0FFFF: EPROM + C10000 : read to ack vblank IRQ 2 (returns bit 7 = 0 for vblank active) + C20000 : read to enable vblank IRQ 2 + C40000-C7FFFF: 256k VRAM + F80000-F8FFFF: EPROM mirror (the SE ROM looks for signatures and jump tables in this region) + + TODO: + * suppress SE built-in screen (it stops working after OS boot with this card installed) & make our screen 3:4 + * investigate if there's also a two-page display mode as the rom labels imply; 256K is + far too much for just 1024x880 but would fit double that nicely. + * later ROM versions provide System 7 compatibility; our current dump is good only + up to 6.0.8. (We have 4.1; the last version is 4.4). + +***************************************************************************/ + +#include "emu.h" +#include "video/pds_tpdfpd.h" +#include "cpu/m68000/m68000.h" + +#define SEDISPLAY_SCREEN_NAME "fpd_screen" +#define SEDISPLAY_ROM_REGION "fpd_rom" + +#define VRAM_SIZE (256*1024) // PCB has a jumper for 1MByte; may require different EPROMs + +MACHINE_CONFIG_FRAGMENT( sedisplay ) + MCFG_SCREEN_ADD( SEDISPLAY_SCREEN_NAME, RASTER) + MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, macpds_sedisplay_device, screen_update) + MCFG_SCREEN_SIZE(1280, 960) + MCFG_SCREEN_REFRESH_RATE(70) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 870-1) +MACHINE_CONFIG_END + +ROM_START( sedisplay ) + ROM_REGION(0x10000, SEDISPLAY_ROM_REGION, ROMREGION_16BIT|ROMREGION_BE) + ROM_LOAD16_BYTE( "tfd_fpd-asic_u6_297-0205-a_v4_1", 0x0000, 0x8000, CRC(fd363f45) SHA1(3c4c596654647ee6ce1880de329aa675d298dc26) ) + ROM_LOAD16_BYTE( "tfd_fpd-asic_u7_297-0205-a_v4_1", 0x0001, 0x8000, CRC(5872451a) SHA1(4673d9f341766c49ff1264b7819916e28a20518f) ) +ROM_END + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type PDS_SEDISPLAY = &device_creator; + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor macpds_sedisplay_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( sedisplay ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *macpds_sedisplay_device::device_rom_region() const +{ + return ROM_NAME( sedisplay ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// macpds_sedisplay_device - constructor +//------------------------------------------------- + +macpds_sedisplay_device::macpds_sedisplay_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, PDS_SEDISPLAY, "Radius SE Full Page Display", tag, owner, clock, "pds_sefp", __FILE__), + device_macpds_card_interface(mconfig, *this) +{ +} + +macpds_sedisplay_device::macpds_sedisplay_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_macpds_card_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void macpds_sedisplay_device::device_start() +{ + set_macpds_device(); + + install_rom(this, SEDISPLAY_ROM_REGION, 0xc00000); + install_rom(this, SEDISPLAY_ROM_REGION, 0xf80000); + + m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); + + static const char bankname[] = { "radpds_ram" }; + m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, 0, 0, bankname, m_vram); + + m_macpds->install_device(0x770000, 0x77000f, read16_delegate(FUNC(macpds_sedisplay_device::ramdac_r), this), write16_delegate(FUNC(macpds_sedisplay_device::ramdac_w), this)); + m_macpds->install_device(0xc10000, 0xc2ffff, read16_delegate(FUNC(macpds_sedisplay_device::sedisplay_r), this), write16_delegate(FUNC(macpds_sedisplay_device::sedisplay_w), this)); + + m_timer = timer_alloc(0, NULL); + m_screen = NULL; // can we look this up now? +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void macpds_sedisplay_device::device_reset() +{ + m_count = 0; + m_clutoffs = 0; + m_vbl_disable = 1; + memset(m_vram, 0, VRAM_SIZE); + memset(m_palette, 0, sizeof(m_palette)); + + m_palette[0] = MAKE_RGB(0, 0, 0); + m_palette[1] = MAKE_RGB(255, 255, 255); +} + + +void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + if (!m_vbl_disable) + { + m_macpds->set_irq_line(M68K_IRQ_2, ASSERT_LINE); + } + + m_timer->adjust(m_screen->time_until_pos(879, 0), 0); +} + +/*************************************************************************** + + CB264 section + +***************************************************************************/ + +UINT32 macpds_sedisplay_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(879, 0), 0); + } + vram = m_vram; + + for (y = 0; y < 870; y++) + { + scanline = &bitmap.pix32(y); + for (x = 0; x < 640/8; x++) + { + pixels = vram[(y * (1024/8)) + (x^1)]; + + *scanline++ = m_palette[((pixels>>7)&0x1)^1]; + *scanline++ = m_palette[((pixels>>6)&0x1)^1]; + *scanline++ = m_palette[((pixels>>5)&0x1)^1]; + *scanline++ = m_palette[((pixels>>4)&0x1)^1]; + *scanline++ = m_palette[((pixels>>3)&0x1)^1]; + *scanline++ = m_palette[((pixels>>2)&0x1)^1]; + *scanline++ = m_palette[((pixels>>1)&0x1)^1]; + *scanline++ = m_palette[(pixels&1)^1]; + } + } + + return 0; +} + +WRITE16_MEMBER( macpds_sedisplay_device::sedisplay_w ) +{ +} + +READ16_MEMBER( macpds_sedisplay_device::sedisplay_r ) +{ + if (offset == 0) // ack vbl + { + m_macpds->set_irq_line(M68K_IRQ_2, CLEAR_LINE); + } + else if (offset == 0x8000) // enable vbl + { + m_vbl_disable = 0; + } + + return 0; +} + +WRITE16_MEMBER( macpds_sedisplay_device::ramdac_w ) +{ + switch (offset) + { + case 4: + m_clutoffs = data>>8; + break; + + case 5: + m_colors[m_count++] = data>>4; // they only fill in the lower nibble + + if (m_count == 3) + { // only the green channel drives the output + m_palette[m_clutoffs] = MAKE_RGB(m_colors[1], m_colors[1], m_colors[1]); + m_clutoffs++; + m_count = 0; + } + break; + + default: +// printf("RAMDAC: %x to %x (mask %04x)\n", data, offset, mem_mask); + break; + } +} + +READ16_MEMBER( macpds_sedisplay_device::ramdac_r ) +{ + return 0; +} diff --git a/src/mess/video/pds_tpdfpd.h b/src/mess/video/pds_tpdfpd.h new file mode 100644 index 00000000000..741a265f709 --- /dev/null +++ b/src/mess/video/pds_tpdfpd.h @@ -0,0 +1,52 @@ +#pragma once + +#ifndef __PDS_SEDISPLAY_H__ +#define __PDS_SEDISPLAY_H__ + +#include "emu.h" +#include "machine/macpds.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> macpds_sedisplay_device + +class macpds_sedisplay_device : + public device_t, + public device_macpds_card_interface +{ +public: + // construction/destruction + macpds_sedisplay_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + macpds_sedisplay_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + + // 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_READ16_MEMBER(sedisplay_r); + DECLARE_WRITE16_MEMBER(sedisplay_w); + DECLARE_READ16_MEMBER(ramdac_r); + DECLARE_WRITE16_MEMBER(ramdac_w); + +public: + UINT8 *m_vram; + UINT32 m_vbl_disable; + 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 PDS_SEDISPLAY; + +#endif /* __MACPDS_SEDISPLAY_H__ */