1 // license:BSD-3-Clause
2 // copyright-holders:Takahiro Nogi
3 #ifndef MAME_INCLUDES_NBMJ8688_H
4 #define MAME_INCLUDES_NBMJ8688_H
5 
6 #pragma once
7 
8 #include "video/hd61830.h"
9 #include "machine/nb1413m3.h"
10 #include "emupal.h"
11 
12 class nbmj8688_state : public driver_device
13 {
14 public:
15 	enum
16 	{
17 		TIMER_BLITTER
18 	};
19 
nbmj8688_state(const machine_config & mconfig,device_type type,const char * tag)20 	nbmj8688_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_maincpu(*this, "maincpu"),
23 		m_nb1413m3(*this, "nb1413m3"),
24 		m_lcdc0(*this, "lcdc0"),
25 		m_lcdc1(*this, "lcdc1")
26 	{ }
27 
28 	void NBMJDRV_4096(machine_config &config);
29 	void NBMJDRV_256(machine_config &config);
30 	void NBMJDRV_65536(machine_config &config);
31 	void mbmj_h12bit(machine_config &config);
32 	void mbmj_p12bit(machine_config &config);
33 	void mbmj_p16bit(machine_config &config);
34 	void mbmj_p16bit_LCD(machine_config &config);
35 	void swinggal(machine_config &config);
36 	void korinai(machine_config &config);
37 	void livegal(machine_config &config);
38 	void apparel(machine_config &config);
39 	void kyuhito(machine_config &config);
40 	void bijokkoy(machine_config &config);
41 	void barline(machine_config &config);
42 	void bijokkog(machine_config &config);
43 	void korinaim(machine_config &config);
44 	void ryuuha(machine_config &config);
45 	void seiham(machine_config &config);
46 	void orangeci(machine_config &config);
47 	void citylove(machine_config &config);
48 	void otonano(machine_config &config);
49 	void ojousanm(machine_config &config);
50 	void mcitylov(machine_config &config);
51 	void iemotom(machine_config &config);
52 	void crystalg(machine_config &config);
53 	void crystal2(machine_config &config);
54 	void secolove(machine_config &config);
55 	void orangec(machine_config &config);
56 	void mjsikaku(machine_config &config);
57 	void housemn2(machine_config &config);
58 	void kanatuen(machine_config &config);
59 	void nightlov(machine_config &config);
60 	void kaguya2(machine_config &config);
61 	void mjgaiden(machine_config &config);
62 	void mjcamera(machine_config &config);
63 	void mmsikaku(machine_config &config);
64 	void housemnq(machine_config &config);
65 	void idhimitu(machine_config &config);
66 	void iemoto(machine_config &config);
67 	void kaguya(machine_config &config);
68 	void vipclub(machine_config &config);
69 	void ojousan(machine_config &config);
70 	void seiha(machine_config &config);
71 	void bikkuri(machine_config &config);
72 
73 	void init_kyuhito();
74 	void init_idhimitu();
75 	void init_kaguya2();
76 	void init_mjcamera();
77 	void init_kanatuen();
78 
79 private:
80 	required_device<cpu_device> m_maincpu;
81 	required_device<nb1413m3_device> m_nb1413m3;
82 	optional_device<hd61830_device> m_lcdc0;
83 	optional_device<hd61830_device> m_lcdc1;
84 
85 	// defined in video_start
86 	int m_gfxmode;
87 
88 	int m_scrolly;
89 	int m_blitter_destx;
90 	int m_blitter_desty;
91 	int m_blitter_sizex;
92 	int m_blitter_sizey;
93 	int m_blitter_direction_x;
94 	int m_blitter_direction_y;
95 	int m_blitter_src_addr;
96 	int m_gfxrom;
97 	int m_dispflag;
98 	int m_gfxflag2;
99 	int m_gfxflag3;
100 	int m_flipscreen;
101 	int m_screen_refresh;
102 	std::unique_ptr<bitmap_ind16> m_tmpbitmap;
103 	std::unique_ptr<uint16_t[]> m_videoram;
104 	std::unique_ptr<uint8_t[]> m_clut;
105 	int m_flipscreen_old;
106 	emu_timer *m_blitter_timer;
107 
108 	// common
109 	uint8_t ff_r();
110 	void clut_w(offs_t offset, uint8_t data);
111 	void blitter_w(offs_t offset, uint8_t data);
112 	void scrolly_w(uint8_t data);
113 
114 	void mjsikaku_gfxflag2_w(uint8_t data);
115 	void mjsikaku_gfxflag3_w(uint8_t data);
116 	void mjsikaku_romsel_w(uint8_t data);
117 	void secolove_romsel_w(uint8_t data);
118 	void crystalg_romsel_w(uint8_t data);
119 	void seiha_romsel_w(uint8_t data);
120 	void HD61830B_both_instr_w(uint8_t data);
121 	void HD61830B_both_data_w(uint8_t data);
122 	void barline_output_w(uint8_t data);
123 
124 	DECLARE_VIDEO_START(mbmj8688_pure_12bit);
125 	void mbmj8688_12bit(palette_device &palette) const;
126 	DECLARE_VIDEO_START(mbmj8688_pure_16bit_LCD);
127 	void mbmj8688_16bit(palette_device &palette) const;
128 	void mbmj8688_lcd(palette_device &palette) const;
129 	DECLARE_VIDEO_START(mbmj8688_8bit);
130 	void mbmj8688_8bit(palette_device &palette) const;
131 	DECLARE_VIDEO_START(mbmj8688_hybrid_16bit);
132 	DECLARE_VIDEO_START(mbmj8688_hybrid_12bit);
133 	DECLARE_VIDEO_START(mbmj8688_pure_16bit);
134 
135 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
136 	void vramflip();
137 	void update_pixel(int x, int y);
138 	void writeram_low(int x, int y, int color);
139 	void writeram_high(int x, int y, int color);
140 	void gfxdraw(int gfxtype);
141 	void common_video_start();
142 	void postload();
143 
144 	void barline_io_map(address_map &map);
145 	void bikkuri_map(address_map &map);
146 	void bikkuri_io_map(address_map &map);
147 	void crystalg_io_map(address_map &map);
148 	void iemoto_io_map(address_map &map);
149 	void kaguya_io_map(address_map &map);
150 	void mjgaiden_io_map(address_map &map);
151 	void mjsikaku_io_map(address_map &map);
152 	void mjsikaku_map(address_map &map);
153 	void mmsikaku_io_map(address_map &map);
154 	void ojousan_map(address_map &map);
155 	void otonano_io_map(address_map &map);
156 	void p16bit_LCD_io_map(address_map &map);
157 	void secolove_io_map(address_map &map);
158 	void secolove_map(address_map &map);
159 	void seiha_io_map(address_map &map);
160 
161 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
162 };
163 
164 #endif // MAME_INCLUDES_NBMJ8688_H
165