1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
// license:BSD-3-Clause
// copyright-holders:Manuel Abadia, Ernesto Corvi, Nicola Salmoria
#ifndef MAME_INCLUDES_GAPLUS_H
#define MAME_INCLUDES_GAPLUS_H
#pragma once
#include "sound/namco.h"
#include "sound/samples.h"
#include "machine/namcoio.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class gaplus_base_state : public driver_device
{
public:
static constexpr unsigned MAX_STARS = 250;
struct star {
float x = 0, y = 0;
int col = 0, set = 0;
};
enum
{
TIMER_NAMCOIO0_RUN,
TIMER_NAMCOIO1_RUN
};
gaplus_base_state(const machine_config &mconfig, device_type type, const char *tag, const char *namco56xx_tag, const char *namco58xx_tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_subcpu(*this, "sub")
, m_subcpu2(*this, "sub2")
, m_namco56xx(*this, namco56xx_tag)
, m_namco58xx(*this, namco58xx_tag)
, m_namco_15xx(*this, "namco")
, m_samples(*this, "samples")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
, m_palette(*this, "palette")
, m_proms_region(*this, "proms")
, m_customio_3(*this, "customio_3")
, m_videoram(*this, "videoram")
, m_spriteram(*this, "spriteram")
, m_gfx1_region(*this, "gfx1")
, m_gfx2_region(*this, "gfx2")
{ }
void irq_1_ctrl_w(offs_t offset, uint8_t data);
void irq_2_ctrl_w(offs_t offset, uint8_t data);
void irq_3_ctrl_w(offs_t offset, uint8_t data);
void sreset_w(offs_t offset, uint8_t data);
void freset_w(offs_t offset, uint8_t data);
void customio_3_w(offs_t offset, uint8_t data);
uint8_t customio_3_r(offs_t offset);
void videoram_w(offs_t offset, uint8_t data);
void starfield_control_w(offs_t offset, uint8_t data);
void gaplus_palette(palette_device &palette) const;
TILEMAP_MAPPER_MEMBER(tilemap_scan);
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
TIMER_CALLBACK_MEMBER(namcoio0_run);
TIMER_CALLBACK_MEMBER(namcoio1_run);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
void starfield_init();
void starfield_render(bitmap_ind16 &bitmap);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) const;
void gaplus_base(machine_config &config);
void cpu1_map(address_map &map);
void cpu2_map(address_map &map);
void cpu3_map(address_map &map);
virtual void driver_init() override;
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_subcpu2;
required_device<namco56xx_device> m_namco56xx;
required_device<namco58xx_device> m_namco58xx;
required_device<namco_15xx_device> m_namco_15xx;
required_device<samples_device> m_samples;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_memory_region m_proms_region;
required_shared_ptr<uint8_t> m_customio_3;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_memory_region m_gfx1_region;
required_memory_region m_gfx2_region;
int m_type = 0;
tilemap_t *m_bg_tilemap = nullptr;
uint8_t m_starfield_control[4]{};
int m_total_stars = 0;
int m_starfield_framecount = 0;
struct star m_stars[MAX_STARS];
uint8_t m_main_irq_mask = 0;
uint8_t m_sub_irq_mask = 0;
uint8_t m_sub2_irq_mask = 0;
emu_timer *m_namcoio0_run_timer = nullptr;
emu_timer *m_namcoio1_run_timer = nullptr;
};
class gaplusd_state : public gaplus_base_state
{
public:
gaplusd_state(const machine_config &mconfig, device_type type, const char *tag)
: gaplus_base_state(mconfig, type, tag, "namcoio_2", "namcoio_1")
{
}
void gaplusd(machine_config &config);
};
class gapluso_state : public gaplus_base_state {
public:
gapluso_state(const machine_config &mconfig, device_type type, const char *tag)
: gaplus_base_state(mconfig, type, tag, "namcoio_1", "namcoio_2") {
}
void gapluso(machine_config &config);
protected:
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
};
class gaplus_state : public gaplus_base_state {
public:
gaplus_state(const machine_config &mconfig, device_type type, const char *tag)
: gaplus_base_state(mconfig, type, tag, "namcoio_1", "namcoio_2")
, m_lamps(*this, "lamp%u", 0U)
{
}
void gaplus(machine_config &config);
protected:
virtual void machine_start() override;
void out_lamps0(uint8_t data);
void out_lamps1(uint8_t data);
output_finder<2> m_lamps;
};
#endif // MAME_INCLUDES_GAPLUS_H
|