Skip to content

Commit f70bc8e

Browse files
committed
forte2, unkhorse: small cleanup
1 parent d94d4b3 commit f70bc8e

File tree

4 files changed

+207
-160
lines changed

4 files changed

+207
-160
lines changed

src/mame/misc/unkhorse.cpp

Lines changed: 72 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// copyright-holders:hap, Tomasz Slanina
33
/*******************************************************************************
44
5-
unknown Japanese horse gambling game
6-
probably early 80s, manufacturer unknown
5+
unknown Japanese horse gambling game
6+
probably early 80s, manufacturer unknown
77
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
1111
1212
TODO:
1313
- identify game!
@@ -38,37 +38,40 @@ class horse_state : public driver_device
3838
horse_state(const machine_config &mconfig, device_type type, const char *tag) :
3939
driver_device(mconfig, type, tag),
4040
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)
4446
{ }
4547

4648
void horse(machine_config &config);
4749

50+
protected:
51+
virtual void machine_start() override;
52+
4853
private:
4954
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;
5159
required_ioport_array<4> m_inputs;
52-
required_shared_ptr<uint8_t> m_vram;
5360

54-
std::unique_ptr<uint8_t[]> m_colorram;
55-
uint8_t m_output = 0;
61+
u8 m_output = 0;
5662

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);
6167

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);
6469
void horse_io_map(address_map &map);
6570
void horse_map(address_map &map);
6671
};
6772

6873
void horse_state::machine_start()
6974
{
70-
m_colorram = std::make_unique<uint8_t []>(0x200);
71-
save_pointer(NAME(m_colorram), 0x200);
7275
save_item(NAME(m_output));
7376
}
7477

@@ -78,14 +81,14 @@ void horse_state::machine_start()
7881
Video
7982
*******************************************************************************/
8083

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)
8285
{
8386
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
8487
{
8588
for (int x = 0; x < 32; x++)
8689
{
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;
8992

9093
for (int i = 0; i < 8; i++)
9194
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,
101104
I/O
102105
*******************************************************************************/
103106

104-
void horse_state::horse_map(address_map &map)
107+
u8 horse_state::input_r()
105108
{
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();
110110
}
111111

112-
void horse_state::horse_io_map(address_map &map)
112+
void horse_state::output_w(u8 data)
113113
{
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;
115118
}
116119

117120

118-
uint8_t horse_state::input_r()
121+
122+
/*******************************************************************************
123+
Address Maps
124+
*******************************************************************************/
125+
126+
void horse_state::horse_map(address_map &map)
119127
{
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));
121132
}
122133

123-
void horse_state::output_w(uint8_t data)
134+
void horse_state::horse_io_map(address_map &map)
124135
{
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));
130137
}
131138

132139

@@ -138,14 +145,14 @@ void horse_state::output_w(uint8_t data)
138145
static INPUT_PORTS_START( horse )
139146
PORT_START("IN.0")
140147
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" )
149156
PORT_DIPNAME( 0x08, 0x08, "UNK04" ) PORT_DIPLOCATION("SW:4")
150157
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
151158
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -190,30 +197,31 @@ INPUT_PORTS_END
190197

191198
void horse_state::horse(machine_config &config)
192199
{
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);
195202
m_maincpu->set_addrmap(AS_PROGRAM, &horse_state::horse_map);
196203
m_maincpu->set_addrmap(AS_IO, &horse_state::horse_io_map);
197204

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+
212220
PALETTE(config, "palette", palette_device::BGR_3BIT);
213221

214-
/* sound hardware */
222+
// sound hardware
215223
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);
217225
}
218226

219227

src/mame/msx/big10.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ class big10_state : public driver_device
105105
* Input Ports Demux & Common Routines *
106106
****************************************/
107107

108-
109108
void big10_state::mux_w(uint8_t data)
110109
{
111110
m_mux_data = ~data;
@@ -138,7 +137,7 @@ void big10_state::main_map(address_map &map)
138137
void big10_state::main_io(address_map &map)
139138
{
140139
map.global_mask(0xff);
141-
map(0x00, 0x00).r(FUNC(big10_state::mux_r)); // present in test mode
140+
map(0x00, 0x00).r(FUNC(big10_state::mux_r)); // present in test mode
142141
map(0x02, 0x02).portr("SYSTEM"); // coins and service
143142
map(0x98, 0x9b).rw("v9938", FUNC(v9938_device::read), FUNC(v9938_device::write));
144143
map(0xa0, 0xa1).w("aysnd", FUNC(ay8910_device::address_data_w));
@@ -157,8 +156,8 @@ static INPUT_PORTS_START( big10 )
157156
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MEMORY_RESET )
158157
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
159158
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
160-
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed.
161-
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed.
159+
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed.
160+
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "
162161
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
163162
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2)
164163

@@ -188,7 +187,7 @@ static INPUT_PORTS_START( big10 )
188187
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big")
189188
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small")
190189
PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
191-
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode triggers a sound and screen turns black, hanging the game.
190+
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode triggers a sound and screen turns black, hanging the game.
192191

193192
PORT_START("IN4")
194193
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -234,12 +233,14 @@ INPUT_PORTS_END
234233
void big10_state::big10(machine_config &config)
235234
{
236235
// basic machine hardware
237-
Z80(config, m_maincpu, MASTER_CLOCK/6); // guess
236+
Z80(config, m_maincpu, MASTER_CLOCK/6); // guess
238237
m_maincpu->set_addrmap(AS_PROGRAM, &big10_state::main_map);
239238
m_maincpu->set_addrmap(AS_IO, &big10_state::main_io);
240239

241240
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
242241

242+
TICKET_DISPENSER(config, m_hopper, attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW);
243+
243244
// video hardware
244245
v9938_device &v9938(V9938(config, "v9938", MASTER_CLOCK));
245246
v9938.set_screen_ntsc("screen");
@@ -249,13 +250,11 @@ void big10_state::big10(machine_config &config)
249250

250251
// sound hardware
251252
SPEAKER(config, "mono").front_center();
252-
ym2149_device &aysnd(YM2149(config, "aysnd", MASTER_CLOCK/12)); // guess
253+
ym2149_device &aysnd(YM2149(config, "aysnd", MASTER_CLOCK/12)); // guess
253254
aysnd.port_a_read_callback().set_ioport("DSW2");
254255
aysnd.port_b_read_callback().set_ioport("DSW1");
255256
aysnd.port_a_write_callback().set(FUNC(big10_state::mux_w));
256257
aysnd.add_route(ALL_OUTPUTS, "mono", 0.30);
257-
258-
TICKET_DISPENSER(config, m_hopper, attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW);
259258
}
260259

261260

@@ -277,5 +276,5 @@ ROM_END
277276
* Game Driver(s) *
278277
**************************************/
279278

280-
/* YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS */
279+
// YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS
281280
GAME( 1985, big10, 0, big10, big10, big10_state, empty_init, ROT0, "Success", "Big 10", MACHINE_SUPPORTS_SAVE )

0 commit comments

Comments
 (0)