diff --git a/.gitattributes b/.gitattributes index 7dba6cc854f..f2d074ec43c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7279,6 +7279,8 @@ src/mess/machine/mm58274c.c svneol=native#text/plain src/mess/machine/mm58274c.h svneol=native#text/plain src/mess/machine/mos6530.c svneol=native#text/plain src/mess/machine/mos6530.h svneol=native#text/plain +src/mess/machine/mos6702.c svneol=native#text/plain +src/mess/machine/mos6702.h svneol=native#text/plain src/mess/machine/mos8722.c svneol=native#text/plain src/mess/machine/mos8722.h svneol=native#text/plain src/mess/machine/mos8726.c svneol=native#text/plain @@ -7454,6 +7456,8 @@ src/mess/machine/sst39vfx.h svneol=native#text/plain src/mess/machine/strata.c svneol=native#text/plain src/mess/machine/strata.h svneol=native#text/plain src/mess/machine/super80.c svneol=native#text/plain +src/mess/machine/superpet.c svneol=native#text/plain +src/mess/machine/superpet.h svneol=native#text/plain src/mess/machine/svi318.c svneol=native#text/plain src/mess/machine/swim.c svneol=native#text/plain src/mess/machine/swim.h svneol=native#text/plain diff --git a/src/mess/drivers/cbm2.c b/src/mess/drivers/cbm2.c index 07e6e461570..7747a80b0df 100644 --- a/src/mess/drivers/cbm2.c +++ b/src/mess/drivers/cbm2.c @@ -1584,7 +1584,7 @@ READ8_MEMBER( cbm2_state::cia_pa_r ) data |= m_ieee1->read(space, 0); // user port - data |= m_user->d1_r(space, 0); + data &= m_user->d1_r(space, 0); // joystick data &= ~(!BIT(m_joy1->joy_r(), 5) << 6); diff --git a/src/mess/drivers/pet2001.c b/src/mess/drivers/pet2001.c index 18a3074d1c9..1ae8cef1566 100644 --- a/src/mess/drivers/pet2001.c +++ b/src/mess/drivers/pet2001.c @@ -134,7 +134,13 @@ ROM sockets: UA3 2K or 4K character - accurate video timing for non-CRTC models - PET 4000-12 (40 column CRTC models) + - High Speed Graphics board + - keyboard layouts + - Swedish + - German - SuperPET + - 6809 + - OS/9 MMU - 8096 - 64k expansion - 8296 @@ -161,6 +167,7 @@ void pet_state::check_interrupts() int irq = m_via_irq || m_pia1a_irq || m_pia1b_irq || m_pia2a_irq || m_pia2b_irq || m_exp_irq; m_maincpu->set_input_line(M6502_IRQ_LINE, irq); + m_exp->irq_w(irq); } @@ -704,7 +711,7 @@ READ8_MEMBER( pet_state::pia1_pa_r ) data |= m_ieee->eoi_r() << 6; // diagnostic jumper - data |= 0x80; + data |= m_exp->diag_r() << 7; return data; } @@ -893,6 +900,17 @@ static PET_DATASSETTE_PORT_INTERFACE( datassette2_intf ) }; +//------------------------------------------------- +// PET_EXPANSION_INTERFACE( exp_intf ) +//------------------------------------------------- + +static PET_EXPANSION_INTERFACE( exp_intf ) +{ + DEVCB_DRIVER_MEMBER(pet_state, read), + DEVCB_DRIVER_MEMBER(pet_state, write) +}; + + //------------------------------------------------- // PET_USER_PORT_INTERFACE( user_intf ) //------------------------------------------------- @@ -1186,7 +1204,7 @@ static MACHINE_CONFIG_START( pet, pet_state ) MCFG_CBM_IEEE488_ADD(ieee488_intf, "c4040") MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, "c2n", NULL) MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, datassette2_intf, cbm_datassette_devices, NULL, NULL) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_8MHz/8, pet_expansion_cards, NULL, NULL) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_8MHz/8, exp_intf, pet_expansion_cards, NULL, NULL) MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, user_intf, pet_user_port_cards, NULL, NULL) MCFG_QUICKLOAD_ADD("quickload", cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) @@ -1462,7 +1480,7 @@ static MACHINE_CONFIG_START( pet80, pet80_state ) MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050") MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, "c2n", NULL) MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT2_TAG, datassette2_intf, cbm_datassette_devices, NULL, NULL) - MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, pet_expansion_cards, NULL, NULL) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, exp_intf, pet_expansion_cards, NULL, NULL) MCFG_PET_USER_PORT_ADD(PET_USER_PORT_TAG, user_intf, pet_user_port_cards, NULL, NULL) MCFG_QUICKLOAD_ADD("quickload", cbm_pet, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) @@ -1485,9 +1503,9 @@ MACHINE_CONFIG_END // MACHINE_CONFIG( superpet ) //------------------------------------------------- -static MACHINE_CONFIG_DERIVED_CLASS( superpet, pet80, superpet_state ) - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("96K") +static MACHINE_CONFIG_DERIVED_CLASS( superpet, pet8032, superpet_state ) + MCFG_DEVICE_REMOVE(PET_EXPANSION_SLOT_TAG) + MCFG_PET_EXPANSION_SLOT_ADD(PET_EXPANSION_SLOT_TAG, XTAL_16MHz/16, exp_intf, pet_expansion_cards, "superpet", NULL) MCFG_SOFTWARE_LIST_ADD("flop_list2", "superpet_flop") MACHINE_CONFIG_END @@ -1750,7 +1768,7 @@ ROM_START( cbm8032_se ) ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "swedish.bin", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) // It had a label "8000-UD7, SCREEN-04" + ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal ROM_REGION( 0x800, "charom", 0 ) @@ -1769,24 +1787,35 @@ ROM_START( superpet ) ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 - ROM_LOAD( "901474-03.ud7", 0x5000, 0x0800, CRC(5674dd5e) SHA1(c605fa343fd77c73cbe1e0e9567e2f014f6e7e30) ) // Screen Editor (80 columns, CRTC 60Hz, Business Keyb) + ROM_LOAD( "901474-04.ud7", 0x5000, 0x0800, CRC(abb000e7) SHA1(66887061b6c4ebef7d6efb90af9afd5e2c3b08ba) ) // Screen Editor (80 columns, CRTC 50Hz, Business Keyb) ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal - ROM_REGION( 0x7000, M6809_TAG, 0 ) - ROM_LOAD( "901898-01.u17", 0x1000, 0x1000, CRC(728a998b) SHA1(0414b3ab847c8977eb05c2fcc72efcf2f9d92871) ) - ROM_LOAD( "901898-02.u18", 0x2000, 0x1000, CRC(6beb7c62) SHA1(df154939b934d0aeeb376813ec1ba0d43c2a3378) ) - ROM_LOAD( "901898-03.u19", 0x3000, 0x1000, CRC(5db4983d) SHA1(6c5b0cce97068f8841112ba6d5cd8e568b562fa3) ) - ROM_LOAD( "901898-04.u20", 0x4000, 0x1000, CRC(f55fc559) SHA1(b42a2050a319a1ffca7868a8d8d635fadd37ec37) ) - ROM_LOAD( "901897-01.u21", 0x5000, 0x0800, CRC(b2cee903) SHA1(e8ce8347451a001214a5e71a13081b38b4be23bc) ) - ROM_LOAD( "901898-05.u22", 0x6000, 0x1000, CRC(f42df0cb) SHA1(9b4a5134d20345171e7303445f87c4e0b9addc96) ) - - ROM_REGION( 0x800, "charom", 0 ) - ROM_LOAD( "901447-10.ua3", 0x000, 0x800, CRC(d8408674) SHA1(0157a2d55b7ac4eaeb38475889ebeea52e2593db) ) // Character Generator + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901640-01.ua3", 0x0000, 0x1000, CRC(ee8229c4) SHA1(bf346f11595a3e65e55d6aeeaa2c0cec807b66c7) ) ROM_END #define rom_mmf9000 rom_superpet +//------------------------------------------------- +// ROM( mmf9000_se ) +//------------------------------------------------- + +ROM_START( mmf9000_se ) + ROM_REGION( 0x7000, M6502_TAG, 0 ) + ROM_CART_LOAD( "9000", 0x0000, 0x1000, ROM_MIRROR ) + ROM_CART_LOAD( "a000", 0x1000, 0x1000, ROM_MIRROR ) + ROM_LOAD( "901465-23.ud10", 0x2000, 0x1000, CRC(ae3deac0) SHA1(975ee25e28ff302879424587e5fb4ba19f403adc) ) // BASIC 4 + ROM_LOAD( "901465-20.ud9", 0x3000, 0x1000, CRC(0fc17b9c) SHA1(242f98298931d21eaacb55fe635e44b7fc192b0a) ) // BASIC 4 + ROM_LOAD( "901465-21.ud8", 0x4000, 0x1000, CRC(36d91855) SHA1(1bb236c72c726e8fb029c68f9bfa5ee803faf0a8) ) // BASIC 4 + ROM_LOAD( "8000-ud7, screen-04.ud7", 0x5000, 0x0800, CRC(75901dd7) SHA1(2ead0d83255a344a42bb786428353ca48d446d03) ) + ROM_LOAD( "901465-22.ud6", 0x6000, 0x1000, CRC(cc5298a1) SHA1(96a0fa56e0c937da92971d9c99d504e44e898806) ) // Kernal + + ROM_REGION( 0x1000, "charom", 0 ) + ROM_LOAD( "901640-01 skand.gen.ua3", 0x0000, 0x1000, CRC(da1cd630) SHA1(35f472114ff001259bdbae073ae041b0759e32cb) ) +ROM_END + + //------------------------------------------------- // ROM( cbm8296 ) //------------------------------------------------- @@ -1895,6 +1924,7 @@ COMP( 1981, cbm8032_de, pet8032, 0, pet8032, petb_de, driver_device, 0, "Commod COMP( 1981, cbm8032_se, pet8032, 0, pet8032, petb_se, driver_device, 0, "Commodore Business Machines", "CBM 8032 (Sweden/Finland)", GAME_SUPPORTS_SAVE ) COMP( 1981, superpet, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "SuperPET SP-9000", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) COMP( 1981, mmf9000, pet8032, 0, superpet, petb, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) +COMP( 1981, mmf9000_se, pet8032, 0, superpet, petb_se, driver_device, 0, "Commodore Business Machines", "MicroMainFrame 9000 (Sweden/Finland)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) COMP( 1981, cbm8096, pet8032, 0, cbm8096, petb, driver_device, 0, "Commodore Business Machines", "CBM 8096", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) COMP( 1984, cbm8296, 0, 0, cbm8296, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) COMP( 1984, cbm8296d, cbm8296, 0, cbm8296d, petb, driver_device, 0, "Commodore Business Machines", "CBM 8296D", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) diff --git a/src/mess/includes/pet2001.h b/src/mess/includes/pet2001.h index 135c097c1cc..5a4cd8942d3 100644 --- a/src/mess/includes/pet2001.h +++ b/src/mess/includes/pet2001.h @@ -6,8 +6,8 @@ #include "emu.h" #include "cpu/m6502/m6502.h" #include "formats/cbm_snqk.h" -#include "machine/6821pia.h" #include "machine/6522via.h" +#include "machine/6821pia.h" #include "machine/cbmipt.h" #include "machine/ieee488.h" #include "machine/petcass.h" @@ -22,7 +22,6 @@ #define M6520_1_TAG "g8" #define M6520_2_TAG "b8" #define MC6845_TAG "ub13" -#define M6809_TAG "u4" #define SCREEN_TAG "screen" class pet_state : public driver_device diff --git a/src/mess/machine/cbmipt.c b/src/mess/machine/cbmipt.c index 2262843a9c8..2a6dbff58fd 100644 --- a/src/mess/machine/cbmipt.c +++ b/src/mess/machine/cbmipt.c @@ -1025,6 +1025,7 @@ INPUT_PORTS_END SLOT_INTERFACE_START( pet_expansion_cards ) //SLOT_INTERFACE("64k", PET_64K) + SLOT_INTERFACE("superpet", SUPERPET) SLOT_INTERFACE_END SLOT_INTERFACE_START( pet_user_port_cards ) diff --git a/src/mess/machine/cbmipt.h b/src/mess/machine/cbmipt.h index 7c2da78767e..d2beb62c0fe 100644 --- a/src/mess/machine/cbmipt.h +++ b/src/mess/machine/cbmipt.h @@ -84,6 +84,7 @@ #include "machine/plus4_std.h" #include "machine/serialbox.h" #include "machine/softbox.h" +#include "machine/superpet.h" #include "machine/vic1010.h" #include "machine/vic1110.h" #include "machine/vic1111.h" diff --git a/src/mess/machine/mos6702.c b/src/mess/machine/mos6702.c new file mode 100644 index 00000000000..d019e3a30c7 --- /dev/null +++ b/src/mess/machine/mos6702.c @@ -0,0 +1,69 @@ +/********************************************************************** + + MOS Technology 6702 Mystery Device emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "mos6702.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type MOS6702 = &device_creator; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// mos6702_device - constructor +//------------------------------------------------- + +mos6702_device::mos6702_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MOS6702, "MOS6702", tag, owner, clock) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mos6702_device::device_start() +{ +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( mos6702_device::read ) +{ + return 0; +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( mos6702_device::write ) +{ +} diff --git a/src/mess/machine/mos6702.h b/src/mess/machine/mos6702.h new file mode 100644 index 00000000000..65f125367dd --- /dev/null +++ b/src/mess/machine/mos6702.h @@ -0,0 +1,68 @@ +/********************************************************************** + + MOS Technology 6702 Mystery Device emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +********************************************************************** + _____ _____ + R/_W 1 |* \_/ | 20 Vcc + D7 2 | | 19 CS0 + D6 3 | | 18 CS1 + D5 4 | | 17 CS2 + D4 5 | MOS6702 | 16 CS3 + D3 6 | | 15 _CS4 + D2 7 | | 14 _CS5 + D1 8 | | 13 _CS5 + D0 9 | | 12 _RTS + Vss 10 |_____________| 11 phi2 + +**********************************************************************/ + +#pragma once + +#ifndef __MOS6702__ +#define __MOS6702__ + +#include "emu.h" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MOS6702_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, MOS6702, _clock) + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> mos6702_device + +class mos6702_device : public device_t +{ +public: + // construction/destruction + mos6702_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + +protected: + // device-level overrides + virtual void device_config_complete() { m_shortname = "mos6702"; } + virtual void device_start(); +}; + + +// device type definition +extern const device_type MOS6702; + + + +#endif diff --git a/src/mess/machine/petexp.c b/src/mess/machine/petexp.c index 5056087603b..63dd877dd29 100644 --- a/src/mess/machine/petexp.c +++ b/src/mess/machine/petexp.c @@ -71,6 +71,30 @@ device_pet_expansion_card_interface::~device_pet_expansion_card_interface() } +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pet_expansion_slot_device::device_config_complete() +{ + // inherit a copy of the static data + const pet_expansion_slot_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } + + // or initialize to defaults if none provided + else + { + memset(&m_in_dma_bd_cb, 0, sizeof(m_in_dma_bd_cb)); + memset(&m_out_dma_bd_cb, 0, sizeof(m_out_dma_bd_cb)); + } +} + + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -78,6 +102,10 @@ device_pet_expansion_card_interface::~device_pet_expansion_card_interface() void pet_expansion_slot_device::device_start() { m_card = dynamic_cast(get_card_device()); + + // resolve callbacks + m_in_dma_bd_func.resolve(m_in_dma_bd_cb, *this); + m_out_dma_bd_func.resolve(m_out_dma_bd_cb, *this); } @@ -105,7 +133,7 @@ int pet_expansion_slot_device::norom_r(address_space &space, offs_t offset, int //------------------------------------------------- -// read - cartridge data read +// read - buffered data read //------------------------------------------------- UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int sel) @@ -120,7 +148,7 @@ UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 //------------------------------------------------- -// write - cartridge data write +// write - buffered data write //------------------------------------------------- void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int sel) @@ -132,6 +160,46 @@ void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 } +//------------------------------------------------- +// diag_r - DIAG read +//------------------------------------------------- + +READ_LINE_MEMBER( pet_expansion_slot_device::diag_r ) +{ + return m_card ? m_card->pet_diag_r() : 1; +} + + +//------------------------------------------------- +// irq_w - IRQ write +//------------------------------------------------- + +WRITE_LINE_MEMBER( pet_expansion_slot_device::irq_w ) +{ + if (m_card) m_card->pet_irq_w(state); +} + + +//------------------------------------------------- +// dma_bd_r - DMA read +//------------------------------------------------- + +UINT8 pet_expansion_slot_device::dma_bd_r(offs_t offset) +{ + return m_in_dma_bd_func(offset); +} + + +//------------------------------------------------- +// dma_bd_w - DMA write +//------------------------------------------------- + +void pet_expansion_slot_device::dma_bd_w(offs_t offset, UINT8 data) +{ + m_out_dma_bd_func(offset, data); +} + + //------------------------------------------------- // phi2 - system clock frequency //------------------------------------------------- diff --git a/src/mess/machine/petexp.h b/src/mess/machine/petexp.h index 2ba202bee29..a02ff2fa655 100644 --- a/src/mess/machine/petexp.h +++ b/src/mess/machine/petexp.h @@ -30,8 +30,13 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_PET_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp) \ +#define PET_EXPANSION_INTERFACE(_name) \ + const pet_expansion_slot_interface (_name) = + + +#define MCFG_PET_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \ MCFG_DEVICE_ADD(_tag, PET_EXPANSION_SLOT, _clock) \ + MCFG_DEVICE_CONFIG(_config) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) @@ -40,12 +45,22 @@ // TYPE DEFINITIONS //************************************************************************** +// ======================> pet_expansion_slot_interface + +struct pet_expansion_slot_interface +{ + devcb_read8 m_in_dma_bd_cb; + devcb_write8 m_out_dma_bd_cb; +}; + + // ======================> pet_expansion_slot_device class device_pet_expansion_card_interface; class pet_expansion_slot_device : public device_t, - public device_slot_interface + public device_slot_interface, + public pet_expansion_slot_interface { public: // construction/destruction @@ -56,17 +71,24 @@ public: int norom_r(address_space &space, offs_t offset, int sel); UINT8 read(address_space &space, offs_t offset, UINT8 data, int sel); void write(address_space &space, offs_t offset, UINT8 data, int sel); + DECLARE_READ_LINE_MEMBER( diag_r ); + DECLARE_WRITE_LINE_MEMBER( irq_w ); // cartridge interface + UINT8 dma_bd_r(offs_t offset); + void dma_bd_w(offs_t offset, UINT8 data); int phi2(); protected: // device-level overrides - virtual void device_config_complete() { m_shortname = "petexp"; } + virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); device_pet_expansion_card_interface *m_card; + + devcb_resolved_read8 m_in_dma_bd_func; + devcb_resolved_write8 m_out_dma_bd_func; }; @@ -86,6 +108,8 @@ protected: virtual int pet_norom_r(address_space &space, offs_t offset, int sel) { return 1; } virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) { return data; }; virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) { }; + virtual int pet_diag_r() { return 1; } + virtual void pet_irq_w(int state) { } pet_expansion_slot_device *m_slot; }; diff --git a/src/mess/machine/superpet.c b/src/mess/machine/superpet.c new file mode 100644 index 00000000000..b9e6e131a6c --- /dev/null +++ b/src/mess/machine/superpet.c @@ -0,0 +1,386 @@ +/********************************************************************** + + Commodore SuperPET emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "superpet.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define M6809_TAG "u4" +#define M6551_TAG "u23" +#define MOS6702_TAG "u2" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type SUPERPET = &device_creator; + + +//------------------------------------------------- +// ROM( superpet ) +//------------------------------------------------- + +ROM_START( superpet ) + ROM_REGION( 0x7000, M6809_TAG, 0 ) + ROM_LOAD( "901898-01.u17", 0x1000, 0x1000, CRC(728a998b) SHA1(0414b3ab847c8977eb05c2fcc72efcf2f9d92871) ) + ROM_LOAD( "901898-02.u18", 0x2000, 0x1000, CRC(6beb7c62) SHA1(df154939b934d0aeeb376813ec1ba0d43c2a3378) ) + ROM_LOAD( "901898-03.u19", 0x3000, 0x1000, CRC(5db4983d) SHA1(6c5b0cce97068f8841112ba6d5cd8e568b562fa3) ) + ROM_LOAD( "901898-04.u20", 0x4000, 0x1000, CRC(f55fc559) SHA1(b42a2050a319a1ffca7868a8d8d635fadd37ec37) ) + ROM_LOAD( "901897-01.u21", 0x5000, 0x0800, CRC(b2cee903) SHA1(e8ce8347451a001214a5e71a13081b38b4be23bc) ) + ROM_LOAD( "901898-05.u22", 0x6000, 0x1000, CRC(f42df0cb) SHA1(9b4a5134d20345171e7303445f87c4e0b9addc96) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *superpet_device::device_rom_region() const +{ + return ROM_NAME( superpet ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( superpet_mem ) +//------------------------------------------------- + +static ADDRESS_MAP_START( superpet_mem, AS_PROGRAM, 8, superpet_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write) +ADDRESS_MAP_END + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( superpet ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( superpet ) + MCFG_CPU_ADD(M6809_TAG, M6809, XTAL_16MHz/16) + MCFG_CPU_PROGRAM_MAP(superpet_mem) + + MCFG_ACIA6551_ADD(M6551_TAG) // XTAL_1_8432MHz + MCFG_MOS6702_ADD(MOS6702_TAG, XTAL_16MHz/16) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor superpet_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( superpet ); +} + + +//------------------------------------------------- +// INPUT_PORTS( superpet ) +//------------------------------------------------- + +static INPUT_PORTS_START( superpet ) + PORT_START("SW1") + + PORT_START("SW2") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor superpet_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( superpet ); +} + + + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//------------------------------------------------- +// update_cpu - +//------------------------------------------------- + +inline void superpet_device::update_cpu(int cpu) +{ + if (cpu) + { + // 6502 active + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + machine().firstcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + } + else + { + // 6809 active + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + machine().firstcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + } +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// superpet_device - constructor +//------------------------------------------------- + +superpet_device::superpet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, SUPERPET, "SuperPET", tag, owner, clock), + device_pet_expansion_card_interface(mconfig, *this), + m_maincpu(*this, M6809_TAG), + m_acia(*this, M6551_TAG), + m_dongle(*this, MOS6702_TAG), + m_rom(*this, M6809_TAG), + m_ram(*this, "ram"), + m_sw1(*this, "SW1"), + m_sw2(*this, "SW2"), + m_system(0), + m_bank(0), + m_sel9_rom(0), + m_pet_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void superpet_device::device_start() +{ + // allocate memory + m_ram.allocate(0x10000); + + // state saving + save_item(NAME(m_system)); + save_item(NAME(m_bank)); + save_item(NAME(m_sel9_rom)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void superpet_device::device_reset() +{ + m_maincpu->reset(); + m_acia->reset(); + m_dongle->reset(); + + m_system = 0; + m_bank = 0; + m_sel9_rom = 0; + + update_cpu(BIT(m_system, 0)); +} + + +//------------------------------------------------- +// pet_norom_r - NO ROM read +//------------------------------------------------- + +int superpet_device::pet_norom_r(address_space &space, offs_t offset, int sel) +{ + return BIT(m_system, 0); +} + + +//------------------------------------------------- +// pet_bd_r - buffered data read +//------------------------------------------------- + +UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) +{ + int norom = pet_norom_r(space, offset, sel); + + switch (sel) + { + case SEL9: + if (m_sel9_rom) + { + data = m_rom->base()[offset - 0x9000]; + } + else + { + data = m_ram[((m_bank & 0x0f) << 12) | (offset & 0xfff)]; + } + break; + + case SELA: case SELB: case SELC: case SELD: case SELF: + if (!norom) + { + data = m_rom->base()[offset - 0x9000]; + } + break; + + case SELE: + if (!norom && !BIT(offset, 11)) + { + data = m_rom->base()[offset - 0x9000]; + } + break; + } + + switch (offset) + { + case 0xefe0: + case 0xefe1: + case 0xefe2: + case 0xefe3: + data = m_dongle->read(space, offset & 0x03); + break; + + case 0xeff0: + case 0xeff1: + case 0xeff2: + case 0xeff3: + data = m_acia->read(space, offset & 0x03); + break; + } + + return data; +} + + +//------------------------------------------------- +// pet_bd_w - buffered data write +//------------------------------------------------- + +void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) +{ + switch (sel) + { + case SEL9: + if (!m_sel9_rom && BIT(m_system, 1)) + { + m_ram[((m_bank & 0x0f) << 12) | (offset & 0xfff)] = data; + } + break; + } + + switch (offset) + { + case 0xefe0: + case 0xefe1: + case 0xefe2: + case 0xefe3: + m_dongle->write(space, offset & 0x03, data); + printf("6702 %u %02x\n", offset & 0x03, data); + break; + + case 0xeff0: + case 0xeff1: + case 0xeff2: + case 0xeff3: + m_acia->write(space, offset & 0x03, data); + break; + + case 0xeff8: + case 0xeff9: + if (BIT(m_bank, 7)) + { + /* + + bit description + + 0 SW2 CPU (0=6809, 1=6502) + 1 SW1 RAM (0=read only, 1=read/write) + 2 + 3 DIAG + 4 + 5 + 6 + 7 + + */ + + m_system = data; + update_cpu(BIT(m_system, 0)); + printf("SYSTEM %02x\n", data); + } + break; + + case 0xeffc: + case 0xeffd: + /* + + bit description + + 0 A0 + 1 A1 + 2 A2 + 3 SEL A + 4 J1 pin 40 + 5 SEL B + 6 J1 pin 39 + 7 BIT 7 + + */ + + m_bank = data; + printf("BANK %02x\n", data); + break; + } +} + + +//------------------------------------------------- +// pet_diag_r - DIAG read +//------------------------------------------------- + +int superpet_device::pet_diag_r() +{ + return BIT(m_system, 3); +} + + +//------------------------------------------------- +// pet_irq_w - IRQ write +//------------------------------------------------- + +void superpet_device::pet_irq_w(int state) +{ + m_pet_irq = state; + + //m_maincpu->set_input_line(M6809_IRQ_LINE, m_pet_irq || m_acia_irq); +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +READ8_MEMBER( superpet_device::read ) +{ + return m_slot->dma_bd_r(offset); +} + + +//------------------------------------------------- +// write - +//------------------------------------------------- + +WRITE8_MEMBER( superpet_device::write ) +{ + m_slot->dma_bd_w(offset, data); +} diff --git a/src/mess/machine/superpet.h b/src/mess/machine/superpet.h new file mode 100644 index 00000000000..738228bea95 --- /dev/null +++ b/src/mess/machine/superpet.h @@ -0,0 +1,101 @@ +/********************************************************************** + + Commodore SuperPET emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __SUPERPET__ +#define __SUPERPET__ + + +#include "emu.h" +#include "cpu/m6809/m6809.h" +#include "machine/6551acia.h" +#include "machine/mos6702.h" +#include "machine/petexp.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> superpet_device + +class superpet_device : public device_t, + public device_pet_expansion_card_interface +{ +public: + // construction/destruction + superpet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + +protected: + // device-level overrides + virtual void device_config_complete() { m_shortname = "pet_superpet"; } + virtual void device_start(); + virtual void device_reset(); + + // device_pet_expansion_card_interface overrides + virtual int pet_norom_r(address_space &space, offs_t offset, int sel); + virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel); + virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel); + virtual int pet_diag_r(); + virtual void pet_irq_w(int state); + + enum + { + SEL0 = 0, + SEL1, + SEL2, + SEL3, + SEL4, + SEL5, + SEL6, + SEL7, + SEL8, + SEL9, + SELA, + SELB, + SELC, + SELD, + SELE, + SELF + }; + +private: + required_device m_maincpu; + required_device m_acia; + required_device m_dongle; + required_memory_region m_rom; + optional_shared_ptr m_ram; + required_ioport m_sw1; + required_ioport m_sw2; + + inline void update_cpu(int cpu); + + UINT8 m_system; + UINT8 m_bank; + int m_sel9_rom; + int m_pet_irq; + int m_acia_irq; +}; + + +// device type definition +extern const device_type SUPERPET; + + +#endif diff --git a/src/mess/mess.lst b/src/mess/mess.lst index b577b0ade01..cd3a7e0d506 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -600,6 +600,7 @@ cbm8032_de cbm8032_se superpet mmf9000 +mmf9000_se cbm8096 cbm8296 cbm8296d diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 92db7eae228..bb3286abd2f 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -828,6 +828,8 @@ $(MESSOBJ)/cbm.a: \ $(MESS_MACHINE)/petcass.o \ $(MESS_MACHINE)/petexp.o \ $(MESS_MACHINE)/petuser.o \ + $(MESS_MACHINE)/superpet.o \ + $(MESS_MACHINE)/mos6702.o \ $(MESS_DRIVERS)/c64.o \ $(MESS_MACHINE)/c64_legacy.o \ $(MESS_DRIVERS)/c64dtv.o \