Пример #1
0
void nes_pxrom_device::ppu_latch(offs_t offset)
{
	if ((offset & 0x3ff0) == 0x0fd0)
	{
		LOG_MMC(("mmc2 vrom latch switch (bank 0 low): %02x\n", m_reg[0]));
		m_latch1 = 0xfd;
		chr4_0(m_reg[0], CHRROM);
	}
	else if ((offset & 0x3ff0) == 0x0fe0)
	{
		LOG_MMC(("mmc2 vrom latch switch (bank 0 high): %02x\n", m_reg[1]));
		m_latch1 = 0xfe;
		chr4_0(m_reg[1], CHRROM);
	}
	else if ((offset & 0x3ff0) == 0x1fd0)
	{
		LOG_MMC(("mmc2 vrom latch switch (bank 1 low): %02x\n", m_reg[2]));
		m_latch2 = 0xfd;
		chr4_4(m_reg[2], CHRROM);
	}
	else if ((offset & 0x3ff0) == 0x1fe0)
	{
		LOG_MMC(("mmc2 vrom latch switch (bank 0 high): %02x\n", m_reg[3]));
		m_latch2 = 0xfe;
		chr4_4(m_reg[3], CHRROM);
	}
}
Пример #2
0
void nes_g101_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("g101 write_h, offset: %04x, data: %02x\n", offset, data));

	switch (offset & 0x7000)
	{
		case 0x0000:
			if (m_latch)
			{
				prg8_89(0xfe);
				prg8_cd(data & 0x1f);
			}
			else
			{
				prg8_89(data & 0x1f);
				prg8_cd(0xfe);
			}
			break;
		case 0x1000:
			m_latch = BIT(data, 1);
			if (m_pcb_ctrl_mirror)
				set_nt_mirroring(BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
			break;
		case 0x2000:
			prg8_ab(data & 0x1f);
			break;
		case 0x3000:
			chr1_x(offset & 0x07, data & 0x7f, CHRROM);
			break;
	}
}
Пример #3
0
void nes_cne_shlz_device::write_l(offs_t offset, uint8_t data)
{
	LOG_MMC(("cne_shlz write_l, offset: %04x, data: %02x\n", offset, data));

	prg32(data >> 4);
	chr8(data & 0x0f, CHRROM);
}
Пример #4
0
void nes_bandai_pt554_device::write_m(offs_t offset, uint8_t data)
{
	LOG_MMC(("Bandai PT-554 Sound write, data: %02x\n", data));

	if (!BIT(data, 6))
		m_samples->start(data & 0x07, data & 0x07);
	else
		m_samples->stop(data & 0x07);
}
Пример #5
0
uint8_t nes_cne_fsb_device::read_m(offs_t offset)
{
	LOG_MMC(("cne_fsb read_m, offset: %04x\n", offset));

	if (offset >= 0x0800)
		return m_battery[offset];

	return 0xff;
}
Пример #6
0
void nes_lrog017_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("lrog017 write_h, offset: %04x, data: %02x\n", offset, data));

	// this pcb is subject to bus conflict
	data = account_bus_conflict(offset, data);

	prg32(data);
	chr2_0((data >> 4), CHRROM);
}
Пример #7
0
void nes_holydivr_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("holy diver write_h, offset: %04x, data: %02x\n", offset, data));

	// this pcb is subject to bus conflict
	data = account_bus_conflict(offset, data);

	set_nt_mirroring(BIT(data, 3) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ);
	chr8(data >> 4, CHRROM);
	prg16_89ab(data);
}
Пример #8
0
uint8_t nes_sunsoft_dcs_device::read_m(offs_t offset)
{
	LOG_MMC(("Sunsoft DCS read_m, offset: %04x\n", offset));

	if (!m_battery.empty() && m_wram_enable)
		return m_battery[offset & (m_battery.size() - 1)];
	if (!m_prgram.empty() && m_wram_enable)
		return m_prgram[offset & (m_prgram.size() - 1)];

	return get_open_bus();   // open bus
}
Пример #9
0
void nes_tam_s1_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("tam s1 write_h, offset: %04x, data: %02x\n", offset, data));

	if (offset < 0x4000)
	{
		// this pcb is subject to bus conflict
		data = account_bus_conflict(offset, data);

		set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ);
		prg16_cdef(data);
	}
}
Пример #10
0
uint8_t nes_sunsoft_dcs_device::read_h(offs_t offset)
{
	LOG_MMC(("Sunsoft DCS read_h, offset: %04x\n", offset));

	if (m_exrom_enable && m_subslot->m_cart && offset < 0x4000)
	{
		if (m_timer_on)
			return m_subslot->m_cart->read(offset);
		else
			return get_open_bus();   // after the timer is off, this returns open bus...
	}
	else
		return hi_access_rom(offset);
}
Пример #11
0
void nes_h3001_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("h3001 write_h, offset %04x, data: %02x\n", offset, data));

	switch (offset & 0x7fff)
	{
		case 0x0000:
			prg8_89(data);
			break;

		case 0x1001:
			set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
			break;

		case 0x1003:
			m_irq_enable = data & 0x80;
			set_irq_line(CLEAR_LINE);
			break;

		case 0x1004:
			m_irq_count = m_irq_count_latch;
			set_irq_line(CLEAR_LINE);
			break;

		case 0x1005:
			m_irq_count_latch = (m_irq_count_latch & 0x00ff) | (data << 8);
			break;

		case 0x1006:
			m_irq_count_latch = (m_irq_count_latch & 0xff00) | data;
			break;

		case 0x2000:
			prg8_ab(data);
			break;

		case 0x3000: case 0x3001: case 0x3002: case 0x3003:
		case 0x3004: case 0x3005: case 0x3006: case 0x3007:
			chr1_x(offset & 0x07, data, CHRROM);
			break;

		case 0x4000:
			prg8_cd(data);
			break;

		default:
			break;
	}
}
Пример #12
0
void nes_sc127_device::hblank_irq(int scanline, int vblank, int blanked)
{
	if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE && m_irq_enable)
	{
		m_irq_count--;

		if (!blanked && (m_irq_count == 0))
		{
			LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline,
						machine().primary_screen->vpos(), machine().primary_screen->hpos()));
			machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE);
			m_irq_enable = 0;
		}
	}
}
Пример #13
0
void nes_sunsoft_dcs_device::write_m(offs_t offset, uint8_t data)
{
	LOG_MMC(("Sunsoft DCS write_m, offset: %04x, data: %02x\n", offset, data));

	if (!m_battery.empty() && m_wram_enable)
		m_battery[offset & (m_battery.size() - 1)] = data;
	if (!m_prgram.empty() && m_wram_enable)
		m_prgram[offset & (m_prgram.size() - 1)] = data;
	if (!m_wram_enable && !m_timer_on)
	{
		m_timer_on = 1;
		// start NTB-ROM timer
		ntb_enable_timer->adjust(timer_freq);
	}
}
Пример #14
0
uint8_t nes_karaokestudio_device::read_h(offs_t offset)
{
	LOG_MMC(("karaoke studio read_h, offset: %04x\n", offset));
	// this shall be the proper code, but it's a bit slower, so we access directly the subcart below
	//return m_subslot->read(offset);

	// access expansion cart only if all of the followings are verified
	// * we are in $8000-$bfff range
	// * there has been a bankswitch write to map the expansion to such range
	// * there actually is an expansion cart mounted
	if (offset < 0x4000 && m_exp_active && m_subslot->m_cart)
		return m_subslot->m_cart->read(offset);
	else
		return hi_access_rom(offset);
}
Пример #15
0
void nes_cne_decathl_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("cne_decathl_w, offset: %04x, data: %02x\n", offset, data));

	if (offset < 0x0065)
		return;
	if (offset < 0x00a5)
	{
		prg32((offset - 0x0065) & 0x03);
		return;
	}
	if (offset < 0x00e5)
	{
		chr8((offset - 0x00a5) & 0x07, CHRROM);
	}
}
Пример #16
0
void nes_sunsoft_dcs_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("Sunsoft DCS write_h, offset %04x, data: %02x\n", offset, data));

	switch (offset & 0x7000)
	{
		case 0x7000:
			prg16_89ab(data & 0x07);
			m_exrom_enable = !BIT(data, 3);
			m_wram_enable = BIT(data, 4);
			break;
		default:
			sun4_write(offset, data);
			break;
	}
}
Пример #17
0
// same as MMC3!
void nes_hosenkan_device::hblank_irq( int scanline, int vblank, int blanked )
{
	if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE)
	{
		int prior_count = m_irq_count;
		if ((m_irq_count == 0) || m_irq_clear)
			m_irq_count = m_irq_count_latch;
		else
			m_irq_count--;

		if (m_irq_enable && !blanked && (m_irq_count == 0) && (prior_count || m_irq_clear))
		{
			LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline,
						machine().first_screen()->vpos(), machine().first_screen()->hpos()));
			machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, HOLD_LINE);
		}
	}
	m_irq_clear = 0;
}
Пример #18
0
/* MIRROR_LOW and MIRROR_HIGH are swapped! */
void nes_waixing_a_device::set_mirror(UINT8 nt)
{
	switch (nt)
	{
		case 0:
		case 1:
			set_nt_mirroring(nt ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
			break;
		case 2:
			set_nt_mirroring(PPU_MIRROR_LOW);
			break;
		case 3:
			set_nt_mirroring(PPU_MIRROR_HIGH);
			break;
		default:
			LOG_MMC(("Mapper set NT to invalid value %02x", nt));
			break;
	}
}
Пример #19
0
/* Here, IRQ counter decrements every scanline. */
void nes_txrom_device::hblank_irq(int scanline, int vblank, int blanked)
{
	if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE)
	{
		int prior_count = m_irq_count;
		if ((m_irq_count == 0) || m_irq_clear)
			m_irq_count = m_irq_count_latch;
		else
			m_irq_count--;

		if (m_irq_enable && !blanked && (m_irq_count == 0) && (prior_count || m_irq_clear /*|| !m_mmc3_alt_irq*/)) // according to blargg the latter should be present as well, but it breaks Rampart and Joe & Mac US: they probably use the alt irq!
		{
			LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline,
						machine().first_screen()->vpos(), machine().first_screen()->hpos()));
			m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
		}
	}
	m_irq_clear = 0;
}
Пример #20
0
void nes_karaokestudio_device::write_h(offs_t offset, uint8_t data)
{
	LOG_MMC(("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data));
	// bit3 1 = M ROM (main unit), 0=E ROM (expansion)
	// HACK(?): currently it is not clear how the unit acknowledges the presence of the expansion
	// cart (when expansion is present, code keeps switching both from the expansion rom and from
	// the main ROM)
	// my guess is that writes with bit3=0 and no expansion just do nothing, but it shall be verified

	if (offset >= 04000)
	{
		if (BIT(data, 3))
		{
			m_exp_active = 0;
			prg16_89ab(data & 7);
		}
		else    // expansion cart
		{
			m_exp_active = 1;
			m_subslot->write_prg_bank(data & 7);
		}
	}
}
Пример #21
0
void nes_cne_fsb_device::write_m(offs_t offset, uint8_t data)
{
	LOG_MMC(("cne_fsb write_m, offset: %04x, data: %02x\n", offset, data));

	if (offset < 0x0800)
	{
		switch (offset & 0x0007)
		{
			case 0x0000:
				prg8_89(data);
				break;
			case 0x0001:
				prg8_ab(data);
				break;
			case 0x0002:
				prg8_cd(data);
				break;
			case 0x0003:
				prg8_ef(data);
				break;
			case 0x0004:
				chr2_0(data, CHRROM);
				break;
			case 0x0005:
				chr2_2(data, CHRROM);
				break;
			case 0x0006:
				chr2_4(data, CHRROM);
				break;
			case 0x0007:
				chr2_6(data, CHRROM);
				break;
		}
	}
	else
		m_battery[offset] = data;
}
Пример #22
0
uint8_t nes_karaokestudio_device::read_m(offs_t offset)
{
	LOG_MMC(("karaoke studio read_m, offset: %04x\n", offset));
	return m_mic_ipt->read();
}