1 // license:BSD-3-Clause
2 // copyright-holders:smf
3 #ifndef MAME_INCLUDES_DJMAIN_H
4 #define MAME_INCLUDES_DJMAIN_H
5 
6 #pragma once
7 
8 #include "bus/ata/ataintf.h"
9 #include "video/konami_helper.h"
10 #include "video/k054156_k054157_k056832.h"
11 #include "video/k055555.h"
12 #include "emupal.h"
13 
14 class djmain_state : public driver_device
15 {
16 public:
djmain_state(const machine_config & mconfig,device_type type,const char * tag)17 	djmain_state(const machine_config &mconfig, device_type type, const char *tag)
18 		: driver_device(mconfig, type, tag)
19 		, m_obj_ram(*this, "obj_ram")
20 		, m_maincpu(*this, "maincpu")
21 		, m_k056832(*this, "k056832")
22 		, m_k055555(*this, "k055555")
23 		, m_ata(*this, "ata")
24 		, m_gfxdecode(*this, "gfxdecode")
25 		, m_palette(*this, "palette")
26 		, m_turntable(*this, "TT%u", 1U)
27 		, m_sndram(*this, "sndram")
28 		, m_leds(*this, "led%u", 0U)
29 	{
30 	}
31 
32 	void djmainj(machine_config &config);
33 	void djmainu(machine_config &config);
34 	void djmaina(machine_config &config);
35 
36 	void init_bm7thmix();
37 	void init_bm6thmix();
38 	void init_hmcompmx();
39 	void init_bmfinal();
40 	void init_hmcompm2();
41 	void init_bm5thmix();
42 	void init_bm4thmix();
43 	void init_beatmania();
44 	void init_bmdct();
45 	void init_bmcompm2();
46 	void init_bmcorerm();
47 	void init_bmclubmx();
48 
49 private:
50 	void sndram_bank_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
51 	uint32_t sndram_r(offs_t offset, uint32_t mem_mask = ~0);
52 	void sndram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
53 	uint32_t obj_ctrl_r(offs_t offset);
54 	void obj_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
55 	uint32_t obj_rom_r(offs_t offset, uint32_t mem_mask = ~0);
56 	void v_ctrl_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
57 	uint32_t v_rom_r(offs_t offset, uint32_t mem_mask = ~0);
58 	uint8_t inp1_r(offs_t offset);
59 	uint8_t inp2_r(offs_t offset);
60 	uint32_t turntable_r(offs_t offset, uint32_t mem_mask = ~0);
61 	void turntable_select_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
62 	void light_ctrl_1_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
63 	void light_ctrl_2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
64 	void unknown590000_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
65 	void unknown802000_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
66 	void unknownc02000_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
67 
68 	uint32_t screen_update_djmain(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
69 	INTERRUPT_GEN_MEMBER(vb_interrupt);
70 	DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
71 	void draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect);
72 	K056832_CB_MEMBER(tile_callback);
73 	void k054539_map(address_map &map);
74 	void maincpu_djmain(address_map &map);
75 	void maincpu_djmaina(address_map &map);
76 	void maincpu_djmainj(address_map &map);
77 	void maincpu_djmainu(address_map &map);
78 
79 	virtual void machine_start() override;
80 	virtual void machine_reset() override;
81 	virtual void video_start() override;
82 
83 	required_shared_ptr<uint32_t> m_obj_ram;
84 	required_device<cpu_device> m_maincpu;
85 	required_device<k056832_device> m_k056832;
86 	required_device<k055555_device> m_k055555;
87 	required_device<ata_interface_device> m_ata;
88 	required_device<gfxdecode_device> m_gfxdecode;
89 	required_device<palette_device> m_palette;
90 	optional_ioport_array<2> m_turntable;
91 	required_shared_ptr<uint8_t> m_sndram;
92 	output_finder<3> m_leds;
93 
94 	int m_sndram_bank;
95 	int m_turntable_select;
96 	uint8_t m_turntable_last_pos[2];
97 	uint16_t m_turntable_pos[2];
98 	uint8_t m_pending_vb_int;
99 	uint16_t m_v_ctrl;
100 	uint32_t m_obj_regs[0xa0/4];
101 	const uint8_t *m_ata_user_password;
102 	const uint8_t *m_ata_master_password;
103 };
104 
105 #endif // MAME_INCLUDES_DJMAIN_H
106