Previous 199869 Revisions Next

r36138 Saturday 28th February, 2015 at 09:00:09 UTC by Osso
fgoal.c: killed anonymous timer, enabled save state support (nw)
[src/mame/drivers]fgoal.c
[src/mame/includes]fgoal.h
[src/mame/video]fgoal.c

trunk/src/mame/drivers/fgoal.c
r244649r244650
9898   if (scanline > 256)
9999      scanline = 0;
100100
101   timer_set(m_screen->time_until_pos(scanline), TIMER_INTERRUPT);
101   m_interrupt_timer->adjust(m_screen->time_until_pos(scanline));
102102}
103103
104104
105unsigned fgoal_state::video_ram_address( )
105unsigned fgoal_state::video_ram_address( )
106106{
107107   return 0x4000 | (m_row << 5) | (m_col >> 3);
108108}
109109
110110
111READ8_MEMBER(fgoal_state::fgoal_analog_r)
111READ8_MEMBER(fgoal_state::analog_r)
112112{
113   return ioport(m_fgoal_player ? "PADDLE1" : "PADDLE0")->read(); /* PCB can be jumpered to use a single dial */
113   return ioport(m_player ? "PADDLE1" : "PADDLE0")->read(); /* PCB can be jumpered to use a single dial */
114114}
115115
116116
117CUSTOM_INPUT_MEMBER(fgoal_state::fgoal_80_r)
117CUSTOM_INPUT_MEMBER(fgoal_state::_80_r)
118118{
119119   UINT8 ret = (m_screen->vpos() & 0x80) ? 1 : 0;
120120
121121   return ret;
122122}
123123
124READ8_MEMBER(fgoal_state::fgoal_nmi_reset_r)
124READ8_MEMBER(fgoal_state::nmi_reset_r)
125125{
126126   m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
127127
r244649r244650
129129}
130130
131131
132READ8_MEMBER(fgoal_state::fgoal_irq_reset_r)
132READ8_MEMBER(fgoal_state::irq_reset_r)
133133{
134134   m_maincpu->set_input_line(0, CLEAR_LINE);
135135
r244649r244650
137137}
138138
139139
140READ8_MEMBER(fgoal_state::fgoal_row_r)
140READ8_MEMBER(fgoal_state::row_r)
141141{
142142   return m_row;
143143}
144144
145145
146WRITE8_MEMBER(fgoal_state::fgoal_row_w)
146WRITE8_MEMBER(fgoal_state::row_w)
147147{
148148   m_row = data;
149149   m_mb14241->shift_data_w(space, 0, 0);
150150}
151151
152WRITE8_MEMBER(fgoal_state::fgoal_col_w)
152WRITE8_MEMBER(fgoal_state::col_w)
153153{
154154   m_col = data;
155155   m_mb14241->shift_count_w(space, 0, data);
156156}
157157
158READ8_MEMBER(fgoal_state::fgoal_address_hi_r)
158READ8_MEMBER(fgoal_state::address_hi_r)
159159{
160160   return video_ram_address() >> 8;
161161}
162162
163READ8_MEMBER(fgoal_state::fgoal_address_lo_r)
163READ8_MEMBER(fgoal_state::address_lo_r)
164164{
165165   return video_ram_address() & 0xff;
166166}
167167
168READ8_MEMBER(fgoal_state::fgoal_shifter_r)
168READ8_MEMBER(fgoal_state::shifter_r)
169169{
170170   UINT8 v = m_mb14241->shift_result_r(space, 0);
171171
172172   return BITSWAP8(v, 7, 6, 5, 4, 3, 2, 1, 0);
173173}
174174
175READ8_MEMBER(fgoal_state::fgoal_shifter_reverse_r)
175READ8_MEMBER(fgoal_state::shifter_reverse_r)
176176{
177177   UINT8 v = m_mb14241->shift_result_r(space, 0);
178178
r244649r244650
180180}
181181
182182
183WRITE8_MEMBER(fgoal_state::fgoal_sound1_w)
183WRITE8_MEMBER(fgoal_state::sound1_w)
184184{
185185   /* BIT0 => SX2 */
186186   /* BIT1 => SX1 */
r244649r244650
193193}
194194
195195
196WRITE8_MEMBER(fgoal_state::fgoal_sound2_w)
196WRITE8_MEMBER(fgoal_state::sound2_w)
197197{
198198   /* BIT0 => CX0 */
199199   /* BIT1 => SX6 */
r244649r244650
201201   /* BIT3 => SX5 */
202202   /* BIT4 => SX4 */
203203   /* BIT5 => SX3 */
204   m_fgoal_player = data & 1;
204   m_player = data & 1;
205205}
206206
207207
r244649r244650
209209
210210   AM_RANGE(0x0000, 0x00ef) AM_RAM
211211
212   AM_RANGE(0x00f0, 0x00f0) AM_READ(fgoal_row_r)
213   AM_RANGE(0x00f1, 0x00f1) AM_READ(fgoal_analog_r)
212   AM_RANGE(0x00f0, 0x00f0) AM_READ(row_r)
213   AM_RANGE(0x00f1, 0x00f1) AM_READ(analog_r)
214214   AM_RANGE(0x00f2, 0x00f2) AM_READ_PORT("IN0")
215215   AM_RANGE(0x00f3, 0x00f3) AM_READ_PORT("IN1")
216   AM_RANGE(0x00f4, 0x00f4) AM_READ(fgoal_address_hi_r)
217   AM_RANGE(0x00f5, 0x00f5) AM_READ(fgoal_address_lo_r)
218   AM_RANGE(0x00f6, 0x00f6) AM_READ(fgoal_shifter_r)
219   AM_RANGE(0x00f7, 0x00f7) AM_READ(fgoal_shifter_reverse_r)
220   AM_RANGE(0x00f8, 0x00fb) AM_READ(fgoal_nmi_reset_r)
221   AM_RANGE(0x00fc, 0x00ff) AM_READ(fgoal_irq_reset_r)
216   AM_RANGE(0x00f4, 0x00f4) AM_READ(address_hi_r)
217   AM_RANGE(0x00f5, 0x00f5) AM_READ(address_lo_r)
218   AM_RANGE(0x00f6, 0x00f6) AM_READ(shifter_r)
219   AM_RANGE(0x00f7, 0x00f7) AM_READ(shifter_reverse_r)
220   AM_RANGE(0x00f8, 0x00fb) AM_READ(nmi_reset_r)
221   AM_RANGE(0x00fc, 0x00ff) AM_READ(irq_reset_r)
222222
223   AM_RANGE(0x00f0, 0x00f0) AM_WRITE(fgoal_row_w)
224   AM_RANGE(0x00f1, 0x00f1) AM_WRITE(fgoal_col_w)
225   AM_RANGE(0x00f2, 0x00f2) AM_WRITE(fgoal_row_w)
226   AM_RANGE(0x00f3, 0x00f3) AM_WRITE(fgoal_col_w)
223   AM_RANGE(0x00f0, 0x00f0) AM_WRITE(row_w)
224   AM_RANGE(0x00f1, 0x00f1) AM_WRITE(col_w)
225   AM_RANGE(0x00f2, 0x00f2) AM_WRITE(row_w)
226   AM_RANGE(0x00f3, 0x00f3) AM_WRITE(col_w)
227227   AM_RANGE(0x00f4, 0x00f7) AM_DEVWRITE("mb14241", mb14241_device, shift_data_w)
228   AM_RANGE(0x00f8, 0x00fb) AM_WRITE(fgoal_sound1_w)
229   AM_RANGE(0x00fc, 0x00ff) AM_WRITE(fgoal_sound2_w)
228   AM_RANGE(0x00f8, 0x00fb) AM_WRITE(sound1_w)
229   AM_RANGE(0x00fc, 0x00ff) AM_WRITE(sound2_w)
230230
231231   AM_RANGE(0x0100, 0x03ff) AM_RAM
232232   AM_RANGE(0x4000, 0x7fff) AM_RAM AM_SHARE("video_ram")
233233
234   AM_RANGE(0x8000, 0x8000) AM_WRITE(fgoal_ypos_w)
235   AM_RANGE(0x8001, 0x8001) AM_WRITE(fgoal_xpos_w)
236   AM_RANGE(0x8002, 0x8002) AM_WRITE(fgoal_color_w)
234   AM_RANGE(0x8000, 0x8000) AM_WRITE(ypos_w)
235   AM_RANGE(0x8001, 0x8001) AM_WRITE(xpos_w)
236   AM_RANGE(0x8002, 0x8002) AM_WRITE(color_w)
237237
238238   AM_RANGE(0xa000, 0xbfff) AM_ROM
239239   AM_RANGE(0xd000, 0xffff) AM_ROM
r244649r244650
266266   /* extra credit score changes depending on player's performance */
267267
268268   PORT_START("IN1")
269   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fgoal_state,fgoal_80_r, NULL) /* 128V */
269   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fgoal_state, _80_r, NULL) /* 128V */
270270   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ))
271271   PORT_DIPSETTING(    0x00, DEF_STR( Upright ))
272272   PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ))
r244649r244650
338338
339339void fgoal_state::machine_start()
340340{
341   m_interrupt_timer = timer_alloc(TIMER_INTERRUPT);
342   
341343   save_item(NAME(m_xpos));
342344   save_item(NAME(m_ypos));
343345   save_item(NAME(m_current_color));
344   save_item(NAME(m_fgoal_player));
346   save_item(NAME(m_player));
345347   save_item(NAME(m_row));
346348   save_item(NAME(m_col));
347349   save_item(NAME(m_prev_coin));
r244649r244650
349351
350352void fgoal_state::machine_reset()
351353{
352   timer_set(m_screen->time_until_pos(0), TIMER_INTERRUPT);
354   m_interrupt_timer->adjust(m_screen->time_until_pos(0));
353355
354356   m_xpos = 0;
355357   m_ypos = 0;
356358   m_current_color = 0;
357   m_fgoal_player = 0;
359   m_player = 0;
358360   m_row = 0;
359361   m_col = 0;
360362   m_prev_coin = 0;
r244649r244650
375377   MCFG_SCREEN_REFRESH_RATE(60)
376378   MCFG_SCREEN_SIZE(256, 263)
377379   MCFG_SCREEN_VISIBLE_AREA(0, 255, 16, 255)
378   MCFG_SCREEN_UPDATE_DRIVER(fgoal_state, screen_update_fgoal)
380   MCFG_SCREEN_UPDATE_DRIVER(fgoal_state, screen_update)
379381   MCFG_SCREEN_PALETTE("palette")
380382
381383   MCFG_GFXDECODE_ADD("gfxdecode", "palette", fgoal)
r244649r244650
433435ROM_END
434436
435437
436GAME( 1979, fgoal,  0,     fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 1)", GAME_NO_SOUND )
437GAME( 1979, fgoala, fgoal, fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 2)", GAME_NO_SOUND )
438GAME( 1979, fgoal,  0,     fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 1)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
439GAME( 1979, fgoala, fgoal, fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 2)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/fgoal.h
r244649r244650
1010
1111   fgoal_state(const machine_config &mconfig, device_type type, const char *tag)
1212      : driver_device(mconfig, type, tag),
13      m_video_ram(*this, "video_ram"),
1413      m_maincpu(*this, "maincpu"),
1514      m_mb14241(*this, "mb14241"),
1615      m_gfxdecode(*this, "gfxdecode"),
1716      m_screen(*this, "screen"),
18      m_palette(*this, "palette")
19      { }
17      m_palette(*this, "palette"),
18      m_video_ram(*this, "video_ram")   { }
2019
20   /* devices */
21   required_device<cpu_device> m_maincpu;
22   required_device<mb14241_device> m_mb14241;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<screen_device> m_screen;
25   required_device<palette_device> m_palette;
26
2127   /* memory pointers */
2228   required_shared_ptr<UINT8> m_video_ram;
2329
r244649r244650
2935   int        m_current_color;
3036
3137   /* misc */
32   int        m_fgoal_player;
38   int        m_player;
3339   UINT8      m_row;
3440   UINT8      m_col;
3541   int        m_prev_coin;
42   emu_timer  *m_interrupt_timer;
3643
37   /* devices */
38   required_device<cpu_device> m_maincpu;
39   required_device<mb14241_device> m_mb14241;
40   required_device<gfxdecode_device> m_gfxdecode;
41   required_device<screen_device> m_screen;
42   required_device<palette_device> m_palette;
44   DECLARE_READ8_MEMBER(analog_r);
45   DECLARE_READ8_MEMBER(nmi_reset_r);
46   DECLARE_READ8_MEMBER(irq_reset_r);
47   DECLARE_READ8_MEMBER(row_r);
48   DECLARE_WRITE8_MEMBER(row_w);
49   DECLARE_WRITE8_MEMBER(col_w);
50   DECLARE_READ8_MEMBER(address_hi_r);
51   DECLARE_READ8_MEMBER(address_lo_r);
52   DECLARE_READ8_MEMBER(shifter_r);
53   DECLARE_READ8_MEMBER(shifter_reverse_r);
54   DECLARE_WRITE8_MEMBER(sound1_w);
55   DECLARE_WRITE8_MEMBER(sound2_w);
56   DECLARE_WRITE8_MEMBER(color_w);
57   DECLARE_WRITE8_MEMBER(ypos_w);
58   DECLARE_WRITE8_MEMBER(xpos_w);
4359
44   DECLARE_READ8_MEMBER(fgoal_analog_r);
45   DECLARE_READ8_MEMBER(fgoal_nmi_reset_r);
46   DECLARE_READ8_MEMBER(fgoal_irq_reset_r);
47   DECLARE_READ8_MEMBER(fgoal_row_r);
48   DECLARE_WRITE8_MEMBER(fgoal_row_w);
49   DECLARE_WRITE8_MEMBER(fgoal_col_w);
50   DECLARE_READ8_MEMBER(fgoal_address_hi_r);
51   DECLARE_READ8_MEMBER(fgoal_address_lo_r);
52   DECLARE_READ8_MEMBER(fgoal_shifter_r);
53   DECLARE_READ8_MEMBER(fgoal_shifter_reverse_r);
54   DECLARE_WRITE8_MEMBER(fgoal_sound1_w);
55   DECLARE_WRITE8_MEMBER(fgoal_sound2_w);
56   DECLARE_WRITE8_MEMBER(fgoal_color_w);
57   DECLARE_WRITE8_MEMBER(fgoal_ypos_w);
58   DECLARE_WRITE8_MEMBER(fgoal_xpos_w);
59   DECLARE_CUSTOM_INPUT_MEMBER(fgoal_80_r);
60   DECLARE_CUSTOM_INPUT_MEMBER(_80_r);
61   
62   TIMER_CALLBACK_MEMBER(interrupt_callback);
63
6064   virtual void machine_start();
6165   virtual void machine_reset();
6266   virtual void video_start();
6367   DECLARE_PALETTE_INIT(fgoal);
64   UINT32 screen_update_fgoal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
65   TIMER_CALLBACK_MEMBER(interrupt_callback);
68
69   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6670   int intensity(int bits);
67   unsigned video_ram_address( );
71   unsigned video_ram_address( );
6872
6973protected:
7074   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mame/video/fgoal.c
r244649r244650
88#include "includes/fgoal.h"
99
1010
11WRITE8_MEMBER(fgoal_state::fgoal_color_w)
11WRITE8_MEMBER(fgoal_state::color_w)
1212{
1313   m_current_color = data & 3;
1414}
1515
1616
17WRITE8_MEMBER(fgoal_state::fgoal_ypos_w)
17WRITE8_MEMBER(fgoal_state::ypos_w)
1818{
1919   m_ypos = data;
2020}
2121
2222
23WRITE8_MEMBER(fgoal_state::fgoal_xpos_w)
23WRITE8_MEMBER(fgoal_state::xpos_w)
2424{
2525   m_xpos = data;
2626}
r244649r244650
3636}
3737
3838
39UINT32 fgoal_state::screen_update_fgoal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
39UINT32 fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
4040{
4141   const UINT8* VRAM = m_video_ram;
4242
r244649r244650
4646
4747   /* draw color overlay foreground and background */
4848
49   if (m_fgoal_player == 1 && (ioport("IN1")->read() & 0x40))
49   if (m_player == 1 && (ioport("IN1")->read() & 0x40))
5050   {
5151      m_gfxdecode->gfx(0)->zoom_opaque(m_fgbitmap,cliprect,
52         0, (m_fgoal_player << 2) | m_current_color,
52         0, (m_player << 2) | m_current_color,
5353         1, 1,
5454         0, 16,
5555         0x40000,
r244649r244650
6565   else
6666   {
6767      m_gfxdecode->gfx(0)->zoom_opaque(m_fgbitmap,cliprect,
68         0, (m_fgoal_player << 2) | m_current_color,
68         0, (m_player << 2) | m_current_color,
6969         0, 0,
7070         0, 0,
7171         0x40000,


Previous 199869 Revisions Next


© 1997-2024 The MAME Team