Previous 199869 Revisions Next

r19163 Tuesday 27th November, 2012 at 11:24:57 UTC by Robbbert
rotaryf : Added 'invaders' sounds [Robbbert]
[src/mame/drivers]rotaryf.c

trunk/src/mame/drivers/rotaryf.c
r19162r19163
1414
1515#include "emu.h"
1616#include "cpu/i8085/i8085.h"
17#include "sound/samples.h"
18#include "sound/sn76477.h"
1719
18
1920class rotaryf_state : public driver_device
2021{
2122public:
2223   rotaryf_state(const machine_config &mconfig, device_type type, const char *tag)
2324      : driver_device(mconfig, type, tag),
2425      m_maincpu(*this,"maincpu"),
25      m_videoram(*this, "videoram"){ }
26      m_videoram(*this, "videoram"),
27      m_samples(*this, "samples"),
28      m_sn(*this, "snsnd")
29   { }
2630
2731   DECLARE_READ8_MEMBER(port29_r);
2832   DECLARE_WRITE8_MEMBER(port28_w);
2933   DECLARE_WRITE8_MEMBER(port30_w);
3034   bool m_flipscreen;
35   UINT8 m_last;
3136   required_device<cpu_device> m_maincpu;
3237   required_shared_ptr<UINT8> m_videoram;
38   required_device<samples_device> m_samples;
39   required_device<sn76477_device> m_sn;
3340   UINT32 screen_update_rotaryf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
3441   TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_interrupt);
3542};
3643
44static const sn76477_interface rotaryf_sn76477_interface =
45{
46   0,         /*  4 noise_res (N/C)        */
47   0,         /*  5 filter_res (N/C)       */
48   0,         /*  6 filter_cap (N/C)       */
49   0,         /*  7 decay_res (N/C)        */
50   0,         /*  8 attack_decay_cap (N/C) */
51   RES_K(100), /* 10 attack_res             */
52   RES_K(56),   /* 11 amplitude_res          */
53   RES_K(10),   /* 12 feedback_res           */
54   0,         /* 16 vco_voltage (N/C)      */
55   CAP_U(0.1),   /* 17 vco_cap                */
56   RES_K(8.2),   /* 18 vco_res                */
57   5.0,      /* 19 pitch_voltage          */
58   RES_K(120),   /* 20 slf_res                */
59   CAP_U(1.0),   /* 21 slf_cap                */
60   0,         /* 23 oneshot_cap (N/C)      */
61   0,         /* 24 oneshot_res (N/C)      */
62   1,         /* 22 vco                    */
63   0,         /* 26 mixer A                */
64   0,         /* 25 mixer B                */
65   0,         /* 27 mixer C                */
66   1,         /* 1  envelope 1             */
67   0,         /* 28 envelope 2             */
68   1         /* 9  enable (variable)      */
69};
70
71
72
73static const char *const rotaryf_sample_names[] =
74{
75   "*invaders",
76   "1",      /* shot/missle */
77   "2",      /* base hit/explosion */
78   "3",      /* invader hit */
79   "4",      /* fleet move 1 */
80   "5",      /* fleet move 2 */
81   "6",      /* fleet move 3 */
82   "7",      /* fleet move 4 */
83   "8",      /* UFO/saucer hit */
84   "9",      /* bonus base */
85   0
86};
87
88
89static const samples_interface rotaryf_samples_interface =
90{
91   6,   /* 6 channels */
92   rotaryf_sample_names
93};
94
3795READ8_MEMBER( rotaryf_state::port29_r )
3896{
3997   UINT8 data = ioport("INPUTS")->read();
r19162r19163
45103
46104WRITE8_MEMBER( rotaryf_state::port28_w )
47105{
48// sound
106   UINT8 rising_bits = data & ~m_last;
107
108   if (BIT(rising_bits, 0)) m_samples->start (3, 7);   /* Hit Saucer */
109   if (BIT(rising_bits, 2)) m_samples->start (5, 8);   /* Bonus */
110   if (BIT(rising_bits, 5)) m_samples->start (1, 1);   /* Death */
111   if (BIT(rising_bits, 6)) m_samples->start (2, 2);   /* Hit */
112   if (BIT(rising_bits, 7)) m_samples->start (0, 0);   /* Shoot */
113
114   sn76477_enable_w(m_sn, (data & 3) ? 1 : 0);      /* Saucer Sound */
115
116   if (BIT(rising_bits, 4))
117   {
118      if (BIT(rising_bits, 3))
119         m_samples->start (4, 3);      /* Fleet 1 */
120      else
121         m_samples->start (4, 6);      /* Fleet 2 */
122   }
123
124   m_last = data;
49125}
50126
51127WRITE8_MEMBER( rotaryf_state::port30_w )
52128{
53129   /* bit 0 = player 2 is playing */
54130
55   m_flipscreen = BIT(data, 0) & BIT(ioport("COCKTAIL")->read(), 0);
131   m_flipscreen = BIT(data, 0) & ioport("COCKTAIL")->read();
56132}
57133
58134
r19162r19163
115191
116192static ADDRESS_MAP_START( rotaryf_map, AS_PROGRAM, 8, rotaryf_state )
117193   AM_RANGE(0x0000, 0x17ff) AM_MIRROR(0x4000) AM_ROM
118//  AM_RANGE(0x6ffb, 0x6ffb) AM_READ_LEGACY(random_r) ??
119//  AM_RANGE(0x6ffd, 0x6ffd) AM_READ_LEGACY(random_r) ??
120//  AM_RANGE(0x6fff, 0x6fff) AM_READ_LEGACY(random_r) ??
121   AM_RANGE(0x7000, 0x73ff) AM_RAM // clears to 1ff ?
194   AM_RANGE(0x7000, 0x73ff) AM_MIRROR(0x0c00) AM_RAM
122195   AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x4000) AM_RAM AM_SHARE("videoram")
123196   AM_RANGE(0xa000, 0xa1ff) AM_RAM   /* writes 00, 18, 27, 3C, 7E, FE to A019, A039, A059... A179 */
124197ADDRESS_MAP_END
r19162r19163
178251   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
179252   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
180253   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
181//  PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
182//  PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
183//  PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
184254
185255   PORT_START("COCKTAIL")      /* Dummy port for cocktail mode */
186256   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
r19162r19163
204274   MCFG_SCREEN_REFRESH_RATE(60)
205275   MCFG_SCREEN_UPDATE_DRIVER(rotaryf_state, screen_update_rotaryf)
206276
277   MCFG_SPEAKER_STANDARD_MONO("mono")
278   MCFG_SOUND_ADD("snsnd", SN76477, 0)
279   MCFG_SOUND_CONFIG(rotaryf_sn76477_interface)
280   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
281   MCFG_SAMPLES_ADD("samples", rotaryf_samples_interface)
282   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
207283MACHINE_CONFIG_END
208284
209285
r19162r19163
218294ROM_END
219295
220296
221GAME( 1979, rotaryf, 0, rotaryf, rotaryf, driver_device, 0, ROT270, "Kasco", "Rotary Fighter", GAME_NO_SOUND )
297GAME( 1979, rotaryf, 0, rotaryf, rotaryf, driver_device, 0, ROT270, "Kasco", "Rotary Fighter", GAME_IMPERFECT_SOUND )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team