Пример #1
0
static READ16_HANDLER( pitfighb_cheap_slapstic_r )
{
	int result = bslapstic_base[offset & 0xfff];

	/* the cheap replacement slapstic just triggers on the simple banking */
	/* addresses; a software patch ensure that this is good enough */

	/* offset 0 primes the chip */
	if (offset == 0)
		bslapstic_primed = 1;

	/* one of 4 bankswitchers produces the result */
	else if (bslapstic_primed)
	{
		if (offset == 0x42)
			update_bank(0), bslapstic_primed = 0;
		else if (offset == 0x52)
			update_bank(1), bslapstic_primed = 0;
		else if (offset == 0x62)
			update_bank(2), bslapstic_primed = 0;
		else if (offset == 0x72)
			update_bank(3), bslapstic_primed = 0;
	}
	return result;
}
Пример #2
0
void sam6883_device::configure_bank(int bank, UINT8 *memory, UINT32 memory_size, bool is_read_only, read8_delegate rhandler, write8_delegate whandler)
{
	assert((bank >= 0) && (bank < sizeof(m_banks) / sizeof(m_banks[0])));
	m_banks[bank].m_memory = memory;
	m_banks[bank].m_memory_size = memory_size;
	m_banks[bank].m_memory_read_only = is_read_only;
	m_banks[bank].m_rhandler = rhandler;
	m_banks[bank].m_whandler = whandler;

	/* if we're configuring a bank that never changes, update it now */
	switch(bank)
	{
		case 4:
			update_bank(4, 0xFF00, 0xFF1F, 0x0000);
			break;
		case 5:
			update_bank(5, 0xFF20, 0xFF3F, 0x0000);
			break;
		case 6:
			update_bank(6, 0xFF40, 0xFF5F, 0x0000);
			break;
		case 7:
			update_bank(7, 0xFF60, 0xFFBF, 0x0000);
			break;
		case 2:
			update_bank(2, 0xFFE0, 0xFFFF, 0x1FE0);
			break;
	}
}
Пример #3
0
void sam6883_device::set_bank_offset(int bank, offs_t offset)
{
	if (m_banks[bank].m_memory_offset != offset)
	{
		m_banks[bank].m_memory_offset = offset;
		update_memory();
		update_bank(2, 0xFFE0, 0xFFFF, 0x1FE0);
	}
}
Пример #4
0
void sam6883_device::update_memory(void)
{
	/* Memory size - allowed restricting memory accesses to something less than
     * 32k
     *
     * This was a SAM switch that occupied 4 addresses:
     *
     *      $FFDD   (set)   R1
     *      $FFDC   (clear) R1
     *      $FFDB   (set)   R0
     *      $FFDA   (clear) R0
     *
     * R1:R0 formed the following states:
     *      00  - 4k
     *      01  - 16k
     *      10  - 64k
     *      11  - static RAM (??)
     *
     * If something less than 64k was set, the low RAM would be smaller and
     * mirror the other parts of the RAM
     *
     * TODO:  Find out what "static RAM" is
     * TODO:  This should affect _all_ memory accesses, not just video ram
     * TODO:  Verify that the CoCo 3 ignored this
     */

	/* update $0000-$7FFF */
	update_bank(0, 0x0000, 0x7FFF, m_sam_state & SAM_STATE_P1 ? 0x8000 : 0x0000);

	if (m_sam_state & SAM_STATE_TY)
	{
		update_bank(0, 0x8000, 0xFEFF, 0x8000);
	}
	else
	{
		update_bank(1, 0x8000, 0x9FFF, 0x0000);
		update_bank(2, 0xA000, 0xBFFF, 0x0000);
		update_bank(3, 0xC000, 0xFEFF, 0x0000);
	}
}
Пример #5
0
void MEMORY::reset()
{
	// reset crtc
	lcdadr = 0;
	memset(lcdreg, 0, sizeof(lcdreg));
	dcr1 = dcr2 = 0;
	kj_l = kj_h = kj_ofs = kj_row = 0;
	blinkcnt = 0;
	
	// reset memory
	mcr1 = 2;
	mcr2 = a20 = 0;
	update_bank();
}
Пример #6
0
void MEMORY::write_io8(uint32 addr, uint32 data)
{
	switch(addr & 0xffff) {
	// memory controller
	case 0x1d:
		mcr1 = data;
		update_bank();
		// protect mode ???
//		d_cpu->write_signal(SIG_I86_A20, data, 0x10);
		break;
	case 0x1e:
		mcr2 = data;
		update_bank();
		break;
	case 0x26:
		a20 = data;
		// protect mode ???
		d_cpu->write_signal(SIG_I86_A20, data, 0x80);
		break;
	// dma bank
	case 0x120:
	case 0x121:
	case 0x122:
	case 0x123:
		d_dma->write_signal(SIG_I8237_BANK0 + (addr & 3), data, 0x0f);
		break;
	// lcd controller
	case 0x300:
		lcdadr = data;
		break;
	case 0x302:
		lcdreg[lcdadr & 31] = data;
		break;
	case 0x308:
		dcr1 = (dcr1 & 0xff00) | data;
		break;
	case 0x309:
		dcr1 = (dcr1 & 0xff) | (data << 8);
		// bit11-10: vram bank
		update_bank();
		break;
	case 0x30a:
		dcr1 = (dcr1 & 0xff00) | data;
		break;
	case 0x30b:
		dcr1 = (dcr1 & 0xff) | (data << 8);
		break;
	// kanji rom
	case 0x30c:
		kj_h = data & 0x7f;
		break;
	case 0x30d:
		kj_l = data & 0x7f;
		kj_row = 0;
		if(kj_h < 0x30) {
			kj_ofs = (((kj_l - 0x00) & 0x1f) <<  5) | (((kj_l - 0x20) & 0x20) <<  9) | (((kj_l - 0x20) & 0x40) <<  7) | (((kj_h - 0x00) & 0x07) << 10);
		}
		else if(kj_h < 0x70) {
			kj_ofs = (((kj_l - 0x00) & 0x1f) <<  5) + (((kj_l - 0x20) & 0x60) <<  9) + (((kj_h - 0x00) & 0x0f) << 10) + (((kj_h - 0x30) & 0x70) * 0xc00) + 0x08000;
		}
		else {
			kj_ofs = (((kj_l - 0x00) & 0x1f) <<  5) | (((kj_l - 0x20) & 0x20) <<  9) | (((kj_l - 0x20) & 0x40) <<  7) | (((kj_h - 0x00) & 0x07) << 10) | 0x38000;
		}
		break;
	case 0x30e:
		kanji16[(kj_ofs | ((kj_row & 0x0f) << 1)) & 0x3ffff] = data;
		break;
	case 0x30f:
		kanji16[(kj_ofs | ((kj_row++ & 0x0f) << 1) | 1) & 0x3ffff] = data;
		break;
	}
}