示例#1
0
文件: tutor.cpp 项目: MASHinfo/mame
void tutor_state::machine_start()
{
	std::string region_tag;
	m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str());

	m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this));

	m_bank1->configure_entry(0, memregion("maincpu")->base() + 0x4000);
	m_bank1->set_entry(0);
	m_bank2->configure_entry(0, memregion("maincpu")->base() + 0x8000);
	m_bank2->set_entry(0);

	if (m_cart_rom)
	{
		if (m_cart_rom->bytes() > 0x4000)
		{
			m_bank1_switching = 1;
			m_bank1->configure_entry(1, m_cart_rom->base());
			m_bank1->set_entry(1);
			m_bank2->configure_entry(1, m_cart_rom->base() + 0x4000);
			m_bank2->set_entry(1);
		}
		else
		{
			m_bank2->configure_entry(1, m_cart_rom->base());
			m_bank2->set_entry(1);
		}
	}
}
示例#2
0
debug_view_memory_source::debug_view_memory_source(const char *name, memory_region &region)
	: debug_view_source(name),
		m_space(nullptr),
		m_memintf(nullptr),
		m_base(region.base()),
		m_length(region.bytes()),
		m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)),
		m_endianness(region.endianness()),
		m_prefsize(std::min<u8>(region.bytewidth(), 8))
{
}
示例#3
0
debug_view_memory_source::debug_view_memory_source(const char *name, memory_region &region)
	: debug_view_source(name),
	  m_space(NULL),
	  m_memintf(NULL),
	  m_base(region),
	  m_length(region.bytes()),
	  m_offsetxor(NATIVE_ENDIAN_VALUE_LE_BE(region.width() - 1, 0)),
	  m_endianness(region.endianness()),
	  m_prefsize(MIN(region.width(), 8))
{
}
示例#4
0
文件: tvc.c 项目: mock--/mame
void tvc_state::set_mem_page(UINT8 data)
{
	address_space &space = m_maincpu->space(AS_PROGRAM);
	switch (data & 0x18)
	{
		case 0x00 : // system ROM selected
			TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff);
			membank("bank1")->set_base(m_bios_rom->base());
			break;
		case 0x08 : // Cart ROM selected
			if (m_cart_rom)
			{
				TVC_INSTALL_ROM_BANK(0, "bank1", 0x0000, 0x3fff);
				membank("bank1")->set_base(m_cart_rom->base());
			}
			break;
		case 0x10 : // RAM selected
			TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff);
			membank("bank1")->set_base(m_ram->pointer());
			break;
		case 0x18 : // Video RAM
			if (m_vram->bytes() > 0x4000)
			{
				// TVC 64+ only
				TVC_INSTALL_RAM_BANK(0, "bank1", 0x0000, 0x3fff);
				membank("bank1")->set_base(m_vram->base() + ((m_vram_bank & 0x03)<<14));
			}
			else
			{
				space.unmap_readwrite(0x0000, 0x3fff);
				m_bank_type[0] = -1;
			}
			break;
	}

	if ((data & 0x20)==0)       // Video RAM
	{
		TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff);
		membank("bank3")->set_base(m_vram->base() + ((m_vram_bank & 0x0c)<<12));
	}
	else                        // System RAM page 3
	{
		if (m_ram->size() > 0x8000)
		{
			TVC_INSTALL_RAM_BANK(2, "bank3", 0x8000, 0xbfff);
			membank("bank3")->set_base(m_ram->pointer() + 0x8000);
		}
		else
		{
			space.unmap_readwrite(0x8000, 0xbfff);
			m_bank_type[2] = -1;
		}
	}

	switch(data & 0xc0)
	{
		case 0x00 : // Cart ROM selected
			if (m_cart_rom)
			{
				TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff);
				membank("bank4")->set_base(m_cart_rom->base());
			}
			break;
		case 0x40 : // System ROM selected
			TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff);
			membank("bank4")->set_base(m_bios_rom->base());
			break;
		case 0x80 : // RAM selected
			if (m_ram->size() > 0x8000)
			{
				TVC_INSTALL_RAM_BANK(3, "bank4", 0xc000, 0xffff);
				membank("bank4")->set_base(m_ram->pointer() + 0xc000);
			}
			else
			{
				space.unmap_readwrite(0xc000, 0xffff);
				m_bank_type[3] = -1;
			}
			break;
		case 0xc0 : // External ROM selected
			TVC_INSTALL_ROM_BANK(3, "bank4", 0xc000, 0xffff);
			membank("bank4")->set_base(m_ext->base());
			space.install_readwrite_handler (0xc000, 0xdfff, 0, 0, read8_delegate(FUNC(tvc_state::expansion_r), this), write8_delegate(FUNC(tvc_state::expansion_w), this), 0);
			m_bank_type[3] = -1;
			break;
	}
}