// license:BSD-3-Clause
// copyright-holders:Roberto Fresca

#include "tilemap.h"

class gatron_state : public driver_device
{
public:
	gatron_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_videoram(*this, "videoram"),
		m_maincpu(*this, "maincpu"),
		m_gfxdecode(*this, "gfxdecode"),
		m_lamps(*this, "lamp%u", 0U) { }

	void gat(machine_config &config);

protected:
	virtual void video_start() override;

private:
	required_shared_ptr<uint8_t> m_videoram;
	required_device<cpu_device> m_maincpu;
	required_device<gfxdecode_device> m_gfxdecode;
	output_finder<9> m_lamps;
	tilemap_t *m_bg_tilemap;

	void output_port_0_w(uint8_t data);
	void videoram_w(offs_t offset, uint8_t data);
	void output_port_1_w(uint8_t data);
	TILE_GET_INFO_MEMBER(get_bg_tile_info);

	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	void gat_map(address_map &map);
	void gat_portmap(address_map &map);
};
