summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/deco222.cpp
blob: d19aefade66c044545667fc70d7f2d41aebcfac0 (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
// license:BSD-3-Clause
// copyright-holders:David Haywood

/* Data East encrypted CPU 222, aka C10707?
 also sometimes implemented as basic logic outside the CPU on early revs and bootlegs */


#include "emu.h"
#include "deco222.h"

const device_type DECO_222 = device_creator<deco_222_device>;
const device_type DECO_C10707 = device_creator<deco_c10707_device>;


deco_222_device::deco_222_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	m6502_device(mconfig, DECO_222, "DECO 222", tag, owner, clock, "deco222", __FILE__)
{
}

void deco_222_device::device_start()
{
	mintf = new mi_decrypt;
	init();
}

void deco_222_device::device_reset()
{
	m6502_device::device_reset();
	static_cast<mi_decrypt *>(mintf)->had_written = false;
}

uint8_t deco_222_device::mi_decrypt::read_sync(uint16_t adr)
{
	return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
}



deco_c10707_device::deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	m6502_device(mconfig, DECO_C10707, "DECO C10707", tag, owner, clock, "decoc10707", __FILE__)
{
}

void deco_c10707_device::device_start()
{
	mintf = new mi_decrypt;
	init();
}

void deco_c10707_device::device_reset()
{
	m6502_device::device_reset();
	static_cast<mi_decrypt *>(mintf)->had_written = false;
}

uint8_t deco_c10707_device::mi_decrypt::read_sync(uint16_t adr)
{
	return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
}