summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/zemina.cpp
blob: e6b42f88dbee09d7802d0cdf38a8a4a19c8426a2 (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
84
85
// 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(x) do { if (VERBOSE) logerror x; } while (0)

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

const device_type NES_ZEMINA = &device_creator<nes_zemina_device>;

nes_zemina_device::nes_zemina_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
					: nes_nrom_device(mconfig, NES_ZEMINA, "NES Cart Zemina PCB", tag, owner, clock, "nes_zemina", __FILE__)
{
}

void nes_zemina_device::device_start()
{
	common_start();
}

void nes_zemina_device::pcb_reset()
{
	set_nt_mirroring(PPU_MIRROR_VERT);
	chr2_0(0, CHRROM);
	chr2_2(0, CHRROM);
	chr2_4(0, CHRROM);
	chr2_6(0, CHRROM);
	prg16_89ab(0);
	prg16_cdef(0);
}

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

/*-------------------------------------------------
 
 Zemina board emulation

 Currently, this board is only known to be used
 by one game: Magic Kid Googoo.
 
 Info from kevtris at NESDev, who dumped the game:
 https://wiki.nesdev.com/w/index.php/INES_Mapper_190

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

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

		if (offset >= 0x0000 && offset <= 0x1FFF)
		{
			prg16_89ab(data & 0x07);
		}
		else if (offset >= 0x4000 && offset <= 0x5FFF)
		{
			prg16_89ab((data & 0x07) | 0x08);
		}
		else if ((offset & 0x2000) == 0x2000) // 2K CHR banks
		{
			switch (offset & 0x03) // only A0, A1, A13, A14, and A15 are used to select the CHR bank
			{
				case 0x00: chr2_0(data, CHRROM); break;
				case 0x01: chr2_2(data, CHRROM); break;
				case 0x02: chr2_4(data, CHRROM); break;
				case 0x03: chr2_6(data, CHRROM); break;
			}
		}
}