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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
#ifndef MAME_BUS_NES_JY_H
#define MAME_BUS_NES_JY_H
#pragma once
#include "nxrom.h"
// ======================> nes_jy_typea_device
class nes_jy_typea_device : public nes_nrom_device
{
public:
// construction/destruction
nes_jy_typea_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual uint8_t read_l(offs_t offset) override;
virtual uint8_t read_m(offs_t offset) override;
virtual void write_l(offs_t offset, uint8_t data) override;
virtual void write_h(offs_t offset, uint8_t data) override;
virtual uint8_t chr_r(offs_t offset) override;
virtual uint8_t nt_r(offs_t offset) override;
virtual void scanline_irq(int scanline, int vblank, int blanked) override;
virtual void pcb_reset() override;
protected:
nes_jy_typea_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void irq_clock(int blanked, int mode);
void update_banks(int reg);
void update_prg();
void update_chr();
void update_mirror_typea();
virtual void update_mirror() { update_mirror_typea(); }
inline uint8_t unscramble(uint8_t bank);
uint8_t m_mul[2];
uint8_t m_latch;
uint8_t m_reg[4];
uint8_t m_chr_latch[2]; // type C uses a more complex CHR 4K mode, and these vars are only changed for those games
uint8_t m_mmc_prg_bank[4];
uint16_t m_mmc_nt_bank[4];
uint16_t m_mmc_vrom_bank[8];
uint16_t m_extra_chr_bank;
uint16_t m_extra_chr_mask;
int m_bank_6000;
uint8_t m_irq_mode;
uint8_t m_irq_count;
uint8_t m_irq_prescale;
uint8_t m_irq_prescale_mask;
uint8_t m_irq_flip;
int m_irq_enable;
int m_irq_up, m_irq_down;
static const device_timer_id TIMER_IRQ = 0;
emu_timer *irq_timer;
attotime timer_freq;
};
// ======================> nes_jy_typeb_device
class nes_jy_typeb_device : public nes_jy_typea_device
{
public:
// construction/destruction
nes_jy_typeb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
nes_jy_typeb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void update_mirror_typeb();
virtual void update_mirror() override { update_mirror_typeb(); }
};
// ======================> nes_jy_typec_device
class nes_jy_typec_device : public nes_jy_typeb_device
{
public:
// construction/destruction
nes_jy_typec_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual uint8_t chr_r(offs_t offset) override;
protected:
void update_mirror_typec();
virtual void update_mirror() override { update_mirror_typec(); }
};
// device type definition
DECLARE_DEVICE_TYPE(NES_JY_TYPEA, nes_jy_typea_device)
DECLARE_DEVICE_TYPE(NES_JY_TYPEB, nes_jy_typeb_device)
DECLARE_DEVICE_TYPE(NES_JY_TYPEC, nes_jy_typec_device)
#endif // MAME_BUS_NES_JY_H
|