mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
(MESS) misc generic cartslot conversions. while at it, I have added
experimental eprom writing to the beta.c driver (pending more accurate tests). nw.
This commit is contained in:
parent
540b2f00c2
commit
f8ef333fb4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8592,7 +8592,6 @@ src/mess/includes/avigo.h svneol=native#text/plain
|
||||
src/mess/includes/b2m.h svneol=native#text/plain
|
||||
src/mess/includes/bbc.h svneol=native#text/plain
|
||||
src/mess/includes/bebox.h svneol=native#text/plain
|
||||
src/mess/includes/beta.h svneol=native#text/plain
|
||||
src/mess/includes/bk.h svneol=native#text/plain
|
||||
src/mess/includes/bullet.h svneol=native#text/plain
|
||||
src/mess/includes/busicom.h svneol=native#text/plain
|
||||
|
@ -25,13 +25,78 @@
|
||||
|
||||
TODO:
|
||||
|
||||
- write EPROM back to file
|
||||
- verify whether feeding a 0xff-filled 2K binary file as cart allows
|
||||
to write back correctly EPROM or not
|
||||
|
||||
*/
|
||||
|
||||
#include "includes/beta.h"
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "machine/6532riot.h"
|
||||
#include "machine/ram.h"
|
||||
#include "sound/speaker.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
#include "beta.lh"
|
||||
|
||||
#define SCREEN_TAG "screen"
|
||||
#define M6502_TAG "m6502"
|
||||
#define M6532_TAG "m6532"
|
||||
#define EPROM_TAG "eprom"
|
||||
//#define SPEAKER_TAG "b237"
|
||||
|
||||
class beta_state : public driver_device
|
||||
{
|
||||
public:
|
||||
beta_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, M6502_TAG),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_eprom(*this, EPROM_TAG),
|
||||
m_q6(*this, "Q6"),
|
||||
m_q7(*this, "Q7"),
|
||||
m_q8(*this, "Q8"),
|
||||
m_q9(*this, "Q9")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<generic_slot_device> m_eprom;
|
||||
required_ioport m_q6;
|
||||
required_ioport m_q7;
|
||||
required_ioport m_q8;
|
||||
required_ioport m_q9;
|
||||
|
||||
virtual void machine_start();
|
||||
|
||||
DECLARE_READ8_MEMBER( riot_pa_r );
|
||||
DECLARE_WRITE8_MEMBER( riot_pa_w );
|
||||
DECLARE_READ8_MEMBER( riot_pb_r );
|
||||
DECLARE_WRITE8_MEMBER( riot_pb_w );
|
||||
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
|
||||
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( beta_eprom );
|
||||
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom );
|
||||
|
||||
/* EPROM state */
|
||||
int m_eprom_oe;
|
||||
int m_eprom_ce;
|
||||
UINT16 m_eprom_addr;
|
||||
UINT8 m_eprom_data;
|
||||
UINT8 m_old_data;
|
||||
dynamic_buffer m_eprom_rom;
|
||||
|
||||
/* display state */
|
||||
UINT8 m_ls145_p;
|
||||
UINT8 m_segment;
|
||||
|
||||
emu_timer *m_led_refresh_timer;
|
||||
TIMER_CALLBACK_MEMBER(led_refresh);
|
||||
};
|
||||
|
||||
|
||||
/* Memory Maps */
|
||||
|
||||
static ADDRESS_MAP_START( beta_mem, AS_PROGRAM, 8, beta_state )
|
||||
@ -122,7 +187,7 @@ READ8_MEMBER( beta_state::riot_pa_r )
|
||||
default:
|
||||
if (!m_eprom_oe && !m_eprom_ce)
|
||||
{
|
||||
data = m_eprom->base()[m_eprom_addr & 0x7ff];
|
||||
data = m_eprom_rom[m_eprom_addr & 0x7ff];
|
||||
popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data);
|
||||
}
|
||||
}
|
||||
@ -209,19 +274,34 @@ WRITE8_MEMBER( beta_state::riot_pb_w )
|
||||
if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7)))
|
||||
{
|
||||
popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data);
|
||||
m_eprom->base()[m_eprom_addr & 0x7ff] &= m_eprom_data;
|
||||
m_eprom_rom[m_eprom_addr & 0x7ff] &= m_eprom_data;
|
||||
}
|
||||
|
||||
m_old_data = data;
|
||||
}
|
||||
|
||||
/* Quickload */
|
||||
/* EPROM socket */
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom )
|
||||
{
|
||||
UINT32 size = m_eprom->common_get_size("rom");
|
||||
|
||||
if (size != 0x800)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom");
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom )
|
||||
{
|
||||
UINT8 *ptr = m_eprom->base();
|
||||
|
||||
image.fwrite(ptr, 0x800);
|
||||
if (image.software_entry() == NULL)
|
||||
image.fwrite(m_eprom_rom, 0x800);
|
||||
}
|
||||
|
||||
/* Machine Initialization */
|
||||
@ -230,12 +310,23 @@ void beta_state::machine_start()
|
||||
{
|
||||
m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this));
|
||||
|
||||
m_eprom_rom.resize(0x800);
|
||||
|
||||
if (!m_eprom->exists())
|
||||
memset(m_eprom_rom, 0xff, 0x800);
|
||||
else
|
||||
{
|
||||
astring region_tag;
|
||||
memcpy(m_eprom_rom, memregion(region_tag.cpy(m_eprom->tag()).cat(GENERIC_ROM_REGION_TAG))->base(), 0x800);
|
||||
}
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_eprom_oe));
|
||||
save_item(NAME(m_eprom_ce));
|
||||
save_item(NAME(m_eprom_addr));
|
||||
save_item(NAME(m_eprom_data));
|
||||
save_item(NAME(m_old_data));
|
||||
save_item(NAME(m_eprom_rom));
|
||||
save_item(NAME(m_ls145_p));
|
||||
save_item(NAME(m_segment));
|
||||
}
|
||||
@ -264,10 +355,10 @@ static MACHINE_CONFIG_START( beta, beta_state )
|
||||
MCFG_RIOT6532_IRQ_CB(INPUTLINE(M6502_TAG, M6502_IRQ_LINE))
|
||||
|
||||
/* EPROM socket */
|
||||
MCFG_CARTSLOT_ADD(EPROM_TAG)
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_CARTSLOT_UNLOAD(beta_state,beta_eprom)
|
||||
MCFG_GENERIC_CARTSLOT_ADD(EPROM_TAG, generic_plain_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
MCFG_GENERIC_LOAD(beta_state, beta_eprom)
|
||||
MCFG_GENERIC_UNLOAD(beta_state, beta_eprom)
|
||||
|
||||
/* internal ram */
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
@ -279,9 +370,6 @@ MACHINE_CONFIG_END
|
||||
ROM_START( beta )
|
||||
ROM_REGION( 0x10000, M6502_TAG, 0 )
|
||||
ROM_LOAD( "beta.rom", 0x8000, 0x0800, CRC(d42fdb17) SHA1(595225a0cd43dd76c46b2aff6c0f27d5991cc4f0))
|
||||
|
||||
ROM_REGION( 0x800, EPROM_TAG, ROMREGION_ERASEFF )
|
||||
ROM_CART_LOAD( EPROM_TAG, 0x0000, 0x0800, ROM_FULLSIZE )
|
||||
ROM_END
|
||||
|
||||
/* System Drivers */
|
||||
|
@ -103,9 +103,7 @@ static MACHINE_CONFIG_START( gamecom, gamecom_state )
|
||||
|
||||
//MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
|
||||
/* video hardware */
|
||||
|
||||
MCFG_SCREEN_ADD("screen", LCD)
|
||||
MCFG_SCREEN_REFRESH_RATE( 59.732155 )
|
||||
MCFG_SCREEN_VBLANK_TIME(500)
|
||||
@ -126,15 +124,15 @@ static MACHINE_CONFIG_START( gamecom, gamecom_state )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00)
|
||||
|
||||
/* cartridge */
|
||||
MCFG_CARTSLOT_ADD("cart1")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,tgc")
|
||||
MCFG_CARTSLOT_INTERFACE("gamecom_cart")
|
||||
MCFG_CARTSLOT_LOAD(gamecom_state,gamecom_cart1)
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_linear_slot, "gamecom_cart")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,tgc")
|
||||
MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart1)
|
||||
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_linear_slot, "gamecom_cart")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,tgc")
|
||||
MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart2)
|
||||
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list","gamecom")
|
||||
MCFG_CARTSLOT_ADD("cart2")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin,tgc")
|
||||
MCFG_CARTSLOT_INTERFACE("gamecom_cart")
|
||||
MCFG_CARTSLOT_LOAD(gamecom_state,gamecom_cart2)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( gamecom )
|
||||
@ -143,9 +141,6 @@ ROM_START( gamecom )
|
||||
|
||||
ROM_REGION( 0x40000, "kernel", 0 )
|
||||
ROM_LOAD( "external.bin", 0x00000, 0x40000, CRC(e235a589) SHA1(97f782e72d738f4d7b861363266bf46b438d9b50) )
|
||||
|
||||
ROM_REGION( 0x200000, "cart1", ROMREGION_ERASEFF )
|
||||
ROM_REGION( 0x200000, "cart2", ROMREGION_ERASEFF )
|
||||
ROM_END
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
|
||||
|
@ -134,7 +134,8 @@ irq vector 0x26:
|
||||
#include "sound/wave.h"
|
||||
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
#include "formats/p6001_cas.h"
|
||||
|
||||
|
||||
@ -147,10 +148,10 @@ public:
|
||||
m_ram(*this, "ram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_cas_hack(*this, "cas_hack"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_region_maincpu(*this, "maincpu"),
|
||||
m_region_gfx1(*this, "gfx1"),
|
||||
m_region_cas(*this, "cas"),
|
||||
m_region_cart_img(*this, "cart_img"),
|
||||
m_io_mode4_dsw(*this, "MODE4_DSW"),
|
||||
m_io_p1(*this, "P1"),
|
||||
m_io_p2(*this, "P2"),
|
||||
@ -266,15 +267,14 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(pc6001_8255_portb_w);
|
||||
DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w);
|
||||
DECLARE_READ8_MEMBER(pc6001_8255_portc_r);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc6001_cass);
|
||||
IRQ_CALLBACK_MEMBER(pc6001_irq_callback);
|
||||
protected:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<device_t> m_cassette;
|
||||
optional_device<cassette_image_device> m_cassette;
|
||||
optional_device<generic_slot_device> m_cas_hack;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
required_memory_region m_region_maincpu;
|
||||
required_memory_region m_region_gfx1;
|
||||
required_memory_region m_region_cas;
|
||||
required_memory_region m_region_cart_img;
|
||||
required_ioport m_io_mode4_dsw;
|
||||
required_ioport m_io_p1;
|
||||
required_ioport m_io_p2;
|
||||
@ -292,6 +292,8 @@ protected:
|
||||
optional_memory_bank m_bank8;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
memory_region *m_cart_rom;
|
||||
|
||||
void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr);
|
||||
void draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr);
|
||||
void draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr);
|
||||
@ -906,15 +908,12 @@ WRITE8_MEMBER(pc6001_state::nec_ppi8255_w)
|
||||
m_port_c_8255 |= 0xa8;
|
||||
|
||||
{
|
||||
UINT8 *gfx_data = m_region_gfx1->base();
|
||||
UINT8 *ext_rom = m_region_cart_img->base();
|
||||
|
||||
//printf("%02x\n",data);
|
||||
|
||||
if((data & 0x0f) == 0x05)
|
||||
m_bank1->set_base(&ext_rom[0x2000]);
|
||||
if((data & 0x0f) == 0x04)
|
||||
m_bank1->set_base(&gfx_data[0]);
|
||||
if ((data & 0x0f) == 0x05 && m_cart_rom)
|
||||
m_bank1->set_base(m_cart_rom->base() + 0x2000);
|
||||
if ((data & 0x0f) == 0x04)
|
||||
m_bank1->set_base(m_region_gfx1->base());
|
||||
}
|
||||
}
|
||||
m_ppi->write(space,offset,data);
|
||||
@ -923,7 +922,7 @@ WRITE8_MEMBER(pc6001_state::nec_ppi8255_w)
|
||||
static ADDRESS_MAP_START(pc6001_map, AS_PROGRAM, 8, pc6001_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP
|
||||
AM_RANGE(0x4000, 0x5fff) AM_ROM AM_REGION("cart_img",0)
|
||||
//AM_RANGE(0x4000, 0x5fff) // mapped by the cartslot
|
||||
AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram")
|
||||
ADDRESS_MAP_END
|
||||
@ -1639,15 +1638,12 @@ WRITE8_MEMBER(pc6001_state::necsr_ppi8255_w)
|
||||
|
||||
if(0)
|
||||
{
|
||||
UINT8 *gfx_data = m_region_gfx1->base();
|
||||
UINT8 *ext_rom = m_region_cart_img->base();
|
||||
|
||||
//printf("%02x\n",data);
|
||||
|
||||
if((data & 0x0f) == 0x05)
|
||||
m_bank1->set_base(&ext_rom[0x2000]);
|
||||
if((data & 0x0f) == 0x04)
|
||||
m_bank1->set_base(&gfx_data[0]);
|
||||
|
||||
if ((data & 0x0f) == 0x05 && m_cart_rom)
|
||||
m_bank1->set_base(m_cart_rom->base() + 0x2000);
|
||||
if ((data & 0x0f) == 0x04)
|
||||
m_bank1->set_base(m_region_gfx1->base());
|
||||
}
|
||||
}
|
||||
m_ppi->write(space,offset,data);
|
||||
@ -1994,27 +1990,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::cassette_callback)
|
||||
if(m_cas_switch == 1)
|
||||
{
|
||||
#if 0
|
||||
static UINT8 cas_data_i = 0x80,cas_data_poll;
|
||||
//m_cur_keycode = gfx_data[m_cas_offset++];
|
||||
if(m_cassette->input() > 0.03)
|
||||
cas_data_poll|= cas_data_i;
|
||||
else
|
||||
cas_data_poll&=~cas_data_i;
|
||||
if(cas_data_i == 1)
|
||||
{
|
||||
m_cur_keycode = cas_data_poll;
|
||||
cas_data_i = 0x80;
|
||||
/* data ready, poll irq */
|
||||
m_irq_vector = 0x08;
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
cas_data_i>>=1;
|
||||
static UINT8 cas_data_i = 0x80,cas_data_poll;
|
||||
//m_cur_keycode = gfx_data[m_cas_offset++];
|
||||
if(m_cassette->input() > 0.03)
|
||||
cas_data_poll|= cas_data_i;
|
||||
else
|
||||
cas_data_poll&=~cas_data_i;
|
||||
if(cas_data_i == 1)
|
||||
{
|
||||
m_cur_keycode = cas_data_poll;
|
||||
cas_data_i = 0x80;
|
||||
/* data ready, poll irq */
|
||||
m_irq_vector = 0x08;
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
cas_data_i>>=1;
|
||||
#else
|
||||
UINT8 *cas_data = m_region_cas->base();
|
||||
|
||||
m_cur_keycode = cas_data[m_cas_offset++];
|
||||
popmessage("%04x %04x",m_cas_offset,m_cas_maxsize);
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
m_cur_keycode = m_cas_hack->read_rom(space, m_cas_offset++);
|
||||
popmessage("%04x %04x", m_cas_offset, m_cas_maxsize);
|
||||
if(m_cas_offset > m_cas_maxsize)
|
||||
{
|
||||
m_cas_offset = 0;
|
||||
@ -2078,14 +2073,19 @@ void pc6001_state::machine_start()
|
||||
|
||||
void pc6001_state::machine_reset()
|
||||
{
|
||||
UINT8 *work_ram = m_region_maincpu->base();
|
||||
|
||||
m_video_ram = work_ram + 0xc000;
|
||||
m_video_ram = m_region_maincpu->base() + 0xc000;
|
||||
|
||||
if (m_cart->exists())
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
|
||||
|
||||
astring region_tag;
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
|
||||
m_port_c_8255=0;
|
||||
|
||||
m_cas_switch = 0;
|
||||
m_cas_offset = 0;
|
||||
m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
|
||||
m_timer_irq_mask = 1;
|
||||
m_timer_irq_mask2 = 1;
|
||||
m_timer_irq_vector = 0x06; // actually vector is fixed in plain PC-6001
|
||||
@ -2094,14 +2094,19 @@ void pc6001_state::machine_reset()
|
||||
|
||||
MACHINE_RESET_MEMBER(pc6001_state,pc6001m2)
|
||||
{
|
||||
UINT8 *work_ram = m_region_maincpu->base();
|
||||
|
||||
m_video_ram = work_ram + 0xc000 + 0x28000;
|
||||
|
||||
m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000;
|
||||
|
||||
astring region_tag;
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
// hackish way to simplify bankswitch handling
|
||||
if (m_cart_rom)
|
||||
memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000);
|
||||
|
||||
m_port_c_8255=0;
|
||||
|
||||
m_cas_switch = 0;
|
||||
m_cas_offset = 0;
|
||||
m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
|
||||
|
||||
/* set default bankswitch */
|
||||
{
|
||||
@ -2128,14 +2133,17 @@ MACHINE_RESET_MEMBER(pc6001_state,pc6001m2)
|
||||
|
||||
MACHINE_RESET_MEMBER(pc6001_state,pc6001sr)
|
||||
{
|
||||
UINT8 *work_ram = m_region_maincpu->base();
|
||||
|
||||
m_video_ram = work_ram + 0x70000;
|
||||
|
||||
m_video_ram = m_region_maincpu->base() + 0x70000;
|
||||
|
||||
astring region_tag;
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
// should this be mirrored into the EXROM regions? hard to tell without an actual cart dump...
|
||||
|
||||
m_port_c_8255=0;
|
||||
|
||||
m_cas_switch = 0;
|
||||
m_cas_offset = 0;
|
||||
m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
|
||||
|
||||
/* set default bankswitch */
|
||||
{
|
||||
@ -2235,23 +2243,6 @@ static const cassette_interface pc6001_cassette_interface =
|
||||
};
|
||||
#endif
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( pc6001_state,pc6001_cass )
|
||||
{
|
||||
UINT8 *cas = m_region_cas->base();
|
||||
UINT32 size;
|
||||
|
||||
size = image.length();
|
||||
if (image.fread( cas, size) != size)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
m_cas_maxsize = size;
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
static const gfx_layout char_layout =
|
||||
{
|
||||
8, 16,
|
||||
@ -2318,16 +2309,11 @@ static MACHINE_CONFIG_START( pc6001, pc6001_state )
|
||||
/* uart */
|
||||
MCFG_DEVICE_ADD("uart", I8251, 0)
|
||||
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pc6001_cart")
|
||||
|
||||
// MCFG_CASSETTE_ADD("cassette",pc6001_cassette_interface)
|
||||
MCFG_CARTSLOT_ADD("cassette")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("cas,p6")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_CARTSLOT_INTERFACE("pc6001_cass")
|
||||
MCFG_CARTSLOT_LOAD(pc6001_state,pc6001_cass)
|
||||
// MCFG_CASSETTE_ADD("cassette", pc6001_cassette_interface)
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cas_hack", generic_plain_slot, "pc6001_cass")
|
||||
MCFG_GENERIC_EXTENSIONS("cas,p6")
|
||||
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SOUND_ADD("ay8910", AY8910, PC6001_MAIN_CLOCK/4)
|
||||
@ -2405,11 +2391,6 @@ ROM_START( pc6001 )
|
||||
ROM_RELOAD( 0x1000, 0x1000 )
|
||||
|
||||
ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
|
||||
ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
|
||||
ROM_END
|
||||
|
||||
ROM_START( pc6001a )
|
||||
@ -2423,11 +2404,6 @@ ROM_START( pc6001a )
|
||||
ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) )
|
||||
|
||||
ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
|
||||
ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
|
||||
ROM_END
|
||||
|
||||
ROM_START( pc6001mk2 )
|
||||
@ -2439,7 +2415,7 @@ ROM_START( pc6001mk2 )
|
||||
ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
|
||||
// work ram 0x28000,0x10000
|
||||
// extended work ram 0x38000,0x10000
|
||||
ROM_CART_LOAD("cart", 0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
|
||||
// exrom 0x48000, 0x4000
|
||||
// <invalid> 0x4c000, 0x4000
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF )
|
||||
@ -2450,11 +2426,6 @@ ROM_START( pc6001mk2 )
|
||||
|
||||
ROM_REGION( 0x8000, "gfx2", 0 )
|
||||
ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 )
|
||||
|
||||
ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
|
||||
ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
|
||||
ROM_END
|
||||
|
||||
ROM_START( pc6601 ) /* Variant of pc6001m2 */
|
||||
@ -2464,7 +2435,7 @@ ROM_START( pc6601 ) /* Variant of pc6001m2 */
|
||||
ROM_LOAD( "cgrom60.66", 0x1c000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) )
|
||||
ROM_LOAD( "cgrom66.66", 0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) )
|
||||
ROM_LOAD( "kanjirom.66", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
|
||||
ROM_CART_LOAD("cart", 0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
|
||||
// exrom 0x48000, 0x4000
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF )
|
||||
ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP )
|
||||
@ -2474,11 +2445,6 @@ ROM_START( pc6601 ) /* Variant of pc6001m2 */
|
||||
|
||||
ROM_REGION( 0x8000, "gfx2", 0 )
|
||||
ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 )
|
||||
|
||||
ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
|
||||
ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
|
||||
ROM_END
|
||||
|
||||
ROM_START( pc6001sr )
|
||||
@ -2500,11 +2466,6 @@ ROM_START( pc6001sr )
|
||||
|
||||
ROM_REGION( 0x8000, "gfx2", 0 )
|
||||
ROM_COPY( "maincpu", 0x28000, 0x00000, 0x8000 )
|
||||
|
||||
ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
|
||||
|
||||
ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
|
||||
ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
|
||||
ROM_END
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
|
||||
|
@ -39,14 +39,12 @@
|
||||
|
||||
void pc8401a_state::scan_keyboard()
|
||||
{
|
||||
int row, strobe = 0;
|
||||
|
||||
UINT8 keydata[10] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read(), m_y8->read(), m_y9->read() };
|
||||
int strobe = 0;
|
||||
|
||||
/* scan keyboard */
|
||||
for (row = 0; row < 10; row++)
|
||||
for (int row = 0; row < 10; row++)
|
||||
{
|
||||
UINT8 data = keydata[row];
|
||||
UINT8 data = m_io_y[row]->read();
|
||||
|
||||
if (data != 0xff)
|
||||
{
|
||||
@ -90,11 +88,15 @@ void pc8401a_state::bankswitch(UINT8 data)
|
||||
program.unmap_write(0x0000, 0x7fff);
|
||||
membank("bank1")->set_entry(rombank);
|
||||
}
|
||||
else
|
||||
else if (m_cart_rom)
|
||||
{
|
||||
/* ROM cartridge */
|
||||
program.unmap_readwrite(0x0000, 0x7fff);
|
||||
program.install_read_bank(0x0000, 0x7fff, "bank1");
|
||||
program.unmap_write(0x0000, 0x7fff);
|
||||
membank("bank1")->set_entry(6);
|
||||
}
|
||||
else
|
||||
program.unmap_readwrite(0x0000, 0x7fff);
|
||||
//logerror("0x0000-0x7fff = ROM %u\n", rombank);
|
||||
break;
|
||||
|
||||
@ -264,8 +266,7 @@ WRITE8_MEMBER( pc8401a_state::rtc_ctrl_w )
|
||||
READ8_MEMBER( pc8401a_state::io_rom_data_r )
|
||||
{
|
||||
//logerror("I/O ROM read from %05x\n", m_io_addr);
|
||||
|
||||
return m_io_rom->base()[m_io_addr];
|
||||
return m_io_cart->read_rom(space, m_io_addr);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( pc8401a_state::io_rom_addr_w )
|
||||
@ -345,16 +346,16 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( pc8500_io, AS_IO, 8, pc8401a_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_READ_PORT("Y0")
|
||||
AM_RANGE(0x01, 0x01) AM_READ_PORT("Y1")
|
||||
AM_RANGE(0x02, 0x02) AM_READ_PORT("Y2")
|
||||
AM_RANGE(0x03, 0x03) AM_READ_PORT("Y3")
|
||||
AM_RANGE(0x04, 0x04) AM_READ_PORT("Y4")
|
||||
AM_RANGE(0x05, 0x05) AM_READ_PORT("Y5")
|
||||
AM_RANGE(0x06, 0x06) AM_READ_PORT("Y6")
|
||||
AM_RANGE(0x07, 0x07) AM_READ_PORT("Y7")
|
||||
AM_RANGE(0x08, 0x08) AM_READ_PORT("Y8")
|
||||
AM_RANGE(0x09, 0x09) AM_READ_PORT("Y9")
|
||||
AM_RANGE(0x00, 0x00) AM_READ_PORT("Y.0")
|
||||
AM_RANGE(0x01, 0x01) AM_READ_PORT("Y.1")
|
||||
AM_RANGE(0x02, 0x02) AM_READ_PORT("Y.2")
|
||||
AM_RANGE(0x03, 0x03) AM_READ_PORT("Y.3")
|
||||
AM_RANGE(0x04, 0x04) AM_READ_PORT("Y.4")
|
||||
AM_RANGE(0x05, 0x05) AM_READ_PORT("Y.5")
|
||||
AM_RANGE(0x06, 0x06) AM_READ_PORT("Y.6")
|
||||
AM_RANGE(0x07, 0x07) AM_READ_PORT("Y.7")
|
||||
AM_RANGE(0x08, 0x08) AM_READ_PORT("Y.8")
|
||||
AM_RANGE(0x09, 0x09) AM_READ_PORT("Y.9")
|
||||
AM_RANGE(0x10, 0x10) AM_WRITE(rtc_cmd_w)
|
||||
AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w)
|
||||
AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w)
|
||||
@ -382,7 +383,7 @@ ADDRESS_MAP_END
|
||||
/* Input Ports */
|
||||
|
||||
static INPUT_PORTS_START( pc8401a )
|
||||
PORT_START("Y0")
|
||||
PORT_START("Y.0")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP")// PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
|
||||
@ -392,7 +393,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
|
||||
|
||||
PORT_START("Y1")
|
||||
PORT_START("Y.1")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
|
||||
@ -402,7 +403,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
||||
|
||||
PORT_START("Y2")
|
||||
PORT_START("Y.2")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
|
||||
@ -412,7 +413,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
|
||||
|
||||
PORT_START("Y3")
|
||||
PORT_START("Y.3")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
|
||||
@ -422,7 +423,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
|
||||
|
||||
PORT_START("Y4")
|
||||
PORT_START("Y.4")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('*')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('*')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*')
|
||||
@ -432,7 +433,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
|
||||
|
||||
PORT_START("Y5")
|
||||
PORT_START("Y.5")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('*')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('*')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*')
|
||||
@ -442,7 +443,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('*')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('*')
|
||||
|
||||
PORT_START("Y6")
|
||||
PORT_START("Y.6")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*')
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*')
|
||||
@ -452,7 +453,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*')
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
|
||||
|
||||
PORT_START("Y7")
|
||||
PORT_START("Y.7")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^I
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
|
||||
@ -462,7 +463,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^C
|
||||
|
||||
PORT_START("Y8")
|
||||
PORT_START("Y.8")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7)
|
||||
@ -472,7 +473,7 @@ static INPUT_PORTS_START( pc8401a )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("Y9")
|
||||
PORT_START("Y.9")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8)
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10)
|
||||
@ -487,6 +488,9 @@ INPUT_PORTS_END
|
||||
|
||||
void pc8401a_state::machine_start()
|
||||
{
|
||||
astring region_tag;
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
|
||||
/* initialize RTC */
|
||||
m_rtc->cs_w(1);
|
||||
|
||||
@ -498,6 +502,8 @@ void pc8401a_state::machine_start()
|
||||
/* set up A0/A1 memory banking */
|
||||
membank("bank1")->configure_entries(0, 4, m_rom->base(), 0x8000);
|
||||
membank("bank1")->configure_entries(4, 2, ram, 0x8000);
|
||||
if (m_cart_rom)
|
||||
membank("bank1")->configure_entries(6, 1, m_cart_rom->base(), 0x8000);
|
||||
membank("bank1")->set_entry(0);
|
||||
|
||||
/* set up A2 memory banking */
|
||||
@ -515,7 +521,7 @@ void pc8401a_state::machine_start()
|
||||
|
||||
/* bank switch */
|
||||
bankswitch(0);
|
||||
|
||||
|
||||
/* register for state saving */
|
||||
save_item(NAME(m_mmr));
|
||||
save_item(NAME(m_io_addr));
|
||||
@ -590,14 +596,12 @@ static MACHINE_CONFIG_START( pc8401a, pc8401a_state )
|
||||
MCFG_FRAGMENT_ADD(pc8401a_video)
|
||||
|
||||
/* option ROM cartridge */
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
/* I/O ROM cartridge */
|
||||
MCFG_CARTSLOT_ADD("iocart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
/* internal ram */
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
@ -634,14 +638,12 @@ static MACHINE_CONFIG_START( pc8500, pc8500_state )
|
||||
MCFG_FRAGMENT_ADD(pc8500_video)
|
||||
|
||||
/* option ROM cartridge */
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
/* I/O ROM cartridge */
|
||||
MCFG_CARTSLOT_ADD("iocart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL)
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
|
||||
/* internal ram */
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
@ -654,25 +656,17 @@ MACHINE_CONFIG_END
|
||||
ROM_START( pc8401a )
|
||||
ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF )
|
||||
ROM_LOAD( "pc8401a.bin", 0x0000, 0x18000, NO_DUMP )
|
||||
ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL)
|
||||
|
||||
ROM_REGION( 0x1000, "chargen", 0 )
|
||||
ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF )
|
||||
ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL)
|
||||
ROM_END
|
||||
|
||||
ROM_START( pc8500 )
|
||||
ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF )
|
||||
ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) )
|
||||
ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL)
|
||||
|
||||
ROM_REGION( 0x1000, "chargen", 0 )
|
||||
ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF )
|
||||
ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL)
|
||||
ROM_END
|
||||
|
||||
/* System Drivers */
|
||||
|
@ -106,8 +106,8 @@ TODO:
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "audio/socrates.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
class socrates_state : public driver_device
|
||||
{
|
||||
@ -122,19 +122,26 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_sound(*this, "soc_snd"),
|
||||
m_screen(*this, "screen")
|
||||
m_screen(*this, "screen"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_bios_reg(*this, "maincpu"),
|
||||
m_vram_reg(*this, "vram")
|
||||
{ }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<socrates_snd_device> m_sound;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
|
||||
rgb_t m_palette_val[256];
|
||||
|
||||
required_memory_region m_bios_reg;
|
||||
required_memory_region m_vram_reg;
|
||||
memory_region *m_cart_reg;
|
||||
|
||||
UINT8 m_data[8];
|
||||
UINT8 m_rom_bank;
|
||||
UINT8 m_ram_bank;
|
||||
UINT16 m_scroll_offset;
|
||||
UINT8* m_videoram;
|
||||
UINT8 m_kb_latch_low[2];
|
||||
UINT8 m_kb_latch_high[2];
|
||||
UINT8 m_kb_latch_mouse;
|
||||
@ -235,15 +242,21 @@ private:
|
||||
|
||||
/* Devices */
|
||||
|
||||
void socrates_state::socrates_set_rom_bank( )
|
||||
void socrates_state::socrates_set_rom_bank()
|
||||
{
|
||||
membank( "bank1" )->set_base( memregion("maincpu")->base() + ( m_rom_bank * 0x4000 ));
|
||||
if (m_cart_reg && m_rom_bank >= 0x10)
|
||||
{
|
||||
int bank = m_rom_bank % (m_cart->get_rom_size() / 0x4000);
|
||||
membank("bank1")->set_base(m_cart_reg->base() + (bank * 0x4000));
|
||||
}
|
||||
else
|
||||
membank("bank1")->set_base(m_bios_reg->base() + (m_rom_bank * 0x4000));
|
||||
}
|
||||
|
||||
void socrates_state::socrates_set_ram_bank( )
|
||||
void socrates_state::socrates_set_ram_bank()
|
||||
{
|
||||
membank( "bank2" )->set_base( memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0
|
||||
membank( "bank3" )->set_base( memregion("vram")->base() + ( ((m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
|
||||
membank("bank2")->set_base(m_vram_reg->base() + ( (m_ram_bank & 0x3) * 0x4000)); // window 0
|
||||
membank("bank3")->set_base(m_vram_reg->base() + (((m_ram_bank & 0xc) >> 2) * 0x4000)); // window 1
|
||||
}
|
||||
|
||||
void socrates_state::socrates_update_kb( )
|
||||
@ -304,6 +317,9 @@ void socrates_state::socrates_check_kb_latch( ) // if kb[1] is full and kb[0] i
|
||||
|
||||
void socrates_state::machine_reset()
|
||||
{
|
||||
astring region_tag;
|
||||
m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
|
||||
m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere...
|
||||
socrates_set_rom_bank();
|
||||
m_ram_bank = 0; // the actual console sets it semi randomly on power up, and the bios cleans it up.
|
||||
@ -343,9 +359,9 @@ void socrates_state::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
DRIVER_INIT_MEMBER(socrates_state,socrates)
|
||||
{
|
||||
UINT8 *gfx = memregion("vram")->base();
|
||||
int i;
|
||||
|
||||
/* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */
|
||||
for (i = 0; i < 0x10000; i++)
|
||||
for (int i = 0; i < 0x10000; i++)
|
||||
gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff));
|
||||
// init sound channels to both be on lowest pitch and max volume
|
||||
m_maincpu->set_clock_scale(0.45f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */
|
||||
@ -714,7 +730,6 @@ PALETTE_INIT_MEMBER(socrates_state, socrates)
|
||||
|
||||
void socrates_state::video_start()
|
||||
{
|
||||
m_videoram = memregion("vram")->base();
|
||||
m_scroll_offset = 0;
|
||||
}
|
||||
|
||||
@ -724,6 +739,7 @@ UINT32 socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7
|
||||
};
|
||||
UINT8 *videoram = m_vram_reg->base();
|
||||
int x, y, colidx, color;
|
||||
int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000
|
||||
for (y = 0; y < 228; y++)
|
||||
@ -733,19 +749,19 @@ UINT32 socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
if (x < 256)
|
||||
{
|
||||
colidx = m_videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff];
|
||||
colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff];
|
||||
if (x&1) colidx >>=4;
|
||||
colidx &= 0xF;
|
||||
if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
|
||||
if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
|
||||
else color=fixedcolors[colidx];
|
||||
bitmap.pix16(y, x) = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
colidx = m_videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff];
|
||||
colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff];
|
||||
colidx >>=4;
|
||||
colidx &= 0xF;
|
||||
if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
|
||||
if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
|
||||
else color=fixedcolors[colidx];
|
||||
bitmap.pix16(y, x) = color;
|
||||
}
|
||||
@ -791,18 +807,20 @@ int iqunlim_state::get_color(int index, int y)
|
||||
if (index < 8)
|
||||
return m_colors[index];
|
||||
else
|
||||
return m_videoram[0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)];
|
||||
return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff));
|
||||
}
|
||||
|
||||
UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *videoram = m_vram_reg->base();
|
||||
|
||||
// bitmap layer
|
||||
for (int y=0; y<224; y++)
|
||||
{
|
||||
if (y >= m_video_regs[0x03]) break;
|
||||
for (int x=0; x<128; x++)
|
||||
{
|
||||
UINT8 data = m_videoram[(m_scroll_offset + y) * 0x80 + x];
|
||||
UINT8 data = videoram[(m_scroll_offset + y) * 0x80 + x];
|
||||
|
||||
for(int b=0; b<2; b++)
|
||||
{
|
||||
@ -819,8 +837,8 @@ UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
|
||||
{
|
||||
for (int x=0; x<line_len; x++)
|
||||
{
|
||||
UINT8 c = m_videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x];
|
||||
UINT8 *gfx = &m_videoram[0x8000 + (c & 0x7f) * 8];
|
||||
UINT8 c = videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x];
|
||||
UINT8 *gfx = &videoram[0x8000 + (c & 0x7f) * 8];
|
||||
|
||||
for (int cy=0; cy<8; cy++)
|
||||
{
|
||||
@ -878,18 +896,22 @@ WRITE8_MEMBER( iqunlim_state::video_regs_w )
|
||||
|
||||
void iqunlim_state::machine_start()
|
||||
{
|
||||
UINT8 *bios = memregion("bios")->base();
|
||||
UINT8 *cart = memregion("cart")->base();
|
||||
UINT8 *ram = memregion("vram")->base();
|
||||
astring region_tag;
|
||||
m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
|
||||
UINT8 *bios = m_bios_reg->base();
|
||||
UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base();
|
||||
UINT8 *ram = m_vram_reg->base();
|
||||
|
||||
m_bank1->configure_entries(0x00, 0x10, bios, 0x4000);
|
||||
m_bank1->configure_entries(0x10, 0x10, cart , 0x4000);
|
||||
m_bank1->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000);
|
||||
m_bank1->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000);
|
||||
m_bank1->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000);
|
||||
|
||||
m_bank2->configure_entries(0x00, 0x10, bios, 0x4000);
|
||||
m_bank2->configure_entries(0x10, 0x10, cart , 0x4000);
|
||||
m_bank2->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000);
|
||||
m_bank2->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000);
|
||||
m_bank2->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000);
|
||||
|
||||
m_bank3->configure_entries(0x00, 0x08, ram, 0x4000);
|
||||
m_bank4->configure_entries(0x00, 0x08, ram, 0x4000);
|
||||
@ -998,7 +1020,7 @@ static ADDRESS_MAP_START(z80_io, AS_IO, 8, socrates_state )
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */
|
||||
AM_RANGE(0x08, 0x08) AM_READWRITE(socrates_ram_bank_r, socrates_ram_bank_w) AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */
|
||||
AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section:
|
||||
0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions)
|
||||
0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions)
|
||||
0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above
|
||||
0x12 - W - 0b***EVVVV enable, volume control for channel 1
|
||||
0x13 - W - 0b***EVVVV enable, volume control for channel 2
|
||||
@ -1386,10 +1408,7 @@ static MACHINE_CONFIG_START( socrates, socrates_state )
|
||||
MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) // this is correct, as strange as it sounds.
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_CARTSLOT_INTERFACE("socrates_cart")
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart")
|
||||
|
||||
/* Software lists */
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates")
|
||||
@ -1421,10 +1440,7 @@ static MACHINE_CONFIG_START( socrates_pal, socrates_state )
|
||||
MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // TODO: verify divider for pal mode
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_CARTSLOT_INTERFACE("socrates_cart")
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart")
|
||||
|
||||
/* Software lists */
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates")
|
||||
@ -1468,9 +1484,7 @@ static MACHINE_CONFIG_START( iqunlimz, iqunlim_state )
|
||||
MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256))
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
|
||||
MCFG_CARTSLOT_ADD("cart")
|
||||
MCFG_CARTSLOT_EXTENSION_LIST("bin")
|
||||
MCFG_CARTSLOT_NOT_MANDATORY
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
/******************************************************************************
|
||||
@ -1514,7 +1528,6 @@ ROM_START(socrates)
|
||||
if all tests passed, jump to 0x4000 (0x0000 in cart rom)
|
||||
*/
|
||||
ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) // Label: "(Vtech) 27-00817-000-000 // (C)1987 VIDEO TECHNOLOGY // 8811 D"
|
||||
ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
|
||||
|
||||
ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
|
||||
|
||||
@ -1536,7 +1549,6 @@ ROM_START(socratfc)
|
||||
ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3))
|
||||
/* Socrates SAITOUT (French Canadian) NTSC */
|
||||
ROM_LOAD("27-00884-001-000.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D"
|
||||
ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
|
||||
|
||||
ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
|
||||
|
||||
@ -1560,7 +1572,6 @@ ROM_START(profweis)
|
||||
ROMX_LOAD("lh53216d.u1", 0x00000, 0x40000, CRC(6e801762) SHA1(b80574a3abacf18133dacb9d3a8d9e2916730423), ROM_BIOS(1)) // Label: "(Vtech) LH53216D // (C)1989 VIDEO TECHNOLOGY // 9119 D"
|
||||
ROM_SYSTEM_BIOS(1, "88", "1988")
|
||||
ROMX_LOAD("27-00885-001-000.u1", 0x00000, 0x40000, CRC(fcaf8850) SHA1(a99011ee6a1ef63461c00d062278951252f117db), ROM_BIOS(2)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D"
|
||||
ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
|
||||
|
||||
ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
|
||||
|
||||
@ -1576,12 +1587,9 @@ ROM_START(profweis)
|
||||
ROM_END
|
||||
|
||||
ROM_START( iqunlimz )
|
||||
ROM_REGION( 0x80000, "bios", 0 )
|
||||
ROM_REGION( 0x80000, "maincpu", 0 )
|
||||
ROM_LOAD( "vtech.bin", 0x000000, 0x080000, CRC(f100c8a7) SHA1(6ad2a8accae2dd5c5c46ae953eef33cdd1ea3cf9) )
|
||||
|
||||
ROM_REGION( 0x80000, "cart", ROMREGION_ERASEFF )
|
||||
ROM_CART_LOAD( "cart", 0, 0x80000, 0 )
|
||||
|
||||
ROM_REGION( 0x20000, "vram", ROMREGION_ERASE )
|
||||
ROM_END
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Curt Coder
|
||||
#pragma once
|
||||
|
||||
#ifndef __BETA__
|
||||
#define __BETA__
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "machine/6532riot.h"
|
||||
#include "sound/speaker.h"
|
||||
#include "machine/ram.h"
|
||||
|
||||
#define SCREEN_TAG "screen"
|
||||
#define M6502_TAG "m6502"
|
||||
#define M6532_TAG "m6532"
|
||||
#define EPROM_TAG "eprom"
|
||||
//#define SPEAKER_TAG "b237"
|
||||
|
||||
class beta_state : public driver_device
|
||||
{
|
||||
public:
|
||||
beta_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, M6502_TAG),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_eprom(*this, EPROM_TAG),
|
||||
m_q6(*this, "Q6"),
|
||||
m_q7(*this, "Q7"),
|
||||
m_q8(*this, "Q8"),
|
||||
m_q9(*this, "Q9")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_memory_region m_eprom;
|
||||
required_ioport m_q6;
|
||||
required_ioport m_q7;
|
||||
required_ioport m_q8;
|
||||
required_ioport m_q9;
|
||||
|
||||
virtual void machine_start();
|
||||
|
||||
DECLARE_READ8_MEMBER( riot_pa_r );
|
||||
DECLARE_WRITE8_MEMBER( riot_pa_w );
|
||||
DECLARE_READ8_MEMBER( riot_pb_r );
|
||||
DECLARE_WRITE8_MEMBER( riot_pb_w );
|
||||
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
|
||||
|
||||
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom );
|
||||
|
||||
/* EPROM state */
|
||||
int m_eprom_oe;
|
||||
int m_eprom_ce;
|
||||
UINT16 m_eprom_addr;
|
||||
UINT8 m_eprom_data;
|
||||
UINT8 m_old_data;
|
||||
|
||||
/* display state */
|
||||
UINT8 m_ls145_p;
|
||||
UINT8 m_segment;
|
||||
|
||||
emu_timer *m_led_refresh_timer;
|
||||
TIMER_CALLBACK_MEMBER(led_refresh);
|
||||
};
|
||||
|
||||
#endif
|
@ -13,9 +13,11 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/sm8500/sm8500.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "rendlay.h"
|
||||
#include "sound/dac.h"
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
#include "rendlay.h"
|
||||
|
||||
/* SM8521 register addresses */
|
||||
enum
|
||||
@ -213,6 +215,8 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_dac(*this, "dac"),
|
||||
m_cart1(*this, "cartslot1"),
|
||||
m_cart2(*this, "cartslot2"),
|
||||
m_p_nvram(*this,"p_nvram"),
|
||||
m_p_videoram(*this,"p_videoram"),
|
||||
m_bank1(*this, "bank1"),
|
||||
@ -230,6 +234,8 @@ public:
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<dac_device> m_dac;
|
||||
required_device<generic_slot_device> m_cart1;
|
||||
required_device<generic_slot_device> m_cart2;
|
||||
DECLARE_READ8_MEMBER( gamecom_internal_r );
|
||||
DECLARE_READ8_MEMBER( gamecom_pio_r );
|
||||
DECLARE_WRITE8_MEMBER( gamecom_internal_w );
|
||||
@ -237,9 +243,9 @@ public:
|
||||
required_shared_ptr<UINT8> m_p_nvram;
|
||||
UINT8 *m_p_ram;
|
||||
required_shared_ptr<UINT8> m_p_videoram;
|
||||
UINT8 *m_cartridge1;
|
||||
UINT8 *m_cartridge2;
|
||||
UINT8 *m_cartridge;
|
||||
UINT8 *m_cart_ptr;
|
||||
memory_region *m_cart1_rom;
|
||||
memory_region *m_cart2_rom;
|
||||
emu_timer *m_clock_timer;
|
||||
emu_timer *m_scanline_timer;
|
||||
GAMECOM_DMA m_dma;
|
||||
@ -268,6 +274,7 @@ public:
|
||||
TIMER_CALLBACK_MEMBER(gamecom_scanline);
|
||||
DECLARE_WRITE8_MEMBER( gamecom_handle_dma );
|
||||
DECLARE_WRITE8_MEMBER( gamecom_update_timers );
|
||||
int common_load(device_image_interface &image, generic_slot_device *slot);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart1 );
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart2 );
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "imagedev/cartslot.h"
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/ram.h"
|
||||
@ -16,6 +15,9 @@
|
||||
#include "video/mc6845.h"
|
||||
#include "video/sed1330.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
|
||||
#define SCREEN_TAG "screen"
|
||||
#define CRT_SCREEN_TAG "screen2"
|
||||
|
||||
@ -40,20 +42,12 @@ public:
|
||||
m_lcdc(*this, SED1330_TAG),
|
||||
m_crtc(*this, MC6845_TAG),
|
||||
m_screen_lcd(*this, SCREEN_TAG),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_io_cart(*this, "io_cart"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_rom(*this, Z80_TAG),
|
||||
m_io_rom(*this, "iorom"),
|
||||
m_crt_ram(*this, "crt_ram"),
|
||||
m_y0(*this, "Y0"),
|
||||
m_y1(*this, "Y1"),
|
||||
m_y2(*this, "Y2"),
|
||||
m_y3(*this, "Y3"),
|
||||
m_y4(*this, "Y4"),
|
||||
m_y5(*this, "Y5"),
|
||||
m_y6(*this, "Y6"),
|
||||
m_y7(*this, "Y7"),
|
||||
m_y8(*this, "Y8"),
|
||||
m_y9(*this, "Y9")
|
||||
m_io_y(*this, "Y")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -61,23 +55,16 @@ public:
|
||||
required_device<sed1330_device> m_lcdc;
|
||||
optional_device<mc6845_device> m_crtc;
|
||||
required_device<screen_device> m_screen_lcd;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
required_device<generic_slot_device> m_io_cart;
|
||||
required_device<ram_device> m_ram;
|
||||
required_memory_region m_rom;
|
||||
required_memory_region m_io_rom;
|
||||
optional_shared_ptr<UINT8> m_crt_ram;
|
||||
required_ioport m_y0;
|
||||
required_ioport m_y1;
|
||||
required_ioport m_y2;
|
||||
required_ioport m_y3;
|
||||
required_ioport m_y4;
|
||||
required_ioport m_y5;
|
||||
required_ioport m_y6;
|
||||
required_ioport m_y7;
|
||||
required_ioport m_y8;
|
||||
required_ioport m_y9;
|
||||
required_ioport_array<10> m_io_y;
|
||||
|
||||
memory_region *m_cart_rom;
|
||||
|
||||
virtual void machine_start();
|
||||
|
||||
virtual void video_start();
|
||||
|
||||
DECLARE_WRITE8_MEMBER( mmr_w );
|
||||
|
@ -16,41 +16,45 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback)
|
||||
void gamecom_state::machine_reset()
|
||||
{
|
||||
UINT8 *rom = m_region_kernel->base();
|
||||
m_bank1->set_base( rom );
|
||||
m_bank2->set_base( rom );
|
||||
m_bank3->set_base( rom );
|
||||
m_bank4->set_base( rom );
|
||||
m_bank1->set_base(rom);
|
||||
m_bank2->set_base(rom);
|
||||
m_bank3->set_base(rom);
|
||||
m_bank4->set_base(rom);
|
||||
|
||||
m_cartridge = NULL;
|
||||
m_cart_ptr = NULL;
|
||||
m_lch_reg = 0x07;
|
||||
m_lcv_reg = 0x27;
|
||||
m_lcdc_reg = 0xb0;
|
||||
|
||||
astring region_tag;
|
||||
m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
}
|
||||
|
||||
void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data )
|
||||
void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data)
|
||||
{
|
||||
if (data < 0x20)
|
||||
{
|
||||
/* select internal ROM bank */
|
||||
switch ( mmu )
|
||||
switch (mmu)
|
||||
{
|
||||
case 1: m_bank1->set_base( m_region_kernel->base() + (data << 13) ); break;
|
||||
case 2: m_bank2->set_base( m_region_kernel->base() + (data << 13) ); break;
|
||||
case 3: m_bank3->set_base( m_region_kernel->base() + (data << 13) ); break;
|
||||
case 4: m_bank4->set_base( m_region_kernel->base() + (data << 13) ); break;
|
||||
case 1: m_bank1->set_base(m_region_kernel->base() + (data << 13)); break;
|
||||
case 2: m_bank2->set_base(m_region_kernel->base() + (data << 13)); break;
|
||||
case 3: m_bank3->set_base(m_region_kernel->base() + (data << 13)); break;
|
||||
case 4: m_bank4->set_base(m_region_kernel->base() + (data << 13)); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* select cartridge bank */
|
||||
if ( m_cartridge )
|
||||
if (m_cart_ptr)
|
||||
{
|
||||
switch ( mmu )
|
||||
switch (mmu)
|
||||
{
|
||||
case 1: m_bank1->set_base( m_cartridge + ( data << 13 ) ); break;
|
||||
case 2: m_bank2->set_base( m_cartridge + ( data << 13 ) ); break;
|
||||
case 3: m_bank3->set_base( m_cartridge + ( data << 13 ) ); break;
|
||||
case 4: m_bank4->set_base( m_cartridge + ( data << 13 ) ); break;
|
||||
case 1: m_bank1->set_base(m_cart_ptr + (data << 13)); break;
|
||||
case 2: m_bank2->set_base(m_cart_ptr + (data << 13)); break;
|
||||
case 3: m_bank3->set_base(m_cart_ptr + (data << 13)); break;
|
||||
case 4: m_bank4->set_base(m_cart_ptr + (data << 13)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,7 +179,7 @@ WRITE8_MEMBER( gamecom_state::gamecom_pio_w )
|
||||
{
|
||||
offset += 0x14;
|
||||
m_p_ram[offset] = data;
|
||||
switch( offset )
|
||||
switch (offset)
|
||||
{
|
||||
case SM8521_P1:
|
||||
case SM8521_P2:
|
||||
@ -184,11 +188,11 @@ WRITE8_MEMBER( gamecom_state::gamecom_pio_w )
|
||||
case SM8521_P3:
|
||||
/* P3 bit7 clear, bit6 set -> enable cartridge port #0? */
|
||||
/* P3 bit6 clear, bit7 set -> enable cartridge port #1? */
|
||||
switch( data & 0xc0 )
|
||||
switch (data & 0xc0)
|
||||
{
|
||||
case 0x40: m_cartridge = m_cartridge1; break;
|
||||
case 0x80: m_cartridge = m_cartridge2; break;
|
||||
default: m_cartridge = NULL; break;
|
||||
case 0x40: m_cart_ptr = m_cart1_rom->base(); break;
|
||||
case 0x80: m_cart_ptr = m_cart2_rom->base(); break;
|
||||
default: m_cart_ptr = NULL; break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -481,17 +485,10 @@ WRITE8_MEMBER( gamecom_state::gamecom_handle_dma )
|
||||
// logerror( "DMA DMBR = %X\n", RAM[SM8521_DMBR] );
|
||||
m_dma.source_width = 64;
|
||||
m_dma.source_mask = 0x3FFF;
|
||||
if ( RAM[SM8521_DMBR] < 16 )
|
||||
{
|
||||
if (RAM[SM8521_DMBR] < 16)
|
||||
m_dma.source_bank = m_region_kernel->base() + (RAM[SM8521_DMBR] << 14);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_cartridge)
|
||||
{
|
||||
m_dma.source_bank = m_cartridge + (RAM[SM8521_DMBR] << 14);
|
||||
}
|
||||
}
|
||||
else if (m_cart_ptr)
|
||||
m_dma.source_bank = m_cart_ptr + (RAM[SM8521_DMBR] << 14);
|
||||
|
||||
m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000];
|
||||
break;
|
||||
@ -637,94 +634,43 @@ DRIVER_INIT_MEMBER(gamecom_state,gamecom)
|
||||
m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 )
|
||||
int gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot)
|
||||
{
|
||||
UINT32 filesize;
|
||||
UINT32 size = slot->common_get_size("rom");
|
||||
UINT32 load_offset = 0;
|
||||
|
||||
m_cartridge1 = memregion("cart1")->base();
|
||||
|
||||
if (image.software_entry() == NULL)
|
||||
filesize = image.length();
|
||||
else
|
||||
filesize = image.get_software_region_length("rom");
|
||||
|
||||
switch(filesize)
|
||||
if (size != 0x008000 && size != 0x040000 && size != 0x080000
|
||||
&& size != 0x100000 && size != 0x1c0000 && size != 0x200000)
|
||||
{
|
||||
case 0x008000: load_offset = 0; break; /* 32 KB */
|
||||
case 0x040000: load_offset = 0; break; /* 256KB */
|
||||
case 0x080000: load_offset = 0; break; /* 512KB */
|
||||
case 0x100000: load_offset = 0; break; /* 1 MB */
|
||||
case 0x1c0000: load_offset = 0x040000; break; /* 1.8MB */
|
||||
case 0x200000: load_offset = 0; break; /* 2 MB */
|
||||
default: /* otherwise */
|
||||
logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize);
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
if (image.software_entry() == NULL)
|
||||
{
|
||||
if (image.fread( m_cartridge1 + load_offset, filesize) != filesize)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
memcpy(m_cartridge1 + load_offset, image.get_software_region("rom"), filesize);
|
||||
|
||||
if (filesize < 0x010000) { memcpy(m_cartridge1 + 0x008000, m_cartridge1, 0x008000); } /* ->64KB */
|
||||
if (filesize < 0x020000) { memcpy(m_cartridge1 + 0x010000, m_cartridge1, 0x010000); } /* ->128KB */
|
||||
if (filesize < 0x040000) { memcpy(m_cartridge1 + 0x020000, m_cartridge1, 0x020000); } /* ->256KB */
|
||||
if (filesize < 0x080000) { memcpy(m_cartridge1 + 0x040000, m_cartridge1, 0x040000); } /* ->512KB */
|
||||
if (filesize < 0x100000) { memcpy(m_cartridge1 + 0x080000, m_cartridge1, 0x080000); } /* ->1MB */
|
||||
if (filesize < 0x1c0000) { memcpy(m_cartridge1 + 0x100000, m_cartridge1, 0x100000); } /* -> >=1.8MB */
|
||||
|
||||
if (size == 0x1c0000)
|
||||
load_offset = 0x40000;
|
||||
|
||||
// in order to simplify banked access from the driver, we always allocate 0x200000,
|
||||
slot->rom_alloc(0x200000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
// we load what we have
|
||||
slot->common_load_rom(slot->get_rom_base() + load_offset, size, "rom");
|
||||
// and then we mirror the content, instead of masking out larger accesses
|
||||
UINT8 *crt = slot->get_rom_base();
|
||||
if (size < 0x010000) { memcpy(crt + 0x008000, crt, 0x008000); } /* ->64KB */
|
||||
if (size < 0x020000) { memcpy(crt + 0x010000, crt, 0x010000); } /* ->128KB */
|
||||
if (size < 0x040000) { memcpy(crt + 0x020000, crt, 0x020000); } /* ->256KB */
|
||||
if (size < 0x080000) { memcpy(crt + 0x040000, crt, 0x040000); } /* ->512KB */
|
||||
if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */
|
||||
if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 )
|
||||
{
|
||||
return common_load(image, m_cart1);
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 )
|
||||
{
|
||||
UINT32 filesize;
|
||||
UINT32 load_offset = 0;
|
||||
|
||||
m_cartridge2 = memregion("cart2")->base();
|
||||
|
||||
// if (image.software_entry() == NULL)
|
||||
filesize = image.length();
|
||||
// else
|
||||
// filesize = image.get_software_region_length("rom");
|
||||
|
||||
switch(filesize)
|
||||
{
|
||||
case 0x008000: load_offset = 0; break; /* 32 KB */
|
||||
case 0x040000: load_offset = 0; break; /* 256KB */
|
||||
case 0x080000: load_offset = 0; break; /* 512KB */
|
||||
case 0x100000: load_offset = 0; break; /* 1 MB */
|
||||
case 0x1c0000: load_offset = 0x040000; break; /* 1.8MB */
|
||||
case 0x200000: load_offset = 0; break; /* 2 MB */
|
||||
default: /* otherwise */
|
||||
logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize);
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
// if (image.software_entry() == NULL)
|
||||
{
|
||||
if (image.fread( m_cartridge2 + load_offset, filesize) != filesize)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
}
|
||||
// else
|
||||
// memcpy(state->m_cartridge2 + load_offset, image.get_software_region("rom"), filesize);
|
||||
|
||||
if (filesize < 0x010000) { memcpy(m_cartridge2 + 0x008000, m_cartridge2, 0x008000); } /* ->64KB */
|
||||
if (filesize < 0x020000) { memcpy(m_cartridge2 + 0x010000, m_cartridge2, 0x010000); } /* ->128KB */
|
||||
if (filesize < 0x040000) { memcpy(m_cartridge2 + 0x020000, m_cartridge2, 0x020000); } /* ->256KB */
|
||||
if (filesize < 0x080000) { memcpy(m_cartridge2 + 0x040000, m_cartridge2, 0x040000); } /* ->512KB */
|
||||
if (filesize < 0x100000) { memcpy(m_cartridge2 + 0x080000, m_cartridge2, 0x080000); } /* ->1MB */
|
||||
if (filesize < 0x1c0000) { memcpy(m_cartridge2 + 0x100000, m_cartridge2, 0x100000); } /* -> >=1.8MB */
|
||||
return IMAGE_INIT_PASS;
|
||||
return common_load(image, m_cart2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user