1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria, Pierpaolo Prazzoli, Quench
3 #ifndef MAME_INCLUDES_PLAYMARK_H
4 #define MAME_INCLUDES_PLAYMARK_H
5 
6 #pragma once
7 
8 #include "sound/okim6295.h"
9 #include "machine/eepromser.h"
10 #include "machine/ticket.h"
11 #include "cpu/pic16c5x/pic16c5x.h"
12 #include "emupal.h"
13 #include "tilemap.h"
14 
15 class playmark_state : public driver_device
16 {
17 public:
playmark_state(const machine_config & mconfig,device_type type,const char * tag)18 	playmark_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_bgvideoram(*this, "bgvideoram"),
21 		m_videoram1(*this, "videoram1"),
22 		m_videoram2(*this, "videoram2"),
23 		m_videoram3(*this, "videoram3"),
24 		m_spriteram(*this, "spriteram"),
25 		m_rowscroll(*this, "rowscroll"),
26 		m_sprtranspen(0),
27 		m_oki(*this, "oki"),
28 		m_okibank(*this, "okibank"),
29 		m_eeprom(*this, "eeprom"),
30 		m_maincpu(*this, "maincpu"),
31 		m_audiocpu(*this, "audiocpu"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette"),
34 		m_ticket(*this, "ticket"),
35 		m_token(*this, "token")
36 	{ }
37 
38 	void wbeachvl(machine_config &config);
39 	void hrdtimes(machine_config &config);
40 	void luckboomh(machine_config &config);
41 	void bigtwin(machine_config &config);
42 	void hotmind(machine_config &config);
43 	void bigtwinb(machine_config &config);
44 	void excelsr(machine_config &config);
45 
46 	void init_pic_decode();
47 
48 protected:
49 	/* memory pointers */
50 	optional_shared_ptr<uint16_t> m_bgvideoram;
51 	required_shared_ptr<uint16_t> m_videoram1;
52 	optional_shared_ptr<uint16_t> m_videoram2;
53 	optional_shared_ptr<uint16_t> m_videoram3;
54 	required_shared_ptr<uint16_t> m_spriteram;
55 	optional_shared_ptr<uint16_t> m_rowscroll;
56 
57 	/* video-related */
58 	tilemap_t   *m_tx_tilemap;
59 	tilemap_t   *m_fg_tilemap;
60 	tilemap_t   *m_bg_tilemap;
61 	int         m_bgscrollx;
62 	int         m_bgscrolly;
63 	int         m_bg_enable;
64 	int         m_bg_full_size;
65 	int         m_fgscrollx;
66 	int         m_fg_rowscroll_enable;
67 
68 	int         m_xoffset;
69 	int         m_yoffset;
70 	int         m_pri_masks[3];
71 	uint16_t      m_scroll[7];
72 	int         m_sprtranspen;
73 
74 	/* misc */
75 	uint16_t      m_snd_command;
76 	uint16_t      m_snd_flag;
77 	uint8_t       m_oki_control;
78 	uint8_t       m_oki_command;
79 	uint8_t       m_dispenser_latch;
80 	int         m_oki_numbanks;
81 	void configure_oki_banks();
82 
83 	/* devices */
84 	required_device<okim6295_device> m_oki;
85 	optional_memory_bank m_okibank;
86 	optional_device<eeprom_serial_93cxx_device> m_eeprom;
87 	void coinctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
88 	void wbeachvl_coin_eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
89 	void hotmind_coin_eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
90 	void luckboomh_dispenser_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
91 	void hrdtimes_coin_w(uint16_t data);
92 	void playmark_snd_command_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
93 	uint8_t playmark_snd_command_r();
94 	uint8_t playmark_snd_flag_r();
95 	void playmark_oki_w(uint8_t data);
96 	void playmark_snd_control_w(uint8_t data);
97 	void hrdtimes_snd_control_w(uint8_t data);
98 	void wbeachvl_txvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
99 	void wbeachvl_fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
100 	void wbeachvl_bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
101 	void hrdtimes_txvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
102 	void hrdtimes_fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
103 	void hrdtimes_bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
104 	void bigtwin_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
105 	void wbeachvl_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
106 	void excelsr_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
107 	void hrdtimes_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
108 	void playmark_oki_banking_w(uint8_t data);
109 	TILE_GET_INFO_MEMBER(bigtwin_get_tx_tile_info);
110 	TILE_GET_INFO_MEMBER(bigtwin_get_fg_tile_info);
111 	TILE_GET_INFO_MEMBER(wbeachvl_get_tx_tile_info);
112 	TILE_GET_INFO_MEMBER(wbeachvl_get_fg_tile_info);
113 	TILE_GET_INFO_MEMBER(wbeachvl_get_bg_tile_info);
114 	TILE_GET_INFO_MEMBER(hrdtimes_get_tx_tile_info);
115 	TILE_GET_INFO_MEMBER(bigtwinb_get_tx_tile_info);
116 	TILE_GET_INFO_MEMBER(hrdtimes_get_fg_tile_info);
117 	TILE_GET_INFO_MEMBER(hrdtimes_get_bg_tile_info);
118 	DECLARE_MACHINE_START(playmark);
119 	DECLARE_MACHINE_RESET(playmark);
120 	DECLARE_VIDEO_START(bigtwin);
121 	DECLARE_VIDEO_START(bigtwinb);
122 	DECLARE_VIDEO_START(wbeachvl);
123 	DECLARE_VIDEO_START(excelsr);
124 	DECLARE_VIDEO_START(hotmind);
125 	DECLARE_VIDEO_START(hrdtimes);
126 	DECLARE_VIDEO_START(luckboomh);
127 	TILEMAP_MAPPER_MEMBER(playmark_tilemap_scan_pages);
128 	uint32_t screen_update_bigtwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
129 	uint32_t screen_update_bigtwinb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
130 	uint32_t screen_update_wbeachvl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
131 	uint32_t screen_update_excelsr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
132 	uint32_t screen_update_hrdtimes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
133 	void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift );
134 	void bigtwinb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int codeshift );
135 	void draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
136 	uint8_t playmark_asciitohex(uint8_t data);
137 	void playmark_decode_pic_hex_dump(void);
138 	required_device<cpu_device> m_maincpu;
139 	optional_device<pic16c57_device> m_audiocpu;
140 	required_device<gfxdecode_device> m_gfxdecode;
141 	required_device<palette_device> m_palette;
142 	optional_device<ticket_dispenser_device> m_ticket;
143 	optional_device<ticket_dispenser_device> m_token;
144 
145 	void bigtwin_main_map(address_map &map);
146 	void bigtwinb_main_map(address_map &map);
147 	void excelsr_main_map(address_map &map);
148 	void hotmind_main_map(address_map &map);
149 	void hrdtimes_main_map(address_map &map);
150 	void luckboomh_main_map(address_map &map);
151 	void oki_map(address_map &map);
152 	void wbeachvl_main_map(address_map &map);
153 };
154 
155 #endif // MAME_INCLUDES_PLAYMARK_H
156