trunk/src/mame/drivers/seabattl.c
| r24033 | r24034 | |
| 2 | 2 | |
| 3 | 3 | Sea Battle by Zaccaria |
| 4 | 4 | |
| 5 | driver by Mariusz Wojcieszek and David Haywood |
| 6 | |
| 7 | TODO: |
| 8 | - collision detection |
| 9 | - verify colors |
| 10 | - video timing |
| 11 | - discrete sound |
| 12 | |
| 5 | 13 | Memory map in pics... |
| 6 | 14 | |
| 7 | 15 | |
| r24033 | r24034 | |
| 78 | 86 | |
| 79 | 87 | #include "emu.h" |
| 80 | 88 | #include "cpu/s2650/s2650.h" |
| 89 | #include "sound/s2636.h" |
| 90 | #include "video/s2636.h" |
| 91 | #include "video/dm9368.h" |
| 92 | #include "seabattl.lh" |
| 81 | 93 | |
| 82 | 94 | |
| 83 | 95 | class seabattl_state : public driver_device |
| r24033 | r24034 | |
| 85 | 97 | public: |
| 86 | 98 | seabattl_state(const machine_config &mconfig, device_type type, const char *tag) |
| 87 | 99 | : driver_device(mconfig, type, tag), |
| 88 | | m_maincpu(*this, "maincpu") |
| 100 | m_maincpu(*this, "maincpu"), |
| 101 | m_videoram(*this, "videoram"), |
| 102 | m_colorram(*this, "colorram"), |
| 103 | m_mobjram(*this, "mobjram"), |
| 104 | m_digit0(*this, "sc_thousand"), |
| 105 | m_digit1(*this, "sc_hundred"), |
| 106 | m_digit2(*this, "sc_half"), |
| 107 | m_digit3(*this, "sc_unity"), |
| 108 | m_digit4(*this, "tm_half"), |
| 109 | m_digit5(*this, "tm_unity"), |
| 110 | m_waveenable(false), |
| 111 | m_collision(0) |
| 89 | 112 | { |
| 90 | 113 | } |
| 91 | 114 | |
| 92 | 115 | required_device<cpu_device> m_maincpu; |
| 116 | required_shared_ptr<UINT8> m_videoram; |
| 117 | required_shared_ptr<UINT8> m_colorram; |
| 118 | required_shared_ptr<UINT8> m_mobjram; |
| 119 | required_device<dm9368_device> m_digit0; |
| 120 | required_device<dm9368_device> m_digit1; |
| 121 | required_device<dm9368_device> m_digit2; |
| 122 | required_device<dm9368_device> m_digit3; |
| 123 | required_device<dm9368_device> m_digit4; |
| 124 | required_device<dm9368_device> m_digit5; |
| 93 | 125 | |
| 126 | tilemap_t *m_bg_tilemap; |
| 127 | bitmap_ind16 m_collision_bg; |
| 128 | |
| 129 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 130 | DECLARE_WRITE8_MEMBER(seabattl_videoram_w); |
| 131 | DECLARE_WRITE8_MEMBER(seabattl_colorram_w); |
| 132 | DECLARE_WRITE8_MEMBER(seabattl_wrtc_w); |
| 133 | DECLARE_READ8_MEMBER(seabattl_redc_r); |
| 134 | DECLARE_WRITE8_MEMBER(seabattl_portd_w); |
| 135 | DECLARE_READ8_MEMBER(seabattl_portd_r); |
| 136 | DECLARE_WRITE8_MEMBER(sound_w); |
| 137 | DECLARE_WRITE8_MEMBER(sound2_w); |
| 138 | DECLARE_WRITE8_MEMBER(time_display_w); |
| 139 | DECLARE_WRITE8_MEMBER(score_display_w); |
| 140 | DECLARE_WRITE8_MEMBER(score2_display_w); |
| 141 | DECLARE_READ8_HANDLER(input_1e05_r); |
| 142 | DECLARE_READ8_HANDLER(input_1e06_r); |
| 143 | DECLARE_READ8_HANDLER(input_1e07_r); |
| 144 | |
| 145 | INTERRUPT_GEN_MEMBER(seabattl_interrupt); |
| 146 | |
| 94 | 147 | virtual void machine_start(); |
| 95 | 148 | virtual void machine_reset(); |
| 96 | 149 | virtual void video_start(); |
| 150 | virtual void palette_init(); |
| 97 | 151 | UINT32 screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 152 | bool m_waveenable; |
| 153 | UINT8 m_collision; |
| 98 | 154 | }; |
| 99 | 155 | |
| 156 | void seabattl_state::palette_init() |
| 157 | { |
| 158 | int i; |
| 159 | // m.obj |
| 160 | for ( i = 0; i < 8; i++ ) |
| 161 | { |
| 162 | palette_set_color( machine(), i, MAKE_RGB( (i&1)?0xff:0x00, (i&2)?0xff:0x00, (i&4)?0xff:0x00) ); |
| 163 | } |
| 164 | // scr |
| 165 | for(i=0;i<8;++i) |
| 166 | { |
| 167 | palette_set_color( machine(),8+2*i, MAKE_RGB(0x00, 0x00, 0x00) ); |
| 168 | palette_set_color( machine(),8+2*i+1, MAKE_RGB( (i&1)?0xff:0x00, (i&2)?0xff:0x00, (i&4)?0xff:0x00) ); |
| 169 | } |
| 170 | // wave |
| 171 | palette_set_color( machine(), 24, RGB_BLACK ); |
| 172 | palette_set_color( machine(), 25, RGB_WHITE ); |
| 173 | } |
| 100 | 174 | |
| 175 | TILE_GET_INFO_MEMBER(seabattl_state::get_bg_tile_info) |
| 176 | { |
| 177 | int code = m_videoram[tile_index]; |
| 178 | int color = m_colorram[tile_index]; |
| 101 | 179 | |
| 180 | SET_TILE_INFO_MEMBER(1, code, (color & 0x7), 0); |
| 181 | } |
| 182 | |
| 183 | WRITE8_MEMBER(seabattl_state::seabattl_videoram_w) |
| 184 | { |
| 185 | m_videoram[offset] = data; |
| 186 | m_bg_tilemap->mark_tile_dirty(offset); |
| 187 | } |
| 188 | |
| 189 | WRITE8_MEMBER(seabattl_state::seabattl_colorram_w) |
| 190 | { |
| 191 | m_colorram[offset] = data; |
| 192 | m_bg_tilemap->mark_tile_dirty(offset); |
| 193 | }; |
| 194 | |
| 102 | 195 | UINT32 seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 103 | 196 | { |
| 197 | int x,y, offset; |
| 198 | |
| 199 | static int s2636_enabled = 1; |
| 200 | static int mobj_enabled = 1; |
| 201 | static int tilemap_enabled = 1; |
| 202 | |
| 203 | if(machine().input().code_pressed_once(KEYCODE_Q)) |
| 204 | { |
| 205 | s2636_enabled ^= 1; |
| 206 | popmessage("S2636 layer %sabled", s2636_enabled ? "en" : "dis"); |
| 207 | } |
| 208 | if(machine().input().code_pressed_once(KEYCODE_W)) |
| 209 | { |
| 210 | mobj_enabled ^= 1; |
| 211 | popmessage("mobj layer %sabled", mobj_enabled ? "en" : "dis"); |
| 212 | } |
| 213 | if(machine().input().code_pressed_once(KEYCODE_E)) |
| 214 | { |
| 215 | tilemap_enabled ^= 1; |
| 216 | popmessage("mobj layer %sabled", tilemap_enabled ? "en" : "dis"); |
| 217 | } |
| 218 | |
| 219 | // wave |
| 220 | if ( m_waveenable ) |
| 221 | { |
| 222 | for ( y = 0; y < 32; y++ ) |
| 223 | { |
| 224 | for ( x = 0; x < 32; x++ ) |
| 225 | { |
| 226 | drawgfx_opaque( bitmap, cliprect, machine().gfx[2], (y & 0x0f) + (((x & 0x0f) + ((screen.frame_number() & 0xe0) >> 4)) << 4), 0, 0, 0, x*8, y*8 ); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 233 | } |
| 234 | // bg tilemap |
| 235 | if ( tilemap_enabled ) |
| 236 | { |
| 237 | m_bg_tilemap->draw(bitmap, cliprect, 0, 0); |
| 238 | m_bg_tilemap->draw(m_collision_bg, cliprect, 0, 0); |
| 239 | } |
| 240 | |
| 241 | // m.obj |
| 242 | if ( mobj_enabled ) |
| 243 | { |
| 244 | for ( offset = 0; offset < 256; offset++ ) |
| 245 | { |
| 246 | // bits 0-3: sprite num |
| 247 | // bits 4-7: x coordinate |
| 248 | if ( m_mobjram[offset] & 0xf ) |
| 249 | { |
| 250 | drawgfx_transpen(bitmap, cliprect, machine().gfx[0], (m_mobjram[offset] & 0x0f) | 0x10, 0, 0, 0, ((offset & 0x0f) << 4) - ((m_mobjram[offset] & 0xf0) >> 4), (offset & 0xf0), 0 ); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | // s2636 layer |
| 256 | bitmap_ind16 &s2636_0_bitmap = s2636_update(machine().device("s2636"), cliprect); |
| 257 | |
| 258 | // collisions |
| 259 | // bit 0: m.obj - pvi-bkg |
| 260 | // bit 1: pvi-bkg - src.sm.obj |
| 261 | // bit 2: m.obj - src.sm.obj |
| 262 | int colx = -1, coly = -1; |
| 263 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 264 | { |
| 265 | for (x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 266 | { |
| 267 | if ( (bitmap.pix(y,x) > 0) && (bitmap.pix(y,x) < 8) && S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix16(y, x)) ) |
| 268 | { |
| 269 | m_collision |= 0x01; |
| 270 | } |
| 271 | if ( S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix16(y, x)) && (m_collision_bg.pix(y,x) > 8) && (m_collision_bg.pix(y,x) < 24) && (palette_get_color(machine(), m_collision_bg.pix(y,x) != RGB_BLACK))) |
| 272 | { |
| 273 | m_collision |= 0x02; |
| 274 | } |
| 275 | if ( ( bitmap.pix(y,x) > 0 ) && ( bitmap.pix(y,x) < 8 ) && ( m_collision_bg.pix(y,x) < 24 ) && (m_collision_bg.pix(y,x) > 8) && (palette_get_color(machine(), m_collision_bg.pix(y,x)) != RGB_BLACK)) |
| 276 | { |
| 277 | m_collision |= 0x04; |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | if ( s2636_enabled ) |
| 283 | { |
| 284 | for (y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 285 | { |
| 286 | for (x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 287 | { |
| 288 | int pixel = s2636_0_bitmap.pix16(y, x); |
| 289 | if (S2636_IS_PIXEL_DRAWN(pixel)) |
| 290 | { |
| 291 | bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); |
| 292 | } |
| 293 | } |
| 294 | } |
| 295 | } |
| 104 | 296 | return 0; |
| 105 | 297 | } |
| 106 | 298 | |
| 107 | 299 | void seabattl_state::video_start() |
| 108 | 300 | { |
| 301 | machine().primary_screen->register_screen_bitmap(m_collision_bg); |
| 302 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(seabattl_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, |
| 303 | 8, 8, 32, 32); |
| 304 | m_bg_tilemap->set_transparent_pen(0); |
| 305 | machine().gfx[1]->set_colorbase(8); |
| 306 | machine().gfx[2]->set_colorbase(24); |
| 109 | 307 | } |
| 110 | 308 | |
| 111 | 309 | static ADDRESS_MAP_START( seabattl_map, AS_PROGRAM, 8, seabattl_state ) |
| 310 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) |
| 112 | 311 | AM_RANGE(0x0000, 0x13ff) AM_ROM |
| 113 | | AM_RANGE(0x1400, 0x17ff) AM_RAM |
| 114 | 312 | AM_RANGE(0x2000, 0x33ff) AM_ROM |
| 115 | | AM_RANGE(0x3400, 0x37ff) AM_RAM |
| 313 | |
| 314 | AM_RANGE(0x1400, 0x17ff) AM_MIRROR(0x2000) AM_RAM_WRITE(seabattl_colorram_w) AM_SHARE("colorram") |
| 315 | AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x2000) AM_RAM_WRITE(seabattl_videoram_w) AM_SHARE("videoram") |
| 316 | AM_RANGE(0x1c00, 0x1cff) AM_MIRROR(0x2000) AM_RAM |
| 317 | AM_RANGE(0x1d00, 0x1dff) AM_MIRROR(0x2000) AM_RAM AM_SHARE("mobjram") |
| 318 | AM_RANGE(0x1e00, 0x1e00) AM_MIRROR(0x20f0) AM_WRITE(time_display_w) |
| 319 | AM_RANGE(0x1e01, 0x1e01) AM_MIRROR(0x20f0) AM_WRITE(score_display_w) |
| 320 | AM_RANGE(0x1e02, 0x1e02) AM_MIRROR(0x20f0) AM_READ_PORT("IN0") AM_WRITE(score2_display_w) |
| 321 | AM_RANGE(0x1e05, 0x1e05) AM_MIRROR(0x20f0) AM_READ(input_1e05_r) |
| 322 | AM_RANGE(0x1e06, 0x1e06) AM_MIRROR(0x20f0) AM_READ(input_1e06_r) AM_WRITE(sound_w) |
| 323 | AM_RANGE(0x1e07, 0x1e07) AM_MIRROR(0x20f0) AM_READ(input_1e07_r) AM_WRITE(sound2_w) |
| 324 | AM_RANGE(0x1fcc, 0x1fcc) AM_MIRROR(0x2000) AM_READ_PORT("IN1") |
| 325 | AM_RANGE(0x1f00, 0x1fff) AM_MIRROR(0x2000) AM_DEVREADWRITE_LEGACY("s2636", s2636_work_ram_r, s2636_work_ram_w) |
| 116 | 326 | ADDRESS_MAP_END |
| 117 | 327 | |
| 328 | static ADDRESS_MAP_START( seabattl_io_map, AS_IO, 8, seabattl_state ) |
| 329 | AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE( seabattl_redc_r, seabattl_wrtc_w ) |
| 330 | AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE( seabattl_portd_r, seabattl_portd_w ) |
| 331 | AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") |
| 332 | ADDRESS_MAP_END |
| 333 | |
| 334 | READ8_HANDLER(seabattl_state::seabattl_redc_r) |
| 335 | { |
| 336 | return m_collision; |
| 337 | }; |
| 338 | |
| 339 | WRITE8_MEMBER(seabattl_state::seabattl_wrtc_w) |
| 340 | { |
| 341 | // bit 0: play counter |
| 342 | // bit 1: super bonus counter |
| 343 | coin_counter_w( machine(), 0, BIT(data, 2) ); |
| 344 | // bit 3: inverse image |
| 345 | output_set_lamp_value(0, BIT(data,4) ); |
| 346 | m_waveenable = BIT(data, 5); |
| 347 | }; |
| 348 | |
| 349 | READ8_HANDLER(seabattl_state::seabattl_portd_r) |
| 350 | { |
| 351 | m_collision = 0; |
| 352 | return 0; |
| 353 | }; |
| 354 | |
| 355 | WRITE8_HANDLER(seabattl_state::seabattl_portd_w ) |
| 356 | { |
| 357 | m_collision = 0; |
| 358 | }; |
| 359 | |
| 360 | WRITE8_HANDLER(seabattl_state::sound_w ) |
| 361 | { |
| 362 | // sound effects |
| 363 | // bits: |
| 364 | // 0 - missile |
| 365 | // 1 - ship |
| 366 | // 2 - aircraft |
| 367 | // 3 - silence |
| 368 | // 4 - torpedo |
| 369 | // 5 - bomb |
| 370 | // 6 - unused |
| 371 | // 7 - unused |
| 372 | }; |
| 373 | |
| 374 | WRITE8_HANDLER(seabattl_state::sound2_w ) |
| 375 | { |
| 376 | // sound effects |
| 377 | // bits: |
| 378 | // 0 - melody |
| 379 | // 1 - expl. a |
| 380 | // 2 - expl. b |
| 381 | // 3 - expl. c |
| 382 | // 4 - expl. d |
| 383 | // 5 - fall aircraft |
| 384 | // 6 - unused |
| 385 | // 7 - unused |
| 386 | }; |
| 387 | |
| 388 | WRITE8_HANDLER(seabattl_state::time_display_w ) |
| 389 | { |
| 390 | m_digit5->a_w(data & 0x0f); |
| 391 | m_digit4->a_w((data >> 4) & 0x0f); |
| 392 | }; |
| 393 | |
| 394 | WRITE8_HANDLER(seabattl_state::score_display_w ) |
| 395 | { |
| 396 | m_digit3->a_w(data & 0x0f); |
| 397 | m_digit2->a_w((data >> 4) & 0x0f); |
| 398 | }; |
| 399 | |
| 400 | WRITE8_HANDLER(seabattl_state::score2_display_w ) |
| 401 | { |
| 402 | m_digit1->a_w(data & 0x0f); |
| 403 | m_digit0->a_w((data >> 4) & 0x0f); |
| 404 | }; |
| 405 | |
| 406 | READ8_HANDLER(seabattl_state::input_1e05_r) |
| 407 | { |
| 408 | UINT8 val = 0xf0; |
| 409 | UINT8 dsw1 = ioport("DSW1")->read(); |
| 410 | val |= (BIT(dsw1,6) ? 1 : 0); |
| 411 | val |= (BIT(dsw1,5) ? 2 : 0); |
| 412 | val |= (BIT(dsw1,4) ? 4 : 0); |
| 413 | val |= (BIT(dsw1,7) ? 8 : 0); |
| 414 | return val; |
| 415 | }; |
| 416 | |
| 417 | READ8_HANDLER(seabattl_state::input_1e06_r) |
| 418 | { |
| 419 | UINT8 val = 0xc0; |
| 420 | UINT8 dsw1 = ioport("DSW1")->read(); |
| 421 | val |= (BIT(dsw1,1) ? 1 : 0); |
| 422 | val |= (BIT(dsw1,2) ? 2 : 0); |
| 423 | val |= (BIT(dsw1,3) ? 4 : 0); |
| 424 | val |= (BIT(dsw1,0) ? 8 : 0); |
| 425 | val |= (BIT(dsw1,6) ? 16 : 0); |
| 426 | val |= (BIT(dsw1,7) ? 32 : 0); |
| 427 | return val; |
| 428 | }; |
| 429 | |
| 430 | READ8_HANDLER(seabattl_state::input_1e07_r) |
| 431 | { |
| 432 | UINT8 val = 0xc0; |
| 433 | UINT8 dsw0 = ioport("DSW0")->read(); |
| 434 | val |= (BIT(dsw0,2) ? 1 : 0); |
| 435 | val |= (BIT(dsw0,1) ? 2 : 0); |
| 436 | val |= (BIT(dsw0,0) ? 4 : 0); |
| 437 | val |= (BIT(dsw0,3) ? 8 : 0); |
| 438 | val |= (BIT(dsw0,5) ? 16 : 0); |
| 439 | val |= (BIT(dsw0,4) ? 32 : 0); |
| 440 | return val; |
| 441 | }; |
| 442 | |
| 118 | 443 | static INPUT_PORTS_START( seabattl ) |
| 444 | PORT_START("IN0") |
| 445 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // must be high or coins don't work |
| 446 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 447 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("TORPEDO") |
| 448 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("MISSILE") |
| 449 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 450 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 451 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 452 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 453 | |
| 454 | PORT_START("IN1") |
| 455 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_PLAYER(1) |
| 456 | |
| 457 | PORT_START("DSW0") |
| 458 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Game_Time ) ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x00) |
| 459 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x00) |
| 460 | PORT_DIPSETTING( 0x02, "75 seconds" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x00) |
| 461 | PORT_DIPSETTING( 0x03, "90 seconds" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x00) |
| 462 | PORT_DIPSETTING( 0x01, "105 seconds" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x00) |
| 463 | PORT_DIPNAME( 0x03, 0x02, "Ships number" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x04) |
| 464 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x04) |
| 465 | PORT_DIPSETTING( 0x02, "3 ships" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x04) |
| 466 | PORT_DIPSETTING( 0x03, "4 ships" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x04) |
| 467 | PORT_DIPSETTING( 0x01, "5 ships" ) PORT_CONDITION("DSW0", 0x04, EQUALS, 0x04) |
| 468 | PORT_DIPNAME( 0x04, 0x00, "Game Type" ) |
| 469 | PORT_DIPSETTING( 0x00, "Time based" ) |
| 470 | PORT_DIPSETTING( 0x04, "Ships based" ) |
| 471 | PORT_DIPNAME( 0x38, 0x10, DEF_STR( Coin_A ) ) |
| 472 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 473 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) |
| 474 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) |
| 475 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_3C ) ) |
| 476 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_4C ) ) |
| 477 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_5C ) ) |
| 478 | PORT_DIPSETTING( 0x28, DEF_STR( 1C_6C ) ) |
| 479 | PORT_DIPSETTING( 0x38, DEF_STR( 1C_7C ) ) |
| 480 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Coin_B ) ) |
| 481 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00) |
| 482 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_1C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00) |
| 483 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00) |
| 484 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00) |
| 485 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_4C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01) |
| 486 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_5C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01) |
| 487 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01) |
| 488 | PORT_DIPSETTING( 0xc0, DEF_STR( 1C_7C ) ) PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01) |
| 489 | |
| 490 | PORT_START("DSW1") |
| 491 | PORT_DIPNAME( 0x01, 0x00, "Coin B Mode" ) |
| 492 | PORT_DIPSETTING( 0x01, "Coin B Mode 2" ) |
| 493 | PORT_DIPSETTING( 0x00, "Coin B Mode 1" ) |
| 494 | PORT_DIPNAME( 0x02, 0x00, "Ships speed" ) |
| 495 | PORT_DIPSETTING( 0x02, "Slow ships" ) |
| 496 | PORT_DIPSETTING( 0x00, "Fast ships" ) |
| 497 | PORT_DIPNAME( 0x0c, 0x0c, "Extend play" ) |
| 498 | PORT_DIPSETTING( 0x0c, "Not extended" ) |
| 499 | PORT_DIPSETTING( 0x08, "2000 points" ) |
| 500 | PORT_DIPSETTING( 0x04, "3000 points" ) |
| 501 | PORT_DIPSETTING( 0x00, "4000 points" ) |
| 502 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Test ) ) |
| 503 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 504 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 505 | PORT_DIPUNUSED( 0xe0, 0xe0 ) |
| 506 | |
| 507 | PORT_START("SENSE") |
| 508 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") |
| 119 | 509 | INPUT_PORTS_END |
| 120 | 510 | |
| 121 | 511 | void seabattl_state::machine_start() |
| r24033 | r24034 | |
| 126 | 516 | { |
| 127 | 517 | } |
| 128 | 518 | |
| 519 | INTERRUPT_GEN_MEMBER(seabattl_state::seabattl_interrupt) |
| 520 | { |
| 521 | device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x03); |
| 522 | } |
| 523 | |
| 129 | 524 | static const gfx_layout tiles32x16x3_layout = |
| 130 | 525 | { |
| 131 | 526 | 32,16, |
| r24033 | r24034 | |
| 155 | 550 | GFXDECODE_ENTRY( "gfx3", 0, tiles8x8_layout, 0, 1 ) |
| 156 | 551 | GFXDECODE_END |
| 157 | 552 | |
| 553 | static const s2636_interface s2636_config = |
| 554 | { |
| 555 | "screen", |
| 556 | 0x100, |
| 557 | 0, -16, |
| 558 | "s2636snd" |
| 559 | }; |
| 158 | 560 | |
| 561 | static DM9368_INTERFACE( digit_score_thousand_intf ) |
| 562 | { |
| 563 | 0, |
| 564 | DEVCB_NULL, |
| 565 | DEVCB_NULL |
| 566 | }; |
| 567 | |
| 568 | static DM9368_INTERFACE( digit_score_hundred_intf ) |
| 569 | { |
| 570 | 1, |
| 571 | DEVCB_NULL, |
| 572 | DEVCB_NULL |
| 573 | }; |
| 574 | |
| 575 | static DM9368_INTERFACE( digit_score_half_a_score_intf ) |
| 576 | { |
| 577 | 2, |
| 578 | DEVCB_NULL, |
| 579 | DEVCB_NULL |
| 580 | }; |
| 581 | |
| 582 | static DM9368_INTERFACE( digit_score_unity_intf ) |
| 583 | { |
| 584 | 3, |
| 585 | DEVCB_NULL, |
| 586 | DEVCB_NULL |
| 587 | }; |
| 588 | |
| 589 | static DM9368_INTERFACE( digit_time_half_a_score_intf ) |
| 590 | { |
| 591 | 4, |
| 592 | DEVCB_NULL, |
| 593 | DEVCB_NULL |
| 594 | }; |
| 595 | |
| 596 | static DM9368_INTERFACE( digit_time_unity_intf ) |
| 597 | { |
| 598 | 5, |
| 599 | DEVCB_NULL, |
| 600 | DEVCB_NULL |
| 601 | }; |
| 602 | |
| 159 | 603 | static MACHINE_CONFIG_START( seabattl, seabattl_state ) |
| 160 | 604 | |
| 161 | 605 | /* basic machine hardware */ |
| 162 | | MCFG_CPU_ADD("maincpu", S2650, 14318180/4) // ??? |
| 606 | MCFG_CPU_ADD("maincpu", S2650, 14318180/4/2) |
| 163 | 607 | MCFG_CPU_PROGRAM_MAP(seabattl_map) |
| 164 | | // MCFG_CPU_IO_MAP(seabattl_io_map) |
| 165 | | // MCFG_CPU_VBLANK_INT_DRIVER("screen", seabattl_state, seabattl_interrupt) |
| 608 | MCFG_CPU_IO_MAP(seabattl_io_map) |
| 609 | MCFG_CPU_VBLANK_INT_DRIVER("screen", seabattl_state, seabattl_interrupt) |
| 166 | 610 | |
| 167 | | MCFG_PALETTE_LENGTH(256) |
| 611 | MCFG_PALETTE_LENGTH(26) |
| 168 | 612 | |
| 169 | 613 | MCFG_GFXDECODE(seabattl) |
| 170 | 614 | |
| 615 | MCFG_S2636_ADD("s2636", s2636_config) |
| 616 | |
| 617 | MCFG_DM9368_ADD("sc_thousand", digit_score_thousand_intf) |
| 618 | MCFG_DM9368_ADD("sc_hundred", digit_score_hundred_intf) |
| 619 | MCFG_DM9368_ADD("sc_half", digit_score_half_a_score_intf) |
| 620 | MCFG_DM9368_ADD("sc_unity", digit_score_unity_intf) |
| 621 | MCFG_DM9368_ADD("tm_half", digit_time_half_a_score_intf) |
| 622 | MCFG_DM9368_ADD("tm_unity", digit_time_unity_intf) |
| 623 | |
| 171 | 624 | /* video hardware */ |
| 172 | 625 | MCFG_SCREEN_ADD("screen", RASTER) |
| 173 | 626 | MCFG_SCREEN_REFRESH_RATE(50) |
| r24033 | r24034 | |
| 175 | 628 | MCFG_SCREEN_SIZE(256, 256) |
| 176 | 629 | MCFG_SCREEN_VISIBLE_AREA(1*8, 29*8-1, 2*8, 32*8-1) |
| 177 | 630 | MCFG_SCREEN_UPDATE_DRIVER(seabattl_state, screen_update_seabattl) |
| 631 | MCFG_DEFAULT_LAYOUT(layout_seabattl) |
| 632 | |
| 633 | /* sound hardware */ |
| 634 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 635 | MCFG_SOUND_ADD("s2636snd", S2636_SOUND, 0) |
| 636 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 637 | |
| 638 | /* discrete sound */ |
| 178 | 639 | MACHINE_CONFIG_END |
| 179 | 640 | |
| 180 | 641 | |
| r24033 | r24034 | |
| 191 | 652 | ROM_LOAD( "sea b b_1 5.prg", 0x1000, 0x0400, CRC(55c263f6) SHA1(33eba61cb8c9318cf19b771c93a14397b4ee0ace) ) |
| 192 | 653 | ROM_CONTINUE( 0x3000, 0x0400 ) |
| 193 | 654 | |
| 194 | | ROM_REGION( 0x1800, "gfx1", 0 ) // first half of each of these is empty, is that correct? |
| 655 | ROM_REGION( 0x1800, "gfx1", 0 ) |
| 195 | 656 | ROM_LOAD( "sea b red.prg", 0x0000, 0x0800, CRC(fe7192df) SHA1(0b262bc1ac959d8dd79d71780e16237075f4a099) ) |
| 196 | 657 | ROM_LOAD( "sea b green.prg", 0x0800, 0x0800, CRC(cea4c0c9) SHA1(697c136ef363676b346692740d3c3a482dde6207) ) |
| 197 | 658 | ROM_LOAD( "sea b blu.prg", 0x1000, 0x0800, CRC(cd972c4a) SHA1(fcb8149bc462912c8393431ccb792ea4b1b1109d) ) |