Previous 199869 Revisions Next

r19073 Tuesday 20th November, 2012 at 18:42:05 UTC by hap
small cleanup+preparation
[src/mame/drivers]starfire.c
[src/mame/includes]starfire.h
[src/mame/video]starfire.c

trunk/src/mame/video/starfire.c
r19072r19073
11/***************************************************************************
22
3    Star Fire video system
3    Star Fire/Fire One system - video hardware
44
55***************************************************************************/
66
r19072r19073
1717
1818void starfire_state::video_start()
1919{
20
2120   machine().primary_screen->register_screen_bitmap(m_starfire_screen);
2221   m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(starfire_state::starfire_scanline_callback),this));
2322   m_scanline_timer->adjust(machine().primary_screen->time_until_pos(STARFIRE_VBEND), STARFIRE_VBEND);
r19072r19073
3837
3938WRITE8_MEMBER(starfire_state::starfire_colorram_w)
4039{
41
4240    /* handle writes to the pseudo-color RAM */
4341   if ((offset & 0xe0) == 0)
4442   {
r19072r19073
7270
7371READ8_MEMBER(starfire_state::starfire_colorram_r)
7472{
75
7673   /* handle writes to the pseudo-color RAM, which also happen on reads */
7774   if ((offset & 0xe0) == 0)
7875   {
trunk/src/mame/includes/starfire.h
r19072r19073
44
55***************************************************************************/
66
7#define STARFIRE_MASTER_CLOCK   (20000000)
7#define STARFIRE_MASTER_CLOCK   (XTAL_20MHz)
88#define STARFIRE_CPU_CLOCK      (STARFIRE_MASTER_CLOCK / 8)
99#define STARFIRE_PIXEL_CLOCK   (STARFIRE_MASTER_CLOCK / 4)
1010#define STARFIRE_HTOTAL         (0x13f)  /* could be 0x140, but I think this is right */
r19072r19073
2424      m_starfire_videoram(*this, "videoram")
2525   { }
2626
27    read8_delegate m_input_read;
27   required_shared_ptr<UINT8> m_starfire_colorram;
28   required_shared_ptr<UINT8> m_starfire_videoram;
2829
2930   UINT8 m_fireone_select;
3031
r19072r19073
3334    UINT8 m_starfire_color;
3435    UINT16 m_starfire_colors[STARFIRE_NUM_PENS];
3536
36   required_shared_ptr<UINT8> m_starfire_colorram;
37   required_shared_ptr<UINT8> m_starfire_videoram;
37    read8_delegate m_input_read;
38    write8_delegate m_io2_write;
3839
3940    emu_timer* m_scanline_timer;
4041    bitmap_rgb32 m_starfire_screen;
r19072r19073
4243   DECLARE_READ8_MEMBER(starfire_scratch_r);
4344   DECLARE_READ8_MEMBER(starfire_input_r);
4445   DECLARE_READ8_MEMBER(fireone_input_r);
46   DECLARE_WRITE8_MEMBER(starfire_sound_w);
47   DECLARE_WRITE8_MEMBER(fireone_io2_w);
4548   DECLARE_WRITE8_MEMBER(starfire_colorram_w);
4649   DECLARE_READ8_MEMBER(starfire_colorram_r);
4750   DECLARE_WRITE8_MEMBER(starfire_videoram_w);
trunk/src/mame/drivers/starfire.c
r19072r19073
6262   {
6363      switch (offset & 7)
6464      {
65         case 0:   m_starfire_vidctrl = data; break;
66         case 1:   m_starfire_vidctrl1 = data; break;
67         case 2:
68            /* Sounds */
69            m_fireone_select = (data & 0x8) ? 0 : 1;
70            break;
65         case 0: m_starfire_vidctrl = data; break;
66         case 1: m_starfire_vidctrl1 = data; break;
67         case 2: m_io2_write(space, offset, data, 0xff); break;
7168         default: break;
7269      }
7370   }
r19072r19073
9390
9491/*************************************
9592 *
96 *  Game-specific input handlers
93 *  Game-specific I/O handlers
9794 *
9895 *************************************/
9996
97WRITE8_MEMBER(starfire_state::starfire_sound_w)
98{
99   // TODO: sound
100}
101
102WRITE8_MEMBER(starfire_state::fireone_io2_w)
103{
104   // TODO: sound
105   m_fireone_select = (data & 0x8) ? 0 : 1;
106}
107
108
100109READ8_MEMBER(starfire_state::starfire_input_r)
101110{
102111   switch (offset & 15)
103112   {
104      case 0:   return ioport("DSW")->read();
105      case 1:   return ioport("SYSTEM")->read();   /* Note: need to loopback sounds lengths on that one */
113      case 0: return ioport("DSW")->read();
114      case 1: return ioport("SYSTEM")->read();   /* Note: need to loopback sounds lengths on that one */
106115      case 5: return ioport("STICKZ")->read();
107      case 6:   return ioport("STICKX")->read();
108      case 7:   return ioport("STICKY")->read();
116      case 6: return ioport("STICKX")->read();
117      case 7: return ioport("STICKY")->read();
109118      default: return 0xff;
110119   }
111120}
112121
113
114122READ8_MEMBER(starfire_state::fireone_input_r)
115123{
116124   static const UINT8 fireone_paddle_map[64] =
r19072r19073
124132      0x28,0x29,0x2b,0x2a,0x2e,0x2f,0x2d,0x2c,
125133      0x24,0x25,0x27,0x26,0x22,0x23,0x21,0x20
126134   };
127   int temp;
128135
129
130136   switch (offset & 15)
131137   {
132      case 0:   return ioport("DSW")->read();
133      case 1:   return ioport("SYSTEM")->read();
138      case 0: return ioport("DSW")->read();
139      case 1: return ioport("SYSTEM")->read();
134140      case 2:
135         temp = m_fireone_select ? ioport("P1")->read() : ioport("P2")->read();
136         temp = (temp & 0xc0) | fireone_paddle_map[temp & 0x3f];
137         return temp;
141      {
142         UINT8 input = m_fireone_select ? ioport("P1")->read() : ioport("P2")->read();
143         return (input & 0xc0) | fireone_paddle_map[input & 0x3f];
144      }
138145      default: return 0xff;
139146   }
140147}
r19072r19073
163170 *************************************/
164171
165172static INPUT_PORTS_START( starfire )
166   PORT_START("DSW")   /* DSW0 */
167   PORT_DIPNAME( 0x03, 0x00, "Time" )
173   PORT_START("DSW")
174   PORT_DIPNAME( 0x03, 0x00, "Time" )            PORT_DIPLOCATION("3A:1,2")
168175   PORT_DIPSETTING(    0x00, "90 Sec" )
169176   PORT_DIPSETTING(    0x01, "80 Sec" )
170177   PORT_DIPSETTING(    0x02, "70 Sec" )
171178   PORT_DIPSETTING(    0x03, "60 Sec" )
172   PORT_DIPNAME( 0x04, 0x00, "Coin(s) to Start" )
173   PORT_DIPSETTING(    0x00, "1" )
174   PORT_DIPSETTING(    0x04, "2" )
175   PORT_DIPNAME( 0x08, 0x00, "Fuel per Coin" )
179   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Coinage ) )   PORT_DIPLOCATION("3A:3")
180   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
181   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
182   PORT_DIPNAME( 0x08, 0x00, "Fuel per Coin" )      PORT_DIPLOCATION("3A:4")
176183   PORT_DIPSETTING(    0x00, "300" )
177184   PORT_DIPSETTING(    0x08, "600" )
178   PORT_DIPNAME( 0x30, 0x00, "Bonus" )
185   PORT_DIPNAME( 0x30, 0x00, "Bonus" )            PORT_DIPLOCATION("3A:5,6")
179186   PORT_DIPSETTING(    0x00, "300 points" )
180187   PORT_DIPSETTING(    0x10, "500 points" )
181188   PORT_DIPSETTING(    0x20, "700 points" )
182189   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
183   PORT_DIPNAME( 0x40, 0x00, "Score Table Hold" )
190   PORT_DIPNAME( 0x40, 0x00, "Score Table Hold" )   PORT_DIPLOCATION("3A:7")
184191   PORT_DIPSETTING(    0x00, "fixed length" )
185192   PORT_DIPSETTING(    0x40, "fixed length+fire" )
186   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
193   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_HIGH, "3A:8" )
187194
188195   PORT_START("SYSTEM")   /* IN1 */
189196   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
190197   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
191198   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
192   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
193   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
194   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
195   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
196   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
199   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) // (audio) TIE ON, see starfire_input_r
200   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) // (audio) LASER ON, see starfire_input_r
201   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) // SLAM/STATIC
202   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
197204
198205   PORT_START("STICKX")   /* IN2 */
199206   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
r19072r19073
212219
213220
214221static INPUT_PORTS_START( fireone )
215   PORT_START("DSW")   /* DSW0 */
222   PORT_START("DSW")
216223   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
217224   PORT_DIPSETTING(    0x03, "2 Coins/1 Player" )
218225   PORT_DIPSETTING(    0x02, "2 Coins/1 or 2 Players" )
r19072r19073
382389DRIVER_INIT_MEMBER(starfire_state,starfire)
383390{
384391   m_input_read = read8_delegate(FUNC(starfire_state::starfire_input_r),this);
392   m_io2_write = write8_delegate(FUNC(starfire_state::starfire_sound_w),this);
385393}
386394
387395DRIVER_INIT_MEMBER(starfire_state,fireone)
388396{
389397   m_input_read = read8_delegate(FUNC(starfire_state::fireone_input_r),this);
398   m_io2_write = write8_delegate(FUNC(starfire_state::fireone_io2_w),this);
390399
391400   /* register for state saving */
392401   save_item(NAME(m_fireone_select));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team