branches/old_menus/src/mame/drivers/model2.c
| r29608 | r29609 | |
| 161 | 161 | { |
| 162 | 162 | UINT32 r = m_copro_fifoin_data[m_copro_fifoin_rpos++]; |
| 163 | 163 | |
| 164 | |
| 164 | 165 | if (m_copro_fifoin_rpos == COPRO_FIFOIN_SIZE) |
| 165 | 166 | { |
| 166 | 167 | m_copro_fifoin_rpos = 0; |
| r29608 | r29609 | |
| 181 | 182 | return; |
| 182 | 183 | } |
| 183 | 184 | |
| 184 | | //mame_printf_debug("COPRO FIFOIN at %08X, %08X, %f\n", device->safe_pc(), data, *(float*)&data); |
| 185 | //printf("COPRO FIFOIN at %08X, %08X, %f\n", device->safe_pc(), data, *(float*)&data); |
| 185 | 186 | |
| 186 | 187 | state->m_copro_fifoin_data[state->m_copro_fifoin_wpos++] = data; |
| 187 | 188 | if (state->m_copro_fifoin_wpos == COPRO_FIFOIN_SIZE) |
| r29608 | r29609 | |
| 339 | 340 | m_timers[tnum]->reset(); |
| 340 | 341 | |
| 341 | 342 | m_intreq |= (1<<bit); |
| 342 | | if (m_intena & (1<<bit)) |
| 343 | | { |
| 344 | | m_maincpu->set_input_line(I960_IRQ2, ASSERT_LINE); |
| 345 | | } |
| 343 | model2_check_irq_state(); |
| 346 | 344 | |
| 347 | 345 | m_timervals[tnum] = 0; |
| 348 | 346 | m_timerrun[tnum] = 0; |
| r29608 | r29609 | |
| 366 | 364 | m_geocnt = 0; |
| 367 | 365 | m_ctrlmode = 0; |
| 368 | 366 | m_analog_channel = 0; |
| 367 | m_soundack = 0; |
| 369 | 368 | |
| 370 | 369 | m_timervals[0] = 0xfffff; |
| 371 | 370 | m_timervals[1] = 0xfffff; |
| r29608 | r29609 | |
| 483 | 482 | |
| 484 | 483 | READ32_MEMBER(model2_state::videoctl_r) |
| 485 | 484 | { |
| 486 | | return (m_screen->frame_number() & 1) << 2; |
| 485 | return ((m_screen->frame_number() & 1) << 2) | (m_videocontrol & 3); |
| 487 | 486 | } |
| 488 | 487 | |
| 488 | WRITE32_MEMBER(model2_state::videoctl_w) |
| 489 | { |
| 490 | COMBINE_DATA(&m_videocontrol); |
| 491 | } |
| 492 | |
| 489 | 493 | CUSTOM_INPUT_MEMBER(model2_state::_1c00000_r) |
| 490 | 494 | { |
| 491 | 495 | UINT32 ret = ioport("IN0")->read(); |
| r29608 | r29609 | |
| 994 | 998 | return m_intreq; |
| 995 | 999 | } |
| 996 | 1000 | |
| 1001 | void model2_state::model2_check_irq_state() |
| 1002 | { |
| 1003 | const int irq_type[16]= {I960_IRQ0,I960_IRQ1,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ2,I960_IRQ3,I960_IRQ3}; |
| 1004 | |
| 1005 | for(int i=0;i<16;i++) |
| 1006 | { |
| 1007 | if (m_intena & (1<<i) && m_intreq & 1<<i) |
| 1008 | m_maincpu->set_input_line(irq_type[i], ASSERT_LINE); |
| 1009 | } |
| 1010 | } |
| 1011 | |
| 997 | 1012 | WRITE32_MEMBER(model2_state::model2_irq_w) |
| 998 | 1013 | { |
| 999 | 1014 | m_maincpu->i960_noburst(); |
| r29608 | r29609 | |
| 1001 | 1016 | if (offset) |
| 1002 | 1017 | { |
| 1003 | 1018 | COMBINE_DATA(&m_intena); |
| 1019 | model2_check_irq_state(); |
| 1004 | 1020 | return; |
| 1005 | 1021 | } |
| 1006 | 1022 | |
| 1007 | 1023 | m_intreq &= data; |
| 1024 | /* TODO: improve this */ |
| 1008 | 1025 | UINT32 irq_ack = data ^ 0xffffffff; |
| 1009 | 1026 | |
| 1010 | 1027 | if(irq_ack & 1<<0) |
| r29608 | r29609 | |
| 1015 | 1032 | |
| 1016 | 1033 | } |
| 1017 | 1034 | |
| 1035 | /* TODO: rewrite this part. */ |
| 1018 | 1036 | READ32_MEMBER(model2_state::model2_serial_r) |
| 1019 | 1037 | { |
| 1020 | 1038 | if ((offset == 0) && (mem_mask == 0xffff0000)) |
| r29608 | r29609 | |
| 1025 | 1043 | return 0xffffffff; |
| 1026 | 1044 | } |
| 1027 | 1045 | |
| 1046 | |
| 1028 | 1047 | WRITE32_MEMBER(model2_state::model2o_serial_w) |
| 1029 | 1048 | { |
| 1049 | if(mem_mask == 0xffff0000) |
| 1050 | { |
| 1051 | if (!space.debugger_access()) |
| 1052 | { |
| 1053 | //m_soundack++; |
| 1054 | } |
| 1055 | } |
| 1030 | 1056 | if (mem_mask == 0x0000ffff) |
| 1031 | 1057 | { |
| 1032 | 1058 | if (!m_m1audio->ready_r(space, 0)) |
| r29608 | r29609 | |
| 1081 | 1107 | 0x94,0xD5,0x73,0x09,0xE4,0x3D,0x2D,0x92,0xC9,0xA7,0xA3,0x53,0x42,0x82,0x55,0x67, |
| 1082 | 1108 | 0xE4,0x66,0xD0,0x4A,0x7D,0x4A,0x13,0xDE,0xD7,0x9F,0x38,0xAA,0x00,0x56,0x85,0x0A |
| 1083 | 1109 | }; |
| 1110 | |
| 1084 | 1111 | static const UINT8 DCOPKey1326[]= |
| 1085 | 1112 | { |
| 1086 | 1113 | 0x43,0x66,0x54,0x11,0x99,0xfe,0xcc,0x8e,0xdd,0x87,0x11,0x89,0x22,0xdf,0x44,0x09 |
| r29608 | r29609 | |
| 1376 | 1403 | |
| 1377 | 1404 | |
| 1378 | 1405 | AM_RANGE(0x00980004, 0x00980007) AM_READ(fifoctl_r) |
| 1379 | | AM_RANGE(0x0098000c, 0x0098000f) AM_READ(videoctl_r) |
| 1406 | AM_RANGE(0x0098000c, 0x0098000f) AM_READWRITE(videoctl_r,videoctl_w) |
| 1380 | 1407 | |
| 1381 | 1408 | AM_RANGE(0x00e80000, 0x00e80007) AM_READWRITE(model2_irq_r, model2_irq_w) |
| 1382 | 1409 | |
| r29608 | r29609 | |
| 1489 | 1516 | |
| 1490 | 1517 | AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE(ctrl0_w ) |
| 1491 | 1518 | AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004") |
| 1519 | AM_RANGE(0x01c0000c, 0x01c0000f) AM_READ_PORT("1c0000c") |
| 1492 | 1520 | AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010") |
| 1493 | 1521 | AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014") |
| 1494 | 1522 | AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r ) |
| r29608 | r29609 | |
| 1580 | 1608 | PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") |
| 1581 | 1609 | PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2") |
| 1582 | 1610 | |
| 1611 | PORT_START("1c0000c") |
| 1612 | PORT_BIT( 0xfffffff7, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1613 | PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") |
| 1614 | |
| 1583 | 1615 | PORT_START("1c00010") |
| 1584 | 1616 | PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0") |
| 1585 | 1617 | PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") |
| r29608 | r29609 | |
| 1940 | 1972 | { |
| 1941 | 1973 | int scanline = param; |
| 1942 | 1974 | |
| 1943 | | if(scanline == 384) // 384 |
| 1975 | if(scanline == 384) |
| 1944 | 1976 | { |
| 1945 | | m_intreq |= (1<<10); |
| 1946 | | if (m_intena & (1<<10)) |
| 1947 | | m_maincpu->set_input_line(I960_IRQ3, ASSERT_LINE); |
| 1977 | m_intreq |= (1<<0); |
| 1978 | model2_check_irq_state(); |
| 1948 | 1979 | } |
| 1949 | | |
| 1950 | | if(scanline == 0) |
| 1980 | else if(scanline == 0) |
| 1951 | 1981 | { |
| 1952 | | m_intreq |= (1<<0); |
| 1953 | | if (m_intena & (1<<0)) |
| 1954 | | m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE); |
| 1982 | /* From sound to main CPU (TODO: what enables this?) */ |
| 1983 | m_intreq |= (1<<10); |
| 1984 | model2_check_irq_state(); |
| 1955 | 1985 | } |
| 1956 | 1986 | } |
| 1957 | 1987 | |
| r29608 | r29609 | |
| 1962 | 1992 | if(scanline == 0) // 384 |
| 1963 | 1993 | { |
| 1964 | 1994 | m_intreq |= (1<<10); |
| 1965 | | if (m_intena & (1<<10)) |
| 1966 | | m_maincpu->set_input_line(I960_IRQ3, ASSERT_LINE); |
| 1995 | model2_check_irq_state(); |
| 1967 | 1996 | } |
| 1968 | 1997 | |
| 1969 | 1998 | if(scanline == 256) |
| 1970 | 1999 | { |
| 1971 | 2000 | m_intreq |= (1<<2); |
| 1972 | | if (m_intena & (1<<2)) |
| 1973 | | m_maincpu->set_input_line(I960_IRQ2, ASSERT_LINE); |
| 2001 | model2_check_irq_state(); |
| 1974 | 2002 | } |
| 1975 | 2003 | |
| 1976 | 2004 | if(scanline == 128) |
| 1977 | 2005 | { |
| 1978 | 2006 | m_intreq |= (1<<0); |
| 1979 | | if (m_intena & (1<<0)) |
| 1980 | | m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE); |
| 2007 | model2_check_irq_state(); |
| 1981 | 2008 | } |
| 1982 | 2009 | } |
| 1983 | 2010 | |
| r29608 | r29609 | |
| 2167 | 2194 | |
| 2168 | 2195 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2169 | 2196 | MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK ) |
| 2170 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 2171 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2172 | | MCFG_SCREEN_SIZE(62*8, 48*8) |
| 2173 | | MCFG_SCREEN_VISIBLE_AREA(0*8, 62*8-1, 0*8, 48*8-1) |
| 2197 | MCFG_SCREEN_RAW_PARAMS(25000000/2, 496+16, 0, 496, 384+16, 0, 384) // not accurate |
| 2174 | 2198 | MCFG_SCREEN_UPDATE_DRIVER(model2_state, screen_update_model2) |
| 2175 | 2199 | |
| 2176 | 2200 | MCFG_PALETTE_ADD("palette", 8192) |
| r29608 | r29609 | |
| 5640 | 5664 | GAME( 1994, vcopa, 0, model2o, vcop, driver_device, 0, ROT0, "Sega", "Virtua Cop (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
| 5641 | 5665 | |
| 5642 | 5666 | // Model 2A-CRX (TGPs, SCSP sound board) |
| 5643 | | GAME( 1995, manxtt, 0, manxttdx,model2, driver_device, 0, ROT0, "Sega", "Manx TT Superbike - DX (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
| 5667 | GAME( 1995, manxtt, 0, manxttdx,model2, driver_device, 0, ROT0, "Sega", "Manx TT Superbike - DX (Revision D)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
| 5644 | 5668 | GAME( 1995, manxttc, 0, model2a, model2, driver_device, 0, ROT0, "Sega", "Manx TT Superbike - Twin (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
| 5645 | 5669 | GAME( 1995, srallyc, 0, srallyc, srallyc, model2_state, srallyc, ROT0, "Sega", "Sega Rally Championship - TWIN (Revision C)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
| 5646 | 5670 | GAME( 1995, srallycb, srallyc, srallyc, srallyc, model2_state, srallyc, ROT0, "Sega", "Sega Rally Championship - TWIN (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) |
branches/old_menus/src/mame/drivers/battlnts.c
| r29608 | r29609 | |
| 330 | 330 | ROM_LOAD( "765_j01.10a", 0x00000, 0x08000, CRC(77ae753e) SHA1(9e463a825d31bb79644b083d24b25670d96441c5) ) |
| 331 | 331 | |
| 332 | 332 | ROM_REGION( 0x40000, "gfx1", 0 ) |
| 333 | | ROM_LOAD( "765_l04.13a", 0x00000, 0x40000, CRC(acfbeee2) SHA1(c2bf750892ba33d4610fa4497170f49c101ed4c1) ) /* tiles */ |
| 333 | ROM_LOAD( "765_l04.13a", 0x00000, 0x40000, CRC(d8fb9c64) SHA1(37dac643aa492ef1ecc29c5030bc7fe5226027a2) ) /* tiles */ |
| 334 | 334 | |
| 335 | 335 | ROM_REGION( 0x40000, "gfx2", 0 ) |
| 336 | 336 | ROM_LOAD( "765_l05.13e", 0x00000, 0x40000, CRC(1bb6855f) SHA1(251081564dfede8fa9a422081d58465fe5ca4ed1) ) /* sprites */ |
| r29608 | r29609 | |
| 367 | 367 | ROM_END |
| 368 | 368 | |
| 369 | 369 | |
| 370 | | /************************************* |
| 371 | | * |
| 372 | | * Driver initialization |
| 373 | | * |
| 374 | | *************************************/ |
| 375 | 370 | |
| 376 | | /* |
| 377 | | This recursive function doesn't use additional memory |
| 378 | | (it could be easily converted into an iterative one). |
| 379 | | It's called shuffle because it mimics the shuffling of a deck of cards. |
| 380 | | */ |
| 381 | | static void shuffle( UINT8 *buf, int len ) |
| 382 | | { |
| 383 | | int i; |
| 384 | | UINT8 t; |
| 385 | | |
| 386 | | if (len == 2) |
| 387 | | return; |
| 388 | | |
| 389 | | if (len % 4) |
| 390 | | fatalerror("shuffle() - not modulo 4\n"); /* must not happen */ |
| 391 | | |
| 392 | | len /= 2; |
| 393 | | |
| 394 | | for (i = 0; i < len / 2; i++) |
| 395 | | { |
| 396 | | t = buf[len / 2 + i]; |
| 397 | | buf[len / 2 + i] = buf[len + i]; |
| 398 | | buf[len + i] = t; |
| 399 | | } |
| 400 | | |
| 401 | | shuffle(buf, len); |
| 402 | | shuffle(buf + len, len); |
| 403 | | } |
| 404 | | |
| 405 | | |
| 406 | | DRIVER_INIT_MEMBER(battlnts_state,rackemup) |
| 407 | | { |
| 408 | | /* rearrange char ROM */ |
| 409 | | shuffle(memregion("gfx1")->base(), memregion("gfx1")->bytes()); |
| 410 | | } |
| 411 | | |
| 412 | | |
| 413 | | |
| 414 | 371 | /************************************* |
| 415 | 372 | * |
| 416 | 373 | * Game driver(s) |
| 417 | 374 | * |
| 418 | 375 | *************************************/ |
| 419 | 376 | |
| 420 | | GAME( 1987, battlnts, 0, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (program code G)", GAME_SUPPORTS_SAVE ) |
| 421 | | GAME( 1987, battlntsa, battlnts, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (program code F)", GAME_SUPPORTS_SAVE ) |
| 422 | | GAME( 1987, battlntsj, battlnts, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (Japan, program code E)", GAME_SUPPORTS_SAVE ) |
| 423 | | GAME( 1987, rackemup, 0, battlnts, rackemup, battlnts_state, rackemup, ROT90, "Konami", "Rack 'em Up (program code L)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 424 | | GAME( 1987, thehustl, rackemup, battlnts, thehustl, driver_device, 0, ROT90, "Konami", "The Hustler (Japan, program code M)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 425 | | GAME( 1987, thehustlj, rackemup, battlnts, thehustl, driver_device, 0, ROT90, "Konami", "The Hustler (Japan, program code J)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 377 | GAME( 1987, battlnts, 0, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (program code G)", GAME_SUPPORTS_SAVE ) |
| 378 | GAME( 1987, battlntsa, battlnts, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (program code F)", GAME_SUPPORTS_SAVE ) |
| 379 | GAME( 1987, battlntsj, battlnts, battlnts, battlnts, driver_device, 0, ROT90, "Konami", "Battlantis (Japan, program code E)", GAME_SUPPORTS_SAVE ) |
| 380 | GAME( 1987, rackemup, 0, battlnts, rackemup, driver_device, 0, ROT90, "Konami", "Rack 'em Up (program code L)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 381 | GAME( 1987, thehustl, rackemup, battlnts, thehustl, driver_device, 0, ROT90, "Konami", "The Hustler (Japan, program code M)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
| 382 | GAME( 1987, thehustlj, rackemup, battlnts, thehustl, driver_device, 0, ROT90, "Konami", "The Hustler (Japan, program code J)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |