Previous 199869 Revisions Next

r18076 Saturday 22nd September, 2012 at 21:39:27 UTC by hap
fix broken sound - MT 5017
(the regression was in poo_state::timer_r)
[src/mame/drivers]poo.c

trunk/src/mame/drivers/poo.c
r18075r18076
5050{
5151public:
5252   poo_state(const machine_config &mconfig, device_type type, const char *tag)
53      : driver_device(mconfig, type, tag) ,
53      : driver_device(mconfig, type, tag),
54      m_maincpu(*this, "maincpu"),
55      m_subcpu(*this, "subcpu"),
5456      m_sprites(*this, "sprites"),
5557      m_scrolly(*this, "scrolly"),
56      m_vram(*this, "vram"){ }
58      m_vram(*this, "vram")
59   { }
5760
61   required_device<cpu_device> m_maincpu;
62   required_device<cpu_device> m_subcpu;
5863   required_shared_ptr<UINT8> m_sprites;
5964   required_shared_ptr<UINT8> m_scrolly;
6065   required_shared_ptr<UINT8> m_vram;
66
6167   UINT8 m_vram_colbank;
62   DECLARE_READ8_MEMBER(unk_inp_r);
63   DECLARE_READ8_MEMBER(unk_inp2_r);
64   DECLARE_READ8_MEMBER(unk_inp3_r);
65   DECLARE_WRITE8_MEMBER(unk_w);
68
6669   DECLARE_WRITE8_MEMBER(sound_cmd_w);
6770   DECLARE_WRITE8_MEMBER(poo_vregs_w);
6871   DECLARE_READ8_MEMBER(timer_r);
r18075r18076
7275};
7376
7477
78/******************************************************************************************/
79
80void poo_state::palette_init()
81{
82   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
83   int i,r,g,b,val;
84   int bit0,bit1,bit2;
85
86   for (i = 0; i < 0x100; i++)
87   {
88      val = (color_prom[i+0x100]) | (color_prom[i+0x000]<<4);
89
90      bit0 = 0;
91      bit1 = (val >> 6) & 0x01;
92      bit2 = (val >> 7) & 0x01;
93      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
94      bit0 = (val >> 3) & 0x01;
95      bit1 = (val >> 4) & 0x01;
96      bit2 = (val >> 5) & 0x01;
97      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
98      bit0 = (val >> 0) & 0x01;
99      bit1 = (val >> 1) & 0x01;
100      bit2 = (val >> 2) & 0x01;
101      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
102
103      palette_set_color(machine(), i, MAKE_RGB(r, g, b));
104   }
105}
106
75107void poo_state::video_start()
76108{
77109}
r18075r18076
118150   return 0;
119151}
120152
121READ8_MEMBER(poo_state::unk_inp_r)
122{
123   return 0x00;//machine().rand();
124}
125153
126#if 0
154/******************************************************************************************/
127155
128READ8_MEMBER(poo_state::unk_inp2_r)
129{
130   return 0xff;
131}
132
133READ8_MEMBER(poo_state::unk_inp3_r)
134{
135   return machine().rand();
136}
137#endif
138
139
140#if 0
141WRITE8_MEMBER(poo_state::unk_w)
142{
143   printf("%02x %02x\n",data,offset);
144}
145#endif
146
147/* soundlatch write */
148156WRITE8_MEMBER(poo_state::sound_cmd_w)
149157{
150   soundlatch_byte_w(space, 0, (data & 0xff));
151   machine().device("subcpu")->execute().set_input_line(0, HOLD_LINE);
158   soundlatch_byte_w(space, 0, data);
159   m_subcpu->set_input_line(0, HOLD_LINE);
152160}
153161
154162WRITE8_MEMBER(poo_state::poo_vregs_w)
r18075r18076
161169   AM_RANGE(0x0000, 0x7fff) AM_ROM AM_WRITENOP
162170   AM_RANGE(0x8000, 0x8fff) AM_RAM
163171   AM_RANGE(0x9000, 0x97ff) AM_RAM
164   AM_RANGE(0x9800, 0x9801) AM_READ(unk_inp_r) //AM_WRITE(unk_w )
172   AM_RANGE(0x9800, 0x9801) AM_NOP // ?
165173
166174   AM_RANGE(0xb000, 0xb07f) AM_RAM AM_SHARE("sprites")
167175   AM_RANGE(0xb080, 0xb0ff) AM_RAM AM_SHARE("scrolly")
r18075r18076
177185   AM_RANGE(0xb700, 0xb700) AM_WRITE(poo_vregs_w)
178186
179187   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_SHARE("vram")
180
181188ADDRESS_MAP_END
182189
183190static ADDRESS_MAP_START( unclepoo_main_portmap, AS_IO, 8, poo_state )
r18075r18076
185192ADDRESS_MAP_END
186193
187194
188
189195static ADDRESS_MAP_START( unclepoo_sub_map, AS_PROGRAM, 8, poo_state )
190196   AM_RANGE(0x0000, 0x0fff) AM_ROM
191197   AM_RANGE(0x4000, 0x43ff) AM_RAM
r18075r18076
199205ADDRESS_MAP_END
200206
201207
208/******************************************************************************************/
209
202210static INPUT_PORTS_START( unclepoo )
203211   PORT_START("P1")
204212   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r18075r18076
265273   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:!5")
266274   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
267275   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
268   PORT_DIPNAME( 0x20, 0x00, "Test Mode" )         PORT_DIPLOCATION("SW2:!6")
276   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:!6") // ??? Locks up at boot if set to ON
269277   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
270278   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
271279   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:!7")
272280   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
273281   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
274   PORT_DIPNAME( 0x80, 0x00, "Start with 255 Lives (Cheat)" )   PORT_DIPLOCATION("SW2:!8")
282   PORT_DIPNAME( 0x80, 0x00, "255 Lives (Cheat)" )      PORT_DIPLOCATION("SW2:!8")
275283   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
276284   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
277285INPUT_PORTS_END
278286
287
288/******************************************************************************************/
289
279290static const gfx_layout tiles8x8_layout =
280291{
281292   8,8,
r18075r18076
291302   GFXDECODE_ENTRY( "gfx", 0, tiles8x8_layout, 0, 0x20 )
292303GFXDECODE_END
293304
294void poo_state::palette_init()
295{
296   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
297   int i,r,g,b,val;
298   int bit0,bit1,bit2;
299305
300   for (i = 0; i < 0x100; i++)
301   {
302      val = (color_prom[i+0x100]) | (color_prom[i+0x000]<<4);
303
304      bit0 = 0;
305      bit1 = (val >> 6) & 0x01;
306      bit2 = (val >> 7) & 0x01;
307      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
308      bit0 = (val >> 3) & 0x01;
309      bit1 = (val >> 4) & 0x01;
310      bit2 = (val >> 5) & 0x01;
311      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
312      bit0 = (val >> 0) & 0x01;
313      bit1 = (val >> 1) & 0x01;
314      bit2 = (val >> 2) & 0x01;
315      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
316
317      palette_set_color(machine(), i, MAKE_RGB(r, g, b));
318   }
319}
320
321306READ8_MEMBER(poo_state::timer_r)
322307{
323   return downcast<cpu_device *>(&space.device())->total_cycles() / 16;
308   return m_subcpu->total_cycles() / 16;
324309}
325310
326
327311static const ay8910_interface ay8910_config =
328312{
329313   AY8910_LEGACY_OUTPUT,
r18075r18076
335319};
336320
337321static MACHINE_CONFIG_START( unclepoo, poo_state )
322
338323   /* basic machine hardware */
339324   MCFG_CPU_ADD("maincpu", Z80,18000000/6)       /* ? MHz */
340325   MCFG_CPU_PROGRAM_MAP(unclepoo_main_map)
r18075r18076
358343   MCFG_GFXDECODE(unclepoo)
359344   MCFG_PALETTE_LENGTH(0x100)
360345
361
346   /* sound hardware */
362347   MCFG_SPEAKER_STANDARD_MONO("mono")
363348   MCFG_SOUND_ADD("ay", AY8910, 18000000/12) /* ? Mhz */
364349   MCFG_SOUND_CONFIG(ay8910_config)
r18075r18076
366351MACHINE_CONFIG_END
367352
368353
354/******************************************************************************************/
369355
370356ROM_START( unclepoo )
371357   ROM_REGION( 0x8000, "maincpu", 0 )
r18075r18076
387373   ROM_LOAD( "diatec_l.bin", 0x100, 0x100, CRC(b04d466a) SHA1(1438abeae76ef807ba34bd6d3e4c44f707dbde6e) )
388374ROM_END
389375
390GAME( 1983, unclepoo, 0, unclepoo, unclepoo, driver_device, 0, ROT90, "Diatec",         "Uncle Poo", GAME_NO_COCKTAIL )
376
377GAME( 1983, unclepoo, 0, unclepoo, unclepoo, driver_device, 0, ROT90, "Diatec", "Uncle Poo", GAME_NO_COCKTAIL )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team