summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6502/m6507.cpp
blob: 2932eb2923ad37ea182f6be361585749d00318d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/***************************************************************************

    m6507.c

    Mostek 6502, NMOS variant with reduced address bus

***************************************************************************/

#include "emu.h"
#include "m6507.h"

DEFINE_DEVICE_TYPE(M6507, m6507_device, "m6507", "MOS Technology M6507")

m6507_device::m6507_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	m6502_device(mconfig, M6507, tag, owner, clock)
{
	program_config.m_addr_width = 13;
	sprogram_config.m_addr_width = 13;
}

void m6507_device::device_start()
{
	if(cache_disabled)
		mintf = std::make_unique<mi_6507_nd>();
	else
		mintf = std::make_unique<mi_6507_normal>();

	init();
}

uint8_t m6507_device::mi_6507_normal::read(uint16_t adr)
{
	return program->read_byte(adr & 0x1fff);
}

uint8_t m6507_device::mi_6507_normal::read_sync(uint16_t adr)
{
	return scache->read_byte(adr & 0x1fff);
}

uint8_t m6507_device::mi_6507_normal::read_arg(uint16_t adr)
{
	return cache->read_byte(adr & 0x1fff);
}

void m6507_device::mi_6507_normal::write(uint16_t adr, uint8_t val)
{
	program->write_byte(adr & 0x1fff, val);
}

uint8_t m6507_device::mi_6507_nd::read_sync(uint16_t adr)
{
	return sprogram->read_byte(adr & 0x1fff);
}

uint8_t m6507_device::mi_6507_nd::read_arg(uint16_t adr)
{
	return program->read_byte(adr & 0x1fff);
}