1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 /***************************************************************************
4 
5   Fast Freddie/Jump Coaster hardware
6   driver by Zsolt Vasvari
7 
8 ***************************************************************************/
9 #ifndef MAME_INCLUDES_FASTFRED_H
10 #define MAME_INCLUDES_FASTFRED_H
11 
12 #pragma once
13 
14 #include "machine/74259.h"
15 #include "includes/galaxold.h"
16 #include "tilemap.h"
17 
18 class fastfred_state : public galaxold_state
19 {
20 public:
fastfred_state(const machine_config & mconfig,device_type type,const char * tag)21 	fastfred_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: galaxold_state(mconfig, type, tag)
23 		, m_outlatch(*this, "outlatch")
24 		, m_videoram(*this, "videoram")
25 		, m_spriteram(*this, "spriteram")
26 		, m_attributesram(*this, "attributesram")
27 		, m_background_color(*this, "bgcolor")
28 		, m_imago_fg_videoram(*this, "imago_fg_vram")
29 	{ }
30 
31 	void jumpcoas(machine_config &config);
32 	void imago(machine_config &config);
33 	void fastfred(machine_config &config);
34 
35 	void init_fastfred();
36 	void init_flyboy();
37 	void init_flyboyb();
38 	void init_imago();
39 	void init_boggy84();
40 	void init_jumpcoas();
41 	void init_boggy84b();
42 
43 private:
44 	required_device<ls259_device> m_outlatch;
45 	required_shared_ptr<uint8_t> m_videoram;
46 	required_shared_ptr<uint8_t> m_spriteram;
47 	required_shared_ptr<uint8_t> m_attributesram;
48 	optional_shared_ptr<uint8_t> m_background_color;
49 	optional_shared_ptr<uint8_t> m_imago_fg_videoram;
50 
51 	int m_hardware_type;
52 	uint16_t m_charbank;
53 	uint8_t m_colorbank;
54 	uint8_t m_nmi_mask;
55 	uint8_t m_sound_nmi_mask;
56 	uint8_t m_imago_sprites[0x800*3];
57 	uint16_t m_imago_sprites_address;
58 	uint8_t m_imago_sprites_bank;
59 
60 	tilemap_t *m_bg_tilemap;
61 	tilemap_t *m_fg_tilemap;
62 	tilemap_t *m_web_tilemap;
63 
64 	uint8_t fastfred_custom_io_r(offs_t offset);
65 	uint8_t flyboy_custom1_io_r(offs_t offset);
66 	uint8_t flyboy_custom2_io_r(offs_t offset);
67 	uint8_t jumpcoas_custom_io_r(offs_t offset);
68 	uint8_t boggy84_custom_io_r(offs_t offset);
69 	DECLARE_WRITE_LINE_MEMBER(imago_dma_irq_w);
70 	void imago_sprites_bank_w(uint8_t data);
71 	void imago_sprites_dma_w(offs_t offset, uint8_t data);
72 	uint8_t imago_sprites_offset_r(offs_t offset);
73 	DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
74 	void sound_nmi_mask_w(uint8_t data);
75 	void fastfred_videoram_w(offs_t offset, uint8_t data);
76 	void fastfred_attributes_w(offs_t offset, uint8_t data);
77 	DECLARE_WRITE_LINE_MEMBER(charbank1_w);
78 	DECLARE_WRITE_LINE_MEMBER(charbank2_w);
79 	DECLARE_WRITE_LINE_MEMBER(colorbank1_w);
80 	DECLARE_WRITE_LINE_MEMBER(colorbank2_w);
81 	DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
82 	DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
83 	void imago_fg_videoram_w(offs_t offset, uint8_t data);
84 	DECLARE_WRITE_LINE_MEMBER(imago_charbank_w);
85 
86 	TILE_GET_INFO_MEMBER(get_tile_info);
87 	TILE_GET_INFO_MEMBER(imago_get_tile_info_bg);
88 	TILE_GET_INFO_MEMBER(imago_get_tile_info_fg);
89 	TILE_GET_INFO_MEMBER(imago_get_tile_info_web);
90 
91 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
92 	INTERRUPT_GEN_MEMBER(sound_timer_irq);
93 
94 	virtual void machine_start() override;
95 	void fastfred_palette(palette_device &palette) const;
96 	DECLARE_MACHINE_START(imago);
97 	DECLARE_VIDEO_START(fastfred);
98 	DECLARE_VIDEO_START(imago);
99 
100 	uint32_t screen_update_fastfred(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101 	uint32_t screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
103 	void fastfred_map(address_map &map);
104 	void imago_map(address_map &map);
105 	void jumpcoas_map(address_map &map);
106 	void sound_map(address_map &map);
107 };
108 
109 #endif // MAME_INCLUDES_FASTFRED_H
110