summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/zemina.cpp
blob: b46da0e756104c8cd6398b7b1c9788ac319fafbf (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// license:BSD-3-Clause
// copyright-holders:Kaz
/***********************************************************************************************************

 NES/Famicom cartridge emulation for Zemina PCBs

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

#include "emu.h"
#include "zemina.h"

#ifdef NES_PCB_DEBUG
#define VERBOSE 1
#else
#define VERBOSE 0
#endif

#define LOG_MMC(...) do { if (VERBOSE) logerror(__VA_ARGS__); } while (0)

//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(NES_ZEMINA, nes_zemina_device, "nes_zemina", "NES Cart Zemina PCB")

//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  constructor
//-------------------------------------------------

nes_zemina_device::nes_zemina_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
	: nes_nrom_device(mconfig, NES_ZEMINA, tag, owner, clock)
{
}




void nes_zemina_device::pcb_reset()
{
	prg16_89ab(0);
	prg16_cdef(0);    // fixed bank

	for (int i = 0; i < 4; i++)
		chr2_x(i << 1, 0, CHRROM);
}



/*-------------------------------------------------
    mapper specific handlers
-------------------------------------------------*/

/*-------------------------------------------------

 Zemina board emulation

 Games: Magic Kid GooGoo

 iNES: mapper 190

 In MAME: Supported.

-------------------------------------------------*/

void nes_zemina_device::write_h(offs_t offset, u8 data)
{
	LOG_MMC("zemina write_h, offset: %04x, data: %02x\n", offset, data);

	switch (offset & 0x6000)
	{
		case 0x0000:
		case 0x4000:
			prg16_89ab(BIT(offset, 14) << 3 | (data & 0x07));
			break;
		case 0x2000:
			chr2_x((offset & 0x03) << 1, data, CHRROM);
			break;
	}
}