mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
(MESS) a few more carts. nw.
This commit is contained in:
parent
67b323374c
commit
29aea79a9c
@ -15,11 +15,13 @@
|
||||
#include "machine/ram.h"
|
||||
#include "bus/epson_sio/epson_sio.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "sound/speaker.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
#include "px4.lh"
|
||||
|
||||
|
||||
@ -80,6 +82,9 @@ public:
|
||||
m_speaker(*this, "speaker"),
|
||||
m_sio(*this, "sio"),
|
||||
m_rs232(*this, "rs232"),
|
||||
m_caps1(*this, "capsule1"),
|
||||
m_caps2(*this, "capsule2"),
|
||||
m_rdsocket(*this, "ramdisk_socket"),
|
||||
m_isr(0), m_ier(0), m_str(0), m_sior(0xbf),
|
||||
m_artdir(0xff), m_artdor(0xff), m_artsr(0), m_artcr(0),
|
||||
m_swr(0),
|
||||
@ -97,6 +102,12 @@ public:
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<epson_sio_device> m_sio;
|
||||
required_device<rs232_port_device> m_rs232;
|
||||
required_device<generic_slot_device> m_caps1;
|
||||
required_device<generic_slot_device> m_caps2;
|
||||
optional_device<generic_slot_device> m_rdsocket;
|
||||
|
||||
memory_region *m_caps1_rom;
|
||||
memory_region *m_caps2_rom;
|
||||
|
||||
// gapnit register
|
||||
UINT8 m_ctrl1;
|
||||
@ -143,7 +154,7 @@ public:
|
||||
// external cassette/barcode reader
|
||||
int m_ear_last_state;
|
||||
|
||||
void install_rom_capsule(address_space &space, int size, const char *region);
|
||||
void install_rom_capsule(address_space &space, int size, memory_region *mem);
|
||||
|
||||
// device_serial_interface overrides
|
||||
virtual void tra_callback();
|
||||
@ -200,6 +211,7 @@ public:
|
||||
DECLARE_READ8_MEMBER(px4_ramdisk_control_r);
|
||||
DECLARE_DRIVER_INIT(px4);
|
||||
DECLARE_DRIVER_INIT(px4p);
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
DECLARE_PALETTE_INIT(px4);
|
||||
DECLARE_MACHINE_START(px4_ramdisk);
|
||||
@ -437,19 +449,18 @@ READ8_MEMBER( px4_state::px4_str_r )
|
||||
}
|
||||
|
||||
// helper function to map rom capsules
|
||||
void px4_state::install_rom_capsule(address_space &space, int size, const char *region)
|
||||
void px4_state::install_rom_capsule(address_space &space, int size, memory_region *mem)
|
||||
{
|
||||
// ram, part 1
|
||||
space.install_ram(0x0000, 0xdfff - size, 0, 0, m_ram->pointer());
|
||||
|
||||
// actual rom data, part 1
|
||||
space.install_rom(0xe000 - size, 0xffff, 0, 0, memregion(region)->base() + (size - 0x2000));
|
||||
if (mem)
|
||||
space.install_rom(0xe000 - size, 0xffff, 0, 0, mem->base() + (size - 0x2000));
|
||||
|
||||
// rom data, part 2
|
||||
if (size != 0x2000)
|
||||
{
|
||||
space.install_rom(0x10000 - size, 0xdfff, 0, 0, memregion(region)->base());
|
||||
}
|
||||
if (mem && size != 0x2000)
|
||||
space.install_rom(0x10000 - size, 0xdfff, 0, 0, mem->base());
|
||||
|
||||
// ram, continued
|
||||
space.install_ram(0xe000, 0xffff, 0, 0, m_ram->pointer() + 0xe000);
|
||||
@ -479,12 +490,12 @@ WRITE8_MEMBER( px4_state::px4_bankr_w )
|
||||
space_program.install_ram(0x0000, 0xffff, 0, 0, m_ram->pointer());
|
||||
break;
|
||||
|
||||
case 0x08: install_rom_capsule(space_program, 0x2000, "capsule1"); break;
|
||||
case 0x09: install_rom_capsule(space_program, 0x4000, "capsule1"); break;
|
||||
case 0x0a: install_rom_capsule(space_program, 0x8000, "capsule1"); break;
|
||||
case 0x0c: install_rom_capsule(space_program, 0x2000, "capsule2"); break;
|
||||
case 0x0d: install_rom_capsule(space_program, 0x4000, "capsule2"); break;
|
||||
case 0x0e: install_rom_capsule(space_program, 0x8000, "capsule2"); break;
|
||||
case 0x08: install_rom_capsule(space_program, 0x2000, m_caps1_rom); break;
|
||||
case 0x09: install_rom_capsule(space_program, 0x4000, m_caps1_rom); break;
|
||||
case 0x0a: install_rom_capsule(space_program, 0x8000, m_caps1_rom); break;
|
||||
case 0x0c: install_rom_capsule(space_program, 0x2000, m_caps2_rom); break;
|
||||
case 0x0d: install_rom_capsule(space_program, 0x4000, m_caps2_rom); break;
|
||||
case 0x0e: install_rom_capsule(space_program, 0x8000, m_caps2_rom); break;
|
||||
|
||||
default:
|
||||
if (VERBOSE)
|
||||
@ -1036,7 +1047,7 @@ READ8_MEMBER( px4_state::px4_ramdisk_data_r )
|
||||
else if (m_ramdisk_address < 0x40000)
|
||||
{
|
||||
// read from rom
|
||||
ret = memregion("ramdisk")->base()[m_ramdisk_address];
|
||||
ret = m_rdsocket->read_rom(space, m_ramdisk_address);
|
||||
}
|
||||
|
||||
m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1);
|
||||
@ -1124,6 +1135,13 @@ DRIVER_INIT_MEMBER( px4_state, px4p )
|
||||
m_ramdisk = auto_alloc_array(machine(), UINT8, 0x20000);
|
||||
}
|
||||
|
||||
void px4_state::machine_start()
|
||||
{
|
||||
astring region_tag;
|
||||
m_caps1_rom = memregion(region_tag.cpy(m_caps1->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
m_caps2_rom = memregion(region_tag.cpy(m_caps2->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
}
|
||||
|
||||
void px4_state::machine_reset()
|
||||
{
|
||||
m_artsr = ART_TXRDY | ART_TXEMPTY;
|
||||
@ -1133,6 +1151,7 @@ void px4_state::machine_reset()
|
||||
|
||||
MACHINE_START_MEMBER( px4_state, px4_ramdisk )
|
||||
{
|
||||
px4_state::machine_start();
|
||||
machine().device<nvram_device>("nvram")->set_base(m_ramdisk, 0x20000);
|
||||
}
|
||||
|
||||
@ -1416,15 +1435,8 @@ static MACHINE_CONFIG_START( px4, px4_state )
|
||||
MCFG_RS232_CTS_HANDLER(WRITELINE(px4_state, rs232_cts_w))
|
||||
|
||||
// rom capsules
|
||||
MCFG_CARTSLOT_ADD("capsule1")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_INTERFACE("px4_cart")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
|
||||
MCFG_CARTSLOT_ADD("capsule2")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_INTERFACE("px4_cart")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, "px4_cart")
|
||||
MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, "px4_cart")
|
||||
|
||||
// software list
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list", "px4_cart")
|
||||
@ -1440,8 +1452,7 @@ static MACHINE_CONFIG_DERIVED( px4p, px4 )
|
||||
MCFG_PALETTE_MODIFY("palette")
|
||||
MCFG_PALETTE_INIT_OWNER(px4_state, px4p)
|
||||
|
||||
MCFG_CARTSLOT_ADD("ramdisk")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("ramdisk_socket", generic_plain_slot, "px4_cart")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -1457,12 +1468,6 @@ ROM_START( px4 )
|
||||
|
||||
ROM_REGION(0x1000, "slave", 0)
|
||||
ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP)
|
||||
|
||||
ROM_REGION(0x8000, "capsule1", 0)
|
||||
ROM_CART_LOAD("capsule1", 0x0000, 0x8000, ROM_OPTIONAL)
|
||||
|
||||
ROM_REGION(0x8000, "capsule2", 0)
|
||||
ROM_CART_LOAD("capsule2", 0x0000, 0x8000, ROM_OPTIONAL)
|
||||
ROM_END
|
||||
|
||||
ROM_START( px4p )
|
||||
@ -1471,15 +1476,6 @@ ROM_START( px4p )
|
||||
|
||||
ROM_REGION(0x1000, "slave", 0)
|
||||
ROM_LOAD("upd7508.bin", 0x0000, 0x1000, NO_DUMP)
|
||||
|
||||
ROM_REGION(0x8000, "capsule1", 0)
|
||||
ROM_CART_LOAD("capsule1", 0x0000, 0x8000, ROM_OPTIONAL)
|
||||
|
||||
ROM_REGION(0x8000, "capsule2", 0)
|
||||
ROM_CART_LOAD("capsule2", 0x0000, 0x8000, ROM_OPTIONAL)
|
||||
|
||||
ROM_REGION(0x20000, "ramdisk", 0)
|
||||
ROM_CART_LOAD("ramdisk", 0x0000, 0x20000, ROM_OPTIONAL | ROM_MIRROR)
|
||||
ROM_END
|
||||
|
||||
|
||||
|
@ -786,11 +786,11 @@ static MACHINE_CONFIG_START( px8, px8_state )
|
||||
MCFG_SOUND_ROUTE(0, "mono", 0.25)
|
||||
|
||||
/* cartridge */
|
||||
MCFG_CARTSLOT_ADD("capsule1")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
|
||||
MCFG_GENERIC_CARTSLOT_ADD("capsule1", generic_plain_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
MCFG_CARTSLOT_ADD("capsule2")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
|
||||
MCFG_GENERIC_CARTSLOT_ADD("capsule2", generic_plain_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
/* devices */
|
||||
MCFG_DEVICE_ADD(I8251_TAG, I8251, 0)
|
||||
@ -818,10 +818,6 @@ ROM_START( px8 )
|
||||
ROM_REGION( 0x0800, SED1320_TAG, 0 )
|
||||
ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(5b52edbd) SHA1(38197edf301bb2843bea040536af545f76b3d44f) )
|
||||
|
||||
ROM_REGION( 0x10000, "capsule", 0 )
|
||||
ROM_CART_LOAD( "capsule2", 0x0000, 0x8000, ROM_NOMIRROR )
|
||||
ROM_CART_LOAD( "capsule1", 0x8000, 0x8000, ROM_NOMIRROR )
|
||||
|
||||
ROM_REGION( 0x1000, HD6303_TAG, 0 )
|
||||
ROM_LOAD( "hd6303 slave cpu internal rom.13d", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
|
@ -5,10 +5,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m65c02.h"
|
||||
|
||||
#include "includes/svision.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
|
||||
#include "svision.lh"
|
||||
|
||||
#define MAKE8_RGB32(red3, green3, blue2) ( ( (red3)<<(16+5)) | ( (green3)<<(8+5)) | ( (blue2)<<(0+6)) )
|
||||
@ -129,8 +128,7 @@ READ8_MEMBER(svision_state::svision_r)
|
||||
|
||||
WRITE8_MEMBER(svision_state::svision_w)
|
||||
{
|
||||
int value;
|
||||
int delay;
|
||||
int value, delay, bank;
|
||||
|
||||
m_reg[offset] = data;
|
||||
|
||||
@ -141,8 +139,9 @@ WRITE8_MEMBER(svision_state::svision_w)
|
||||
break;
|
||||
|
||||
case 0x26: /* bits 5,6 memory management for a000? */
|
||||
logerror("%.6f svision write %04x %02x\n", machine().time().as_double(),offset,data);
|
||||
m_bank1->set_base(m_user1->base() + ((m_reg[0x26] & 0xe0) << 9));
|
||||
logerror("%.6f svision write %04x %02x\n", machine().time().as_double(), offset, data);
|
||||
bank = ((m_reg[0x26] & 0xe0) >> 5) % (m_cart_rom->bytes() / 0x4000);
|
||||
m_bank1->set_base(m_cart_rom->base() + (bank * 0x4000));
|
||||
svision_irq();
|
||||
break;
|
||||
|
||||
@ -451,10 +450,6 @@ DRIVER_INIT_MEMBER(svision_state,svision)
|
||||
m_sound = machine().device<svision_sound_device>("custom");
|
||||
m_dma_finished = m_sound->dma_finished();
|
||||
m_pet.on = FALSE;
|
||||
m_user1 = memregion("user1");
|
||||
m_bank1 = membank("bank1");
|
||||
m_bank2 = membank("bank2");
|
||||
m_bank2->set_base(m_user1->base() + 0x1c000);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(svision_state,svisions)
|
||||
@ -462,68 +457,51 @@ DRIVER_INIT_MEMBER(svision_state,svisions)
|
||||
m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this));
|
||||
m_sound = machine().device<svision_sound_device>("custom");
|
||||
m_dma_finished = m_sound->dma_finished();
|
||||
m_user1 = memregion("user1");
|
||||
m_bank1 = membank("bank1");
|
||||
m_bank2 = membank("bank2");
|
||||
m_bank2->set_base(m_user1->base() + 0x1c000);
|
||||
m_pet.on = TRUE;
|
||||
m_pet.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_pet_timer),this));
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( svision_state, svision_cart )
|
||||
{
|
||||
UINT32 size;
|
||||
dynamic_buffer temp_copy;
|
||||
int mirror, i;
|
||||
|
||||
if (image.software_entry() == NULL)
|
||||
UINT32 size = m_cart->common_get_size("rom");
|
||||
|
||||
if (size > 0x20000)
|
||||
{
|
||||
size = image.length();
|
||||
|
||||
if (size > memregion("user1")->bytes())
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
temp_copy.resize(size);
|
||||
if (image.fread( temp_copy, size) != size)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = image.get_software_region_length("rom");
|
||||
temp_copy.resize(size);
|
||||
memcpy(temp_copy, image.get_software_region("rom"), size);
|
||||
}
|
||||
|
||||
mirror = memregion("user1")->bytes() / size;
|
||||
|
||||
/* With the following, we mirror the cart in the whole "user1" memory region */
|
||||
for (i = 0; i < mirror; i++)
|
||||
{
|
||||
memcpy(memregion("user1")->base() + i * size, temp_copy, size);
|
||||
}
|
||||
|
||||
|
||||
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
void svision_state::machine_start()
|
||||
{
|
||||
int num_banks;
|
||||
astring region_tag;
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
num_banks = m_cart_rom->bytes() / 0x4000;
|
||||
|
||||
m_bank1 = membank("bank1");
|
||||
m_bank2 = membank("bank2");
|
||||
// bank1 is set to the first bank
|
||||
m_bank1->set_base(m_cart_rom->base());
|
||||
// bank2 is set to the last bank
|
||||
m_bank2->set_base(m_cart_rom->base() + (num_banks - 1) * 0x4000);
|
||||
}
|
||||
|
||||
void svision_state::machine_reset()
|
||||
{
|
||||
m_svision.timer_shot = FALSE;
|
||||
*m_dma_finished = FALSE;
|
||||
m_bank1->set_base(m_user1->base());
|
||||
}
|
||||
|
||||
|
||||
MACHINE_RESET_MEMBER(svision_state,tvlink)
|
||||
{
|
||||
m_svision.timer_shot = FALSE;
|
||||
*m_dma_finished = FALSE;
|
||||
m_bank1->set_base(m_user1->base());
|
||||
svision_state::machine_reset();
|
||||
m_tvlink.palette_on = FALSE;
|
||||
|
||||
memset(m_reg + 0x800, 0xff, 0x40); // normally done from m_tvlink microcontroller
|
||||
@ -541,7 +519,6 @@ static MACHINE_CONFIG_START( svision, svision_state )
|
||||
MCFG_CPU_PROGRAM_MAP(svision_mem)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", svision_state, svision_frame_int)
|
||||
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", LCD)
|
||||
MCFG_SCREEN_REFRESH_RATE(61)
|
||||
@ -562,11 +539,10 @@ static MACHINE_CONFIG_START( svision, svision_state )
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
|
||||
|
||||
/* cartridge */
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,ws,sv")
|
||||
MCFG_CARTSLOT_MANDATORY
|
||||
MCFG_CARTSLOT_INTERFACE("svision_cart")
|
||||
MCFG_CARTSLOT_LOAD(svision_state, svision_cart)
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "svision_cart")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,ws,sv")
|
||||
MCFG_GENERIC_MANDATORY
|
||||
MCFG_GENERIC_LOAD(svision_state, svision_cart)
|
||||
|
||||
/* Software lists */
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list","svision")
|
||||
@ -607,7 +583,7 @@ static MACHINE_CONFIG_DERIVED( tvlinkp, svisionp )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START(svision)
|
||||
ROM_REGION(0x20000, "user1", ROMREGION_ERASE00)
|
||||
ROM_REGION(0x20000, "maincpu", ROMREGION_ERASE00)
|
||||
ROM_END
|
||||
|
||||
|
||||
|
@ -7,13 +7,15 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "cpu/m6800/m6800.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "bus/epson_sio/pf10.h"
|
||||
#include "sound/wave.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
#define UPD70008_TAG "4a"
|
||||
#define UPD7508_TAG "2e"
|
||||
#define HD6303_TAG "13d"
|
||||
|
@ -7,6 +7,10 @@
|
||||
#ifndef SVISION_H_
|
||||
#define SVISION_H_
|
||||
|
||||
#include "cpu/m6502/m65c02.h"
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
struct svision_t
|
||||
{
|
||||
emu_timer *timer1;
|
||||
@ -35,6 +39,7 @@ public:
|
||||
svision_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_reg(*this, "reg"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_joy(*this, "JOY"),
|
||||
@ -53,6 +58,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(tvlink_w);
|
||||
DECLARE_DRIVER_INIT(svisions);
|
||||
DECLARE_DRIVER_INIT(svision);
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
DECLARE_PALETTE_INIT(svision);
|
||||
DECLARE_PALETTE_INIT(svisionp);
|
||||
@ -69,13 +75,14 @@ public:
|
||||
|
||||
protected:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
required_shared_ptr<UINT8> m_reg;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_ioport m_joy;
|
||||
optional_ioport m_joy2;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
memory_region *m_user1;
|
||||
memory_region *m_cart_rom;
|
||||
memory_bank *m_bank1;
|
||||
memory_bank *m_bank2;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user