1 // license:BSD-3-Clause
2 // copyright-holders:Krzysztof Strzecha, Miodrag Milanovic
3 /*****************************************************************************
4  *
5  * includes/galaxy.h
6  *
7  ****************************************************************************/
8 #ifndef MAME_INCLUDES_GALAXY_H
9 #define MAME_INCLUDES_GALAXY_H
10 
11 #pragma once
12 
13 #include "imagedev/snapquik.h"
14 #include "imagedev/cassette.h"
15 #include "machine/ram.h"
16 #include "screen.h"
17 
18 class galaxy_state : public driver_device
19 {
20 public:
galaxy_state(const machine_config & mconfig,device_type type,const char * tag)21 	galaxy_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_maincpu(*this, "maincpu")
24 		, m_screen(*this, "screen")
25 		, m_cassette(*this, "cassette")
26 		, m_ram(*this, RAM_TAG)
27 		, m_p_chargen(*this, "chargen")
28 		, m_io_keyboard(*this, "LINE%u", 0U)
29 	{ }
30 
31 	void galaxy(machine_config &config);
32 	void galaxyp(machine_config &config);
33 
34 	void init_galaxy();
35 	void init_galaxyp();
36 
37 private:
38 	uint8_t keyboard_r(offs_t offset);
39 	void latch_w(uint8_t data);
40 	void machine_start() override;
41 	void machine_reset() override;
42 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
43 	TIMER_CALLBACK_MEMBER(gal_video);
44 	IRQ_CALLBACK_MEMBER(irq_callback);
45 	void set_timer();
46 	void setup_snapshot (const uint8_t * data, uint32_t size);
47 	DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb);
48 	void galaxy_mem(address_map &map);
49 	void galaxyp_io(address_map &map);
50 	void galaxyp_mem(address_map &map);
51 
52 	int m_interrupts_enabled;
53 	uint8_t m_latch_value;
54 	uint32_t m_gal_cnt;
55 	uint8_t m_code;
56 	uint8_t m_first;
57 	uint32_t m_start_addr;
58 	emu_timer *m_gal_video_timer;
59 	bitmap_ind16 m_bitmap;
60 
61 	required_device<cpu_device> m_maincpu;
62 	required_device<screen_device> m_screen;
63 	required_device<cassette_image_device> m_cassette;
64 	optional_device<ram_device> m_ram;
65 	required_region_ptr<u8> m_p_chargen;
66 	required_ioport_array<8> m_io_keyboard;
67 };
68 
69 #endif // MAME_INCLUDES_GALAXY_H
70