1 // license:BSD-3-Clause
2 // copyright-holders:Pierpaolo Prazzoli
3 /********************************************************************
4
5 F-E1-32 driver
6
7
8 Supported Games PCB-ID
9 ----------------------------------
10 Mosaic F-E1-32-009
11 Royal Poker 2 F-E1-32N-COM9e
12
13 driver by Pierpaolo Prazzoli
14
15 *********************************************************************/
16
17 /*
18 royalpk2 : to get 'secret. OK.'
19
20 0002D92C: MOV L18, L29
21 0002D92E: CMPI L18, $1
22 0002D930: BNE $2d94c
23
24 go 2d92c
25 do l29 = 1
26 f5
27
28 */
29
30 #include "emu.h"
31 #include "cpu/e132xs/e132xs.h"
32 #include "machine/eepromser.h"
33 #include "sound/ym2151.h"
34 #include "sound/okim6295.h"
35 #include "emupal.h"
36 #include "screen.h"
37 #include "speaker.h"
38
39
40 class mosaicf2_state : public driver_device
41 {
42 public:
mosaicf2_state(const machine_config & mconfig,device_type type,const char * tag)43 mosaicf2_state(const machine_config &mconfig, device_type type, const char *tag) :
44 driver_device(mconfig, type, tag),
45 m_maincpu(*this, "maincpu") ,
46 m_videoram(*this, "videoram")
47 { }
48
49 void mosaicf2(machine_config &config);
50 void royalpk2(machine_config &config);
51
52 private:
53 /* devices */
54 required_device<hyperstone_device> m_maincpu;
55
56 /* memory pointers */
57 required_shared_ptr<uint32_t> m_videoram;
58
59 uint32_t f32_input_port_1_r();
60 uint32_t screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61 void common_map(address_map &map);
62 void mosaicf2_io(address_map &map);
63 void royalpk2_io(address_map &map);
64 void royalpk2_map(address_map &map);
65 };
66
67
screen_update_mosaicf2(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)68 uint32_t mosaicf2_state::screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
69 {
70 for (offs_t offs = 0; offs < 0x10000; offs++)
71 {
72 int y = offs >> 8;
73 int x = offs & 0xff;
74
75 if ((x < 0xa0) && (y < 0xe0))
76 {
77 bitmap.pix(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff;
78 bitmap.pix(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff;
79 }
80 }
81
82 return 0;
83 }
84
85
86
common_map(address_map & map)87 void mosaicf2_state::common_map(address_map &map)
88 {
89 map(0x00000000, 0x001fffff).ram();
90 map(0x40000000, 0x4003ffff).ram().share("videoram");
91 map(0x80000000, 0x80ffffff).rom().region("user2", 0);
92 map(0xfff00000, 0xffffffff).rom().region("user1", 0);
93 }
94
f32_input_port_1_r()95 uint32_t mosaicf2_state::f32_input_port_1_r()
96 {
97 /* burn a bunch of cycles because this is polled frequently during busy loops */
98
99 offs_t pc = m_maincpu->pc();
100 if ((pc == 0x000379de) || (pc == 0x000379cc) )
101 m_maincpu->eat_cycles(100);
102 //else printf("PC %08x\n", pc );
103 return ioport("SYSTEM_P2")->read();
104 }
105
106
mosaicf2_io(address_map & map)107 void mosaicf2_state::mosaicf2_io(address_map &map)
108 {
109 map(0x4003, 0x4003).r("oki", FUNC(okim6295_device::read));
110 map(0x4813, 0x4813).r("ymsnd", FUNC(ym2151_device::status_r));
111 map(0x5000, 0x5003).portr("P1");
112 map(0x5200, 0x5203).r(FUNC(mosaicf2_state::f32_input_port_1_r));
113 map(0x5400, 0x5403).portr("EEPROMIN");
114 map(0x6003, 0x6003).w("oki", FUNC(okim6295_device::write));
115 map(0x6803, 0x6803).w("ymsnd", FUNC(ym2151_device::data_w));
116 map(0x6813, 0x6813).w("ymsnd", FUNC(ym2151_device::register_w));
117 map(0x7000, 0x7003).portw("EEPROMCLK");
118 map(0x7200, 0x7203).portw("EEPROMCS");
119 map(0x7400, 0x7403).portw("EEPROMOUT");
120 }
121
122
123 static INPUT_PORTS_START( mosaicf2 )
124 PORT_START("P1")
125 PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED )
126 PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
127 PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
128 PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
129 PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
130 PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
131 PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
132 PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
133 PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_START1 )
134 PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNUSED )
135
136 PORT_START("SYSTEM_P2")
137 PORT_BIT( 0x000000ff, IP_ACTIVE_LOW, IPT_UNUSED )
138 PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_COIN1 )
139 PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 )
140 PORT_SERVICE_NO_TOGGLE( 0x00000400, IP_ACTIVE_LOW )
141 PORT_BIT( 0x00007800, IP_ACTIVE_LOW, IPT_UNUSED )
142 PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
143 PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
144 PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
145 PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
146 PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
147 PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
148 PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
149 PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
150 PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_START2 )
151 PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNUSED )
152
153 PORT_START( "EEPROMIN" )
154 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
155
156 PORT_START( "EEPROMOUT" )
157 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write)
158
159 PORT_START( "EEPROMCLK" )
160 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write)
161
162 PORT_START( "EEPROMCS" )
163 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write)
164 INPUT_PORTS_END
165
166
167
168
mosaicf2(machine_config & config)169 void mosaicf2_state::mosaicf2(machine_config &config)
170 {
171 /* basic machine hardware */
172 E132XN(config, m_maincpu, XTAL(20'000'000)*4); /* 4x internal multiplier */
173 m_maincpu->set_addrmap(AS_PROGRAM, &mosaicf2_state::common_map);
174 m_maincpu->set_addrmap(AS_IO, &mosaicf2_state::mosaicf2_io);
175 m_maincpu->set_vblank_int("screen", FUNC(mosaicf2_state::irq0_line_hold));
176
177 EEPROM_93C46_16BIT(config, "eeprom")
178 .erase_time(attotime::from_usec(1))
179 .write_time(attotime::from_usec(1));
180
181 /* video hardware */
182 screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
183 screen.set_refresh_hz(60);
184 screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
185 screen.set_size(512, 512);
186 screen.set_visarea(0, 319, 0, 223);
187 screen.set_screen_update(FUNC(mosaicf2_state::screen_update_mosaicf2));
188 screen.set_palette("palette");
189
190 PALETTE(config, "palette", palette_device::RGB_555);
191
192 /* sound hardware */
193 SPEAKER(config, "lspeaker").front_left();
194 SPEAKER(config, "rspeaker").front_right();
195
196 ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545 MHz */
197 ymsnd.add_route(0, "lspeaker", 1.0);
198 ymsnd.add_route(1, "rspeaker", 1.0);
199
200 okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/8, okim6295_device::PIN7_HIGH)); /* 1.7897725 MHz */
201 oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
202 oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
203 }
204
205
206
207 static INPUT_PORTS_START( royalpk2 )
208 PORT_START("P1")
209
210 PORT_START("SYSTEM_P2")
211 PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
212 PORT_BIT( 0xff7fffff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
213
214 PORT_START( "EEPROMIN" )
215 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
216
217 PORT_START( "EEPROMOUT" )
218 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write)
219
220 PORT_START( "EEPROMCLK" )
221 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write)
222
223 PORT_START( "EEPROMCS" )
224 PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write)
225 INPUT_PORTS_END
226
227
228
royalpk2_map(address_map & map)229 void mosaicf2_state::royalpk2_map(address_map &map)
230 {
231 map(0x00000000, 0x003fffff).ram();
232 map(0x40000000, 0x4003ffff).ram().share("videoram");
233 map(0x80000000, 0x807fffff).rom().region("user2", 0);
234 map(0xfff00000, 0xffffffff).rom().region("user1", 0);
235 }
236
royalpk2_io(address_map & map)237 void mosaicf2_state::royalpk2_io(address_map &map)
238 {
239 map(0x4900, 0x4903).portr("SYSTEM_P2");
240
241 map(0x4a00, 0x4a03).portr("EEPROMIN");
242
243 map(0x6800, 0x6803).portw("EEPROMCLK");
244 map(0x6900, 0x6903).portw("EEPROMCS");
245 map(0x6a00, 0x6a03).portw("EEPROMOUT");
246 }
247
royalpk2(machine_config & config)248 void mosaicf2_state::royalpk2(machine_config &config)
249 {
250 /* basic machine hardware */
251 GMS30C2132(config, m_maincpu, XTAL(50'000'000));
252 m_maincpu->set_addrmap(AS_PROGRAM, &mosaicf2_state::royalpk2_map);
253 m_maincpu->set_addrmap(AS_IO, &mosaicf2_state::royalpk2_io);
254 m_maincpu->set_vblank_int("screen", FUNC(mosaicf2_state::irq1_line_hold));
255
256 EEPROM_93C46_16BIT(config, "eeprom")
257 .erase_time(attotime::from_usec(1))
258 .write_time(attotime::from_usec(1));
259
260 /* video hardware */
261 screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
262 screen.set_refresh_hz(60);
263 screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
264 screen.set_size(512, 512);
265 screen.set_visarea(0, 319, 0, 223);
266 screen.set_screen_update(FUNC(mosaicf2_state::screen_update_mosaicf2));
267 screen.set_palette("palette");
268
269 PALETTE(config, "palette", palette_device::RGB_555);
270
271 /* sound hardware */
272 SPEAKER(config, "lspeaker").front_left();
273 SPEAKER(config, "rspeaker").front_right();
274
275 // ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(14'318'181)/4)); /* 3.579545 MHz */
276 // ymsnd.add_route(0, "lspeaker", 1.0);
277 // ymsnd.add_route(1, "rspeaker", 1.0);
278
279 okim6295_device &oki(OKIM6295(config, "oki", XTAL(14'318'181)/8, okim6295_device::PIN7_HIGH)); /* 1.7897725 MHz */
280 oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0);
281 oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0);
282
283 // there is a 16c550 for communication
284 }
285
286
287 /*
288
289 Mosaic (c) 1999 F2 System
290
291 CPU: Hyperstone E1-32XN
292 Video: QuickLogic QL2003-XPL84C FPGA
293 Sound: OKI 6295, BS901 (YM2151) & BS902 (YM3012)
294 OSC: 20MHz & 14.31818MHz
295 EEPROM: 93C46 (controlled through FPGA)
296
297 F-E1-32-009
298 +------------------------------------------------------------------+
299 | VOL +---------+ |
300 +-+ YM3812 | SND | |
301 | +---------+ |
302 +-+ YM2151 OKI6295 |
303 | |
304 | +---------------+ |
305 | | | |
306 |J +-------+ | | |
307 |A | VRAML | | QuickLogic | 14.31818MHz |
308 |M +-------+ | QL2003-XPL84C | |
309 |M +-------+ | 9819 BA | +-----+ |
310 |A | VRAMU | | | |93C46| |
311 | +-------+ +---------------+ +-----+ |
312 |C |
313 |O +---------+ +---------+ |
314 |N | L00 | | U00 | |
315 |N | | | | |
316 |E +---------+ +---------+ |
317 |C +------------+ +---------+ +---------+ |
318 |T | | | L01 | | U01 | |
319 |O | | | | | | |
320 |R | HyperStone | +---------+ +---------+ |
321 | | E1-32XN | +---------+ +---------+ |
322 | | | | L02 | | U02 | |
323 | +-----+ | | | | | | |
324 | |DRAML| +------------+ +---------+ +---------+ |
325 +-+ +-----+ +---------+ +---------+ |
326 | +-----+ 20MHz | L03 | | U03 | |
327 +-+ |DRAMU| | | | | |
328 | +-----+ +----------+ +---------+ +---------+ |
329 | +--+ +--+ | ROM1 | |
330 | |S3| |S1| +----------+ |
331 +------------------------------------------------------------------+
332
333 S3 is a reset button
334 S1 is the setup button
335
336 VRAML & VRAMU are KM6161002CJ-12
337 DRAML & DRAMU are GM71C18163CJ6
338
339 ROM1 & SND are stardard 27C040 and/or 27C020 eproms
340 L00-L03 & U00-U03 are 29F1610ML Flash roms
341
342
343 todo: royalpk2 layout (it's very different)
344 */
345
346 ROM_START( mosaicf2 ) /* Released October 1999 */
347 ROM_REGION32_BE( 0x100000, "user1", ROMREGION_ERASE00 ) /* Hyperstone CPU Code */
348 /* 0 - 0x80000 empty */
349 ROM_LOAD( "rom1.bin", 0x80000, 0x080000, CRC(fceb6f83) SHA1(b98afb477627c3b2d584c0f0fb26c4dd5b1a31e2) )
350
351 ROM_REGION32_BE( 0x1000000, "user2", 0 ) /* gfx data */
352 ROM_LOAD32_WORD_SWAP( "u00.bin", 0x000000, 0x200000, CRC(a2329675) SHA1(bff8974fab9120274821c9c9646744317f47c79c) )
353 ROM_LOAD32_WORD_SWAP( "l00.bin", 0x000002, 0x200000, CRC(d96fe93b) SHA1(005d9889077825fc0e308d2981f6fca5e6b51fe8) )
354 ROM_LOAD32_WORD_SWAP( "u01.bin", 0x400000, 0x200000, CRC(6379e73f) SHA1(fe5abafbcbd828795cb06a08763fae1bbe2a75ad) )
355 ROM_LOAD32_WORD_SWAP( "l01.bin", 0x400002, 0x200000, CRC(a269ea82) SHA1(d962a8b3293c6f46dbefa49859b2b3e594e7a386) )
356 ROM_LOAD32_WORD_SWAP( "u02.bin", 0x800000, 0x200000, CRC(c17f95cd) SHA1(1c701185be138b615d2851866288647f40809c28) )
357 ROM_LOAD32_WORD_SWAP( "l02.bin", 0x800002, 0x200000, CRC(69cd9c5c) SHA1(6b4d204a6ab5f36dfba9053bb3be2d094fcfdd00) )
358 ROM_LOAD32_WORD_SWAP( "u03.bin", 0xc00000, 0x200000, CRC(0e47df20) SHA1(6f6c3e7fc8c99db7ddc73d8d10a661373bb72a1a) )
359 ROM_LOAD32_WORD_SWAP( "l03.bin", 0xc00002, 0x200000, CRC(d79f6ca8) SHA1(4735dda9269aa05ba1251d335dc73914f5cb43b0) )
360
361 ROM_REGION( 0x40000, "oki", 0 ) /* Oki Samples */
362 ROM_LOAD( "snd.bin", 0x000000, 0x040000, CRC(4584589c) SHA1(5f9824724f840767c3dc1dc04b203ddf3d78b84c) )
363 ROM_END
364
365 ROM_START( royalpk2 )
366 ROM_REGION32_BE( 0x100000, "user1", ROMREGION_ERASE00 ) /* Hyperstone CPU Code */
367 /* 0 - 0x80000 empty */
368 ROM_LOAD( "prog1", 0x80000, 0x080000, CRC(e1546304) SHA1(b628b347ba7fbbae948e98e72aa5ea190c5d0f2b) )
369
370 ROM_REGION32_BE( 0x800000, "user2", 0 ) /* gfx data */
371 ROM_LOAD32_WORD_SWAP( "1.u00", 0x000000, 0x200000, CRC(b397a805) SHA1(3fafa8533c793f41d0567b76667d3f3478eb9c1d) )
372 ROM_LOAD32_WORD_SWAP( "2.l00", 0x000002, 0x200000, CRC(83a67d20) SHA1(9bf4c3da0cd1aab2488f260f694493d8ee25883e) )
373 ROM_LOAD32_WORD_SWAP( "3.u01", 0x400000, 0x200000, CRC(f7b9d508) SHA1(5d98687c6cf158df8134d88d3726778d3762b411) )
374 ROM_LOAD32_WORD_SWAP( "4.l01", 0x400002, 0x200000, CRC(dcff4960) SHA1(f742c7a3b62262c4b0210db9df03f51b3f600bf2) )
375
376 ROM_REGION( 0x80000, "oki", 0 ) /* Oki Samples */
377 ROM_LOAD( "snd2", 0x000000, 0x080000, CRC(f25e3315) SHA1(ce5350ecba6769b17bb01d82b55f26ded4d51773) )
378 ROM_END
379
380
381 GAME( 1999, mosaicf2, 0, mosaicf2, mosaicf2, mosaicf2_state, empty_init, ROT0, "F2 System", "Mosaic (F2 System)", MACHINE_SUPPORTS_SAVE )
382 GAME( 1999, royalpk2, 0, royalpk2, royalpk2, mosaicf2_state, empty_init, ROT0, "F2 System", "Royal Poker 2 (Network version 3.12)", MACHINE_NOT_WORKING )
383