trunk/src/mame/drivers/fgoal.c
| r244649 | r244650 | |
| 98 | 98 | if (scanline > 256) |
| 99 | 99 | scanline = 0; |
| 100 | 100 | |
| 101 | | timer_set(m_screen->time_until_pos(scanline), TIMER_INTERRUPT); |
| 101 | m_interrupt_timer->adjust(m_screen->time_until_pos(scanline)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
| 105 | | unsigned fgoal_state::video_ram_address( ) |
| 105 | unsigned fgoal_state::video_ram_address( ) |
| 106 | 106 | { |
| 107 | 107 | return 0x4000 | (m_row << 5) | (m_col >> 3); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | | READ8_MEMBER(fgoal_state::fgoal_analog_r) |
| 111 | READ8_MEMBER(fgoal_state::analog_r) |
| 112 | 112 | { |
| 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 */ |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | | CUSTOM_INPUT_MEMBER(fgoal_state::fgoal_80_r) |
| 117 | CUSTOM_INPUT_MEMBER(fgoal_state::_80_r) |
| 118 | 118 | { |
| 119 | 119 | UINT8 ret = (m_screen->vpos() & 0x80) ? 1 : 0; |
| 120 | 120 | |
| 121 | 121 | return ret; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | | READ8_MEMBER(fgoal_state::fgoal_nmi_reset_r) |
| 124 | READ8_MEMBER(fgoal_state::nmi_reset_r) |
| 125 | 125 | { |
| 126 | 126 | m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
| 127 | 127 | |
| r244649 | r244650 | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | | READ8_MEMBER(fgoal_state::fgoal_irq_reset_r) |
| 132 | READ8_MEMBER(fgoal_state::irq_reset_r) |
| 133 | 133 | { |
| 134 | 134 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 135 | 135 | |
| r244649 | r244650 | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | | READ8_MEMBER(fgoal_state::fgoal_row_r) |
| 140 | READ8_MEMBER(fgoal_state::row_r) |
| 141 | 141 | { |
| 142 | 142 | return m_row; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | | WRITE8_MEMBER(fgoal_state::fgoal_row_w) |
| 146 | WRITE8_MEMBER(fgoal_state::row_w) |
| 147 | 147 | { |
| 148 | 148 | m_row = data; |
| 149 | 149 | m_mb14241->shift_data_w(space, 0, 0); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | | WRITE8_MEMBER(fgoal_state::fgoal_col_w) |
| 152 | WRITE8_MEMBER(fgoal_state::col_w) |
| 153 | 153 | { |
| 154 | 154 | m_col = data; |
| 155 | 155 | m_mb14241->shift_count_w(space, 0, data); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | | READ8_MEMBER(fgoal_state::fgoal_address_hi_r) |
| 158 | READ8_MEMBER(fgoal_state::address_hi_r) |
| 159 | 159 | { |
| 160 | 160 | return video_ram_address() >> 8; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | | READ8_MEMBER(fgoal_state::fgoal_address_lo_r) |
| 163 | READ8_MEMBER(fgoal_state::address_lo_r) |
| 164 | 164 | { |
| 165 | 165 | return video_ram_address() & 0xff; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | | READ8_MEMBER(fgoal_state::fgoal_shifter_r) |
| 168 | READ8_MEMBER(fgoal_state::shifter_r) |
| 169 | 169 | { |
| 170 | 170 | UINT8 v = m_mb14241->shift_result_r(space, 0); |
| 171 | 171 | |
| 172 | 172 | return BITSWAP8(v, 7, 6, 5, 4, 3, 2, 1, 0); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | | READ8_MEMBER(fgoal_state::fgoal_shifter_reverse_r) |
| 175 | READ8_MEMBER(fgoal_state::shifter_reverse_r) |
| 176 | 176 | { |
| 177 | 177 | UINT8 v = m_mb14241->shift_result_r(space, 0); |
| 178 | 178 | |
| r244649 | r244650 | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
| 183 | | WRITE8_MEMBER(fgoal_state::fgoal_sound1_w) |
| 183 | WRITE8_MEMBER(fgoal_state::sound1_w) |
| 184 | 184 | { |
| 185 | 185 | /* BIT0 => SX2 */ |
| 186 | 186 | /* BIT1 => SX1 */ |
| r244649 | r244650 | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | |
| 196 | | WRITE8_MEMBER(fgoal_state::fgoal_sound2_w) |
| 196 | WRITE8_MEMBER(fgoal_state::sound2_w) |
| 197 | 197 | { |
| 198 | 198 | /* BIT0 => CX0 */ |
| 199 | 199 | /* BIT1 => SX6 */ |
| r244649 | r244650 | |
| 201 | 201 | /* BIT3 => SX5 */ |
| 202 | 202 | /* BIT4 => SX4 */ |
| 203 | 203 | /* BIT5 => SX3 */ |
| 204 | | m_fgoal_player = data & 1; |
| 204 | m_player = data & 1; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| r244649 | r244650 | |
| 209 | 209 | |
| 210 | 210 | AM_RANGE(0x0000, 0x00ef) AM_RAM |
| 211 | 211 | |
| 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) |
| 214 | 214 | AM_RANGE(0x00f2, 0x00f2) AM_READ_PORT("IN0") |
| 215 | 215 | 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) |
| 222 | 222 | |
| 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) |
| 227 | 227 | 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) |
| 230 | 230 | |
| 231 | 231 | AM_RANGE(0x0100, 0x03ff) AM_RAM |
| 232 | 232 | AM_RANGE(0x4000, 0x7fff) AM_RAM AM_SHARE("video_ram") |
| 233 | 233 | |
| 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) |
| 237 | 237 | |
| 238 | 238 | AM_RANGE(0xa000, 0xbfff) AM_ROM |
| 239 | 239 | AM_RANGE(0xd000, 0xffff) AM_ROM |
| r244649 | r244650 | |
| 266 | 266 | /* extra credit score changes depending on player's performance */ |
| 267 | 267 | |
| 268 | 268 | 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 */ |
| 270 | 270 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet )) |
| 271 | 271 | PORT_DIPSETTING( 0x00, DEF_STR( Upright )) |
| 272 | 272 | PORT_DIPSETTING( 0x40, DEF_STR( Cocktail )) |
| r244649 | r244650 | |
| 338 | 338 | |
| 339 | 339 | void fgoal_state::machine_start() |
| 340 | 340 | { |
| 341 | m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); |
| 342 | |
| 341 | 343 | save_item(NAME(m_xpos)); |
| 342 | 344 | save_item(NAME(m_ypos)); |
| 343 | 345 | save_item(NAME(m_current_color)); |
| 344 | | save_item(NAME(m_fgoal_player)); |
| 346 | save_item(NAME(m_player)); |
| 345 | 347 | save_item(NAME(m_row)); |
| 346 | 348 | save_item(NAME(m_col)); |
| 347 | 349 | save_item(NAME(m_prev_coin)); |
| r244649 | r244650 | |
| 349 | 351 | |
| 350 | 352 | void fgoal_state::machine_reset() |
| 351 | 353 | { |
| 352 | | timer_set(m_screen->time_until_pos(0), TIMER_INTERRUPT); |
| 354 | m_interrupt_timer->adjust(m_screen->time_until_pos(0)); |
| 353 | 355 | |
| 354 | 356 | m_xpos = 0; |
| 355 | 357 | m_ypos = 0; |
| 356 | 358 | m_current_color = 0; |
| 357 | | m_fgoal_player = 0; |
| 359 | m_player = 0; |
| 358 | 360 | m_row = 0; |
| 359 | 361 | m_col = 0; |
| 360 | 362 | m_prev_coin = 0; |
| r244649 | r244650 | |
| 375 | 377 | MCFG_SCREEN_REFRESH_RATE(60) |
| 376 | 378 | MCFG_SCREEN_SIZE(256, 263) |
| 377 | 379 | 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) |
| 379 | 381 | MCFG_SCREEN_PALETTE("palette") |
| 380 | 382 | |
| 381 | 383 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", fgoal) |
| r244649 | r244650 | |
| 433 | 435 | ROM_END |
| 434 | 436 | |
| 435 | 437 | |
| 436 | | GAME( 1979, fgoal, 0, fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 1)", GAME_NO_SOUND ) |
| 437 | | GAME( 1979, fgoala, fgoal, fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 2)", GAME_NO_SOUND ) |
| 438 | GAME( 1979, fgoal, 0, fgoal, fgoal, driver_device, 0, ROT90, "Taito", "Field Goal (set 1)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 439 | GAME( 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
| r244649 | r244650 | |
| 10 | 10 | |
| 11 | 11 | fgoal_state(const machine_config &mconfig, device_type type, const char *tag) |
| 12 | 12 | : driver_device(mconfig, type, tag), |
| 13 | | m_video_ram(*this, "video_ram"), |
| 14 | 13 | m_maincpu(*this, "maincpu"), |
| 15 | 14 | m_mb14241(*this, "mb14241"), |
| 16 | 15 | m_gfxdecode(*this, "gfxdecode"), |
| 17 | 16 | m_screen(*this, "screen"), |
| 18 | | m_palette(*this, "palette") |
| 19 | | { } |
| 17 | m_palette(*this, "palette"), |
| 18 | m_video_ram(*this, "video_ram") { } |
| 20 | 19 | |
| 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 | |
| 21 | 27 | /* memory pointers */ |
| 22 | 28 | required_shared_ptr<UINT8> m_video_ram; |
| 23 | 29 | |
| r244649 | r244650 | |
| 29 | 35 | int m_current_color; |
| 30 | 36 | |
| 31 | 37 | /* misc */ |
| 32 | | int m_fgoal_player; |
| 38 | int m_player; |
| 33 | 39 | UINT8 m_row; |
| 34 | 40 | UINT8 m_col; |
| 35 | 41 | int m_prev_coin; |
| 42 | emu_timer *m_interrupt_timer; |
| 36 | 43 | |
| 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); |
| 43 | 59 | |
| 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 | |
| 60 | 64 | virtual void machine_start(); |
| 61 | 65 | virtual void machine_reset(); |
| 62 | 66 | virtual void video_start(); |
| 63 | 67 | 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); |
| 66 | 70 | int intensity(int bits); |
| 67 | | unsigned video_ram_address( ); |
| 71 | unsigned video_ram_address( ); |
| 68 | 72 | |
| 69 | 73 | protected: |
| 70 | 74 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |