2
2
// copyright-holders:hap, Tomasz Slanina
3
3
/* ******************************************************************************
4
4
5
- unknown Japanese horse gambling game
6
- probably early 80s, manufacturer unknown
5
+ unknown Japanese horse gambling game
6
+ probably early 80s, manufacturer unknown
7
7
8
- from a broken PCB, labeled EFI TG-007
9
- 8085A CPU + 8155 (for I/O and sound)
10
- 8KB RAM mainly for bitmap video, and 512x4 RAM for color map
8
+ from a broken PCB, labeled EFI TG-007
9
+ M5L8085AP CPU + M5L8155P (for I/O and sound)
10
+ 8KB RAM mainly for bitmap video, and 512x4 RAM for color map
11
11
12
12
TODO:
13
13
- identify game!
@@ -38,37 +38,40 @@ class horse_state : public driver_device
38
38
horse_state (const machine_config &mconfig, device_type type, const char *tag) :
39
39
driver_device (mconfig, type, tag),
40
40
m_maincpu (*this , " maincpu" ),
41
- m_speaker (*this , " speaker" ),
42
- m_inputs (*this , " IN.%u" , 0 ),
43
- m_vram (*this , " vram" )
41
+ m_i8155 (*this , " i8155" ),
42
+ m_screen (*this , " screen" ),
43
+ m_vram (*this , " vram" ),
44
+ m_colorram (*this , " colorram" , 0x200 , ENDIANNESS_LITTLE),
45
+ m_inputs (*this , " IN.%u" , 0 )
44
46
{ }
45
47
46
48
void horse (machine_config &config);
47
49
50
+ protected:
51
+ virtual void machine_start () override ;
52
+
48
53
private:
49
54
required_device<cpu_device> m_maincpu;
50
- required_device<speaker_sound_device> m_speaker;
55
+ required_device<i8155_device> m_i8155;
56
+ required_device<screen_device> m_screen;
57
+ required_shared_ptr<u8 > m_vram;
58
+ memory_share_creator<u8 > m_colorram;
51
59
required_ioport_array<4 > m_inputs;
52
- required_shared_ptr<uint8_t > m_vram;
53
60
54
- std::unique_ptr<uint8_t []> m_colorram;
55
- uint8_t m_output = 0 ;
61
+ u8 m_output = 0 ;
56
62
57
- uint8_t colorram_r (offs_t offset) { return m_colorram[(offset >> 2 & 0x1e0 ) | (offset & 0x1f )] | 0x0f ; }
58
- void colorram_w (offs_t offset, uint8_t data) { m_colorram[(offset >> 2 & 0x1e0 ) | (offset & 0x1f )] = data & 0xf0 ; }
59
- uint8_t input_r ();
60
- void output_w (uint8_t data);
63
+ u8 colorram_r (offs_t offset) { return m_colorram[(offset >> 2 & 0x1e0 ) | (offset & 0x1f )] | 0x0f ; }
64
+ void colorram_w (offs_t offset, u8 data) { m_colorram[(offset >> 2 & 0x1e0 ) | (offset & 0x1f )] = data & 0xf0 ; }
65
+ u8 input_r ();
66
+ void output_w (u8 data);
61
67
62
- virtual void machine_start () override ;
63
- uint32_t screen_update (screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68
+ u32 screen_update (screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
64
69
void horse_io_map (address_map &map);
65
70
void horse_map (address_map &map);
66
71
};
67
72
68
73
void horse_state::machine_start ()
69
74
{
70
- m_colorram = std::make_unique<uint8_t []>(0x200 );
71
- save_pointer (NAME (m_colorram), 0x200 );
72
75
save_item (NAME (m_output));
73
76
}
74
77
@@ -78,14 +81,14 @@ void horse_state::machine_start()
78
81
Video
79
82
*******************************************************************************/
80
83
81
- uint32_t horse_state::screen_update (screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
84
+ u32 horse_state::screen_update (screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
82
85
{
83
86
for (int y = cliprect.min_y ; y <= cliprect.max_y ; y++)
84
87
{
85
88
for (int x = 0 ; x < 32 ; x++)
86
89
{
87
- uint8_t data = m_vram[y << 5 | x];
88
- uint8_t color = m_colorram[(y << 1 & 0x1e0 ) | x] >> 4 ;
90
+ u8 data = m_vram[y << 5 | x];
91
+ u8 color = m_colorram[(y << 1 & 0x1e0 ) | x] >> 4 ;
89
92
90
93
for (int i = 0 ; i < 8 ; i++)
91
94
bitmap.pix (y, x << 3 | i) = (data >> i & 1 ) ? color : 0 ;
@@ -101,32 +104,36 @@ uint32_t horse_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
101
104
I/O
102
105
*******************************************************************************/
103
106
104
- void horse_state::horse_map (address_map &map )
107
+ u8 horse_state::input_r ( )
105
108
{
106
- map (0x0000 , 0x37ff ).rom ();
107
- map (0x4000 , 0x40ff ).rw (" i8155" , FUNC (i8155_device::memory_r), FUNC (i8155_device::memory_w));
108
- map (0x6000 , 0x7fff ).ram ().share (" vram" );
109
- map (0x8000 , 0x87ff ).mirror (0x0800 ).rw (FUNC (horse_state::colorram_r), FUNC (horse_state::colorram_w));
109
+ return m_inputs[m_output >> 6 & 3 ]->read ();
110
110
}
111
111
112
- void horse_state::horse_io_map (address_map &map )
112
+ void horse_state::output_w ( u8 data )
113
113
{
114
- map (0x40 , 0x47 ).rw (" i8155" , FUNC (i8155_device::io_r), FUNC (i8155_device::io_w));
114
+ // d4: payout related
115
+ // d6-d7: input mux
116
+ // other bits: ?
117
+ m_output = data;
115
118
}
116
119
117
120
118
- uint8_t horse_state::input_r ()
121
+
122
+ /* ******************************************************************************
123
+ Address Maps
124
+ *******************************************************************************/
125
+
126
+ void horse_state::horse_map (address_map &map)
119
127
{
120
- return m_inputs[m_output >> 6 & 3 ]->read ();
128
+ map (0x0000 , 0x37ff ).rom ();
129
+ map (0x4000 , 0x40ff ).rw (m_i8155, FUNC (i8155_device::memory_r), FUNC (i8155_device::memory_w));
130
+ map (0x6000 , 0x7fff ).ram ().share (" vram" );
131
+ map (0x8000 , 0x87ff ).mirror (0x0800 ).rw (FUNC (horse_state::colorram_r), FUNC (horse_state::colorram_w));
121
132
}
122
133
123
- void horse_state::output_w ( uint8_t data )
134
+ void horse_state::horse_io_map (address_map &map )
124
135
{
125
- m_output = data;
126
-
127
- // d4: payout related
128
- // d6-d7: input mux
129
- // other bits: ?
136
+ map (0x40 , 0x47 ).rw (m_i8155, FUNC (i8155_device::io_r), FUNC (i8155_device::io_w));
130
137
}
131
138
132
139
@@ -138,14 +145,14 @@ void horse_state::output_w(uint8_t data)
138
145
static INPUT_PORTS_START ( horse )
139
146
PORT_START(" IN.0" )
140
147
PORT_DIPNAME( 0x07 , 0x07 , DEF_STR( Coinage ) ) PORT_DIPLOCATION(" SW:1,2,3" )
141
- PORT_DIPSETTING( 0x01 , DEF_STR( 1C_1C ) )
142
- PORT_DIPSETTING( 0x02 , DEF_STR( 1C_2C ) )
143
- PORT_DIPSETTING( 0x03 , DEF_STR( 1C_3C ) )
144
- PORT_DIPSETTING( 0x04 , DEF_STR( 1C_4C ) )
145
- PORT_DIPSETTING( 0x05 , DEF_STR( 1C_5C ) )
146
- PORT_DIPSETTING( 0x06 , DEF_STR( 1C_6C ) )
147
- PORT_DIPSETTING( 0x07 , DEF_STR( 1C_7C ) )
148
- PORT_DIPSETTING( 0x00 , " 1 Coin/10 Credits" )
148
+ PORT_DIPSETTING( 0x01 , DEF_STR( 1C_1C ) )
149
+ PORT_DIPSETTING( 0x02 , DEF_STR( 1C_2C ) )
150
+ PORT_DIPSETTING( 0x03 , DEF_STR( 1C_3C ) )
151
+ PORT_DIPSETTING( 0x04 , DEF_STR( 1C_4C ) )
152
+ PORT_DIPSETTING( 0x05 , DEF_STR( 1C_5C ) )
153
+ PORT_DIPSETTING( 0x06 , DEF_STR( 1C_6C ) )
154
+ PORT_DIPSETTING( 0x07 , DEF_STR( 1C_7C ) )
155
+ PORT_DIPSETTING( 0x00 , " 1 Coin/10 Credits" )
149
156
PORT_DIPNAME( 0x08 , 0x08 , " UNK04" ) PORT_DIPLOCATION(" SW:4" )
150
157
PORT_DIPSETTING( 0x08 , DEF_STR( Off ) )
151
158
PORT_DIPSETTING( 0x00 , DEF_STR( On ) )
@@ -190,30 +197,31 @@ INPUT_PORTS_END
190
197
191
198
void horse_state::horse(machine_config &config)
192
199
{
193
- /* basic machine hardware */
194
- I8085A (config, m_maincpu, XTAL ( 12'000'000 ) / 2 );
200
+ // basic machine hardware
201
+ I8085A (config, m_maincpu, 12_MHz_XTAL / 2 );
195
202
m_maincpu->set_addrmap (AS_PROGRAM, &horse_state::horse_map);
196
203
m_maincpu->set_addrmap (AS_IO, &horse_state::horse_io_map);
197
204
198
- i8155_device &i8155 (I8155 (config, " i8155" , XTAL (12'000'000 ) / 4 )); // port A input, B output, C output but unused
199
- i8155.in_pa_callback ().set (FUNC (horse_state::input_r));
200
- i8155.out_pb_callback ().set (FUNC (horse_state::output_w));
201
- i8155.out_to_callback ().set (" speaker" , FUNC (speaker_sound_device::level_w));
202
-
203
- /* video hardware */
204
- screen_device &screen (SCREEN (config, " screen" , SCREEN_TYPE_RASTER));
205
- screen.set_refresh_hz (60 );
206
- screen.set_vblank_time (ATTOSECONDS_IN_USEC (0 ));
207
- screen.set_size (32 *8 , 32 *8 );
208
- screen.set_visarea (0 *8 , 32 *8 -1 , 1 *8 , 31 *8 -1 );
209
- screen.set_screen_update (FUNC (horse_state::screen_update));
210
- screen.screen_vblank ().set_inputline (m_maincpu, I8085_RST75_LINE);
211
- screen.set_palette (" palette" );
205
+ I8155 (config, m_i8155, 12_MHz_XTAL / 4 ); // port A input, B output, C output but unused
206
+ m_i8155->in_pa_callback ().set (FUNC (horse_state::input_r));
207
+ m_i8155->out_pb_callback ().set (FUNC (horse_state::output_w));
208
+ m_i8155->out_to_callback ().set (" speaker" , FUNC (speaker_sound_device::level_w));
209
+
210
+ // video hardware
211
+ SCREEN (config, m_screen, SCREEN_TYPE_RASTER);
212
+ m_screen->set_refresh_hz (60 );
213
+ m_screen->set_vblank_time (ATTOSECONDS_IN_USEC (0 ));
214
+ m_screen->set_size (32 *8 , 32 *8 );
215
+ m_screen->set_visarea (0 *8 , 32 *8 -1 , 1 *8 , 31 *8 -1 );
216
+ m_screen->set_screen_update (FUNC (horse_state::screen_update));
217
+ m_screen->screen_vblank ().set_inputline (m_maincpu, I8085_RST75_LINE);
218
+ m_screen->set_palette (" palette" );
219
+
212
220
PALETTE (config, " palette" , palette_device::BGR_3BIT);
213
221
214
- /* sound hardware */
222
+ // sound hardware
215
223
SPEAKER (config, " mono" ).front_center ();
216
- SPEAKER_SOUND (config, m_speaker ).add_route (ALL_OUTPUTS, " mono" , 0.25 );
224
+ SPEAKER_SOUND (config, " speaker " ).add_route (ALL_OUTPUTS, " mono" , 0.25 );
217
225
}
218
226
219
227
0 commit comments