Previous 15994 Revisions Next

r7973 Wednesday 5th May, 2010 at 11:42:20 UTC by Nathan Woods
Updated to MAME 0.137u4 core
[docs]messnew.txt
[src/emu]cheat.c cpuexec.c inptport.c memory.c uimenu.c
[src/emu/cpu/apexc]apexc.c
[src/emu/cpu/asap]asap.c
[src/emu/cpu/avr8]avr8.c
[src/emu/cpu/cp1610]cp1610.c
[src/emu/cpu/dsp32]dsp32.c
[src/emu/cpu/f8]f8.c
[src/emu/cpu/i960]i960dis.c
[src/emu/cpu/lr35902]lr35902d.c
[src/emu/cpu/m37710]m7700ds.c
[src/emu/cpu/pic16c5x]16c5xdsm.c
[src/emu/cpu/pic16c62x]16c62xdsm.c
[src/emu/cpu/sharc]sharcdma.c
[src/emu/cpu/tms32010]32010dsm.c
[src/emu/cpu/tms32025]32025dsm.c
[src/emu/cpu/tms7000]7000dasm.c
[src/emu/debug]express.c
[src/emu/drivers]xtal.h
[src/emu/machine]am53cf96.c mc146818.c
[src/emu/sound]aica.c cdda.c okim6376.c s14001a.c scsp.c sp0256.c tms5110r.c tms5220.c vrender0.c ymf271.c
[src/lib/util]aviio.c cdrom.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]leland.c mw8080bw.c taitosnd.c turbo.c tx1.c
[src/mame/drivers]8080bw.c aristmk4.c astrocorp.c bbusters.c cps1.c crystal.c deco156.c feversoc.c finalizr.c galdrvr.c gauntlet.c gei.c gunbustr.c harddriv.c hitpoker.c jollyjgr.c konamigx.c ksys573.c legionna.c lwings.c mediagx.c megadriv.c micro3d.c mw8080bw.c namcops2.c namcos12.c namcos2.c namcos23.c naomi.c nemesis.c nmk16.c pachifev.c pgm.c photon.c qix.c rohga.c segahang.c segaorun.c segas16a.c segas16b.c segas18.c segas32.c segaxbd.c segaybd.c shaolins.c skyarmy.c slapshot.c sshangha.c sstrangr.c statriv2.c subsino.c system16.c taito_l.c taito_z.c vicdual.c vsnes.c wldarrow.c
[src/mame/includes]dc.h megadriv.h micro3d.h naomi.h system16.h taito_z.h
[src/mame/layout]sstrangr.lay* stisub.lay*
[src/mame/machine]dc.c micro3d.c namcos2.c naomi.c stvcd.c taitoio.c williams.c
[src/mame/video]cps1.c dc.c finalizr.c konicdev.c model3.c ppu2c0x.c ppu2c0x.h rdpfb.c sega16sp.c* segahang.c segaic16.c segaic16.h segaorun.c segas16a.c segas16b.c segas18.c segaxbd.c segaybd.c stvvdp1.c stvvdp2.c system16.c taito_f3.c thunderx.c vrender0.c vrender0.h
[src/mess/drivers]genesis.c
[src/osd/sdl]main.c strconv.h
[src/osd/windows]winmain.c
[src/tools]chdcd.c srcclean.c unidasm.c

src/mame/audio/turbo.c
r7972r7973
7272
7373WRITE8_DEVICE_HANDLER( turbo_sound_a_w )
7474{
75#if (!DISCRETE_TEST)
7576   running_device *samples = devtag_get_device(device->machine, "samples");
77#endif
7678   turbo_state *state = (turbo_state *)device->machine->driver_data;
7779   UINT8 diff = data ^ state->sound_state[0];
7880   state->sound_state[0] = data;
src/mame/audio/taitosnd.c
r7972r7973
190190   tc0140syt_state *tc0140syt = get_safe_token(device);
191191
192192   data &= 0x0f;
193
194193   switch (tc0140syt->submode)
195194   {
196195      case 0x00:      // mode #0
src/mame/audio/leland.c
r7972r7973
15601560
15611561static READ16_HANDLER( pit8254_r )
15621562{
1563   struct counter_state *ctr;
1563   //struct counter_state *ctr;
15641564   int which = offset / 0x40;
15651565   int reg = offset & 3;
15661566
r7972r7973
15721572      case 2:
15731573         /* warning: assumes LSB/MSB addressing and no latching! */
15741574         which = (which * 3) + reg;
1575         ctr = &counter[which];
1575         //ctr = &counter[which];
15761576
15771577         /* update the count */
15781578         counter_update_count(which);
src/mame/audio/tx1.c
r7972r7973
214214static STREAM_UPDATE( tx1_stream_update )
215215{
216216   UINT32 step_0, step_1, step_2;
217   double gain_0, gain_1, gain_2, gain_3;
217   double /*gain_0, gain_1,*/ gain_2, gain_3;
218218
219219   stream_sample_t *fl = &outputs[0][0];
220220   stream_sample_t *fr = &outputs[1][0];
r7972r7973
232232   step_1 = pit8253.counts[1].val ? (TX1_PIT_CLOCK / pit8253.counts[1].val) * freq_to_step : 0;
233233   step_2 = pit8253.counts[2].val ? (TX1_PIT_CLOCK / pit8253.counts[2].val) * freq_to_step : 0;
234234
235   gain_0 = tx1_engine_gains[ay_outputa & 0xf];
236   gain_1 = tx1_engine_gains[ay_outputa >> 4];
235   //gain_0 = tx1_engine_gains[ay_outputa & 0xf];
236   //gain_1 = tx1_engine_gains[ay_outputa >> 4];
237237   gain_2 = tx1_engine_gains[ay_outputb & 0xf];
238238   gain_3 = BIT(ay_outputb, 5) ? 1.0f : 1.5f;
239239
src/mame/audio/mw8080bw.c
r7972r7973
12901290
12911291   discrete_sound_w(device, DESERTGU_TRIGGER_CLICK_EN, (data >> 1) & 0x01);
12921292
1293   output_set_value("KICKER", (data >> 2) & 0x01);
1293   output_set_value("Player1_Gun_Recoil", (data >> 2) & 0x01);
12941294
12951295   state->desertgun_controller_select = (data >> 3) & 0x01;
12961296
src/mame/machine/micro3d.c
r7972r7973
661661   timer_set(space->machine, ATTOTIME_IN_USEC(40), NULL, data & ~4, adc_done_callback);
662662}
663663
664CUSTOM_INPUT( botssa_hwchk_r )
665{
666   micro3d_state *state = (micro3d_state*)field->port->machine->driver_data;
664667
668   return state->botssa_latch;
669}
670
671READ16_HANDLER( botssa_140000_r )
672{
673   micro3d_state *state = (micro3d_state*)space->machine->driver_data;
674
675   state->botssa_latch = 0;
676   return 0xffff;
677}
678
679READ16_HANDLER( botssa_180000_r )
680{
681   micro3d_state *state = (micro3d_state*)space->machine->driver_data;
682
683   state->botssa_latch = 1;
684   return 0xffff;
685}
686
665687/*************************************
666688 *
667689 *  CPU control
r7972r7973
743765   cpu_set_clockscale(devtag_get_device(machine, "maincpu"), 0.945f);
744766}
745767
768DRIVER_INIT( botssa )
769{
770   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
771
772   /* Required to pass the hardware version check */
773   memory_install_read16_handler(space, 0x140000, 0x140001, 0, 0, botssa_140000_r );
774   memory_install_read16_handler(space, 0x180000, 0x180001, 0, 0, botssa_180000_r );
775
776   DRIVER_INIT_CALL(micro3d);
777}
778
746779MACHINE_RESET( micro3d )
747780{
748781   micro3d_state *state = (micro3d_state*)machine->driver_data;
src/mame/machine/taitoio.c
r7972r7973
124124   tc0220ioc_state *tc0220ioc =  tc0220ioc_get_safe_token(device);
125125
126126   tc0220ioc->regs[offset] = data;
127
128127   switch (offset)
129128   {
129
130130      case 0x00:
131131         watchdog_reset(device->machine);
132132         break;
133133
134134      case 0x04:   /* coin counters and lockout, hi nibble irrelevant */
135
135136         coin_lockout_w(device->machine, 0, ~data & 0x01);
136137         coin_lockout_w(device->machine, 1, ~data & 0x02);
137138         coin_counter_w(device->machine, 0, data & 0x04);
r7972r7973
433434   tc0640fio_state *tc0640fio = tc0640fio_get_safe_token(device);
434435
435436   tc0640fio->regs[offset] = data;
436
437437   switch (offset)
438438   {
439
439440      case 0x00:
440441         watchdog_reset(device->machine);
441442         break;
src/mame/machine/naomi.c
r7972r7973
22
33Per-game specific JVS settings / idle loop skips for the MAME Naomi driver.
44
5suchie3: check bp c0a6458
5suchie3: check bp c0a6458 (might be protection related)
66
7tetkiwam: check bp c09613a
8
9vtennis: check wpset dee3ec8,8,w,wpdata==0xa8804000
10
711vtennis2: check bp c020130 / wpset c013ff0,f,w,wpdata==0x3f800000 -> 0xc020434 (test mode)
812
13smarinef: put cabinet in STD mode, bp c027968, wpset c0e66a6,4,w
14
15
16hotd2: bp 0xc0ba235, modify work RAM 0xc9c35e8 to be zero, bpclear
17
18hotd2o: bp 0xc0ba1f6, modify work RAM 0xc9c35a8 to be zero, bpclear
919***************************************************************************/
1020
1121#include "emu.h"
r7972r7973
224234   return naomi_ram64[0x18d6c8/8];
225235}
226236
227
228237DRIVER_INIT( ggxxrl )
229238{
230239   memory_install_read64_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc18d6c8, 0xc18d6cf, 0, 0, naomigd_ggxxrl_idle_skip_r);
231240   DRIVER_INIT_CALL(naomi);
232241}
233242
243/* at least speeds up the annoying copyright screens ;-) */
244static READ64_HANDLER( naomigd_sfz3ugd_idle_skip_r )
245{
246   if (cpu_get_pc(space->cpu)==0xc36a2dc)
247      cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(500));
248
249   return naomi_ram64[0x5dc900/8];
250}
251
252DRIVER_INIT( sfz3ugd )
253{
254   memory_install_read64_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc5dc900, 0xc5dc907, 0, 0, naomigd_sfz3ugd_idle_skip_r);
255   DRIVER_INIT_CALL(naomi);
256}
257
258
234259DRIVER_INIT( qmegamis )
235260{
236261   DRIVER_INIT_CALL(naomi);
src/mame/machine/stvcd.c
r7972r7973
15571557
15581558static void cd_readTOC(void)
15591559{
1560   int i, ntrks, toclen, tocptr, fad;
1560   int i, ntrks, /*toclen, */tocptr, fad;
15611561
15621562   xfertype = XFERTYPE_TOC;
15631563   xfercount = 0;
r7972r7973
15711571      ntrks = 0;
15721572   }
15731573
1574   toclen = (4 * ntrks);   // toclen header entry
1574   //toclen = (4 * ntrks); // toclen header entry
15751575
15761576   // data format for Saturn TOC:
15771577   // no header.
r7972r7973
18221822
18231823         if (cdrom)
18241824         {
1825            partitionT *playpart;
1825            //partitionT *playpart;
18261826
1827            playpart = cd_read_filtered_sector(cd_curfad);
1827            /*playpart = */cd_read_filtered_sector(cd_curfad);
18281828
18291829            cd_curfad++;
18301830            fadstoplay--;
src/mame/machine/dc.c
r7972r7973
688688            else //direct texture path
689689               dc_sysctrl_regs[SB_C2DSTAT]=address+ddtdata.length;
690690
691            timer_set(space->machine, ATTOTIME_IN_USEC(200), NULL, 0, ch2_dma_irq);
691            /* 200 usecs breaks sfz3upper */
692            timer_set(space->machine, ATTOTIME_IN_USEC(50), NULL, 0, ch2_dma_irq);
692693            /* simulate YUV FIFO processing here */
693694            if((address & 0x1800000) == 0x0800000)
694695               timer_set(space->machine, ATTOTIME_IN_USEC(500), NULL, 0, yuv_fifo_irq);
r7972r7973
13761377      /*dma flag (active HIGH, bug in docs)*/
13771378      case SB_ADEN: wave_dma.flag = (dat & 1); break;
13781379      /*
1379      SB_ADTSEL
1380      bit 1: (0) Wave DMA thru SB_ADST flag (1) Wave DMA thru irq trigger, defined by SB_G2DTNRM / SB_G2DTEXT
1381      */
1380        SB_ADTSEL
1381        bit 1: (0) Wave DMA thru SB_ADST flag (1) Wave DMA thru irq trigger, defined by SB_G2DTNRM / SB_G2DTEXT
1382        */
13821383      case SB_ADTSEL: wave_dma.sel = dat & 7; break;
13831384      /*ready for dma'ing*/
13841385      case SB_ADST:
r7972r7973
14721473      case SB_PDTSEL:
14731474         pvr_dma.sel = dat & 1;
14741475         //if(pvr_dma.sel & 1)
1475         //   printf("Warning: Unsupported irq mode trigger PVR-DMA\n");
1476         //  printf("Warning: Unsupported irq mode trigger PVR-DMA\n");
14761477         break;
14771478      case SB_PDEN: pvr_dma.flag = dat & 1; break;
14781479      case SB_PDST:
src/mame/machine/namcos2.c
r7972r7973
740740
741741   /* Check if this is a start of conversion */
742742   /* Input ports 2 thru 9 are the analog channels */
743
743744   if(data & 0x40)
744745   {
745      /* Set the conversion complete flag */
746   /* Set the conversion complete flag */
746747      namcos2_mcu_analog_complete = 2;
747748      /* We convert instantly, good eh! */
748749      switch((data>>2) & 0x07)
r7972r7973
771772      case 7:
772773         namcos2_mcu_analog_data=input_port_read(space->machine, "AN7");
773774         break;
775      default:
776         output_set_value("anunk",data);
774777      }
775778#if 0
776779      /* Perform the offset handling on the input port */
src/mame/machine/williams.c
r7972r7973
921921static WRITE8_DEVICE_HANDLER( tshoot_lamp_w )
922922{
923923   /* set the grenade lamp */
924   set_led_status(device->machine, 0,data & 0x04);
925
924   output_set_value("Grenade_lamp", (~data & 0x4)>>2 );
926925   /* set the gun lamp */
927   set_led_status(device->machine, 1,data & 0x08);
928
929#if 0
926   output_set_value("Gun_lamp", (~data & 0x8)>>3 );
930927   /* gun coil */
931   if (data & 0x10)
932      mame_printf_debug("[gun coil] ");
933   else
934      mame_printf_debug("           ");
935
928   output_set_value("Player1_Gun_Recoil", (data & 0x10)>>4 );
936929   /* feather coil */
937   if (data & 0x20)
938      mame_printf_debug("[feather coil] ");
939   else
940      mame_printf_debug("               ");
930   output_set_value("Feather_Blower", (data & 0x20)>>5 );
941931
942   mame_printf_debug("\n");
943#endif
944932}
945933
946934
src/mame/mamedriv.c
r7972r7973
170170   DRIVER( skyraidr )   /* bootleg */
171171   DRIVER( batman2 )   /* bootleg */
172172   DRIVER( warofbug )   /* (c) 1981 Armenia */
173   DRIVER( warofbugg )   /* German Version */
173174   DRIVER( redufo )   /* bootleg - original should be (c) Artic / Arcade TV Game List (P.104, Left, 25 from top) */
174175   DRIVER( exodus )   /* Subelectro - bootleg? */
175176   DRIVER( streakng )   /* [1980] Shoei */
r7972r7973
955956   DRIVER( tekken4 )
956957   DRIVER( tekken4a )
957958   DRIVER( tekken4b )
959   DRIVER( timecrs3 )
958960   DRIVER( zgundm )
959961   DRIVER( fghtjam )
960962   DRIVER( sukuinuf )
r7972r7973
13041306   DRIVER( spcewarl )   /* (c) 1979 Leijac Corporation (Konami) */
13051307   DRIVER( polaris )   /* PS  (c) 1980 Taito */
13061308   DRIVER( polarisa )   /* PS  (c) 1980 Taito */
1309   DRIVER( polariso )   /* PS  (c) 1980 Taito */
13071310   DRIVER( ballbomb )   /* TN  (c) 1980 Taito */
13081311   DRIVER( indianbt )   /* (c) 1980 Taito */
13091312   DRIVER( steelwkr )   /* (c) 1980 Taito */
r7972r7973
17081711   DRIVER( grchamp )   /* GM  (c) 1981 Taito Corporation */
17091712   DRIVER( marinedt )   /* MG  (c) 1981 Taito Corporation */
17101713   DRIVER( changela )   /* ??? (c) 1983 Taito Corporation */
1714   DRIVER( fspiderb )   /* bootleg */
17111715   DRIVER( jollyjgr )   /* KD  (c) 1982 Taito Corporation */
17121716   DRIVER( bking )      /* DM  (c) 1982 Taito Corporation */
17131717   DRIVER( bking2 )   /* AD6 (c) 1983 Taito Corporation */
r7972r7973
26682672   DRIVER( sf2ja )      /* 14/02/1991 (c) 1991 (Japan) */
26692673   DRIVER( sf2jc )      /* 06/03/1991 (c) 1991 (Japan) */
26702674   DRIVER( sf2qp1 )   /* hack */
2675   DRIVER( sf2thndr )   /* hack */
26712676   DRIVER( 3wonders )   /* 20/05/1991 (c) 1991 (World) */
26722677   DRIVER( 3wondersu )   /* 20/05/1991 (c) 1991 (US)    */
26732678   DRIVER( wonder3 )   /* 20/05/1991 (c) 1991 (Japan) */
r7972r7973
33533358   DRIVER( ddr4mp )   /* 2000 - Dance Dance Revolution 4th Mix Plus (G*A34 VER. JAA) */
33543359   DRIVER( ddr4mps )   /* 2000 - Dance Dance Revolution 4th Mix Plus Solo (G*A34 VER. JAA) */
33553360   DRIVER( dmx2m )      /* 2000 - Dance Maniax 2nd Mix (G*A39 VER. JAA) */
3361   DRIVER( fmania )   /* 2000 - Fighting Mania (918 xx B02) */
33563362   DRIVER( gtrfrk5m )   /* 2001 - Guitar Freaks 5th Mix (G*A26 VER. JAA) */
33573363   DRIVER( ddr5m )      /* 2001 - Dance Dance Revolution 5th Mix (G*A27 VER. JAA) */
33583364   DRIVER( dmx2majp )   /* 2001 - Dance Maniax 2nd Mix Append J-Paradise (G*A38 VER. JAA ) */
r7972r7973
39933999                  /* 1989.04 Turbo Outrun (US) */
39944000                  /* 1989.?? Turbo Outrun (World) */
39954001   DRIVER( toutrun )   /* 1987 (FD1094, decrypted) */
3996   DRIVER( toutrun2 )   /* 1987 (FD1094, decrypted) */
3997   DRIVER( toutrun1 )   /* 1987 (protected) */
3998   DRIVER( toutrunu )   /* 1987 (FD1094, decrypted) */
4002   DRIVER( toutrun3 )   /* 1987 (FD1094, decrypted) */
4003   DRIVER( toutrun2 )   /* 1987 (protected) */
4004   DRIVER( toutrun1 )   /* 1987 (FD1094, decrypted) */
39994005
40004006   /* X Board */
40014007   DRIVER( aburner )   /* 1987.07 After Burner (Japan) */
r7972r7973
44964502
44974503   DRIVER( hod2bios )   /* 1998.11 The House of the Dead 2 */
44984504   DRIVER( hotd2 )      /* 1998.11 The House of the Dead 2 */
4505   DRIVER( hotd2o )       /* 1998.11 The House of the Dead 2 */
44994506   DRIVER( dybbnao )   /* 1998.12 Dynamite Baseball NAOMI */
45004507   DRIVER( smlg99 )        /* 1999.?? Super Major League '99 */
45014508   DRIVER( pstone )   /* 1999.02 Power Stone */
r7972r7973
45184525   DRIVER( jambo )      /* 1999.09 Jambo! Safari */
45194526                  /* 1999.09 Super Major League 99 */
45204527   DRIVER( sgtetris )   /* 1999.10 Sega Tetris */
4521   DRIVER( derbyoc )   /* 1999.10 Derby Owners Club (Ver. C) */
4522   DRIVER( derbyocb )   /* 1999.10 Derby Owners Club (Ver. B) */
4528   DRIVER( derbyoc )   /* 1999.10 Derby Owners Club */
45234529   DRIVER( doa2 )      /* 1999.11 Dead or Alive 2 */
45244530   DRIVER( otrigger )   /* 1999.11 Out Trigger */
45254531   DRIVER( dybb99 )   /* 1999.11 Dynamite Baseball '99 */
r7972r7973
45644570   DRIVER( sprtjam )   /* 2000.12 Sports Jam */
45654571                  /* 2000.12 Derby Owners Club 2000 ver.2 */
45664572                  /* 2000.?? World Kicks New ver. */
4573   DRIVER( derbyocw )   /* 2001.?? Derby Owners Club World Edition (Rev. C) */
45674574   DRIVER( f355twn2 )   /* 2001.01 F355 Challenge 2 */
45684575   DRIVER( gwing2 )   /* 2001.01 Giga Wing 2 */
45694576   DRIVER( csmash )   /* 2001.01 Cosmic Smash */
r7972r7973
71527159   /* Photon hardware games */
71537160   DRIVER( phtetris )
71547161   DRIVER( phpython )
7162   DRIVER( phklad )
71557163
71567164   /* Photon IK2 hardware */
71577165   DRIVER( kok )
r7972r7973
73207328   DRIVER( cupsocs )   /* (c) 1992 Seibu */
73217329   DRIVER( cupsocs2 )   /* (c) 1992 Seibu */
73227330   DRIVER( cupsocsb )   /* bootleg */
7331   DRIVER( cupsocsb2 )   /* bootleg */
73237332   DRIVER( olysoc92 )   /* (c) 1992 Seibu */
73247333   DRIVER( goal92 )   /* bootleg */
73257334
r7972r7973
83758384   DRIVER( drgw2c )      /* (c) 1997 */
83768385   DRIVER( drgw2j )      /* (c) 1997 */
83778386   DRIVER( drgw3 )         /* (c) 1998 */
8378   DRIVER( drgw3k )      /* (c) 1998 */
8387   DRIVER( drgw3105 )      /* (c) 1998 */
8388   DRIVER( drgw3100 )      /* (c) 1998 */
83798389   DRIVER( kov )         /* (c) 1999 */
83808390   DRIVER( kovplus )      /* (c) 1999 */
83818391   DRIVER( kovplusa )      /* (c) 1999 */
r7972r7973
88278837   DRIVER( gt103aa )   /* (c) 1984 Greyhound Electronics */
88288838   DRIVER( gt103asx )   /* (c) 1984 Greyhound Electronics */
88298839   DRIVER( reelfun )   /* (c) 1986 Grayhound Electronics */
8840   DRIVER( reelfun1 )   /* (c) 1986 Grayhound Electronics */
88308841   DRIVER( findout )   /* (c) 1987 [Elettronolo] */
88318842   DRIVER( quizvid )   /* (c) 1986 Greyhound Electronics */
88328843   DRIVER( quiz )      /* (c) 1986 Italian bootleg */
r7972r7973
90089019   DRIVER( f15se )      /* (c) 1991 Microprose Games Inc. */
90099020   DRIVER( f15se21 )   /* (c) 1991 Microprose Games Inc. */
90109021   DRIVER( botss )      /* (c) 1992 Microprose Games Inc. */
9022   DRIVER( botssa )   /* (c) 1992 Microprose Games Inc. */
90119023   DRIVER( tankbatl )   /* (c) 1992 Microprose Games Inc. */
90129024   DRIVER( dynadice )   /* ? */
90139025   DRIVER( atamanot )   /* (c) 1983 Yachiyo Denki / Uni Enterprize */
r7972r7973
91019113   DRIVER( spaceg )   /* (c) 19?? */
91029114   DRIVER( wldarrow )   /* (c) 1982 */
91039115   DRIVER( mdrawpkr )   /* (c) 19?? */
9116   DRIVER( mdrawpkra )   /* (c) 19?? */
91049117   DRIVER( laserbas )   /* (c) 1981 Amstar/HOEI */
91059118   DRIVER( laserbasa )   /* (c) 1981 Amstar/HOEI */
91069119   DRIVER( futflash )   /* (c) 1981 HOEI (Arcade TV Game List - P.96, Right, 18 from top) */
src/mame/includes/megadriv.h
r7972r7973
77extern DRIVER_INIT( megadrie );
88extern DRIVER_INIT( megadriv );
99extern DRIVER_INIT( megadrij );
10extern DRIVER_INIT( x32x );
10extern DRIVER_INIT( _32x );
1111extern DRIVER_INIT( mpnew );
1212
1313INPUT_PORTS_EXTERN( md_common );
src/mame/includes/system16.h
r7972r7973
4141   int back_yscroll;
4242   int fore_yscroll;
4343   int text_yscroll;
44   int sprite_xoffs;
4544
4645   int bg1_trans; // alien syn + sys18
4746
src/mame/includes/dc.h
r7972r7973
3636
3737int dc_compute_interrupt_level(running_machine *machine);
3838void dc_update_interrupt_status(running_machine *machine);
39
3940INPUT_CHANGED( dc_coin_slots_callback );
4041
4142extern UINT32 dc_sysctrl_regs[0x200/4];
src/mame/includes/naomi.h
r7972r7973
2323extern DRIVER_INIT( naomi_mp );
2424extern DRIVER_INIT( naomi2 );
2525
26extern DRIVER_INIT( sfz3ugd );
2627extern DRIVER_INIT( ggxxsla );
2728extern DRIVER_INIT( ggxxrl );
2829extern DRIVER_INIT( ggxx );
src/mame/includes/micro3d.h
r7972r7973
99
1010#define HOST_MONITOR_DISPLAY      0
1111#define VGB_MONITOR_DISPLAY         0
12#define DRMATH_MONITOR_DISPLAY      1
12#define DRMATH_MONITOR_DISPLAY     
1313
1414class micro3d_state
1515{
r7972r7973
7171   /* ADC */
7272   UINT8            adc_val;
7373
74   /* Hardware version-check latch for BOTSS 1.1a */
75   UINT8            botssa_latch;
76
7477   /* MAC */
7578   UINT32            *mac_sram;
7679   UINT32            sram_r_addr;
r7972r7973
139142READ16_HANDLER( micro3d_encoder_l_r );
140143READ16_HANDLER( micro3d_encoder_h_r );
141144
145CUSTOM_INPUT( botssa_hwchk_r );
146READ16_HANDLER( botssa_140000_r );
147READ16_HANDLER( botssa_180000_r );
148
142149READ32_HANDLER( micro3d_shared_r );
143150WRITE32_HANDLER( micro3d_shared_w );
144151
r7972r7973
156163
157164MACHINE_RESET( micro3d );
158165DRIVER_INIT( micro3d );
166DRIVER_INIT( botssa );
159167
160168/*----------- defined in audio/micro3d.c -----------*/
161169WRITE8_DEVICE_HANDLER( micro3d_upd7759_w );
src/mame/includes/taito_z.h
r7972r7973
11/*************************************************************************
22
3
34    Taito Z system
45
56*************************************************************************/
r7972r7973
2829   INT32       dblaxle_int6;
2930   INT32       ioc220_port;
3031   UINT16      eep_latch;
32
3133//  UINT8       pandata[4];
3234
3335   /* devices */
r7972r7973
4042   running_device *tc0100scn;
4143   running_device *tc0220ioc;
4244   running_device *tc0140syt;
45
46   /* dblaxle motor flag */
47   int       dblaxle_vibration;
4348};
4449
4550/*----------- defined in video/taito_z.c -----------*/
src/mame/mame.mak
r7972r7973
11631163   $(AUDIO)/pulsar.o \
11641164   $(AUDIO)/segasnd.o \
11651165   $(VIDEO)/segaic16.o \
1166   $(VIDEO)/sega16sp.o \
11661167   $(VIDEO)/segaic24.o \
11671168   $(VIDEO)/stvvdp1.o $(VIDEO)/stvvdp2.o \
11681169
r7972r7973
18181819
18191820$(DRIVERS)/stepstag.o:   $(LAYOUT)/stepstag.lh
18201821
1822$(DRIVERS)/sstrangr.o:   $(LAYOUT)/sstrangr.lh
1823
18211824$(DRIVERS)/subsino.o:   $(LAYOUT)/victor5.lh \
18221825                  $(LAYOUT)/victor21.lh \
18231826                  $(LAYOUT)/tisub.lh \
1827                  $(LAYOUT)/stisub.lh \
18241828                  $(LAYOUT)/crsbingo.lh \
18251829                  $(LAYOUT)/sharkpy.lh \
18261830                  $(LAYOUT)/sharkpye.lh \
src/mame/video/stvvdp1.c
r7972r7973
16721672
16731673static void stv_vpd1_draw_normal_sprite(running_machine *machine, const rectangle *cliprect, int sprite_type)
16741674{
1675   UINT16 *destline;
1675   //UINT16 *destline;
16761676
16771677   int y, ysize, drawypos;
16781678   int x, xsize, drawxpos;
r7972r7973
17451745   maxdrawxpos = MIN(x+xsize-1,cliprect->max_x);
17461746   for (drawypos = y; drawypos <= maxdrawypos; drawypos++ )
17471747   {
1748      destline = stv_framebuffer_draw_lines[drawypos];
1748      //destline = stv_framebuffer_draw_lines[drawypos];
17491749      su = u;
17501750      for (drawxpos = x; drawxpos <= maxdrawxpos; drawxpos++ )
17511751      {
src/mame/video/segaxbd.c
r7972r7973
2323   /* initialize the tile/text layers */
2424   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2);
2525
26   /* initialize the sprites */
27   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_XBOARD, 0x000, 0);
28
2926   /* initialize the road */
3027   segaic16_road_init(machine, 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166);
3128}
src/mame/video/stvvdp2.c
r7972r7973
28502850   //popmessage("%04x",STV_VDP2_SCRCTL);
28512851
28522852   int xsize = 0, xsizemask = 0;
2853   int ysize = 0, ysizemask = 0;
2854   int xlinesize = 0, xpixelsize = 0;
2853   int ysize = 0/*, ysizemask = 0*/;
2854   int xlinesize = 0/*, xpixelsize = 0*/;
28552855   int xcnt,ycnt;
28562856   UINT8* gfxdata = stv_vdp2_gfx_decode;
28572857   static UINT16 *destline;
r7972r7973
28722872      case 3: xsize=1024; ysize=512; break;
28732873   }
28742874   xsizemask = xsize - 1;
2875   ysizemask = ysize - 1;
2875   /*ysizemask = ysize - 1;*/
28762876
28772877   switch( stv2_current_tilemap.colour_depth )
28782878   {
2879      case 0: xlinesize = xsize / 2; xpixelsize = 0; break;
2880      case 1: xlinesize = xsize; xpixelsize = 1; break;
2881      case 2: case 3: xlinesize = xsize * 2; xpixelsize = 2; break;
2882      case 4: xlinesize = xsize * 4; xpixelsize = 4; break;
2879      case 0: xlinesize = xsize / 2; /*xpixelsize = 0;*/ break;
2880      case 1: xlinesize = xsize; /*xpixelsize = 1;*/ break;
2881      case 2: case 3: xlinesize = xsize * 2; /*xpixelsize = 2;*/ break;
2882      case 4: xlinesize = xsize * 4; /*xpixelsize = 4;*/ break;
28832883   }
28842884
28852885   if(stv2_current_tilemap.colour_depth == 0)
r7972r7973
33603360   /* Plane Variables */
33613361   int pltiles_x, plpixels_x;
33623362   int pltiles_y, plpixels_y;
3363   int plsize_bytes, plsize_dwords;
3363   int plsize_bytes/*, plsize_dwords*/;
33643364
33653365   /* Map Variables */
33663366   int mptiles_x, mppixels_x;
r7972r7973
35593559   stv2_current_tilemap.scrolly &= mppixels_y-1;
35603560
35613561   pgsize_dwords = pgsize_bytes /4;
3562   plsize_dwords = plsize_bytes /4;
3562   //plsize_dwords = plsize_bytes /4;
35633563   mpsize_dwords = mpsize_bytes /4;
35643564
35653565//  if (stv2_current_tilemap.layer_name==3) popmessage ("well this is a bit  %08x", stv2_current_tilemap.map_offset[0]);
src/mame/video/segaybd.c
r7972r7973
2525   /* allocate a bitmap for the yboard layer */
2626   state->tmp_bitmap = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
2727
28   /* initialize the sprites */
29   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_YBOARD_16B, 0x800, 0);
30   segaic16_sprites_init(machine, 1, SEGAIC16_SPRITES_YBOARD, 0x1000, 0);
31
3228   /* initialize the rotation layer */
3329   segaic16_rotate_init(machine, 0, SEGAIC16_ROTATE_YBOARD, 0x000);
3430
src/mame/video/finalizr.c
r7972r7973
9393   tilemap_mark_all_tiles_dirty(state->bg_tilemap);
9494   tilemap_mark_all_tiles_dirty(state->fg_tilemap);
9595
96   tilemap_set_scrollx(state->bg_tilemap, 0, *state->scroll - 16);
96   tilemap_set_scrollx(state->bg_tilemap, 0, *state->scroll - 32);
9797   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
9898
9999   /* Draw the sprites. */
r7972r7973
109109         int sx, sy, flipx, flipy, code, color, size;
110110
111111
112         sx = 16 + sr[offs + 3] - ((sr[offs + 4] & 0x01) << 8);
112         sx = 32 + 1 + sr[offs + 3] - ((sr[offs + 4] & 0x01) << 8);
113113         sy = sr[offs + 2];
114114         flipx = sr[offs + 4] & 0x20;
115115         flipy = sr[offs + 4] & 0x40;
r7972r7973
218218
219219      /* draw top status region */
220220      clip.min_x = visarea->min_x;
221      clip.max_x = visarea->min_x + 15;
222      tilemap_set_scrolldx(state->fg_tilemap,  0,-16);
221      clip.max_x = visarea->min_x + 31;
222      tilemap_set_scrolldx(state->fg_tilemap,  0,-32);
223223      tilemap_draw(bitmap, &clip, state->fg_tilemap, 0, 0);
224
225      /* draw bottom status region */
226      clip.min_x = visarea->max_x - 15;
227      clip.max_x = visarea->max_x;
228      tilemap_set_scrolldx(state->fg_tilemap,-16,  0);
229      tilemap_draw(bitmap, &clip, state->fg_tilemap, 0, 0);
230224   }
231225   return 0;
232226}
src/mame/video/segaorun.c
r7972r7973
2424   /* initialize the tile/text layers */
2525   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2);
2626
27   /* initialize the sprites */
28   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16B, 0x400, 0);
29
3027   /* initialize the road */
3128   segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0);
3229}
r7972r7973
4037   /* initialize the tile/text layers */
4138   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2);
4239
43   /* initialize the sprites */
44   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_OUTRUN, 0x800, 0);
45
4640   /* initialize the road */
4741   segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0);
4842}
src/mame/video/system16.c
r7972r7973
121121   /*  sBGR BBBB GGGG RRRR */
122122   /*  x000 4321 4321 4321 */
123123   {
124      int r, g, b, rs, gs, bs, rh, gh, bh;
124      int r, g, b, rs, gs, bs/*, rh, gh, bh*/;
125125      int r0 = (newword >> 12) & 1;
126126      int r1 = (newword >>  0) & 1;
127127      int r2 = (newword >>  1) & 1;
r7972r7973
149149      bs = combine_6_weights(state->weights[1][2], b0, b1, b2, b3, b4, 0);
150150
151151      /* Highlight colors */
152      rh = combine_6_weights(state->weights[1][0], r0, r1, r2, r3, r4, 1);
153      gh = combine_6_weights(state->weights[1][1], g0, g1, g2, g3, g4, 1);
154      bh = combine_6_weights(state->weights[1][2], b0, b1, b2, b3, b4, 1);
152      //rh = combine_6_weights(state->weights[1][0], r0, r1, r2, r3, r4, 1);
153      //gh = combine_6_weights(state->weights[1][1], g0, g1, g2, g3, g4, 1);
154      //bh = combine_6_weights(state->weights[1][2], b0, b1, b2, b3, b4, 1);
155155
156156      palette_set_color(space->machine, offset, MAKE_RGB(r, g, b) );
157157
r7972r7973
435435   }
436436
437437   segaic16_palette_init(0x800);
438   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16B, 0x400, state->sprite_xoffs);
439438   setup_system16_bootleg_spritebanking(machine);
440439
441440
r7972r7973
613612
614613VIDEO_START( s16a_bootleg_wb3bl )
615614{
616   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
617
618615   VIDEO_START_CALL(s16a_bootleg);
619   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16A_BOOTLEG_WB3BL, 0x400, state->sprite_xoffs);
620616   setup_system16_bootleg_spritebanking(machine);
621617}
622618
623619VIDEO_START( s16a_bootleg_shinobi )
624620{
625   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
626
627621   VIDEO_START_CALL(s16a_bootleg);
628   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16A_BOOTLEG_SHINOBLD, 0x400, state->sprite_xoffs);
629622   setup_system16_bootleg_spritebanking(machine);
630623}
631624
632625VIDEO_START( s16a_bootleg_passsht )
633626{
634   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
635
636627   VIDEO_START_CALL(s16a_bootleg);
637   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16A_BOOTLEG_PASSHTBL, 0x400, state->sprite_xoffs);
638628   setup_system16_bootleg_spritebanking(machine);
639629}
640630
src/mame/video/cps1.c
r7972r7973
12341234   {"sf2ja",    CPS_B_17,     mapper_STF29,  0x36 },
12351235   {"sf2jc",    CPS_B_12,     mapper_STF29,  0x36 },
12361236   {"sf2qp1",   CPS_B_17,     mapper_STF29,  0x36 },
1237   {"sf2thndr", CPS_B_17,     mapper_STF29,  0x36 },
12371238   /* from here onwards the CPS-B board has suicide battery and multiply protection */
12381239   {"3wonders", CPS_B_21_BT1, mapper_RT24B },
12391240   {"3wondersu",CPS_B_21_BT1, mapper_RT24B },
r7972r7973
17611762   state->stars_enabled[0] = layercontrol & state->game_config->layer_enable_mask[3];
17621763   state->stars_enabled[1] = layercontrol & state->game_config->layer_enable_mask[4];
17631764
1764
1765#ifdef MAME_DEBUG
17651766{
17661767   int enablemask = 0;
17671768
r7972r7973
17741775   if (state->game_config->layer_enable_mask[1] == state->game_config->layer_enable_mask[2])
17751776      enablemask = state->game_config->layer_enable_mask[1];
17761777
1777#ifdef MAME_DEBUG
17781778   if (enablemask)
17791779   {
17801780      if (((layercontrol & enablemask) && (layercontrol & enablemask) != enablemask))
17811781         popmessage("layer %02x contact MAMEDEV", layercontrol & 0xc03f);
17821782   }
1783#endif
17841783
17851784   enablemask = state->game_config->layer_enable_mask[0] | state->game_config->layer_enable_mask[1]
17861785         | state->game_config->layer_enable_mask[2]
17871786         | state->game_config->layer_enable_mask[3] | state->game_config->layer_enable_mask[4];
17881787
1789#ifdef MAME_DEBUG
17901788   if (((layercontrol & ~enablemask) & 0x003e) != 0)
17911789      popmessage("layer %02x contact MAMEDEV", layercontrol & 0xc03f);
1790}
17921791#endif
17931792
17941793}
17951794
1796}
17971795
1798
17991796WRITE16_HANDLER( cps1_gfxram_w )
18001797{
18011798   cps_state *state = (cps_state *)space->machine->driver_data;
src/mame/video/dc.c
r7972r7973
16531653   reg = decode_reg_64(offset, mem_mask, &shift);
16541654   dat = (UINT32)(data >> shift);
16551655
1656//   printf("YUV FIFO: [%08x=%x] write %" I64FMT "x to %x, mask %" I64FMT "x %08x\n", 0x10800000+reg*4, dat, data, offset, mem_mask,test);
1656//  printf("YUV FIFO: [%08x=%x] write %" I64FMT "x to %x, mask %" I64FMT "x %08x\n", 0x10800000+reg*4, dat, data, offset, mem_mask,test);
16571657}
16581658
16591659/* test video start */
src/mame/video/segaic16.c
r7972r7973
366366
367367
368368
369/*************************************
370 *
371 *  Type definitions
372 *
373 *************************************/
374369
375struct palette_info
376{
377   INT32         entries;                  /* number of entries (not counting shadows) */
378   UINT8         normal[32];                  /* RGB translations for normal pixels */
379   UINT8         shadow[32];                  /* RGB translations for shadowed pixels */
380   UINT8         hilight[32];               /* RGB translations for hilighted pixels */
381};
382370
383371
384struct tilemap_callback_info
385{
386   UINT16 *      rambase;                  /* base of RAM for this tilemap page */
387   const UINT8 *   bank;                     /* pointer to bank array */
388   UINT16         banksize;                  /* size of banks */
389};
390
391
392struct tilemap_info
393{
394   UINT8         index;                     /* index of this structure */
395   UINT8         type;                     /* type of tilemap (see segaic16.h for details) */
396   UINT8         numpages;                  /* number of allocated pages */
397   UINT8         flip;                     /* screen flip? */
398   UINT8         rowscroll, colscroll;         /* are rowscroll/colscroll enabled (if external enables are used) */
399   UINT8         bank[8];                  /* indexes of the tile banks */
400   UINT16         banksize;                  /* number of tiles per bank */
401   UINT16         latched_xscroll[4];            /* latched X scroll values */
402   UINT16         latched_yscroll[4];            /* latched Y scroll values */
403   UINT16         latched_pageselect[4];         /* latched page select values */
404   INT32         xoffs;                     /* X scroll offset */
405   tilemap_t *      tilemaps[16];               /* up to 16 tilemap pages */
406   tilemap_t *      textmap;                  /* a single text tilemap */
407   struct tilemap_callback_info tmap_info[16];      /* callback info for 16 tilemap pages */
408   struct tilemap_callback_info textmap_info;      /* callback info for a single textmap page */
409   void         (*reset)(running_machine *machine, struct tilemap_info *info);/* reset callback */
410   void         (*draw_layer)(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority);
411   UINT16 *      textram;                  /* pointer to textram pointer */
412   UINT16 *      tileram;                  /* pointer to tileram pointer */
413};
414
415
416struct sprite_info
417{
418   UINT8         index;                     /* index of this structure */
419   UINT8         type;                     /* type of sprite system (see segaic16.h for details) */
420   UINT8         flip;                     /* screen flip? */
421   UINT8         shadow;                     /* shadow or hilight? */
422   UINT8         bank[16];                  /* banking redirection */
423   UINT16         colorbase;                  /* base color index */
424   INT32         ramsize;                  /* size of sprite RAM */
425   INT32         xoffs;                     /* X scroll offset */
426   void         (*draw)(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect);
427   UINT16 *      spriteram;                  /* pointer to spriteram pointer */
428   UINT16 *      buffer;                     /* buffered spriteram for those that use it */
429};
430
431
432struct road_info
433{
434   UINT8         index;                     /* index of this structure */
435   UINT8         type;                     /* type of road system (see segaic16.h for details) */
436   UINT8         control;                  /* control register value */
437   UINT16         colorbase1;                  /* color base for road ROM data */
438   UINT16         colorbase2;                  /* color base for road background data */
439   UINT16         colorbase3;                  /* color base for sky data */
440   INT32         xoffs;                     /* X scroll offset */
441   void         (*draw)(struct road_info *info, bitmap_t *bitmap, const rectangle *cliprect, int priority);
442   UINT16 *      roadram;                  /* pointer to roadram pointer */
443   UINT16 *      buffer;                     /* buffered roadram pointer */
444   UINT8 *         gfx;                     /* expanded road graphics */
445};
446
447
448struct rotate_info
449{
450   UINT8         index;                     /* index of this structure */
451   UINT8         type;                     /* type of rotate system (see segaic16.h for details) */
452   UINT16         colorbase;                  /* base color index */
453   INT32         ramsize;                  /* size of rotate RAM */
454   UINT16 *      rotateram;                  /* pointer to rotateram pointer */
455   UINT16 *      buffer;                     /* buffered data */
456};
457
458
459
460372/*************************************
461373 *
462374 *  Globals
r7972r7973
466378UINT8 segaic16_display_enable;
467379UINT16 *segaic16_tileram_0;
468380UINT16 *segaic16_textram_0;
469UINT16 *segaic16_spriteram_0;
470UINT16 *segaic16_spriteram_1;
471381UINT16 *segaic16_roadram_0;
472382UINT16 *segaic16_rotateram_0;
473383UINT16 *segaic16_paletteram;
r7972r7973
480390 *
481391 *************************************/
482392
483static struct palette_info palette;
484static struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS];
485static struct sprite_info sprites[SEGAIC16_MAX_SPRITES];
486static struct road_info road[SEGAIC16_MAX_ROADS];
487static struct rotate_info rotate[SEGAIC16_MAX_ROTATE];
393struct palette_info palette;
394struct rotate_info rotate[SEGAIC16_MAX_ROTATE];
395struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS];
396struct road_info road[SEGAIC16_MAX_ROADS];
488397
489398
399
490400/*************************************
491401 *
492402 *  Misc functions
r7972r7973
14521362
14531363
14541364
1455/*******************************************************************************************
1456 *
1457 *  Hang On-style sprites
1458 *
1459 *      Offs  Bits               Usage
1460 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
1461 *       +0   -------- tttttttt  Top scanline of sprite - 1
1462 *       +2   bbbb---- --------  Sprite bank
1463 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
1464 *       +4   pppppppp pppppppp  Signed 16-bit pitch value between scanlines
1465 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
1466 *       +6   f------- --------  Horizontal flip: read the data backwards if set
1467 *       +8   --cccccc --------  Sprite color palette
1468 *       +8   -------- zzzzzz--  Zoom factor
1469 *       +8   -------- ------pp  Sprite priority
1470 *       +E   dddddddd dddddddd  Scratch space for current address
1471 *
1472 *  Special notes:
1473 *
1474 *      There is an interaction between the horizonal flip bit and the offset.
1475 *      The offset is maintained as a 16-bit value, even though only the lower
1476 *      15 bits are used for the address. The top bit is used to control flipping.
1477 *      This means that if the low 15 bits overflow during rendering, the sprite
1478 *      data will be read backwards after the overflow. This is important to
1479 *      emulate correctly as many games make use of this feature to render sprites
1480 *      at the beginning of a bank.
1481 *
1482 *******************************************************************************************/
14831365
1484#define hangon_draw_pixel()                                       \
1485   /* only draw if onscreen, not 0 or 15 */                        \
1486   if (pix != 0 && pix != 15)                                    \
1487   {                                                      \
1488      /* are we high enough priority to be visible? */               \
1489      if (sprpri > pri[x])                                    \
1490      {                                                   \
1491         /* shadow/hilight mode? */                              \
1492         if (color == info->colorbase + (0x3f << 4))                  \
1493            dest[x] += info->shadow ? palette.entries*2 : palette.entries;   \
1494                                                         \
1495         /* regular draw */                                    \
1496         else                                             \
1497            dest[x] = pix | color;                              \
1498      }                                                   \
1499                                                         \
1500      /* always mark priority so no one else draws here */            \
1501      pri[x] = 0xff;                                          \
1502   }                                                      \
15031366
1504static void segaic16_sprites_hangon_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
1505{
1506   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
1507   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
1508   const UINT8 *zoom = (const UINT8 *)memory_region(machine, "proms");
1509   UINT16 *data;
1510
1511   /* first scan forward to find the end of the list */
1512   for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8)
1513      if ((data[0] >> 8) > 0xf0)
1514         break;
1515
1516   /* now scan backwards and render the sprites in order */
1517   for (data -= 8; data >= info->spriteram; data -= 8)
1518   {
1519      int bottom  = (data[0] >> 8) + 1;
1520      int top     = (data[0] & 0xff) + 1;
1521      int bank    = info->bank[(data[1] >> 12) & 0xf];
1522      int xpos    = (data[1] & 0x1ff) - 0xbd;
1523      int pitch   = (INT16)data[2];
1524      UINT16 addr = data[3];
1525      int color   = info->colorbase + (((data[4] >> 8) & 0x3f) << 4);
1526      int vzoom   = (data[4] >> 2) & 0x3f;
1527      int hzoom   = vzoom << 1;
1528      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
1529      int x, y, pix, zaddr, zmask;
1530      const UINT16 *spritedata;
1531
1532      /* initialize the end address to the start address */
1533      data[7] = addr;
1534
1535      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
1536      if ((top >= bottom) || bank == 255)
1537         continue;
1538
1539      /* clamp to within the memory region size */
1540      if (numbanks)
1541         bank %= numbanks;
1542      spritedata = spritebase + 0x8000 * bank;
1543
1544      /* determine the starting zoom address and mask */
1545      zaddr = (vzoom & 0x38) << 5;
1546      zmask = 1 << (vzoom & 7);
1547
1548      /* loop from top to bottom */
1549      for (y = top; y < bottom; y++)
1550      {
1551         /* advance a row */
1552         addr += pitch;
1553
1554         /* if the zoom bit says so, add pitch a second time */
1555         if (zoom[zaddr++] & zmask)
1556            addr += pitch;
1557
1558         /* skip drawing if not within the cliprect */
1559         if (y >= cliprect->min_y && y <= cliprect->max_y)
1560         {
1561            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
1562            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
1563            int xacc = 0x00;
1564
1565            /* note that the System 16A sprites have a design flaw that allows the address */
1566            /* to carry into the flip flag, which is the topmost bit -- it is very important */
1567            /* to emulate this as the games compensate for it */
1568
1569            /* non-flipped case */
1570            if (!(addr & 0x8000))
1571            {
1572               /* start at the word before because we preincrement below */
1573               data[7] = addr - 1;
1574               for (x = xpos; x <= cliprect->max_x; )
1575               {
1576                  UINT16 pixels = spritedata[++data[7] & 0x7fff];
1577
1578                  /* draw four pixels */
1579                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1580                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1581                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1582                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1583
1584                  /* stop if the last pixel in the group was 0xf */
1585                  if (pix == 15)
1586                     break;
1587               }
1588            }
1589
1590            /* flipped case */
1591            else
1592            {
1593               /* start at the word after because we predecrement below */
1594               data[7] = addr + 1;
1595               for (x = xpos; x <= cliprect->max_x; )
1596               {
1597                  UINT16 pixels = spritedata[--data[7] & 0x7fff];
1598
1599                  /* draw four pixels */
1600                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1601                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1602                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1603                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
1604
1605                  /* stop if the last pixel in the group was 0xf */
1606                  if (pix == 15)
1607                     break;
1608               }
1609            }
1610         }
1611      }
1612   }
1613}
1614
1615
1616
16171367/*******************************************************************************************
16181368 *
1619 *  Space Harrier-style sprites
1620 *
1621 *      Offs  Bits               Usage
1622 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
1623 *       +0   -------- tttttttt  Top scanline of sprite - 1
1624 *       +2   bbbb---- --------  Sprite bank
1625 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
1626 *       +4   s------- --------  Sprite shadow enable (0=enable, 1=disable)
1627 *       +4   -p------ --------  Sprite priority
1628 *       +4   --cccccc --------  Sprite color palette
1629 *       +4   -------- -ppppppp  Signed 7-bit pitch value between scanlines
1630 *       +6   f------- --------  Horizontal flip: read the data backwards if set
1631 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
1632 *       +8   --zzzzzz --------  Horizontal zoom factor
1633 *       +8   -------- --zzzzzz  Vertical zoom factor
1634 *       +E   dddddddd dddddddd  Scratch space for current address
1635 *
1636 *  Special notes:
1637 *
1638 *      There is an interaction between the horizonal flip bit and the offset.
1639 *      The offset is maintained as a 16-bit value, even though only the lower
1640 *      15 bits are used for the address. The top bit is used to control flipping.
1641 *      This means that if the low 15 bits overflow during rendering, the sprite
1642 *      data will be read backwards after the overflow. This is important to
1643 *      emulate correctly as many games make use of this feature to render sprites
1644 *      at the beginning of a bank.
1645 *
1646 *******************************************************************************************/
1647
1648#define sharrier_draw_pixel()                                    \
1649   /* only draw if onscreen, not 0 or 15 */                        \
1650   if (pix != 0 && pix != 15)                                    \
1651   {                                                      \
1652      /* are we high enough priority to be visible? */               \
1653      if (sprpri > pri[x])                                    \
1654      {                                                   \
1655         /* shadow/hilight mode? */                              \
1656         if (shadow && pix == 0xa)                              \
1657            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
1658                                                         \
1659         /* regular draw */                                    \
1660         else                                             \
1661            dest[x] = pix | color;                              \
1662      }                                                   \
1663                                                         \
1664      /* always mark priority so no one else draws here */            \
1665      pri[x] = 0xff;                                          \
1666   }                                                      \
1667
1668static void segaic16_sprites_sharrier_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
1669{
1670   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x20000;
1671   const UINT32 *spritebase = (const UINT32 *)memory_region(machine, "gfx2");
1672   const UINT8 *zoom = (const UINT8 *)memory_region(machine, "proms");
1673   UINT16 *data;
1674
1675   /* first scan forward to find the end of the list */
1676   for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8)
1677      if ((data[0] >> 8) > 0xf0)
1678         break;
1679
1680   /* now scan backwards and render the sprites in order */
1681   for (data -= 8; data >= info->spriteram; data -= 8)
1682   {
1683      int bottom  = (data[0] >> 8) + 1;
1684      int top     = (data[0] & 0xff) + 1;
1685      int bank    = info->bank[(data[1] >> 12) & 0x7];
1686      int xpos    = (data[1] & 0x1ff) - 0xbd;
1687      int shadow  = (~data[2] >> 15) & 1;
1688      int sprpri  = ((data[2] >> 14) & 1) ? (1<<3) : (1<<1);
1689      int color   = info->colorbase + (((data[2] >> 8) & 0x3f) << 4);
1690      int pitch   = (INT16)(data[2] << 9) >> 9;
1691      UINT16 addr = data[3];
1692      int hzoom   = ((data[4] >> 8) & 0x3f) << 1;
1693      int vzoom   = (data[4] >> 0) & 0x3f;
1694      int x, y, pix, zaddr, zmask;
1695      const UINT32 *spritedata;
1696
1697      /* initialize the end address to the start address */
1698      data[7] = addr;
1699
1700      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
1701      if ((top >= bottom) || bank == 255)
1702         continue;
1703
1704      /* clamp to within the memory region size */
1705      if (numbanks)
1706         bank %= numbanks;
1707      spritedata = spritebase + 0x8000 * bank;
1708
1709      /* determine the starting zoom address and mask */
1710      zaddr = (vzoom & 0x38) << 5;
1711      zmask = 1 << (vzoom & 7);
1712
1713      /* loop from top to bottom */
1714      for (y = top; y < bottom; y++)
1715      {
1716         /* advance a row */
1717         addr += pitch;
1718
1719         /* if the zoom bit says so, add pitch a second time */
1720         if (zoom[zaddr++] & zmask)
1721            addr += pitch;
1722
1723         /* skip drawing if not within the cliprect */
1724         if (y >= cliprect->min_y && y <= cliprect->max_y)
1725         {
1726            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
1727            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
1728            int xacc = 0x00;
1729
1730            /* note that the System 16A sprites have a design flaw that allows the address */
1731            /* to carry into the flip flag, which is the topmost bit -- it is very important */
1732            /* to emulate this as the games compensate for it */
1733
1734            /* non-flipped case */
1735            if (!(addr & 0x8000))
1736            {
1737               /* start at the word before because we preincrement below */
1738               data[7] = addr - 1;
1739               for (x = xpos; x <= cliprect->max_x; )
1740               {
1741                  UINT32 pixels = spritedata[++data[7] & 0x7fff];
1742
1743                  /* draw 8 pixels */
1744                  pix = (pixels >> 28) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1745                  pix = (pixels >> 24) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1746                  pix = (pixels >> 20) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1747                  pix = (pixels >> 16) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1748                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1749                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1750                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1751                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1752
1753                  /* stop if the last pixel in the group was 0xf */
1754                  if (pix == 15)
1755                     break;
1756               }
1757            }
1758
1759            /* flipped case */
1760            else
1761            {
1762               /* start at the word after because we predecrement below */
1763               data[7] = addr + 1;
1764               for (x = xpos; x <= cliprect->max_x; )
1765               {
1766                  UINT32 pixels = spritedata[--data[7] & 0x7fff];
1767
1768                  /* draw 8 pixels */
1769                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1770                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1771                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1772                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1773                  pix = (pixels >> 16) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1774                  pix = (pixels >> 20) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1775                  pix = (pixels >> 24) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1776                  pix = (pixels >> 28) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
1777
1778                  /* stop if the last pixel in the group was 0xf */
1779                  if (pix == 15)
1780                     break;
1781               }
1782            }
1783         }
1784      }
1785   }
1786}
1787
1788
1789
1790/*******************************************************************************************
1791 *
1792 *  System 16A-style sprites
1793 *
1794 *      Offs  Bits               Usage
1795 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
1796 *       +0   -------- tttttttt  Top scanline of sprite - 1
1797 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
1798 *       +4   pppppppp pppppppp  Signed 16-bit pitch value between scanlines
1799 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
1800 *       +6   f------- --------  Horizontal flip: read the data backwards if set
1801 *       +8   --cccccc --------  Sprite color palette
1802 *       +8   -------- -bbb----  Sprite bank
1803 *       +8   -------- ------pp  Sprite priority
1804 *       +E   dddddddd dddddddd  Scratch space for current address
1805 *
1806 *  Special notes:
1807 *
1808 *      There is an interaction between the horizonal flip bit and the offset.
1809 *      The offset is maintained as a 16-bit value, even though only the lower
1810 *      15 bits are used for the address. The top bit is used to control flipping.
1811 *      This means that if the low 15 bits overflow during rendering, the sprite
1812 *      data will be read backwards after the overflow. This is important to
1813 *      emulate correctly as many games make use of this feature to render sprites
1814 *      at the beginning of a bank.
1815 *
1816 *******************************************************************************************/
1817
1818#define system16a_draw_pixel()                                    \
1819   /* only draw if onscreen, not 0 or 15 */                        \
1820   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
1821   {                                                      \
1822      /* are we high enough priority to be visible? */               \
1823      if (sprpri > pri[x])                                    \
1824      {                                                   \
1825         /* shadow/hilight mode? */                              \
1826         if (color == info->colorbase + (0x3f << 4))                  \
1827            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
1828                                                         \
1829         /* regular draw */                                    \
1830         else                                             \
1831            dest[x] = pix | color;                              \
1832      }                                                   \
1833                                                         \
1834      /* always mark priority so no one else draws here */            \
1835      pri[x] = 0xff;                                          \
1836   }                                                      \
1837
1838static void segaic16_sprites_16a_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
1839{
1840   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
1841   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
1842   UINT16 *data;
1843
1844   /* first scan forward to find the end of the list */
1845   for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8)
1846      if ((data[0] >> 8) > 0xf0)
1847         break;
1848
1849   /* now scan backwards and render the sprites in order */
1850   for (data -= 8; data >= info->spriteram; data -= 8)
1851   {
1852      int bottom  = (data[0] >> 8) + 1;
1853      int top     = (data[0] & 0xff) + 1;
1854      int xpos    = (data[1] & 0x1ff) - 0xbd;
1855      int pitch   = (INT16)data[2];
1856      UINT16 addr = data[3];
1857      int color   = info->colorbase + (((data[4] >> 8) & 0x3f) << 4);
1858      int bank    = info->bank[(data[4] >> 4) & 0x7];
1859      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
1860      const UINT16 *spritedata;
1861      int x, y, pix, xdelta = 1;
1862
1863      /* initialize the end address to the start address */
1864      data[7] = addr;
1865
1866      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
1867      if ((top >= bottom) || bank == 255)
1868         continue;
1869
1870      /* clamp to within the memory region size */
1871      if (numbanks)
1872         bank %= numbanks;
1873      spritedata = spritebase + 0x8000 * bank;
1874
1875      /* adjust positions for screen flipping */
1876      if (info->flip)
1877      {
1878         int temp = top;
1879         top = 224 - bottom;
1880         bottom = 224 - temp;
1881         xpos = 320 - xpos;
1882         xdelta = -1;
1883      }
1884
1885      /* loop from top to bottom */
1886      for (y = top; y < bottom; y++)
1887      {
1888         /* advance a row */
1889         addr += pitch;
1890
1891         /* skip drawing if not within the cliprect */
1892         if (y >= cliprect->min_y && y <= cliprect->max_y)
1893         {
1894            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
1895            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
1896
1897            /* note that the System 16A sprites have a design flaw that allows the address */
1898            /* to carry into the flip flag, which is the topmost bit -- it is very important */
1899            /* to emulate this as the games compensate for it */
1900
1901            /* non-flipped case */
1902            if (!(addr & 0x8000))
1903            {
1904               /* start at the word before because we preincrement below */
1905               data[7] = addr - 1;
1906               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
1907               {
1908                  UINT16 pixels = spritedata[++data[7] & 0x7fff];
1909
1910                  /* draw four pixels */
1911                  pix = (pixels >> 12) & 0xf; system16a_draw_pixel(); x += xdelta;
1912                  pix = (pixels >>  8) & 0xf; system16a_draw_pixel(); x += xdelta;
1913                  pix = (pixels >>  4) & 0xf; system16a_draw_pixel(); x += xdelta;
1914                  pix = (pixels >>  0) & 0xf; system16a_draw_pixel(); x += xdelta;
1915
1916                  /* stop if the last pixel in the group was 0xf */
1917                  if (pix == 15)
1918                     break;
1919               }
1920            }
1921
1922            /* flipped case */
1923            else
1924            {
1925               /* start at the word after because we predecrement below */
1926               data[7] = addr + 1;
1927               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
1928               {
1929                  UINT16 pixels = spritedata[--data[7] & 0x7fff];
1930
1931                  /* draw four pixels */
1932                  pix = (pixels >>  0) & 0xf; system16a_draw_pixel(); x += xdelta;
1933                  pix = (pixels >>  4) & 0xf; system16a_draw_pixel(); x += xdelta;
1934                  pix = (pixels >>  8) & 0xf; system16a_draw_pixel(); x += xdelta;
1935                  pix = (pixels >> 12) & 0xf; system16a_draw_pixel(); x += xdelta;
1936
1937                  /* stop if the last pixel in the group was 0xf */
1938                  if (pix == 15)
1939                     break;
1940               }
1941            }
1942         }
1943      }
1944   }
1945}
1946
1947
1948
1949/*******************************************************************************************
1950 *
1951 *  System 16B-style sprites
1952 *
1953 *      Offs  Bits               Usage
1954 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
1955 *       +0   -------- tttttttt  Top scanline of sprite - 1
1956 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
1957 *       +4   e------- --------  Signify end of sprite list
1958 *       +4   -h------ --------  Hide this sprite
1959 *       +4   -------f --------  Horizontal flip: read the data backwards if set
1960 *       +4   -------- pppppppp  Signed 8-bit pitch value between scanlines
1961 *       +6   oooooooo oooooooo  Offset within selected sprite bank
1962 *       +8   ----bbbb --------  Sprite bank
1963 *       +8   -------- pp------  Sprite priority, relative to tilemaps
1964 *       +8   -------- --cccccc  Sprite color palette
1965 *       +A   ------vv vvv-----  Vertical zoom factor (0 = full size, 0x10 = half size)
1966 *       +A   -------- ---hhhhh  Horizontal zoom factor (0 = full size, 0x10 = half size)
1967 *       +E   dddddddd dddddddd  Scratch space for current address
1968 *
1969 *  Note that the zooming described below is 100% accurate to the real board.
1970 *
1971 *******************************************************************************************/
1972
1973#define system16b_draw_pixel()                                    \
1974   /* only draw if onscreen, not 0 or 15 */                        \
1975   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
1976   {                                                      \
1977      /* are we high enough priority to be visible? */               \
1978      if (sprpri > pri[x])                                    \
1979      {                                                   \
1980         /* shadow/hilight mode? */                              \
1981         if (color == info->colorbase + (0x3f << 4))                  \
1982         {                                                \
1983            /* we have to check this for System 18 so that we don't */  \
1984            /* attempt to shadow VDP pixels */                     \
1985            if (dest[x] < palette.entries)                        \
1986               dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries; \
1987         }                                                \
1988                                                         \
1989         /* regular draw */                                    \
1990         else                                             \
1991            dest[x] = pix | color;                              \
1992      }                                                   \
1993                                                         \
1994      /* always mark priority so no one else draws here */            \
1995      pri[x] = 0xff;                                          \
1996   }                                                      \
1997
1998static void segaic16_sprites_16b_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
1999{
2000   UINT8 numbanks;
2001   const UINT16 *spritebase;
2002   UINT16 *data;
2003
2004   spritebase = (const UINT16 *)memory_region(machine, "gfx2");
2005   if (!spritebase)
2006      return;
2007
2008   numbanks = memory_region_length(machine, "gfx2") / 0x20000;
2009
2010   /* first scan forward to find the end of the list */
2011   for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8)
2012      if (data[2] & 0x8000)
2013         break;
2014
2015   /* now scan backwards and render the sprites in order */
2016   for (data -= 8; data >= info->spriteram; data -= 8)
2017   {
2018      int bottom  = data[0] >> 8;
2019      int top     = data[0] & 0xff;
2020      int xpos    = (data[1] & 0x1ff);
2021      int hide    = data[2] & 0x4000;
2022      int flip    = data[2] & 0x100;
2023      int pitch   = (INT8)(data[2] & 0xff);
2024      UINT16 addr = data[3];
2025      int bank    = info->bank[(data[4] >> 8) & 0xf];
2026      int sprpri  = 1 << ((data[4] >> 6) & 0x3);
2027      int color   = info->colorbase + ((data[4] & 0x3f) << 4);
2028      int vzoom   = (data[5] >> 5) & 0x1f;
2029      int hzoom   = data[5] & 0x1f;
2030      const UINT16 *spritedata;
2031      int x, y, pix, xdelta = 1;
2032
2033      /* some bootlegs have offset sprites */
2034      xpos += info->xoffs;
2035      xpos &= 0x1ff;
2036
2037      /* originals all have this offset */
2038      xpos -= 0xb8;
2039
2040      /* initialize the end address to the start address */
2041      data[7] = addr;
2042
2043      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
2044      if (hide || (top >= bottom) || bank == 255)
2045         continue;
2046
2047      /* clamp to within the memory region size */
2048      if (numbanks)
2049         bank %= numbanks;
2050      spritedata = spritebase + 0x10000 * bank;
2051
2052      /* reset the yzoom counter */
2053      data[5] &= 0x03ff;
2054
2055      /* adjust positions for screen flipping */
2056      if (info->flip)
2057      {
2058         int temp = top;
2059         top = 224 - bottom;
2060         bottom = 224 - temp;
2061         xpos = 320 - xpos;
2062         xdelta = -1;
2063      }
2064
2065      /* loop from top to bottom */
2066      for (y = top; y < bottom; y++)
2067      {
2068         /* advance a row */
2069         addr += pitch;
2070
2071         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
2072         data[5] += vzoom << 10;
2073         if (data[5] & 0x8000)
2074         {
2075            addr += pitch;
2076            data[5] &= ~0x8000;
2077         }
2078
2079         /* skip drawing if not within the cliprect */
2080         if (y >= cliprect->min_y && y <= cliprect->max_y)
2081         {
2082            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
2083            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
2084            int xacc;
2085
2086            /* compute the initial X zoom accumulator; this is verified on the real PCB */
2087            xacc = 4 * hzoom;
2088
2089            /* non-flipped case */
2090            if (!flip)
2091            {
2092               /* start at the word before because we preincrement below */
2093               data[7] = addr - 1;
2094               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
2095               {
2096                  UINT16 pixels = spritedata[++data[7]];
2097
2098                  /* draw four pixels */
2099                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2100                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2101                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2102                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2103
2104                  /* stop if the last pixel in the group was 0xf */
2105                  if (pix == 15)
2106                     break;
2107               }
2108            }
2109
2110            /* flipped case */
2111            else
2112            {
2113               /* start at the word after because we predecrement below */
2114               data[7] = addr + 1;
2115               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
2116               {
2117                  UINT16 pixels = spritedata[--data[7]];
2118
2119                  /* draw four pixels */
2120                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2121                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2122                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2123                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
2124
2125                  /* stop if the last pixel in the group was 0xf */
2126                  if (pix == 15)
2127                     break;
2128               }
2129            }
2130         }
2131      }
2132   }
2133}
2134
2135
2136/*******************************************************************************************
2137 *
2138 *  The Y-board variant has different mixing properties. The sprite implementation itself
2139 *  is identical, however.
2140 *
2141 *******************************************************************************************/
2142
2143#define yboard_16b_draw_pixel()                                  \
2144   /* only draw if onscreen, not 0 or 15 */                        \
2145   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
2146   {                                                      \
2147      /* are we high enough priority to be visible? */               \
2148      if ((sprpri & 0x1f) < (pri[x] & 0x1f))                        \
2149      {                                                   \
2150         /* shadow/hilight mode? */                              \
2151         if (pix == 14)                                       \
2152            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
2153                                                         \
2154         /* regular draw */                                    \
2155         else                                             \
2156            dest[x] = pix | color;                              \
2157      }                                                   \
2158                                                         \
2159      /* always mark priority so no one else draws here */            \
2160      pri[x] = 0;                                             \
2161   }                                                      \
2162
2163static void segaic16_sprites_yboard_16b_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2164{
2165   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x20000;
2166   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
2167   UINT16 *data;
2168
2169   /* first scan forward to find the end of the list */
2170   for (data = info->spriteram; data < info->spriteram + info->ramsize/2; data += 8)
2171      if (data[2] & 0x8000)
2172         break;
2173
2174   /* now scan backwards and render the sprites in order */
2175   for (data -= 8; data >= info->spriteram; data -= 8)
2176   {
2177      int bottom  = data[0] >> 8;
2178      int top     = data[0] & 0xff;
2179      int xpos    = (data[1] & 0x1ff) - 0xb8;
2180      int sprpri  = (data[1] >> 8) & 0x1e;   // 0x00 = high, 0x7f = low -- 0x71 = ship in gforce, 0x31 = strike fighter logo
2181      int hide    = data[2] & 0x4000;
2182      int flip    = data[2] & 0x100;
2183      int pitch   = (INT8)(data[2] & 0xff);
2184      UINT16 addr = data[3];
2185      int bank    = info->bank[(data[4] >> 8) & 0xf];
2186      int color   = info->colorbase + ((data[4] & 0x7f) << 4);
2187      int vzoom   = (data[5] >> 5) & 0x1f;
2188      int hzoom   = data[5] & 0x1f;
2189      const UINT16 *spritedata;
2190      int x, y, pix, xdelta = 1;
2191
2192      /* initialize the end address to the start address */
2193      data[7] = addr;
2194
2195      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
2196      if (hide || (top >= bottom) || bank == 255)
2197         continue;
2198
2199      /* clamp to within the memory region size */
2200      if (numbanks)
2201         bank %= numbanks;
2202      spritedata = spritebase + 0x10000 * bank;
2203
2204      /* reset the yzoom counter */
2205      data[5] &= 0x03ff;
2206
2207      /* adjust positions for screen flipping */
2208      if (info->flip)
2209      {
2210         int temp = top;
2211         top = 224 - bottom;
2212         bottom = 224 - temp;
2213         xpos = 320 - xpos;
2214         xdelta = -1;
2215      }
2216
2217      /* loop from top to bottom */
2218      for (y = top; y < bottom; y++)
2219      {
2220         /* advance a row */
2221         addr += pitch;
2222
2223         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
2224         data[5] += vzoom << 10;
2225         if (data[5] & 0x8000)
2226         {
2227            addr += pitch;
2228            data[5] &= ~0x8000;
2229         }
2230
2231         /* skip drawing if not within the cliprect */
2232         if (y >= cliprect->min_y && y <= cliprect->max_y)
2233         {
2234            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
2235            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
2236            int xacc;
2237
2238            /* compute the initial X zoom accumulator; this is verified on the real PCB */
2239            xacc = 4 * hzoom;
2240
2241            /* non-flipped case */
2242            if (!flip)
2243            {
2244               /* start at the word before because we preincrement below */
2245               data[7] = addr - 1;
2246               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
2247               {
2248                  UINT16 pixels = spritedata[++data[7]];
2249
2250                  /* draw four pixels */
2251                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2252                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2253                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2254                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2255
2256                  /* stop if the last pixel in the group was 0xf */
2257                  if (pix == 15)
2258                     break;
2259               }
2260            }
2261
2262            /* flipped case */
2263            else
2264            {
2265               /* start at the word after because we predecrement below */
2266               data[7] = addr + 1;
2267               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
2268               {
2269                  UINT16 pixels = spritedata[--data[7]];
2270
2271                  /* draw four pixels */
2272                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2273                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2274                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2275                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
2276
2277                  /* stop if the last pixel in the group was 0xf */
2278                  if (pix == 15)
2279                     break;
2280               }
2281            }
2282         }
2283      }
2284   }
2285}
2286
2287
2288
2289/*******************************************************************************************
2290 *
2291 *  Out Run/X-Board-style sprites
2292 *
2293 *      Offs  Bits               Usage
2294 *       +0   e------- --------  Signify end of sprite list
2295 *       +0   -h-h---- --------  Hide this sprite if either bit is set
2296 *       +0   ----bbb- --------  Sprite bank
2297 *       +0   -------t tttttttt  Top scanline of sprite + 256
2298 *       +2   oooooooo oooooooo  Offset within selected sprite bank
2299 *       +4   ppppppp- --------  Signed 7-bit pitch value between scanlines
2300 *       +4   -------x xxxxxxxx  X position of sprite (position $BE is screen position 0)
2301 *       +6   -s------ --------  Enable shadows
2302 *       +6   --pp---- --------  Sprite priority, relative to tilemaps
2303 *       +6   ------vv vvvvvvvv  Vertical zoom factor (0x200 = full size, 0x100 = half size, 0x300 = 2x size)
2304 *       +8   y------- --------  Render from top-to-bottom (1) or bottom-to-top (0) on screen
2305 *       +8   -f------ --------  Horizontal flip: read the data backwards if set
2306 *       +8   --x----- --------  Render from left-to-right (1) or right-to-left (0) on screen
2307 *       +8   ------hh hhhhhhhh  Horizontal zoom factor (0x200 = full size, 0x100 = half size, 0x300 = 2x size)
2308 *       +E   dddddddd dddddddd  Scratch space for current address
2309 *
2310 *    Out Run only:
2311 *       +A   hhhhhhhh --------  Height in scanlines - 1
2312 *       +A   -------- -ccccccc  Sprite color palette
2313 *
2314 *    X-Board only:
2315 *       +A   ----hhhh hhhhhhhh  Height in scanlines - 1
2316 *       +C   -------- cccccccc  Sprite color palette
2317 *
2318 *******************************************************************************************/
2319
2320#define outrun_draw_pixel()                                     \
2321   /* only draw if onscreen, not 0 or 15 */                        \
2322   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
2323   {                                                      \
2324      /* are we high enough priority to be visible? */               \
2325      if (sprpri > pri[x])                                    \
2326      {                                                   \
2327         /* shadow/hilight mode? */                              \
2328         if (shadow && pix == 0xa)                              \
2329            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
2330                                                         \
2331         /* regular draw */                                    \
2332         else                                             \
2333            dest[x] = pix | color;                              \
2334      }                                                   \
2335                                                         \
2336      /* always mark priority so no one else draws here */            \
2337      pri[x] = 0xff;                                          \
2338   }                                                      \
2339
2340static void segaic16_sprites_outrun_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2341{
2342   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x40000;
2343   const UINT32 *spritebase = (const UINT32 *)memory_region(machine, "gfx2");
2344   UINT16 *data;
2345
2346   /* first scan forward to find the end of the list */
2347   for (data = info->buffer; data < info->buffer + info->ramsize/2; data += 8)
2348      if (data[0] & 0x8000)
2349         break;
2350
2351   /* now scan backwards and render the sprites in order */
2352   for (data -= 8; data >= info->buffer; data -= 8)
2353   {
2354      int hide    = (data[0] & 0x5000);
2355      int bank    = (data[0] >> 9) & 7;
2356      int top     = (data[0] & 0x1ff) - 0x100;
2357      UINT16 addr = data[1];
2358      int pitch   = (INT16)((data[2] >> 1) | ((data[4] & 0x1000) << 3)) >> 8;
2359      int xpos    = data[2] & 0x1ff;
2360      int shadow  = (data[3] >> 14) & 1;
2361      int sprpri  = 1 << ((data[3] >> 12) & 3);
2362      int vzoom   = data[3] & 0x7ff;
2363      int ydelta  = (data[4] & 0x8000) ? 1 : -1;
2364      int flip    = (~data[4] >> 14) & 1;
2365      int xdelta  = (data[4] & 0x2000) ? 1 : -1;
2366      int hzoom   = data[4] & 0x7ff;
2367      int height  = ((info->type == SEGAIC16_SPRITES_OUTRUN) ? (data[5] >> 8) : (data[5] & 0xfff)) + 1;
2368      int color   = info->colorbase + (((info->type == SEGAIC16_SPRITES_OUTRUN) ? (data[5] & 0x7f) : (data[6] & 0xff)) << 4);
2369      int x, y, ytarget, yacc = 0, pix;
2370      const UINT32 *spritedata;
2371
2372      /* adjust X coordinate */
2373      /* note: the threshhold below is a guess. If it is too high, rachero will draw garbage */
2374      /* If it is too low, smgp won't draw the bottom part of the road */
2375      if (xpos < 0x80 && xdelta < 0)
2376         xpos += 0x200;
2377      xpos -= 0xbe;
2378
2379      /* initialize the end address to the start address */
2380      data[7] = addr;
2381
2382      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
2383      if (hide || height == 0)
2384         continue;
2385
2386      /* clamp to within the memory region size */
2387      if (numbanks)
2388         bank %= numbanks;
2389      spritedata = spritebase + 0x10000 * bank;
2390
2391      /* clamp to a maximum of 8x (not 100% confirmed) */
2392      if (vzoom < 0x40) vzoom = 0x40;
2393      if (hzoom < 0x40) hzoom = 0x40;
2394
2395      /* loop from top to bottom */
2396      ytarget = top + ydelta * height;
2397      for (y = top; y != ytarget; y += ydelta)
2398      {
2399         /* skip drawing if not within the cliprect */
2400         if (y >= cliprect->min_y && y <= cliprect->max_y)
2401         {
2402            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
2403            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
2404            int xacc = 0;
2405
2406            /* non-flipped case */
2407            if (!flip)
2408            {
2409               /* start at the word before because we preincrement below */
2410               data[7] = addr - 1;
2411               for (x = xpos; (xdelta > 0 && x <= cliprect->max_x) || (xdelta < 0 && x >= cliprect->min_x); )
2412               {
2413                  UINT32 pixels = spritedata[++data[7]];
2414
2415                  /* draw four pixels */
2416                  pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2417                  pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2418                  pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2419                  pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2420                  pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2421                  pix = (pixels >>  8) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2422                  pix = (pixels >>  4) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2423                  pix = (pixels >>  0) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2424
2425                  /* stop if the second-to-last pixel in the group was 0xf */
2426                  if ((pixels & 0x000000f0) == 0x000000f0)
2427                     break;
2428               }
2429            }
2430
2431            /* flipped case */
2432            else
2433            {
2434               /* start at the word after because we predecrement below */
2435               data[7] = addr + 1;
2436               for (x = xpos; (xdelta > 0 && x <= cliprect->max_x) || (xdelta < 0 && x >= cliprect->min_x); )
2437               {
2438                  UINT32 pixels = spritedata[--data[7]];
2439
2440                  /* draw four pixels */
2441                  pix = (pixels >>  0) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2442                  pix = (pixels >>  4) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2443                  pix = (pixels >>  8) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2444                  pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2445                  pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2446                  pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2447                  pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2448                  pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
2449
2450                  /* stop if the second-to-last pixel in the group was 0xf */
2451                  if ((pixels & 0x0f000000) == 0x0f000000)
2452                     break;
2453               }
2454            }
2455         }
2456
2457         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
2458         yacc += vzoom;
2459         addr += pitch * (yacc >> 9);
2460         yacc &= 0x1ff;
2461      }
2462   }
2463}
2464
2465
2466
2467/*******************************************************************************************
2468 *
2469 *  Y-Board-style sprites
2470 *
2471 *      Offs  Bits               Usage
2472 *       +0   e------- --------  Signify end of sprite list
2473 *       +0   -----iii iiiiiiii  Address of indirection table (/16)
2474 *       +2   bbbb---- --------  Upper 4 bits of bank index
2475 *       +2   ----xxxx xxxxxxxx  X position of sprite (position $600 is screen position 0)
2476 *       +4   bbbb---- --------  Lower 4 bits of bank index
2477 *       +4   ----yyyy yyyyyyyy  Y position of sprite (position $600 is screen position 0)
2478 *       +6   oooooooo oooooooo  Offset within selected sprite bank
2479 *       +8   hhhhhhhh hhhhhhhh  Height of sprite
2480 *       +A   -y------ --------  Render from top-to-bottom (1) or bottom-to-top (0) on screen
2481 *       +A   --f----- --------  Horizontal flip: read the data backwards if set
2482 *       +A   ---x---- --------  Render from left-to-right (1) or right-to-left (0) on screen
2483 *       +A   -----zzz zzzzzzzz  Zoom factor
2484 *       +C   -ccc---- --------  Sprite color
2485 *       +C   ----rrrr --------  Sprite priority
2486 *       +C   -------- pppppppp  Signed 8-bit pitch value between scanlines
2487 *       +E   ----nnnn nnnnnnnn  Index of next sprite
2488 *
2489 *  In addition to these parameters, the sprite area is clipped using scanline extents
2490 *  stored for every pair of scanlines in the rotation RAM. It's a bit of a cheat for us
2491 *  to poke our nose into the rotation structure, but there are no known cases of Y-board
2492 *  sprites without rotation RAM.
2493 *
2494 *******************************************************************************************/
2495
2496#define yboard_draw_pixel()                                     \
2497   /* only draw if onscreen */                                    \
2498   if (x >= minx && x <= maxx && ind < 0x1fe)                        \
2499      dest[x] = ind | colorpri;                                 \
2500
2501static void segaic16_sprites_yboard_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2502{
2503   UINT8 numbanks = memory_region_length(machine, "gfx1") / 0x80000;
2504   const UINT64 *spritebase = (const UINT64 *)memory_region(machine, "gfx1");
2505   const UINT16 *rotatebase = rotate[0].buffer ? rotate[0].buffer : rotate[0].rotateram;
2506   UINT8 visited[0x1000];
2507   UINT16 *data;
2508   int next = 0;
2509   int y;
2510
2511   /* reset the visited list */
2512   memset(visited, 0, sizeof(visited));
2513
2514   /* clear out any scanlines we might be using */
2515   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
2516      if (!(rotatebase[y & ~1] & 0xc000))
2517         memset(BITMAP_ADDR16(bitmap, y, cliprect->min_x), 0xff, (cliprect->max_x - cliprect->min_x + 1) * sizeof(UINT16));
2518
2519   /* now scan backwards and render the sprites in order */
2520   for (data = info->spriteram; !(data[0] & 0x8000) && !visited[next]; data = info->spriteram + next * 8)
2521   {
2522      int hide    = (data[0] & 0x5000);
2523      UINT16 *indirect = info->spriteram + ((data[0] & 0x7ff) << 4);
2524      int bank    = ((data[1] >> 8) & 0x10) | ((data[2] >> 12) & 0x0f);
2525      int xpos    = (data[1] & 0xfff) - 0x600;
2526      int top     = (data[2] & 0xfff) - 0x600;
2527      UINT16 addr = data[3];
2528      int height  = data[4];
2529      int ydelta  = (data[5] & 0x4000) ? 1 : -1;
2530      int flip    = (~data[5] >> 13) & 1;
2531      int xdelta  = (data[5] & 0x1000) ? 1 : -1;
2532      int zoom    = data[5] & 0x7ff;
2533      int colorpri= (data[6] << 1) & 0xfe00;
2534      int pitch   = (INT8)data[6];
2535      int x, y, ytarget, yacc = 0, pix, ind;
2536      const UINT64 *spritedata;
2537      UINT16 offs;
2538
2539      /* note that we've visited this entry and get the offset of the next one */
2540      visited[next] = 1;
2541      next = data[7] & 0xfff;
2542
2543      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
2544      if (hide || height == 0)
2545         continue;
2546
2547      /* clamp to within the memory region size */
2548      if (numbanks)
2549         bank %= numbanks;
2550      spritedata = spritebase + 0x10000 * bank;
2551
2552      /* clamp to a maximum of 8x (not 100% confirmed) */
2553      if (zoom == 0) zoom = 1;
2554
2555      /* loop from top to bottom */
2556      ytarget = top + ydelta * height;
2557      for (y = top; y != ytarget; y += ydelta)
2558      {
2559         /* skip drawing if not within the cliprect */
2560         if (y >= cliprect->min_y && y <= cliprect->max_y)
2561         {
2562            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
2563            int minx = rotatebase[y & ~1];
2564            int maxx = rotatebase[y |  1];
2565            int xacc = 0;
2566
2567            /* bit 0x8000 from rotate RAM means that Y is above the top of the screen */
2568            if ((minx & 0x8000) && ydelta < 0)
2569               break;
2570
2571            /* bit 0x4000 from rotate RAM means that Y is below the bottom of the screen */
2572            if ((minx & 0x4000) && ydelta > 0)
2573               break;
2574
2575            /* if either bit is set, skip the rest for this scanline */
2576            if (!(minx & 0xc000))
2577            {
2578               /* clamp min/max to the cliprect */
2579               minx -= 0x600;
2580               maxx -= 0x600;
2581               if (minx < cliprect->min_x)
2582                  minx = cliprect->min_x;
2583               if (maxx > cliprect->max_x)
2584                  maxx = cliprect->max_x;
2585
2586               /* non-flipped case */
2587               if (!flip)
2588               {
2589                  /* start at the word before because we preincrement below */
2590                  offs = addr - 1;
2591                  for (x = xpos; (xdelta > 0 && x <= maxx) || (xdelta < 0 && x >= minx); )
2592                  {
2593                     UINT64 pixels = spritedata[++offs];
2594
2595                     /* draw four pixels */
2596                     pix = (pixels >> 60) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2597                     pix = (pixels >> 56) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2598                     pix = (pixels >> 52) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2599                     pix = (pixels >> 48) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2600                     pix = (pixels >> 44) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2601                     pix = (pixels >> 40) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2602                     pix = (pixels >> 36) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2603                     pix = (pixels >> 32) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2604                     pix = (pixels >> 28) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2605                     pix = (pixels >> 24) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2606                     pix = (pixels >> 20) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2607                     pix = (pixels >> 16) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2608                     pix = (pixels >> 12) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2609                     pix = (pixels >>  8) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2610                     pix = (pixels >>  4) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2611                     pix = (pixels >>  0) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2612
2613                     /* stop if the second-to-last pixel in the group was 0xf */
2614                     if (pix == 0x0f)
2615                        break;
2616                  }
2617               }
2618
2619               /* flipped case */
2620               else
2621               {
2622                  /* start at the word after because we predecrement below */
2623                  offs = addr + 1;
2624                  for (x = xpos; (xdelta > 0 && x <= maxx) || (xdelta < 0 && x >= minx); )
2625                  {
2626                     UINT64 pixels = spritedata[--offs];
2627
2628                     /* draw four pixels */
2629                     pix = (pixels >>  0) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2630                     pix = (pixels >>  4) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2631                     pix = (pixels >>  8) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2632                     pix = (pixels >> 12) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2633                     pix = (pixels >> 16) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2634                     pix = (pixels >> 20) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2635                     pix = (pixels >> 24) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2636                     pix = (pixels >> 28) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2637                     pix = (pixels >> 32) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2638                     pix = (pixels >> 36) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2639                     pix = (pixels >> 40) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2640                     pix = (pixels >> 44) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2641                     pix = (pixels >> 48) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2642                     pix = (pixels >> 52) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2643                     pix = (pixels >> 56) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2644                     pix = (pixels >> 60) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
2645
2646                     /* stop if the second-to-last pixel in the group was 0xf */
2647                     if (pix == 0x0f)
2648                        break;
2649                  }
2650               }
2651            }
2652         }
2653
2654         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
2655         yacc += zoom;
2656         addr += pitch * (yacc >> 9);
2657         yacc &= 0x1ff;
2658      }
2659   }
2660}
2661
2662/* bootlegs */
2663
2664/*
2665
2666 the system16a bootleg sprite hardware differs in subtle ways on a per game basis
2667 with each game having the words swapped around.
2668
2669 there are also some subtle, but important changes when compared to the original
2670 system16a sprites, mainly the increment of the address not happening until
2671 the end of the loop
2672
2673*/
2674
2675/* ignores the sprite priority until we understand priority better on the bootlegs */
2676#define system16a_bootleg_draw_pixel()                                    \
2677   /* only draw if onscreen, not 0 or 15 */                        \
2678   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
2679   {                                                      \
2680      /* are we high enough priority to be visible? */               \
2681      if (sprpri || 1)                                    \
2682      {                                                   \
2683         /* shadow/hilight mode? */                              \
2684         if (color == info->colorbase + (0x3f << 4))                  \
2685            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
2686                                                         \
2687         /* regular draw */                                    \
2688         else                                             \
2689            dest[x] = pix | color;                              \
2690      }                                                   \
2691                                                         \
2692      /* always mark priority so no one else draws here */            \
2693      pri[x] = 0xff;                                          \
2694   }                                                      \
2695
2696
2697/* make this an actual function */
2698#define system16a_bootleg_draw_core()                                       \
2699   {                                                               \
2700      const UINT16 *spritedata;                                          \
2701      int x, y, pix, xdelta = 1;                                          \
2702                                                                  \
2703      xpos += info->xoffs;                                             \
2704      xpos &= 0x1ff;                                                   \
2705                                                                  \
2706      xpos -= 0xbd;                                                   \
2707                                                                  \
2708      /* initialize the end address to the start address */                     \
2709      data[7] = addr;                                                \
2710                                                                  \
2711      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */      \
2712      if ((top >= bottom) || bank == 255)                                    \
2713         continue;                                                   \
2714                                                                  \
2715      /* clamp to within the memory region size */                           \
2716      if (numbanks)                                                   \
2717         bank %= numbanks;                                             \
2718      spritedata = spritebase + 0x8000 * bank;                              \
2719                                                                  \
2720      /* adjust positions for screen flipping */                              \
2721      if (info->flip)                                                   \
2722      {                                                            \
2723         int temp = top;                                                \
2724         top = 224 - bottom;                                             \
2725         bottom = 224 - temp;                                          \
2726         xpos = 320 - xpos;                                             \
2727         xdelta = -1;                                                \
2728      }                                                            \
2729                                                                  \
2730      /* loop from top to bottom */                                       \
2731      for (y = top; y < bottom; y++)                                       \
2732      {                                                            \
2733                                                                  \
2734         /* skip drawing if not within the cliprect */                        \
2735         if (y >= cliprect->min_y && y <= cliprect->max_y)                     \
2736         {                                                         \
2737            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);                        \
2738            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);                  \
2739                                                                  \
2740            /* note that the System 16A sprites have a design flaw that allows the address */      \
2741            /* to carry into the flip flag, which is the topmost bit -- it is very important */      \
2742            /* to emulate this as the games compensate for it */                           \
2743                                                                              \
2744            /* non-flipped case */                                                   \
2745            if (!(addr & 0x8000))                                                   \
2746            {                                                                  \
2747               /* start at the word before because we preincrement below */                  \
2748               data[7] = addr - 1;                                                \
2749               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )                                 \
2750               {                                                               \
2751                  UINT16 pixels = spritedata[++data[7] & 0x7fff];                           \
2752                                                                              \
2753                  /* draw four pixels */                                             \
2754                  pix = (pixels >> 12) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2755                  pix = (pixels >>  8) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2756                  pix = (pixels >>  4) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2757                  pix = (pixels >>  0) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2758                                                                              \
2759                  /* stop if the last pixel in the group was 0xf */                        \
2760                  if (pix == 15)                                                   \
2761                     break;                                                      \
2762               }                                                               \
2763            }                                                                  \
2764                                                                              \
2765            /* flipped case */                                                      \
2766            else                                                               \
2767            {                                                                  \
2768               /* start at the word after because we predecrement below */                     \
2769               data[7] = addr + 1;                                                   \
2770               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )                                 \
2771               {                                                               \
2772                  UINT16 pixels = spritedata[--data[7] & 0x7fff];                           \
2773                                                                              \
2774                  /* draw four pixels */                                             \
2775                  pix = (pixels >>  0) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2776                  pix = (pixels >>  4) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2777                  pix = (pixels >>  8) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2778                  pix = (pixels >> 12) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
2779                                                                              \
2780                  /* stop if the last pixel in the group was 0xf */                        \
2781                  if (pix == 15)                                                   \
2782                     break;                                                      \
2783               }                                                               \
2784            }                                                                  \
2785         }                                                                     \
2786                                                                              \
2787         /* advance a row - must be done at the end on the bootlegs! */                        \
2788         addr += pitch;                                                            \
2789      }                                                                        \
2790   }                                                                           \
2791
2792
2793
2794static void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2795{
2796   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
2797   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
2798   UINT16 *data;
2799
2800   for (data = info->spriteram; data < info->spriteram+ info->ramsize/2; data += 8)
2801   {
2802      int bottom  = (data[4] >> 8);
2803      int top     = (data[4] & 0xff);
2804      int xpos    = (data[0]);
2805      int pitch   = (INT16)data[5];
2806      UINT16 addr = data[1];
2807      int color   = info->colorbase + (((data[6] >> 8) & 0x3f) << 4);
2808      int bank    = info->bank[(data[6] >> 4) & 0x7];
2809      int sprpri  = 1 << ((data[6] >> 0) & 0x3);
2810
2811      system16a_bootleg_draw_core();
2812   }
2813}
2814
2815/* 4 player passing shot is different to this.. */
2816static void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2817{
2818UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
2819   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
2820   UINT16 *data;
2821
2822   for (data = info->spriteram; data < info->spriteram+ info->ramsize/2; data += 8)
2823   {
2824      int bottom  = (data[1] >> 8)-1;
2825      int top     = (data[1] & 0xff)-1;
2826      int xpos    = (data[0]);
2827      int pitch   = (INT16)data[3];
2828      UINT16 addr = data[2];
2829      int color   = info->colorbase + (((data[5] >> 8) & 0x3f) << 4);
2830      int bank    = info->bank[(data[5] >> 4) & 0x7];
2831      int sprpri  = 1 << ((data[5] >> 0) & 0x3);
2832
2833      system16a_bootleg_draw_core();
2834   }
2835}
2836
2837static void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine *machine, struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
2838{
2839   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
2840   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
2841   UINT16 *data;
2842
2843   for (data = info->spriteram; data < info->spriteram+ info->ramsize/2; data += 8)
2844   {
2845      int bottom  = (data[0] >> 8)-1;
2846      int top     = (data[0] & 0xff)-1;
2847      int xpos    = (data[1]);
2848      int pitch   = (INT16)data[2];
2849      UINT16 addr = data[3];
2850      int color   = info->colorbase + (((data[4] >> 8) & 0x3f) << 4);
2851      int bank    = info->bank[(data[4] >> 4) & 0x7];
2852      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
2853
2854      system16a_bootleg_draw_core();
2855   }
2856}
2857
2858/*************************************
2859 *
2860 *  General sprite initialization
2861 *
2862 *************************************/
2863
2864void segaic16_sprites_init(running_machine *machine, int which, int type, int colorbase, int xoffs)
2865{
2866   struct sprite_info *info = &sprites[which];
2867   int i, buffer = 0;
2868
2869   /* reset the sprite info */
2870   memset(info, 0, sizeof(*info));
2871   info->index = which;
2872   info->type = type;
2873   for (i = 0; i < 16; i++)
2874      info->bank[i] = i;
2875   info->colorbase = colorbase;
2876
2877   /* some bootlegs have offset sprites */
2878   info->xoffs = xoffs;
2879
2880   /* set up based on which sprite system */
2881   switch (which)
2882   {
2883      case 0:
2884         info->spriteram = segaic16_spriteram_0;
2885         break;
2886
2887      case 1:
2888         info->spriteram = segaic16_spriteram_1;
2889         break;
2890
2891      default:
2892         fatalerror("Invalid sprite index specified in segaic16_sprites_init");
2893   }
2894
2895   /* determine the parameters of the sprites */
2896   switch (type)
2897   {
2898      case SEGAIC16_SPRITES_HANGON:
2899         info->draw = segaic16_sprites_hangon_draw;
2900         info->ramsize = 0x800;
2901         break;
2902
2903      case SEGAIC16_SPRITES_16A:
2904         info->draw = segaic16_sprites_16a_draw;
2905         info->ramsize = 0x800;
2906         break;
2907
2908      case SEGAIC16_SPRITES_16B:
2909         info->draw = segaic16_sprites_16b_draw;
2910         info->ramsize = 0x800;
2911         break;
2912
2913      case SEGAIC16_SPRITES_SHARRIER:
2914         info->draw = segaic16_sprites_sharrier_draw;
2915         info->ramsize = 0x1000;
2916         break;
2917
2918      case SEGAIC16_SPRITES_OUTRUN:
2919      case SEGAIC16_SPRITES_XBOARD:
2920         info->draw = segaic16_sprites_outrun_draw;
2921         info->ramsize = 0x1000;
2922         buffer = 1;
2923         break;
2924
2925      case SEGAIC16_SPRITES_YBOARD:
2926         info->draw = segaic16_sprites_yboard_draw;
2927         info->ramsize = 0x10000;
2928         break;
2929
2930      case SEGAIC16_SPRITES_YBOARD_16B:
2931         info->draw = segaic16_sprites_yboard_16b_draw;
2932         info->ramsize = 0x800;
2933         break;
2934
2935      case SEGAIC16_SPRITES_16A_BOOTLEG_WB3BL:
2936         info->draw = segaic16_sprites_16a_bootleg_wb3bl_draw;
2937         info->ramsize = 0x800;
2938         break;
2939
2940      case SEGAIC16_SPRITES_16A_BOOTLEG_PASSHTBL:
2941         info->draw = segaic16_sprites_16a_bootleg_passhtb_draw;
2942         info->ramsize = 0x800;
2943         break;
2944
2945      case SEGAIC16_SPRITES_16A_BOOTLEG_SHINOBLD:
2946         info->draw = segaic16_sprites_16a_bootleg_shinobld_draw;
2947         info->ramsize = 0x800;
2948         break;
2949
2950      default:
2951         fatalerror("Invalid sprite system specified in segaic16_sprites_init");
2952   }
2953
2954   /* if the sprites need buffering, allocate memory for the buffer */
2955   if (buffer)
2956      info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2);
2957
2958   state_save_register_item(machine, "segaic16_sp", NULL, which, info->flip);
2959   state_save_register_item(machine, "segaic16_sp", NULL, which, info->shadow);
2960   state_save_register_item_array(machine, "segaic16_sp", NULL, which, info->bank);
2961   state_save_register_item(machine, "segaic16_sp", NULL, which, info->colorbase);
2962   state_save_register_item(machine, "segaic16_sp", NULL, which, info->xoffs);
2963
2964   if (buffer)
2965      state_save_register_item_pointer(machine, "segaic16_sp", NULL, which, ((UINT8 *) info->buffer), info->ramsize);
2966}
2967
2968
2969
2970/*************************************
2971 *
2972 *  General sprite drawing
2973 *
2974 *************************************/
2975
2976void segaic16_sprites_draw(running_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int which)
2977{
2978   struct sprite_info *info = &sprites[which];
2979   (*info->draw)(screen->machine, info, bitmap, cliprect);
2980}
2981
2982
2983
2984/*************************************
2985 *
2986 *  General sprite banking
2987 *
2988 *************************************/
2989
2990void segaic16_sprites_set_bank(running_machine *machine, int which, int banknum, int offset)
2991{
2992   struct sprite_info *info = &sprites[which];
2993
2994   if (info->bank[banknum] != offset)
2995   {
2996      running_device *screen = machine->primary_screen;
2997      video_screen_update_partial(screen, video_screen_get_vpos(screen));
2998      info->bank[banknum] = offset;
2999   }
3000}
3001
3002
3003
3004/*************************************
3005 *
3006 *  General sprite screen flipping
3007 *
3008 *************************************/
3009
3010void segaic16_sprites_set_flip(running_machine *machine, int which, int flip)
3011{
3012   struct sprite_info *info = &sprites[which];
3013
3014   flip = (flip != 0);
3015   if (info->flip != flip)
3016   {
3017      running_device *screen = machine->primary_screen;
3018      video_screen_update_partial(screen, video_screen_get_vpos(screen));
3019      info->flip = flip;
3020   }
3021}
3022
3023
3024
3025/*************************************
3026 *
3027 *  General sprite shadows
3028 *
3029 *************************************/
3030
3031void segaic16_sprites_set_shadow(running_machine *machine, int which, int shadow)
3032{
3033   struct sprite_info *info = &sprites[which];
3034
3035   shadow = (shadow != 0);
3036   if (info->shadow != shadow)
3037   {
3038      running_device *screen = machine->primary_screen;
3039      video_screen_update_partial(screen, video_screen_get_vpos(screen));
3040      info->shadow = shadow;
3041   }
3042}
3043
3044
3045
3046/*************************************
3047 *
3048 *  General sprite buffer control
3049 *
3050 *************************************/
3051
3052static void segaic16_sprites_buffer(struct sprite_info *info)
3053{
3054   if (info->buffer)
3055   {
3056      UINT32 *src = (UINT32 *)info->spriteram;
3057      UINT32 *dst = (UINT32 *)info->buffer;
3058      int i;
3059
3060      /* swap the halves of the sprite RAM */
3061      for (i = 0; i < info->ramsize/4; i++)
3062      {
3063         UINT32 temp = *src;
3064         *src++ = *dst;
3065         *dst++ = temp;
3066      }
3067
3068      /* hack for thunderblade */
3069      *info->spriteram = 0xffff;
3070   }
3071
3072   /* we will render the sprites when the video update happens */
3073}
3074
3075
3076WRITE16_HANDLER( segaic16_sprites_draw_0_w )
3077{
3078   segaic16_sprites_buffer(&sprites[0]);
3079}
3080
3081
3082WRITE16_HANDLER( segaic16_sprites_draw_1_w )
3083{
3084   segaic16_sprites_buffer(&sprites[1]);
3085}
3086
3087
3088
3089/*******************************************************************************************
3090 *
30911369 *  Hang On/Space Harrier-style road chip
30921370 *
30931371 *  Road RAM:
src/mame/video/segaic16.h
r7972r7973
44
55***************************************************************************/
66
7#include "devcb.h"
8
79/* globals */
810extern UINT8 segaic16_display_enable;
911extern UINT16 *segaic16_tileram_0;
r7972r7973
4749/* sprite systems */
4850#define SEGAIC16_MAX_SPRITES      2
4951
50#define SEGAIC16_SPRITES_HANGON      0
51#define SEGAIC16_SPRITES_16A      1
52#define SEGAIC16_SPRITES_16B      2
53#define SEGAIC16_SPRITES_SHARRIER   3
5452#define SEGAIC16_SPRITES_OUTRUN      4
5553#define SEGAIC16_SPRITES_XBOARD      5
56#define SEGAIC16_SPRITES_YBOARD      6
57#define SEGAIC16_SPRITES_YBOARD_16B   7
58#define SEGAIC16_SPRITES_16A_BOOTLEG_WB3BL 8
59#define SEGAIC16_SPRITES_16A_BOOTLEG_PASSHTBL 9
60#define SEGAIC16_SPRITES_16A_BOOTLEG_SHINOBLD 10
6154
62void segaic16_sprites_init(running_machine *machine, int which, int type, int colorbase, int xoffs);
6355void segaic16_sprites_draw(running_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int which);
6456void segaic16_sprites_set_bank(running_machine *machine, int which, int banknum, int offset);
6557void segaic16_sprites_set_flip(running_machine *machine, int which, int flip);
r7972r7973
9183void segaic16_rotate_init(running_machine *machine, int which, int type, int colorbase);
9284void segaic16_rotate_draw(running_machine *machine, int which, bitmap_t *bitmap, const rectangle *cliprect, bitmap_t *srcbitmap);
9385READ16_HANDLER( segaic16_rotate_control_0_r );
86
87/*************************************
88 *
89 *  Type definitions
90 *
91 *************************************/
92
93
94
95struct tilemap_callback_info
96{
97   UINT16 *      rambase;                  /* base of RAM for this tilemap page */
98   const UINT8 *   bank;                     /* pointer to bank array */
99   UINT16         banksize;                  /* size of banks */
100};
101
102
103struct tilemap_info
104{
105   UINT8         index;                     /* index of this structure */
106   UINT8         type;                     /* type of tilemap (see segaic16.h for details) */
107   UINT8         numpages;                  /* number of allocated pages */
108   UINT8         flip;                     /* screen flip? */
109   UINT8         rowscroll, colscroll;         /* are rowscroll/colscroll enabled (if external enables are used) */
110   UINT8         bank[8];                  /* indexes of the tile banks */
111   UINT16         banksize;                  /* number of tiles per bank */
112   UINT16         latched_xscroll[4];            /* latched X scroll values */
113   UINT16         latched_yscroll[4];            /* latched Y scroll values */
114   UINT16         latched_pageselect[4];         /* latched page select values */
115   INT32         xoffs;                     /* X scroll offset */
116   tilemap_t *      tilemaps[16];               /* up to 16 tilemap pages */
117   tilemap_t *      textmap;                  /* a single text tilemap */
118   struct tilemap_callback_info tmap_info[16];      /* callback info for 16 tilemap pages */
119   struct tilemap_callback_info textmap_info;      /* callback info for a single textmap page */
120   void         (*reset)(running_machine *machine, struct tilemap_info *info);/* reset callback */
121   void         (*draw_layer)(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority);
122   UINT16 *      textram;                  /* pointer to textram pointer */
123   UINT16 *      tileram;                  /* pointer to tileram pointer */
124};
125
126struct road_info
127{
128   UINT8         index;                     /* index of this structure */
129   UINT8         type;                     /* type of road system (see segaic16.h for details) */
130   UINT8         control;                  /* control register value */
131   UINT16         colorbase1;                  /* color base for road ROM data */
132   UINT16         colorbase2;                  /* color base for road background data */
133   UINT16         colorbase3;                  /* color base for sky data */
134   INT32         xoffs;                     /* X scroll offset */
135   void         (*draw)(struct road_info *info, bitmap_t *bitmap, const rectangle *cliprect, int priority);
136   UINT16 *      roadram;                  /* pointer to roadram pointer */
137   UINT16 *      buffer;                     /* buffered roadram pointer */
138   UINT8 *         gfx;                     /* expanded road graphics */
139};
140
141struct palette_info
142{
143   INT32         entries;                  /* number of entries (not counting shadows) */
144   UINT8         normal[32];                  /* RGB translations for normal pixels */
145   UINT8         shadow[32];                  /* RGB translations for shadowed pixels */
146   UINT8         hilight[32];               /* RGB translations for hilighted pixels */
147};
148
149struct rotate_info
150{
151   UINT8         index;                     /* index of this structure */
152   UINT8         type;                     /* type of rotate system (see segaic16.h for details) */
153   UINT16         colorbase;                  /* base color index */
154   INT32         ramsize;                  /* size of rotate RAM */
155   UINT16 *      rotateram;                  /* pointer to rotateram pointer */
156   UINT16 *      buffer;                     /* buffered data */
157};
158
159/* interface */
160typedef struct _sega16sp_interface sega16sp_interface;
161struct _sega16sp_interface
162{
163   UINT8         which;                     /* which sprite RAM */
164   UINT16         colorbase;                  /* base color index */
165   INT32         ramsize;                  /* size of sprite RAM */
166   INT32         xoffs;                     /* X scroll offset */
167   void         (*draw)(running_machine *machine, running_device* device, bitmap_t *bitmap, const rectangle *cliprect);
168   int            buffer;                     /* should ram be buffered? */
169};
170
171
172
173
174/* state */
175typedef struct _sega16sp_state sega16sp_state;
176struct _sega16sp_state
177{
178   UINT8         which;                     /* which sprite RAM */
179   UINT8         flip;                     /* screen flip? */
180   UINT8         shadow;                     /* shadow or hilight? */
181   UINT8         bank[16];                  /* banking redirection */
182   UINT16         colorbase;                  /* base color index */
183   INT32         ramsize;                  /* size of sprite RAM */
184   INT32         xoffs;                     /* X scroll offset */
185   void         (*draw)(running_machine *machine, running_device* device, bitmap_t *bitmap, const rectangle *cliprect);
186   UINT16 *      spriteram;                  /* pointer to spriteram pointer */
187   UINT16 *      buffer;                     /* buffered spriteram for those that use it */
188
189};
190
191/***************************************************************************
192    FUNCTION PROTOTYPES
193***************************************************************************/
194
195DEVICE_GET_INFO( sega16sp );
196
197#define SEGA16SP DEVICE_GET_INFO_NAME( sega16sp )
198
199void segaic16_sprites_hangon_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
200void segaic16_sprites_sharrier_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
201void segaic16_sprites_16a_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
202void segaic16_sprites_16b_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
203void segaic16_sprites_yboard_16b_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
204void segaic16_sprites_yboard_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
205void segaic16_sprites_outrun_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
206void segaic16_sprites_xboard_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
207void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
208void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
209void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
210
211/* the various sprite configs */
212static const sega16sp_interface hangon_sega16sp_intf =
213{
214   0,      // which spriteram
215   1024,  // colorbase
216   0x800, // ramsize
217   0,     // xoffs
218   segaic16_sprites_hangon_draw, // draw function
219   0, // use buffer
220};
221
222static const sega16sp_interface sharrier_sega16sp_intf =
223{
224   0,      // which spriteram
225   1024,  // colorbase
226   0x1000, // ramsize
227   0,     // xoffs
228   segaic16_sprites_sharrier_draw, // draw function
229   0, // use buffer
230};
231
232static const sega16sp_interface yboard_16b_sega16sp_intf =
233{
234   0,      // which spriteram
235   2048,  // colorbase
236   0x800, // ramsize
237   0,     // xoffs
238   segaic16_sprites_yboard_16b_draw, // draw function
239   0, // use buffer
240};
241
242static const sega16sp_interface yboard_sega16sp_intf =
243{
244   1,      // which spriteram
245   4096,  // colorbase
246   0x10000, // ramsize
247   0,     // xoffs
248   segaic16_sprites_yboard_draw, // draw function
249   0, // use buffer
250};
251
252static const sega16sp_interface s16a_sega16sp_intf =
253{
254   0,      // which spriteram
255   1024,  // colorbase
256   0x800, // ramsize
257   0,     // xoffs
258   segaic16_sprites_16a_draw, // draw function
259   0, // use buffer
260};
261
262static const sega16sp_interface s16b_sega16sp_intf =
263{
264   0,      // which spriteram
265   1024,  // colorbase
266   0x800, // ramsize
267   0,     // xoffs
268   segaic16_sprites_16b_draw, // draw function
269   0, // use buffer
270};
271
272static const sega16sp_interface outrun_sega16sp_intf =
273{
274   0,      // which spriteram
275   2048,  // colorbase
276   0x1000, // ramsize
277   0,     // xoffs
278   segaic16_sprites_outrun_draw, // draw function
279   1, // use buffer
280};
281
282
283static const sega16sp_interface xboard_sega16sp_intf =
284{
285   0,      // which spriteram
286   0,  // colorbase
287   0x1000, // ramsize
288   0,     // xoffs
289   segaic16_sprites_xboard_draw, // draw function
290   1, // use buffer
291};
292
293static const sega16sp_interface shinobld_sega16sp_intf =
294{
295   0,      // which spriteram
296   1024,  // colorbase
297   0x800, // ramsize
298   117,     // xoffs
299   segaic16_sprites_16a_bootleg_shinobld_draw, // draw function
300   0, // use buffer
301};
302
303static const sega16sp_interface passshtb_sega16sp_intf =
304{
305   0,      // which spriteram
306   1024,  // colorbase
307   0x800, // ramsize
308   117,     // xoffs
309   segaic16_sprites_16a_bootleg_passhtb_draw, // draw function
310   0, // use buffer
311};
312
313static const sega16sp_interface wb3bbl_sega16sp_intf =
314{
315   0,      // which spriteram
316   1024,  // colorbase
317   0x800, // ramsize
318   117,     // xoffs
319   segaic16_sprites_16a_bootleg_wb3bl_draw, // draw function
320   0, // use buffer
321};
322
323
324
325
326
327#define MDRV_SEGA16SP_ADD(_tag, _interface) \
328   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
329   MDRV_DEVICE_CONFIG(_interface)
330
331#define MDRV_SEGA16SP_ADD_HANGON(_tag) \
332   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
333   MDRV_DEVICE_CONFIG(hangon_sega16sp_intf)
334
335#define MDRV_SEGA16SP_ADD_SHARRIER(_tag) \
336   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
337   MDRV_DEVICE_CONFIG(sharrier_sega16sp_intf)
338
339#define MDRV_SEGA16SP_ADD_YBOARD(_tag) \
340   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
341   MDRV_DEVICE_CONFIG(yboard_sega16sp_intf)
342
343#define MDRV_SEGA16SP_ADD_YBOARD_16B(_tag) \
344   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
345   MDRV_DEVICE_CONFIG(yboard_16b_sega16sp_intf)
346
347#define MDRV_SEGA16SP_ADD_16A(_tag) \
348   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
349   MDRV_DEVICE_CONFIG(s16a_sega16sp_intf)
350
351#define MDRV_SEGA16SP_ADD_16B(_tag) \
352   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
353   MDRV_DEVICE_CONFIG(s16b_sega16sp_intf)
354
355#define MDRV_SEGA16SP_ADD_OUTRUN(_tag) \
356   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
357   MDRV_DEVICE_CONFIG(outrun_sega16sp_intf)
358
359#define MDRV_SEGA16SP_ADD_XBOARD(_tag) \
360   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
361   MDRV_DEVICE_CONFIG(xboard_sega16sp_intf)
362
363#define MDRV_SEGA16SP_ADD_SHINOBI_BOOTLEG(_tag) \
364   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
365   MDRV_DEVICE_CONFIG(shinobld_sega16sp_intf)
366
367#define MDRV_SEGA16SP_ADD_PASSINGSHOT_BOOTLEG(_tag) \
368   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
369   MDRV_DEVICE_CONFIG(passshtb_sega16sp_intf)
370
371#define MDRV_SEGA16SP_ADD_WONDERBOY3_BOOTLEG(_tag) \
372   MDRV_DEVICE_ADD(_tag, SEGA16SP, 0) \
373   MDRV_DEVICE_CONFIG(wb3bbl_sega16sp_intf)
374
375
376extern struct palette_info palette;
377extern struct rotate_info rotate[SEGAIC16_MAX_ROTATE];
378extern struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS];
379extern struct road_info road[SEGAIC16_MAX_ROADS];
src/mame/video/model3.c
r7972r7973
380380
381381VIDEO_UPDATE( model3 )
382382{
383   int layer_scroll_x[4], layer_scroll_y[4];
384   UINT32 layer_data[4];
383/*
384    int layer_scroll_x[4], layer_scroll_y[4];
385    UINT32 layer_data[4];
385386
386   layer_data[0] = BYTE_REVERSE32((UINT32)(layer_scroll[0] >> 32));
387   layer_data[1] = BYTE_REVERSE32((UINT32)(layer_scroll[0] >> 0));
388   layer_data[2] = BYTE_REVERSE32((UINT32)(layer_scroll[1] >> 32));
389   layer_data[3] = BYTE_REVERSE32((UINT32)(layer_scroll[1] >> 0));
390   layer_scroll_x[0] = (layer_data[0] & 0x8000) ? (layer_data[0] & 0x1ff) : -(layer_data[0] & 0x1ff);
391   layer_scroll_y[0] = (layer_data[0] & 0x8000) ? (layer_data[0] & 0x1ff) : -(layer_data[0] & 0x1ff);
392   layer_scroll_x[1] = (layer_data[1] & 0x8000) ? (layer_data[1] & 0x1ff) : -(layer_data[1] & 0x1ff);
393   layer_scroll_y[1] = (layer_data[1] & 0x8000) ? (layer_data[1] & 0x1ff) : -(layer_data[1] & 0x1ff);
394   layer_scroll_x[2] = (layer_data[2] & 0x8000) ? (layer_data[2] & 0x1ff) : -(layer_data[2] & 0x1ff);
395   layer_scroll_y[2] = (layer_data[2] & 0x8000) ? (layer_data[2] & 0x1ff) : -(layer_data[2] & 0x1ff);
396   layer_scroll_x[3] = (layer_data[3] & 0x8000) ? (layer_data[3] & 0x1ff) : -(layer_data[3] & 0x1ff);
397   layer_scroll_y[3] = (layer_data[3] & 0x8000) ? (layer_data[3] & 0x1ff) : -(layer_data[3] & 0x1ff);
398
387    layer_data[0] = BYTE_REVERSE32((UINT32)(layer_scroll[0] >> 32));
388    layer_data[1] = BYTE_REVERSE32((UINT32)(layer_scroll[0] >> 0));
389    layer_data[2] = BYTE_REVERSE32((UINT32)(layer_scroll[1] >> 32));
390    layer_data[3] = BYTE_REVERSE32((UINT32)(layer_scroll[1] >> 0));
391    layer_scroll_x[0] = (layer_data[0] & 0x8000) ? (layer_data[0] & 0x1ff) : -(layer_data[0] & 0x1ff);
392    layer_scroll_y[0] = (layer_data[0] & 0x8000) ? (layer_data[0] & 0x1ff) : -(layer_data[0] & 0x1ff);
393    layer_scroll_x[1] = (layer_data[1] & 0x8000) ? (layer_data[1] & 0x1ff) : -(layer_data[1] & 0x1ff);
394    layer_scroll_y[1] = (layer_data[1] & 0x8000) ? (layer_data[1] & 0x1ff) : -(layer_data[1] & 0x1ff);
395    layer_scroll_x[2] = (layer_data[2] & 0x8000) ? (layer_data[2] & 0x1ff) : -(layer_data[2] & 0x1ff);
396    layer_scroll_y[2] = (layer_data[2] & 0x8000) ? (layer_data[2] & 0x1ff) : -(layer_data[2] & 0x1ff);
397    layer_scroll_x[3] = (layer_data[3] & 0x8000) ? (layer_data[3] & 0x1ff) : -(layer_data[3] & 0x1ff);
398    layer_scroll_y[3] = (layer_data[3] & 0x8000) ? (layer_data[3] & 0x1ff) : -(layer_data[3] & 0x1ff);
399*/
399400   screen_clip = (rectangle*)cliprect;
400401
401402   clip3d.min_x = cliprect->min_x;
r7972r7973
14541455{
14551456   const UINT32 *node = get_memory_pointer(address);
14561457   UINT32 link_address;
1457   float viewport_left, viewport_right, viewport_top, viewport_bottom;
1458   float /*viewport_left, viewport_right, */viewport_top, viewport_bottom;
14581459   float /*fov_x,*/ fov_y;
14591460
14601461   link_address = node[1];
r7972r7973
14771478   viewport_region_height   = ((node[20] >> 16) & 0xffff) >> 2;
14781479
14791480   /* frustum plane angles */
1480   viewport_left         = RADIAN_TO_DEGREE(asin(*(float *)&node[12]));
1481   viewport_right         = RADIAN_TO_DEGREE(asin(*(float *)&node[16]));
1481   //viewport_left         = RADIAN_TO_DEGREE(asin(*(float *)&node[12]));
1482   //viewport_right            = RADIAN_TO_DEGREE(asin(*(float *)&node[16]));
14821483   viewport_top         = RADIAN_TO_DEGREE(asin(*(float *)&node[14]));
14831484   viewport_bottom         = RADIAN_TO_DEGREE(asin(*(float *)&node[18]));
14841485
src/mame/video/vrender0.c
r7972r7973
2020
2121**************/
2222
23static UINT16 InternalPalette[256];
24static UINT32 LastPalUpdate;
25
26/*
27Pick a rare enough color to disable transparency (that way I save a cmp per loop to check
28if I must draw transparent or not. The palette build will take this color in account so
29no color in the palette will have this value
30*/
31#define NOTRANSCOLOR   0xecda
32
33#define RGB32(r,g,b) ((r<<16)|(g<<8)|(b<<0))
34#define RGB16(r,g,b) ((r&0xf8)<<8)|((g&0xfc)<<3)|((b&0xf8)>>3)
35
36INLINE UINT16 RGB32TO16(UINT32 rgb)
37{
38   return (((rgb>>(16+3))&0x1f)<<11)|(((rgb>>(8+2))&0x3f)<<5)|(((rgb>>(3))&0x1f)<<0);
39}
40
4123typedef struct
4224{
43   UINT32 Tx;
44   UINT32 Ty;
45   UINT32 Txdx;
46   UINT32 Tydx;
47   UINT32 Txdy;
48   UINT32 Tydy;
49   UINT32 SrcAlphaColor;
50   UINT32 SrcBlend;
51   UINT32 DstAlphaColor;
52   UINT32 DstBlend;
53   UINT32 ShadeColor;
54   UINT32 TransColor;
55   UINT32 TileOffset;
56   UINT32 FontOffset;
57   UINT32 PalOffset;
58   UINT32 PaletteBank;
59   UINT32 TextureMode;
60   UINT32 PixelFormat;
61   UINT32 Width;
62   UINT32 Height;
63} _RenderState;
64
65static _RenderState RenderState;
66
67typedef struct
68{
6925   UINT16 *Dest;
7026   UINT32 Pitch;   //in UINT16s
7127   UINT32 w,h;
r7972r7973
9450   UINT32 DstColor;
9551} _Quad;
9652
97#define EXTRACTR8(Src)   (((Src>>11)<<3)&0xff)
98#define EXTRACTG8(Src)   (((Src>>5)<<2)&0xff)
99#define EXTRACTB8(Src)   (((Src>>0)<<3)&0xff)
53typedef struct
54{
55   UINT32 Tx;
56   UINT32 Ty;
57   UINT32 Txdx;
58   UINT32 Tydx;
59   UINT32 Txdy;
60   UINT32 Tydy;
61   UINT32 SrcAlphaColor;
62   UINT32 SrcBlend;
63   UINT32 DstAlphaColor;
64   UINT32 DstBlend;
65   UINT32 ShadeColor;
66   UINT32 TransColor;
67   UINT32 TileOffset;
68   UINT32 FontOffset;
69   UINT32 PalOffset;
70   UINT32 PaletteBank;
71   UINT32 TextureMode;
72   UINT32 PixelFormat;
73   UINT32 Width;
74   UINT32 Height;
75} _RenderState;
10076
101INLINE UINT16 Shade(UINT16 Src,UINT32 Shade)
77typedef struct _vr0video_state  vr0video_state;
78struct _vr0video_state
10279{
103   UINT32 scr=(EXTRACTR8(Src)*((Shade>>16)&0xff))>>8;
104   UINT32 scg=(EXTRACTG8(Src)*((Shade>>8)&0xff))>>8;
105   UINT32 scb=(EXTRACTB8(Src)*((Shade>>0)&0xff))>>8;
106   return RGB16(scr,scg,scb);
80   running_device *cpu;
81
82   UINT16 InternalPalette[256];
83   UINT32 LastPalUpdate;
84
85   _RenderState RenderState;
86};
87
88
89/*****************************************************************************
90 INLINE FUNCTIONS
91 *****************************************************************************/
92
93INLINE vr0video_state *get_safe_token( running_device *device )
94{
95   assert(device != NULL);
96   assert(device->token != NULL);
97   assert(device->type == VIDEO_VRENDER0);
98
99   return (vr0video_state *)device->token;
107100}
108101
109static UINT16 Alpha(_Quad *Quad,UINT16 Src,UINT16 Dst)
102INLINE const vr0video_interface *get_interface( running_device *device )
110103{
111   UINT32 scr=(EXTRACTR8(Src)*((Quad->Shade>>16)&0xff))>>8;
112   UINT32 scg=(EXTRACTG8(Src)*((Quad->Shade>>8)&0xff))>>8;
113   UINT32 scb=(EXTRACTB8(Src)*((Quad->Shade>>0)&0xff))>>8;
114   UINT32 dcr=EXTRACTR8(Dst);
115   UINT32 dcg=EXTRACTG8(Dst);
116   UINT32 dcb=EXTRACTB8(Dst);
104   assert(device != NULL);
105   assert(device->type == VIDEO_VRENDER0);
106   return (const vr0video_interface *) device->baseconfig().static_config;
107}
117108
118   UINT32 smulr,smulg,smulb;
119   UINT32 dmulr,dmulg,dmulb;
109/*****************************************************************************
110 IMPLEMENTATION
111 *****************************************************************************/
120112
121   switch(Quad->SrcAlpha&0x1f)
113/*
114Pick a rare enough color to disable transparency (that way I save a cmp per loop to check
115if I must draw transparent or not. The palette build will take this color in account so
116no color in the palette will have this value
117*/
118#define NOTRANSCOLOR   0xecda
119
120#define RGB32(r,g,b) ((r << 16) | (g << 8) | (b << 0))
121#define RGB16(r,g,b) ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3)
122
123INLINE UINT16 RGB32TO16(UINT32 rgb)
124{
125   return (((rgb >> (16 + 3)) & 0x1f) << 11) | (((rgb >> (8 + 2)) & 0x3f) << 5) | (((rgb >> (3)) & 0x1f) << 0);
126}
127
128#define EXTRACTR8(Src)   (((Src >> 11) << 3) & 0xff)
129#define EXTRACTG8(Src)   (((Src >>  5) << 2) & 0xff)
130#define EXTRACTB8(Src)   (((Src >>  0) << 3) & 0xff)
131
132INLINE UINT16 Shade(UINT16 Src, UINT32 Shade)
133{
134   UINT32 scr = (EXTRACTR8(Src) * ((Shade >> 16) & 0xff)) >> 8;
135   UINT32 scg = (EXTRACTG8(Src) * ((Shade >>  8) & 0xff)) >> 8;
136   UINT32 scb = (EXTRACTB8(Src) * ((Shade >>  0) & 0xff)) >> 8;
137   return RGB16(scr, scg, scb);
138}
139
140static UINT16 Alpha(_Quad *Quad, UINT16 Src, UINT16 Dst)
141{
142   UINT32 scr = (EXTRACTR8(Src) * ((Quad->Shade >> 16) & 0xff)) >> 8;
143   UINT32 scg = (EXTRACTG8(Src) * ((Quad->Shade >>  8) & 0xff)) >> 8;
144   UINT32 scb = (EXTRACTB8(Src) * ((Quad->Shade >>  0) & 0xff)) >> 8;
145   UINT32 dcr = EXTRACTR8(Dst);
146   UINT32 dcg = EXTRACTG8(Dst);
147   UINT32 dcb = EXTRACTB8(Dst);
148
149   UINT32 smulr, smulg, smulb;
150   UINT32 dmulr, dmulg, dmulb;
151
152   switch (Quad->SrcAlpha & 0x1f)
122153   {
123154      case 0x01:
124         smulr=smulg=smulb=0;
155         smulr = smulg = smulb = 0;
125156         break;
126157      case 0x02:
127         smulr=(Quad->SrcColor>>16)&0xff;
128         smulg=(Quad->SrcColor>>8)&0xff;
129         smulb=(Quad->SrcColor>>0)&0xff;
158         smulr = (Quad->SrcColor >> 16) & 0xff;
159         smulg = (Quad->SrcColor >>  8) & 0xff;
160         smulb = (Quad->SrcColor >>  0) & 0xff;
130161         break;
131162      case 0x04:
132         smulr=scr;
133         smulg=scg;
134         smulb=scb;
163         smulr = scr;
164         smulg = scg;
165         smulb = scb;
135166         break;
136167      case 0x08:
137         smulr=(Quad->DstColor>>16)&0xff;
138         smulg=(Quad->DstColor>>8)&0xff;
139         smulb=(Quad->DstColor>>0)&0xff;
168         smulr = (Quad->DstColor >> 16) & 0xff;
169         smulg = (Quad->DstColor >>  8) & 0xff;
170         smulb = (Quad->DstColor >>  0) & 0xff;
140171         break;
141172      case 0x10:
142         smulr=dcr;
143         smulg=dcg;
144         smulb=dcb;
173         smulr = dcr;
174         smulg = dcg;
175         smulb = dcb;
145176         break;
146177      default:
147         smulr=smulg=smulb=0;
178         smulr = smulg = smulb = 0;
148179         break;
149180   }
150   if(Quad->SrcAlpha&0x20)
181
182   if (Quad->SrcAlpha & 0x20)
151183   {
152      smulr=0x100-smulr;
153      smulg=0x100-smulg;
154      smulb=0x100-smulb;
184      smulr = 0x100 - smulr;
185      smulg = 0x100 - smulg;
186      smulb = 0x100 - smulb;
155187   }
156188
157   switch(Quad->DstAlpha&0x1f)
189   switch (Quad->DstAlpha & 0x1f)
158190   {
159191      case 0x01:
160         dmulr=dmulg=dmulb=0;
192         dmulr = dmulg = dmulb = 0;
161193         break;
162194      case 0x02:
163         dmulr=(Quad->SrcColor>>16)&0xff;
164         dmulg=(Quad->SrcColor>>8)&0xff;
165         dmulb=(Quad->SrcColor>>0)&0xff;
195         dmulr = (Quad->SrcColor >> 16) & 0xff;
196         dmulg = (Quad->SrcColor >>  8) & 0xff;
197         dmulb = (Quad->SrcColor >>  0) & 0xff;
166198         break;
167199      case 0x04:
168         dmulr=scr;
169         dmulg=scg;
170         dmulb=scb;
200         dmulr = scr;
201         dmulg = scg;
202         dmulb = scb;
171203         break;
172204      case 0x08:
173         dmulr=(Quad->DstColor>>16)&0xff;
174         dmulg=(Quad->DstColor>>8)&0xff;
175         dmulb=(Quad->DstColor>>0)&0xff;
205         dmulr = (Quad->DstColor >> 16) & 0xff;
206         dmulg = (Quad->DstColor >>  8) & 0xff;
207         dmulb = (Quad->DstColor >>  0) & 0xff;
176208         break;
177209      case 0x10:
178         dmulr=dcr;
179         dmulg=dcg;
180         dmulb=dcb;
210         dmulr = dcr;
211         dmulg = dcg;
212         dmulb = dcb;
181213         break;
182214      default:
183         dmulr=dmulg=dmulb=0;
215         dmulr = dmulg = dmulb = 0;
184216         break;
185217   }
186   if(Quad->DstAlpha&0x20)
218
219   if (Quad->DstAlpha&0x20)
187220   {
188      dmulr=0x100-dmulr;
189      dmulg=0x100-dmulg;
190      dmulb=0x100-dmulb;
221      dmulr = 0x100 - dmulr;
222      dmulg = 0x100 - dmulg;
223      dmulb = 0x100 - dmulb;
191224   }
192225
193226
194   dcr=(scr*smulr+dcr*dmulr)>>8;
195   if(dcr>0xff)
196      dcr=0xff;
197   dcg=(scg*smulg+dcg*dmulg)>>8;
198   if(dcg>0xff)
199      dcg=0xff;
200   dcb=(scb*smulb+dcb*dmulb)>>8;
201   if(dcb>0xff)
202      dcb=0xff;
203   return RGB16(dcr,dcg,dcb);
227   dcr = (scr * smulr + dcr * dmulr) >> 8;
228   if (dcr > 0xff)
229      dcr = 0xff;
230
231   dcg = (scg * smulg + dcg * dmulg) >> 8;
232   if (dcg > 0xff)
233      dcg = 0xff;
234
235   dcb = (scb * smulb + dcb * dmulb) >> 8;
236   if (dcb > 0xff)
237      dcb = 0xff;
238
239   return RGB16(dcr, dcg, dcb);
204240}
205241
206#define TILENAME(bpp,t,a) \
242#define TILENAME(bpp, t, a) \
207243static void DrawQuad##bpp##t##a(_Quad *Quad)
208244
209245//TRUST ON THE COMPILER OPTIMIZATIONS
210#define TILETEMPL(bpp,t,a) \
211TILENAME(bpp,t,a)\
246#define TILETEMPL(bpp, t, a) \
247TILENAME(bpp, t, a)\
212248{\
213   UINT32 TransColor=Quad->Trans?RGB32TO16(Quad->TransColor):NOTRANSCOLOR;\
214   UINT32 x,y;\
215   UINT16 *line=Quad->Dest;\
216   UINT32 y_tx=Quad->Tx,y_ty=Quad->Ty;\
217   UINT32 x_tx,x_ty;\
218   UINT32 Maskw=Quad->TWidth-1;\
219   UINT32 Maskh=Quad->THeight-1;\
220   UINT32 W=Quad->TWidth>>3;\
249   UINT32 TransColor = Quad->Trans ? RGB32TO16(Quad->TransColor) : NOTRANSCOLOR;\
250   UINT32 x, y;\
251   UINT16 *line = Quad->Dest;\
252   UINT32 y_tx = Quad->Tx, y_ty = Quad->Ty;\
253   UINT32 x_tx, x_ty;\
254   UINT32 Maskw = Quad->TWidth - 1;\
255   UINT32 Maskh = Quad->THeight - 1;\
256   UINT32 W = Quad->TWidth >> 3;\
221257\
222   for(y=0;y<Quad->h;++y)\
258   for (y = 0; y < Quad->h; ++y)\
223259   {\
224      UINT16 *pixel=line;\
225      x_tx=y_tx;\
226      x_ty=y_ty;\
227      for(x=0;x<Quad->w;++x)\
260      UINT16 *pixel = line;\
261      x_tx = y_tx;\
262      x_ty = y_ty;\
263      for (x = 0; x < Quad->w; ++x)\
228264      {\
229265         UINT32 Offset;\
230         UINT32 tx=x_tx>>9;\
231         UINT32 ty=x_ty>>9;\
266         UINT32 tx = x_tx >> 9;\
267         UINT32 ty = x_ty >> 9;\
232268         UINT16 Color;\
233         if(Quad->Clamp)\
269         if (Quad->Clamp)\
234270         {\
235            if(tx>Maskw)\
271            if (tx > Maskw)\
236272               goto Clamped;\
237            if(ty>Maskh)\
273            if (ty > Maskh)\
238274               goto Clamped;\
239275         }\
240276         else\
241277         {\
242            tx&=Maskw;\
243            ty&=Maskh;\
278            tx &= Maskw;\
279            ty &= Maskh;\
244280         }\
245281\
246         if(t)\
282         if (t)\
247283         {\
248            UINT32 Index=Quad->Tile[(ty>>3)*(W)+(tx>>3)];\
249            Offset=(Index<<6)+((ty&7)<<3)+(tx&7);\
284            UINT32 Index = Quad->Tile[(ty >> 3) * (W) + (tx >> 3)];\
285            Offset = (Index << 6) + ((ty & 7) << 3) + (tx & 7);\
250286         }\
251287         else\
252            Offset=ty*(Quad->TWidth)+tx;\
288            Offset = ty * (Quad->TWidth) + tx;\
253289\
254         if(bpp==4)\
290         if (bpp == 4)\
255291         {\
256            UINT8 Texel=Quad->u.Imageb[Offset/2];\
257            if(Offset&1)\
258               Texel&=0xf;\
292            UINT8 Texel = Quad->u.Imageb[Offset / 2];\
293            if (Offset & 1)\
294               Texel &= 0xf;\
259295            else\
260               Texel=(Texel>>4)&0xf;\
261            Color=Quad->Pal[Texel];\
296               Texel = (Texel >> 4) & 0xf;\
297            Color = Quad->Pal[Texel];\
262298         }\
263         else if(bpp==8)\
299         else if (bpp == 8)\
264300         {\
265            UINT8 Texel=Quad->u.Imageb[Offset];\
266            Texel=Quad->u.Imageb[Offset];\
267            Color=Quad->Pal[Texel];\
301            UINT8 Texel = Quad->u.Imageb[Offset];\
302            Texel = Quad->u.Imageb[Offset];\
303            Color = Quad->Pal[Texel];\
268304         }\
269         else if(bpp==16)\
305         else if (bpp == 16)\
270306         {\
271            Color=Quad->u.Imagew[Offset];\
307            Color = Quad->u.Imagew[Offset];\
272308         }\
273         if(Color!=TransColor)\
309         if (Color != TransColor)\
274310         {\
275            if(a==1)\
276               *pixel=Alpha(Quad,Color,*pixel);\
277            else if(a==2)\
278               *pixel=Shade(Color,Quad->Shade);\
311            if (a == 1)\
312               *pixel = Alpha(Quad, Color, *pixel);\
313            else if (a == 2)\
314               *pixel = Shade(Color, Quad->Shade);\
279315            else\
280               *pixel=Color;\
316               *pixel = Color;\
281317         }\
282318         ++pixel;\
283319Clamped:\
284         x_tx+=Quad->Txdx;\
285         x_ty+=Quad->Tydx;\
320         x_tx += Quad->Txdx;\
321         x_ty += Quad->Tydx;\
286322      }\
287      line+=Quad->Pitch;\
288      y_tx+=Quad->Txdy;\
289      y_ty+=Quad->Tydy;\
323      line += Quad->Pitch;\
324      y_tx += Quad->Txdy;\
325      y_ty += Quad->Tydy;\
290326   }\
291327}\
292328
r7972r7973
300336TILETEMPL(4,1,0) TILETEMPL(4,1,1) TILETEMPL(4,1,2)
301337
302338#undef TILENAME
303#define TILENAME(bpp,t,a) \
339#define TILENAME(bpp, t, a) \
304340DrawQuad##bpp##t##a
305341
306342
307343static void DrawQuadFill(_Quad *Quad)
308344{
309   UINT32 x,y;
310   UINT16 *line=Quad->Dest;
311   UINT16 ShadeColor=RGB32TO16(Quad->Shade);
312   for(y=0;y<Quad->h;++y)
345   UINT32 x, y;
346   UINT16 *line = Quad->Dest;
347   UINT16 ShadeColor = RGB32TO16(Quad->Shade);
348   for (y = 0; y < Quad->h; ++y)
313349   {
314      UINT16 *pixel=line;
315      for(x=0;x<Quad->w;++x)
350      UINT16 *pixel = line;
351      for (x = 0; x < Quad->w; ++x)
316352      {
317         if(Quad->SrcAlpha)
318            *pixel=Alpha(Quad,Quad->Shade,*pixel);
353         if (Quad->SrcAlpha)
354            *pixel = Alpha(Quad, Quad->Shade, *pixel);
319355         else
320            *pixel=ShadeColor;
356            *pixel = ShadeColor;
321357         ++pixel;
322358      }
323      line+=Quad->Pitch;
359      line += Quad->Pitch;
324360   }
325361}
326362
r7972r7973
362398   TILENAME(16,1,2),
363399};
364400
365#define Packet(i) memory_read_word(space, PacketPtr+2*i)
401#define Packet(i) memory_read_word(space, PacketPtr + 2 * i)
366402
367void vrender0_init(running_machine *machine)
368{
369   memset(InternalPalette, 0, sizeof(InternalPalette));
370   LastPalUpdate=0xffffffff;
371}
372
373403//Returns TRUE if the operation was a flip (sync or async)
374int vrender0_ProcessPacket(const address_space *space, UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE)
404int vrender0_ProcessPacket(running_device *device, UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE)
375405{
376   UINT32 Dx=Packet(1)&0x3ff;
377   UINT32 Dy=Packet(2)&0x1ff;
378   UINT32 Endx=Packet(3)&0x3ff;
379   UINT32 Endy=Packet(4)&0x1ff;
380   UINT32 Mode=0;
381   UINT16 Packet0=Packet(0);
406   vr0video_state *vr0 = get_safe_token(device);
407   const address_space *space = cpu_get_address_space(vr0->cpu, ADDRESS_SPACE_PROGRAM);
408   UINT32 Dx = Packet(1) & 0x3ff;
409   UINT32 Dy = Packet(2) & 0x1ff;
410   UINT32 Endx = Packet(3) & 0x3ff;
411   UINT32 Endy = Packet(4) & 0x1ff;
412   UINT32 Mode = 0;
413   UINT16 Packet0 = Packet(0);
382414
383   if(Packet0&0x81)   //Sync or ASync flip
415   if (Packet0 & 0x81)   //Sync or ASync flip
384416   {
385      LastPalUpdate=0xffffffff;   //Force update palette next frame
417      vr0->LastPalUpdate = 0xffffffff;   //Force update palette next frame
386418      return 1;
387419   }
388420
389   if(Packet0&0x200)
421   if (Packet0 & 0x200)
390422   {
391      RenderState.Tx=Packet(5)|((Packet(6)&0x1F)<<16);
392      RenderState.Ty=Packet(7)|((Packet(8)&0x1F)<<16);
423      vr0->RenderState.Tx = Packet(5) | ((Packet(6) & 0x1f) << 16);
424      vr0->RenderState.Ty = Packet(7) | ((Packet(8) & 0x1f) << 16);
393425   }
394426   else
395427   {
396      RenderState.Tx=0;
397      RenderState.Ty=0;
428      vr0->RenderState.Tx = 0;
429      vr0->RenderState.Ty = 0;
398430   }
399   if(Packet0&0x400)
431   if (Packet0 & 0x400)
400432   {
401      RenderState.Txdx=Packet(9)|((Packet(10)&0x1F)<<16);
402      RenderState.Tydx=Packet(11)|((Packet(12)&0x1F)<<16);
403      RenderState.Txdy=Packet(13)|((Packet(14)&0x1F)<<16);
404      RenderState.Tydy=Packet(15)|((Packet(16)&0x1F)<<16);
433      vr0->RenderState.Txdx = Packet(9)  | ((Packet(10) & 0x1f) << 16);
434      vr0->RenderState.Tydx = Packet(11) | ((Packet(12) & 0x1f) << 16);
435      vr0->RenderState.Txdy = Packet(13) | ((Packet(14) & 0x1f) << 16);
436      vr0->RenderState.Tydy = Packet(15) | ((Packet(16) & 0x1f) << 16);
405437   }
406438   else
407439   {
408      RenderState.Txdx=1<<9;
409      RenderState.Tydx=0;
410      RenderState.Txdy=0;
411      RenderState.Tydy=1<<9;
440      vr0->RenderState.Txdx = 1 << 9;
441      vr0->RenderState.Tydx = 0;
442      vr0->RenderState.Txdy = 0;
443      vr0->RenderState.Tydy = 1 << 9;
412444   }
413   if(Packet0&0x800)
445   if (Packet0 & 0x800)
414446   {
415      RenderState.SrcAlphaColor=Packet(17)|((Packet(18)&0xff)<<16);
416      RenderState.SrcBlend=(Packet(18)>>8)&0x3f;
417      RenderState.DstAlphaColor=Packet(19)|((Packet(20)&0xff)<<16);
418      RenderState.DstBlend=(Packet(20)>>8)&0x3f;
447      vr0->RenderState.SrcAlphaColor = Packet(17) | ((Packet(18) & 0xff) << 16);
448      vr0->RenderState.SrcBlend = (Packet(18) >> 8) & 0x3f;
449      vr0->RenderState.DstAlphaColor = Packet(19) | ((Packet(20) & 0xff) << 16);
450      vr0->RenderState.DstBlend = (Packet(20) >> 8) & 0x3f;
419451   }
420   if(Packet0&0x1000)
421      RenderState.ShadeColor=Packet(21)|((Packet(22)&0xFF)<<16);
422   if(Packet0&0x2000)
423      RenderState.TransColor=Packet(23)|((Packet(24)&0xFF)<<16);
424   if(Packet0&0x4000)
452   if (Packet0 & 0x1000)
453      vr0->RenderState.ShadeColor = Packet(21) | ((Packet(22) & 0xff) << 16);
454   if (Packet0 & 0x2000)
455      vr0->RenderState.TransColor = Packet(23) | ((Packet(24) & 0xff) << 16);
456   if (Packet0 & 0x4000)
425457   {
426      RenderState.TileOffset=Packet(25);
427      RenderState.FontOffset=Packet(26);
428      RenderState.PalOffset=Packet(27)>>3;
429      RenderState.PaletteBank=(Packet(28)>>8)&0xF;
430      RenderState.TextureMode=Packet(28)&0x1000;
431      RenderState.PixelFormat=(Packet(28)>>6)&3;
432      RenderState.Width =8<<((Packet(28)>>0)&0x7);
433      RenderState.Height=8<<((Packet(28)>>3)&0x7);
458      vr0->RenderState.TileOffset = Packet(25);
459      vr0->RenderState.FontOffset = Packet(26);
460      vr0->RenderState.PalOffset = Packet(27) >> 3;
461      vr0->RenderState.PaletteBank = (Packet(28) >> 8) & 0xf;
462      vr0->RenderState.TextureMode = Packet(28) & 0x1000;
463      vr0->RenderState.PixelFormat = (Packet(28) >> 6) & 3;
464      vr0->RenderState.Width  = 8 << ((Packet(28) >> 0) & 0x7);
465      vr0->RenderState.Height = 8 << ((Packet(28) >> 3) & 0x7);
434466   }
435467
436
437   if(Packet0&0x40 && RenderState.PalOffset!=LastPalUpdate)
468   if (Packet0 & 0x40 && vr0->RenderState.PalOffset != vr0->LastPalUpdate)
438469   {
439      UINT32 *Pal=(UINT32*) (TEXTURE+1024*RenderState.PalOffset);
440      UINT16 Trans=RGB32TO16(RenderState.TransColor);
470      UINT32 *Pal = (UINT32*) (TEXTURE + 1024 * vr0->RenderState.PalOffset);
471      UINT16 Trans = RGB32TO16(vr0->RenderState.TransColor);
441472      int i;
442      for(i=0;i<256;++i)
473      for (i = 0; i < 256; ++i)
443474      {
444         UINT32 p=Pal[i];
445         UINT16 v=RGB32TO16(p);
446         if((v==Trans && p!=RenderState.TransColor) || v==NOTRANSCOLOR)   //Error due to conversion. caused transparent
475         UINT32 p = Pal[i];
476         UINT16 v = RGB32TO16(p);
477         if ((v == Trans && p != vr0->RenderState.TransColor) || v == NOTRANSCOLOR)   //Error due to conversion. caused transparent
447478         {
448            if((v&0x1f)!=0x1f)
479            if ((v & 0x1f) != 0x1f)
449480               v++;                           //Make the color a bit different (blueish) so it's not
450481            else
451482               v--;
452483         }
453         InternalPalette[i]=v;                  //made transparent by mistake
484         vr0->InternalPalette[i] = v;                  //made transparent by mistake
454485      }
455      LastPalUpdate=RenderState.PalOffset;
486      vr0->LastPalUpdate = vr0->RenderState.PalOffset;
456487   }
457488
458   if(Packet0&0x100)
489   if (Packet0 & 0x100)
459490   {
460491      _Quad Quad;
461492
462      Quad.Pitch=512;
493      Quad.Pitch = 512;
463494
464//      assert(Endx>=Dx && Endy>=Dy);
495//      assert(Endx >= Dx && Endy >= Dy);
465496
466      if(Packet0&2)
497      if (Packet0 & 2)
467498      {
468         Quad.SrcAlpha=RenderState.SrcBlend;
469         Quad.DstAlpha=RenderState.DstBlend;
470         Quad.SrcColor=RenderState.SrcAlphaColor;
471         Quad.DstColor=RenderState.DstAlphaColor;
472         Mode=1;
499         Quad.SrcAlpha = vr0->RenderState.SrcBlend;
500         Quad.DstAlpha = vr0->RenderState.DstBlend;
501         Quad.SrcColor = vr0->RenderState.SrcAlphaColor;
502         Quad.DstColor = vr0->RenderState.DstAlphaColor;
503         Mode = 1;
473504      }
474505      else
475         Quad.SrcAlpha=0;
506         Quad.SrcAlpha = 0;
476507
477      Quad.w=1+Endx-Dx;
478      Quad.h=1+Endy-Dy;
508      Quad.w = 1 + Endx - Dx;
509      Quad.h = 1 + Endy - Dy;
479510
480      Quad.Dest=(UINT16*) Dest;
481      Quad.Dest=Quad.Dest+Dx+(Dy*Quad.Pitch);
511      Quad.Dest = (UINT16*) Dest;
512      Quad.Dest = Quad.Dest + Dx + (Dy * Quad.Pitch);
482513
483      Quad.Tx=RenderState.Tx;
484      Quad.Ty=RenderState.Ty;
485      Quad.Txdx=RenderState.Txdx;
486      Quad.Tydx=RenderState.Tydx;
487      Quad.Txdy=RenderState.Txdy;
488      Quad.Tydy=RenderState.Tydy;
489      if(Packet0&0x10)
514      Quad.Tx = vr0->RenderState.Tx;
515      Quad.Ty = vr0->RenderState.Ty;
516      Quad.Txdx = vr0->RenderState.Txdx;
517      Quad.Tydx = vr0->RenderState.Tydx;
518      Quad.Txdy = vr0->RenderState.Txdy;
519      Quad.Tydy = vr0->RenderState.Tydy;
520      if (Packet0 & 0x10)
490521      {
491         Quad.Shade=RenderState.ShadeColor;
492         if(!Mode)      //Alpha includes Shade
493            Mode=2;
522         Quad.Shade = vr0->RenderState.ShadeColor;
523         if (!Mode)      //Alpha includes Shade
524            Mode = 2;
494525         /*
495526            //simulate shade with alphablend (SLOW!!!)
496            if(!Quad.SrcAlpha && (Packet0&0x8))
527            if (!Quad.SrcAlpha && (Packet0 & 0x8))
497528            {
498                Quad.SrcAlpha=0x21; //1
499                Quad.DstAlpha=0x01; //0
529                Quad.SrcAlpha = 0x21; //1
530                Quad.DstAlpha = 0x01; //0
500531            }*/
501532      }
502533      else
503         Quad.Shade=RGB32(255,255,255);
504      Quad.TransColor=RenderState.TransColor;
505      Quad.TWidth=RenderState.Width;
506      Quad.THeight=RenderState.Height;
507      Quad.Trans=Packet0&4;
508      //Quad.Trans=0;
509      Quad.Clamp=Packet0&0x20;
534         Quad.Shade = RGB32(255,255,255);
535      Quad.TransColor = vr0->RenderState.TransColor;
536      Quad.TWidth = vr0->RenderState.Width;
537      Quad.THeight = vr0->RenderState.Height;
538      Quad.Trans = Packet0 & 4;
539      //Quad.Trans = 0;
540      Quad.Clamp = Packet0 & 0x20;
510541
511      if(Packet0&0x8)   //Texture Enable
542      if (Packet0 & 0x8)   //Texture Enable
512543      {
513         Quad.u.Imageb=TEXTURE+128*RenderState.FontOffset;
514         Quad.Tile=(UINT16*) (TEXTURE+128*RenderState.TileOffset);
515         if(!RenderState.PixelFormat)
516            Quad.Pal=InternalPalette+(RenderState.PaletteBank*16);
544         Quad.u.Imageb = TEXTURE + 128 * vr0->RenderState.FontOffset;
545         Quad.Tile = (UINT16*) (TEXTURE + 128 * vr0->RenderState.TileOffset);
546         if (!vr0->RenderState.PixelFormat)
547            Quad.Pal = vr0->InternalPalette + (vr0->RenderState.PaletteBank * 16);
517548         else
518            Quad.Pal=InternalPalette;
519         if(RenderState.TextureMode)   //Tiled
520            DrawTile[RenderState.PixelFormat+4*Mode](&Quad);
549            Quad.Pal = vr0->InternalPalette;
550         if (vr0->RenderState.TextureMode)   //Tiled
551            DrawTile[vr0->RenderState.PixelFormat + 4 * Mode](&Quad);
521552         else
522            DrawImage[RenderState.PixelFormat+4*Mode](&Quad);
553            DrawImage[vr0->RenderState.PixelFormat + 4 * Mode](&Quad);
523554      }
524555      else
525556         DrawQuadFill(&Quad);
526557   }
527558   return 0;
528559}
560
561/*****************************************************************************
562 DEVICE INTERFACE
563 *****************************************************************************/
564
565static DEVICE_START( vr0video )
566{
567   vr0video_state *vr0 = get_safe_token(device);
568   const vr0video_interface *intf = get_interface(device);
569
570   vr0->cpu = devtag_get_device(device->machine, intf->cpu);
571
572   state_save_register_device_item_array(device, 0, vr0->InternalPalette);
573   state_save_register_device_item(device, 0, vr0->LastPalUpdate);
574
575   state_save_register_device_item(device, 0, vr0->RenderState.Tx);
576   state_save_register_device_item(device, 0, vr0->RenderState.Ty);
577   state_save_register_device_item(device, 0, vr0->RenderState.Txdx);
578   state_save_register_device_item(device, 0, vr0->RenderState.Tydx);
579   state_save_register_device_item(device, 0, vr0->RenderState.Txdy);
580   state_save_register_device_item(device, 0, vr0->RenderState.Tydy);
581   state_save_register_device_item(device, 0, vr0->RenderState.SrcAlphaColor);
582   state_save_register_device_item(device, 0, vr0->RenderState.SrcBlend);
583   state_save_register_device_item(device, 0, vr0->RenderState.DstAlphaColor);
584   state_save_register_device_item(device, 0, vr0->RenderState.DstBlend);
585   state_save_register_device_item(device, 0, vr0->RenderState.ShadeColor);
586   state_save_register_device_item(device, 0, vr0->RenderState.TransColor);
587   state_save_register_device_item(device, 0, vr0->RenderState.TileOffset);
588   state_save_register_device_item(device, 0, vr0->RenderState.FontOffset);
589   state_save_register_device_item(device, 0, vr0->RenderState.PalOffset);
590   state_save_register_device_item(device, 0, vr0->RenderState.PaletteBank);
591   state_save_register_device_item(device, 0, vr0->RenderState.TextureMode);
592   state_save_register_device_item(device, 0, vr0->RenderState.PixelFormat);
593   state_save_register_device_item(device, 0, vr0->RenderState.Width);
594   state_save_register_device_item(device, 0, vr0->RenderState.Height);
595}
596
597static DEVICE_RESET( vr0video )
598{
599   vr0video_state *vr0 = get_safe_token(device);
600
601   memset(vr0->InternalPalette, 0, sizeof(vr0->InternalPalette));
602   vr0->LastPalUpdate = 0xffffffff;
603}
604
605static const char DEVTEMPLATE_SOURCE[] = __FILE__;
606
607#define DEVTEMPLATE_ID( p, s )   p##vr0video##s
608#define DEVTEMPLATE_FEATURES   DT_HAS_START | DT_HAS_RESET
609#define DEVTEMPLATE_NAME      "VRender0"
610#define DEVTEMPLATE_FAMILY      "???"
611#define DEVTEMPLATE_CLASS      DEVICE_CLASS_VIDEO
612#include "devtempl.h"
src/mame/video/vrender0.h
r7972r7973
1extern void vrender0_init(running_machine *machine);
2extern int vrender0_ProcessPacket(const address_space *space, UINT32 PacketPtr,UINT16 *Dest,UINT8 *TEXTURE);
1#ifndef __VR0VIDEO_H__
2#define __VR0VIDEO_H__
3
4#include "devcb.h"
5
6/***************************************************************************
7 TYPE DEFINITIONS
8 ***************************************************************************/
9
10typedef struct _vr0video_interface vr0video_interface;
11struct _vr0video_interface
12{
13   const char *cpu;
14};
15
16/***************************************************************************
17 FUNCTION PROTOTYPES
18 ***************************************************************************/
19
20DEVICE_GET_INFO( vr0video );
21
22
23/***************************************************************************
24 DEVICE CONFIGURATION MACROS
25 ***************************************************************************/
26
27#define VIDEO_VRENDER0 DEVICE_GET_INFO_NAME( vr0video )
28
29#define MDRV_VIDEO_VRENDER0_ADD(_tag, _interface) \
30MDRV_DEVICE_ADD(_tag, VIDEO_VRENDER0, 0) \
31MDRV_DEVICE_CONFIG(_interface)
32
33
34/***************************************************************************
35 DEVICE I/O FUNCTIONS
36 ***************************************************************************/
37
38extern int vrender0_ProcessPacket(running_device *device, UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE);
39
40#endif /* __VR0VIDEO_H__ */
src/mame/video/thunderx.c
r7972r7973
5555   state->layer_colorbase[1] = 0;
5656   state->layer_colorbase[2] = 16;
5757   state->sprite_colorbase = 32;
58
59   palette_set_shadow_factor(machine,7.0/8.0);
5860}
5961
6062
src/mame/video/rdpfb.c
r7972r7973
121121
122122   UINT32 newcvg = m_misc_state->m_curpixel_cvg + memory_cvg;
123123   bool wrapped = (newcvg > 8);
124   UINT32 clamped_cvg = (wrapped > 8) ? 8 : newcvg;
124   UINT32 clamped_cvg = wrapped ? 8 : newcvg;
125125   newcvg = (wrapped) ? (newcvg - 8) : newcvg;
126126
127127   m_misc_state->m_curpixel_cvg--;
src/mame/video/sega16sp.c
r0r7973
1#include "emu.h"
2#include "segaic16.h"
3
4
5UINT16 *segaic16_spriteram_0;
6UINT16 *segaic16_spriteram_1;
7
8
9
10
11/*****************************************************************************
12    INLINE FUNCTIONS
13*****************************************************************************/
14
15INLINE sega16sp_state *get_safe_token( running_device *device )
16{
17   assert(device != NULL);
18   assert(device->token != NULL);
19   assert(device->type == SEGA16SP);
20
21   return (sega16sp_state *)device->token;
22}
23
24INLINE const sega16sp_interface *get_interface( running_device *device )
25{
26   assert(device != NULL);
27   assert((device->type == SEGA16SP));
28   return (const sega16sp_interface *) device->baseconfig().static_config;
29}
30
31/*******************************************************************************************
32 *
33 *  Hang On-style sprites
34 *
35 *      Offs  Bits               Usage
36 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
37 *       +0   -------- tttttttt  Top scanline of sprite - 1
38 *       +2   bbbb---- --------  Sprite bank
39 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
40 *       +4   pppppppp pppppppp  Signed 16-bit pitch value between scanlines
41 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
42 *       +6   f------- --------  Horizontal flip: read the data backwards if set
43 *       +8   --cccccc --------  Sprite color palette
44 *       +8   -------- zzzzzz--  Zoom factor
45 *       +8   -------- ------pp  Sprite priority
46 *       +E   dddddddd dddddddd  Scratch space for current address
47 *
48 *  Special notes:
49 *
50 *      There is an interaction between the horizonal flip bit and the offset.
51 *      The offset is maintained as a 16-bit value, even though only the lower
52 *      15 bits are used for the address. The top bit is used to control flipping.
53 *      This means that if the low 15 bits overflow during rendering, the sprite
54 *      data will be read backwards after the overflow. This is important to
55 *      emulate correctly as many games make use of this feature to render sprites
56 *      at the beginning of a bank.
57 *
58 *******************************************************************************************/
59
60#define hangon_draw_pixel()                                       \
61   /* only draw if onscreen, not 0 or 15 */                        \
62   if (pix != 0 && pix != 15)                                    \
63   {                                                      \
64      /* are we high enough priority to be visible? */               \
65      if (sprpri > pri[x])                                    \
66      {                                                   \
67         /* shadow/hilight mode? */                              \
68         if (color == sega16sp->colorbase + (0x3f << 4))                  \
69            dest[x] += sega16sp->shadow ? palette.entries*2 : palette.entries;   \
70                                                         \
71         /* regular draw */                                    \
72         else                                             \
73            dest[x] = pix | color;                              \
74      }                                                   \
75                                                         \
76      /* always mark priority so no one else draws here */            \
77      pri[x] = 0xff;                                          \
78   }                                                      \
79
80void segaic16_sprites_hangon_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
81{
82   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
83   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
84   const UINT8 *zoom = (const UINT8 *)memory_region(machine, "proms");
85   sega16sp_state *sega16sp = get_safe_token(device);
86   UINT16* data = sega16sp->spriteram;
87
88   /* first scan forward to find the end of the list */
89   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
90      if ((data[0] >> 8) > 0xf0)
91         break;
92
93   /* now scan backwards and render the sprites in order */
94   for (data -= 8; data >= sega16sp->spriteram; data -= 8)
95   {
96      int bottom  = (data[0] >> 8) + 1;
97      int top     = (data[0] & 0xff) + 1;
98      int bank    = sega16sp->bank[(data[1] >> 12) & 0xf];
99      int xpos    = (data[1] & 0x1ff) - 0xbd;
100      int pitch   = (INT16)data[2];
101      UINT16 addr = data[3];
102      int color   = sega16sp->colorbase + (((data[4] >> 8) & 0x3f) << 4);
103      int vzoom   = (data[4] >> 2) & 0x3f;
104      int hzoom   = vzoom << 1;
105      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
106      int x, y, pix, zaddr, zmask;
107      const UINT16 *spritedata;
108
109      /* initialize the end address to the start address */
110      data[7] = addr;
111
112      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
113      if ((top >= bottom) || bank == 255)
114         continue;
115
116      /* clamp to within the memory region size */
117      if (numbanks)
118         bank %= numbanks;
119      spritedata = spritebase + 0x8000 * bank;
120
121      /* determine the starting zoom address and mask */
122      zaddr = (vzoom & 0x38) << 5;
123      zmask = 1 << (vzoom & 7);
124
125      /* loop from top to bottom */
126      for (y = top; y < bottom; y++)
127      {
128         /* advance a row */
129         addr += pitch;
130
131         /* if the zoom bit says so, add pitch a second time */
132         if (zoom[zaddr++] & zmask)
133            addr += pitch;
134
135         /* skip drawing if not within the cliprect */
136         if (y >= cliprect->min_y && y <= cliprect->max_y)
137         {
138            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
139            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
140            int xacc = 0x00;
141
142            /* note that the System 16A sprites have a design flaw that allows the address */
143            /* to carry into the flip flag, which is the topmost bit -- it is very important */
144            /* to emulate this as the games compensate for it */
145
146            /* non-flipped case */
147            if (!(addr & 0x8000))
148            {
149               /* start at the word before because we preincrement below */
150               data[7] = addr - 1;
151               for (x = xpos; x <= cliprect->max_x; )
152               {
153                  UINT16 pixels = spritedata[++data[7] & 0x7fff];
154
155                  /* draw four pixels */
156                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
157                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
158                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
159                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
160
161                  /* stop if the last pixel in the group was 0xf */
162                  if (pix == 15)
163                     break;
164               }
165            }
166
167            /* flipped case */
168            else
169            {
170               /* start at the word after because we predecrement below */
171               data[7] = addr + 1;
172               for (x = xpos; x <= cliprect->max_x; )
173               {
174                  UINT16 pixels = spritedata[--data[7] & 0x7fff];
175
176                  /* draw four pixels */
177                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
178                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
179                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
180                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) hangon_draw_pixel(); x++; }
181
182                  /* stop if the last pixel in the group was 0xf */
183                  if (pix == 15)
184                     break;
185               }
186            }
187         }
188      }
189   }
190}
191
192
193
194/*******************************************************************************************
195 *
196 *  Space Harrier-style sprites
197 *
198 *      Offs  Bits               Usage
199 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
200 *       +0   -------- tttttttt  Top scanline of sprite - 1
201 *       +2   bbbb---- --------  Sprite bank
202 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
203 *       +4   s------- --------  Sprite shadow enable (0=enable, 1=disable)
204 *       +4   -p------ --------  Sprite priority
205 *       +4   --cccccc --------  Sprite color palette
206 *       +4   -------- -ppppppp  Signed 7-bit pitch value between scanlines
207 *       +6   f------- --------  Horizontal flip: read the data backwards if set
208 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
209 *       +8   --zzzzzz --------  Horizontal zoom factor
210 *       +8   -------- --zzzzzz  Vertical zoom factor
211 *       +E   dddddddd dddddddd  Scratch space for current address
212 *
213 *  Special notes:
214 *
215 *      There is an interaction between the horizonal flip bit and the offset.
216 *      The offset is maintained as a 16-bit value, even though only the lower
217 *      15 bits are used for the address. The top bit is used to control flipping.
218 *      This means that if the low 15 bits overflow during rendering, the sprite
219 *      data will be read backwards after the overflow. This is important to
220 *      emulate correctly as many games make use of this feature to render sprites
221 *      at the beginning of a bank.
222 *
223 *******************************************************************************************/
224
225#define sharrier_draw_pixel()                                    \
226   /* only draw if onscreen, not 0 or 15 */                        \
227   if (pix != 0 && pix != 15)                                    \
228   {                                                      \
229      /* are we high enough priority to be visible? */               \
230      if (sprpri > pri[x])                                    \
231      {                                                   \
232         /* shadow/hilight mode? */                              \
233         if (shadow && pix == 0xa)                              \
234            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
235                                                         \
236         /* regular draw */                                    \
237         else                                             \
238            dest[x] = pix | color;                              \
239      }                                                   \
240                                                         \
241      /* always mark priority so no one else draws here */            \
242      pri[x] = 0xff;                                          \
243   }                                                      \
244
245void segaic16_sprites_sharrier_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
246{
247   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x20000;
248   const UINT32 *spritebase = (const UINT32 *)memory_region(machine, "gfx2");
249   const UINT8 *zoom = (const UINT8 *)memory_region(machine, "proms");
250   sega16sp_state *sega16sp = get_safe_token(device);
251   UINT16* data = sega16sp->spriteram;
252
253   /* first scan forward to find the end of the list */
254   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
255      if ((data[0] >> 8) > 0xf0)
256         break;
257
258   /* now scan backwards and render the sprites in order */
259   for (data -= 8; data >= sega16sp->spriteram; data -= 8)
260   {
261      int bottom  = (data[0] >> 8) + 1;
262      int top     = (data[0] & 0xff) + 1;
263      int bank    = sega16sp->bank[(data[1] >> 12) & 0x7];
264      int xpos    = (data[1] & 0x1ff) - 0xbd;
265      int shadow  = (~data[2] >> 15) & 1;
266      int sprpri  = ((data[2] >> 14) & 1) ? (1<<3) : (1<<1);
267      int color   = sega16sp->colorbase + (((data[2] >> 8) & 0x3f) << 4);
268      int pitch   = (INT16)(data[2] << 9) >> 9;
269      UINT16 addr = data[3];
270      int hzoom   = ((data[4] >> 8) & 0x3f) << 1;
271      int vzoom   = (data[4] >> 0) & 0x3f;
272      int x, y, pix, zaddr, zmask;
273      const UINT32 *spritedata;
274
275      /* initialize the end address to the start address */
276      data[7] = addr;
277
278      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
279      if ((top >= bottom) || bank == 255)
280         continue;
281
282      /* clamp to within the memory region size */
283      if (numbanks)
284         bank %= numbanks;
285      spritedata = spritebase + 0x8000 * bank;
286
287      /* determine the starting zoom address and mask */
288      zaddr = (vzoom & 0x38) << 5;
289      zmask = 1 << (vzoom & 7);
290
291      /* loop from top to bottom */
292      for (y = top; y < bottom; y++)
293      {
294         /* advance a row */
295         addr += pitch;
296
297         /* if the zoom bit says so, add pitch a second time */
298         if (zoom[zaddr++] & zmask)
299            addr += pitch;
300
301         /* skip drawing if not within the cliprect */
302         if (y >= cliprect->min_y && y <= cliprect->max_y)
303         {
304            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
305            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
306            int xacc = 0x00;
307
308            /* note that the System 16A sprites have a design flaw that allows the address */
309            /* to carry into the flip flag, which is the topmost bit -- it is very important */
310            /* to emulate this as the games compensate for it */
311
312            /* non-flipped case */
313            if (!(addr & 0x8000))
314            {
315               /* start at the word before because we preincrement below */
316               data[7] = addr - 1;
317               for (x = xpos; x <= cliprect->max_x; )
318               {
319                  UINT32 pixels = spritedata[++data[7] & 0x7fff];
320
321                  /* draw 8 pixels */
322                  pix = (pixels >> 28) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
323                  pix = (pixels >> 24) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
324                  pix = (pixels >> 20) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
325                  pix = (pixels >> 16) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
326                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
327                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
328                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
329                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
330
331                  /* stop if the last pixel in the group was 0xf */
332                  if (pix == 15)
333                     break;
334               }
335            }
336
337            /* flipped case */
338            else
339            {
340               /* start at the word after because we predecrement below */
341               data[7] = addr + 1;
342               for (x = xpos; x <= cliprect->max_x; )
343               {
344                  UINT32 pixels = spritedata[--data[7] & 0x7fff];
345
346                  /* draw 8 pixels */
347                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
348                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
349                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
350                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
351                  pix = (pixels >> 16) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
352                  pix = (pixels >> 20) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
353                  pix = (pixels >> 24) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
354                  pix = (pixels >> 28) & 0xf; xacc = (xacc & 0xff) + hzoom; if (xacc < 0x100) { if (x >= cliprect->min_x) sharrier_draw_pixel(); x++; }
355
356                  /* stop if the last pixel in the group was 0xf */
357                  if (pix == 15)
358                     break;
359               }
360            }
361         }
362      }
363   }
364}
365
366
367
368/*******************************************************************************************
369 *
370 *  System 16A-style sprites
371 *
372 *      Offs  Bits               Usage
373 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
374 *       +0   -------- tttttttt  Top scanline of sprite - 1
375 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
376 *       +4   pppppppp pppppppp  Signed 16-bit pitch value between scanlines
377 *       +6   -ooooooo oooooooo  Offset within selected sprite bank
378 *       +6   f------- --------  Horizontal flip: read the data backwards if set
379 *       +8   --cccccc --------  Sprite color palette
380 *       +8   -------- -bbb----  Sprite bank
381 *       +8   -------- ------pp  Sprite priority
382 *       +E   dddddddd dddddddd  Scratch space for current address
383 *
384 *  Special notes:
385 *
386 *      There is an interaction between the horizonal flip bit and the offset.
387 *      The offset is maintained as a 16-bit value, even though only the lower
388 *      15 bits are used for the address. The top bit is used to control flipping.
389 *      This means that if the low 15 bits overflow during rendering, the sprite
390 *      data will be read backwards after the overflow. This is important to
391 *      emulate correctly as many games make use of this feature to render sprites
392 *      at the beginning of a bank.
393 *
394 *******************************************************************************************/
395
396#define system16a_draw_pixel()                                    \
397   /* only draw if onscreen, not 0 or 15 */                        \
398   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
399   {                                                      \
400      /* are we high enough priority to be visible? */               \
401      if (sprpri > pri[x])                                    \
402      {                                                   \
403         /* shadow/hilight mode? */                              \
404         if (color == sega16sp->colorbase + (0x3f << 4))                  \
405            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
406                                                         \
407         /* regular draw */                                    \
408         else                                             \
409            dest[x] = pix | color;                              \
410      }                                                   \
411                                                         \
412      /* always mark priority so no one else draws here */            \
413      pri[x] = 0xff;                                          \
414   }                                                      \
415
416void segaic16_sprites_16a_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
417{
418   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
419   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
420   sega16sp_state *sega16sp = get_safe_token(device);
421   UINT16* data = sega16sp->spriteram;
422
423   /* first scan forward to find the end of the list */
424   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
425      if ((data[0] >> 8) > 0xf0)
426         break;
427
428   /* now scan backwards and render the sprites in order */
429   for (data -= 8; data >= sega16sp->spriteram; data -= 8)
430   {
431      int bottom  = (data[0] >> 8) + 1;
432      int top     = (data[0] & 0xff) + 1;
433      int xpos    = (data[1] & 0x1ff) - 0xbd;
434      int pitch   = (INT16)data[2];
435      UINT16 addr = data[3];
436      int color   = sega16sp->colorbase + (((data[4] >> 8) & 0x3f) << 4);
437      int bank    = sega16sp->bank[(data[4] >> 4) & 0x7];
438      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
439      const UINT16 *spritedata;
440      int x, y, pix, xdelta = 1;
441
442      /* initialize the end address to the start address */
443      data[7] = addr;
444
445      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
446      if ((top >= bottom) || bank == 255)
447         continue;
448
449      /* clamp to within the memory region size */
450      if (numbanks)
451         bank %= numbanks;
452      spritedata = spritebase + 0x8000 * bank;
453
454      /* adjust positions for screen flipping */
455      if (sega16sp->flip)
456      {
457         int temp = top;
458         top = 224 - bottom;
459         bottom = 224 - temp;
460         xpos = 320 - xpos;
461         xdelta = -1;
462      }
463
464      /* loop from top to bottom */
465      for (y = top; y < bottom; y++)
466      {
467         /* advance a row */
468         addr += pitch;
469
470         /* skip drawing if not within the cliprect */
471         if (y >= cliprect->min_y && y <= cliprect->max_y)
472         {
473            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
474            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
475
476            /* note that the System 16A sprites have a design flaw that allows the address */
477            /* to carry into the flip flag, which is the topmost bit -- it is very important */
478            /* to emulate this as the games compensate for it */
479
480            /* non-flipped case */
481            if (!(addr & 0x8000))
482            {
483               /* start at the word before because we preincrement below */
484               data[7] = addr - 1;
485               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
486               {
487                  UINT16 pixels = spritedata[++data[7] & 0x7fff];
488
489                  /* draw four pixels */
490                  pix = (pixels >> 12) & 0xf; system16a_draw_pixel(); x += xdelta;
491                  pix = (pixels >>  8) & 0xf; system16a_draw_pixel(); x += xdelta;
492                  pix = (pixels >>  4) & 0xf; system16a_draw_pixel(); x += xdelta;
493                  pix = (pixels >>  0) & 0xf; system16a_draw_pixel(); x += xdelta;
494
495                  /* stop if the last pixel in the group was 0xf */
496                  if (pix == 15)
497                     break;
498               }
499            }
500
501            /* flipped case */
502            else
503            {
504               /* start at the word after because we predecrement below */
505               data[7] = addr + 1;
506               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
507               {
508                  UINT16 pixels = spritedata[--data[7] & 0x7fff];
509
510                  /* draw four pixels */
511                  pix = (pixels >>  0) & 0xf; system16a_draw_pixel(); x += xdelta;
512                  pix = (pixels >>  4) & 0xf; system16a_draw_pixel(); x += xdelta;
513                  pix = (pixels >>  8) & 0xf; system16a_draw_pixel(); x += xdelta;
514                  pix = (pixels >> 12) & 0xf; system16a_draw_pixel(); x += xdelta;
515
516                  /* stop if the last pixel in the group was 0xf */
517                  if (pix == 15)
518                     break;
519               }
520            }
521         }
522      }
523   }
524}
525
526
527
528/*******************************************************************************************
529 *
530 *  System 16B-style sprites
531 *
532 *      Offs  Bits               Usage
533 *       +0   bbbbbbbb --------  Bottom scanline of sprite - 1
534 *       +0   -------- tttttttt  Top scanline of sprite - 1
535 *       +2   -------x xxxxxxxx  X position of sprite (position $BD is screen position 0)
536 *       +4   e------- --------  Signify end of sprite list
537 *       +4   -h------ --------  Hide this sprite
538 *       +4   -------f --------  Horizontal flip: read the data backwards if set
539 *       +4   -------- pppppppp  Signed 8-bit pitch value between scanlines
540 *       +6   oooooooo oooooooo  Offset within selected sprite bank
541 *       +8   ----bbbb --------  Sprite bank
542 *       +8   -------- pp------  Sprite priority, relative to tilemaps
543 *       +8   -------- --cccccc  Sprite color palette
544 *       +A   ------vv vvv-----  Vertical zoom factor (0 = full size, 0x10 = half size)
545 *       +A   -------- ---hhhhh  Horizontal zoom factor (0 = full size, 0x10 = half size)
546 *       +E   dddddddd dddddddd  Scratch space for current address
547 *
548 *  Note that the zooming described below is 100% accurate to the real board.
549 *
550 *******************************************************************************************/
551
552#define system16b_draw_pixel()                                    \
553   /* only draw if onscreen, not 0 or 15 */                        \
554   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
555   {                                                      \
556      /* are we high enough priority to be visible? */               \
557      if (sprpri > pri[x])                                    \
558      {                                                   \
559         /* shadow/hilight mode? */                              \
560         if (color == sega16sp->colorbase + (0x3f << 4))                  \
561         {                                                \
562            /* we have to check this for System 18 so that we don't */  \
563            /* attempt to shadow VDP pixels */                     \
564            if (dest[x] < palette.entries)                        \
565               dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries; \
566         }                                                \
567                                                         \
568         /* regular draw */                                    \
569         else                                             \
570            dest[x] = pix | color;                              \
571      }                                                   \
572                                                         \
573      /* always mark priority so no one else draws here */            \
574      pri[x] = 0xff;                                          \
575   }                                                      \
576
577void segaic16_sprites_16b_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
578{
579   UINT8 numbanks;
580   const UINT16 *spritebase;
581   sega16sp_state *sega16sp = get_safe_token(device);
582   UINT16* data = sega16sp->spriteram;
583
584   spritebase = (const UINT16 *)memory_region(machine, "gfx2");
585   if (!spritebase)
586      return;
587
588   numbanks = memory_region_length(machine, "gfx2") / 0x20000;
589
590   /* first scan forward to find the end of the list */
591   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
592      if (data[2] & 0x8000)
593         break;
594
595   /* now scan backwards and render the sprites in order */
596   for (data -= 8; data >= sega16sp->spriteram; data -= 8)
597   {
598      int bottom  = data[0] >> 8;
599      int top     = data[0] & 0xff;
600      int xpos    = (data[1] & 0x1ff);
601      int hide    = data[2] & 0x4000;
602      int flip    = data[2] & 0x100;
603      int pitch   = (INT8)(data[2] & 0xff);
604      UINT16 addr = data[3];
605      int bank    = sega16sp->bank[(data[4] >> 8) & 0xf];
606      int sprpri  = 1 << ((data[4] >> 6) & 0x3);
607      int color   = sega16sp->colorbase + ((data[4] & 0x3f) << 4);
608      int vzoom   = (data[5] >> 5) & 0x1f;
609      int hzoom   = data[5] & 0x1f;
610      const UINT16 *spritedata;
611      int x, y, pix, xdelta = 1;
612
613      /* some bootlegs have offset sprites */
614      xpos += sega16sp->xoffs;
615      xpos &= 0x1ff;
616
617      /* originals all have this offset */
618      xpos -= 0xb8;
619
620      /* initialize the end address to the start address */
621      data[7] = addr;
622
623      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
624      if (hide || (top >= bottom) || bank == 255)
625         continue;
626
627      /* clamp to within the memory region size */
628      if (numbanks)
629         bank %= numbanks;
630      spritedata = spritebase + 0x10000 * bank;
631
632      /* reset the yzoom counter */
633      data[5] &= 0x03ff;
634
635      /* adjust positions for screen flipping */
636      if (sega16sp->flip)
637      {
638         int temp = top;
639         top = 224 - bottom;
640         bottom = 224 - temp;
641         xpos = 320 - xpos;
642         xdelta = -1;
643      }
644
645      /* loop from top to bottom */
646      for (y = top; y < bottom; y++)
647      {
648         /* advance a row */
649         addr += pitch;
650
651         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
652         data[5] += vzoom << 10;
653         if (data[5] & 0x8000)
654         {
655            addr += pitch;
656            data[5] &= ~0x8000;
657         }
658
659         /* skip drawing if not within the cliprect */
660         if (y >= cliprect->min_y && y <= cliprect->max_y)
661         {
662            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
663            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
664            int xacc;
665
666            /* compute the initial X zoom accumulator; this is verified on the real PCB */
667            xacc = 4 * hzoom;
668
669            /* non-flipped case */
670            if (!flip)
671            {
672               /* start at the word before because we preincrement below */
673               data[7] = addr - 1;
674               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
675               {
676                  UINT16 pixels = spritedata[++data[7]];
677
678                  /* draw four pixels */
679                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
680                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
681                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
682                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
683
684                  /* stop if the last pixel in the group was 0xf */
685                  if (pix == 15)
686                     break;
687               }
688            }
689
690            /* flipped case */
691            else
692            {
693               /* start at the word after because we predecrement below */
694               data[7] = addr + 1;
695               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
696               {
697                  UINT16 pixels = spritedata[--data[7]];
698
699                  /* draw four pixels */
700                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
701                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
702                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
703                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { system16b_draw_pixel(); x += xdelta; }
704
705                  /* stop if the last pixel in the group was 0xf */
706                  if (pix == 15)
707                     break;
708               }
709            }
710         }
711      }
712   }
713}
714
715
716/*******************************************************************************************
717 *
718 *  The Y-board variant has different mixing properties. The sprite implementation itself
719 *  is identical, however.
720 *
721 *******************************************************************************************/
722
723#define yboard_16b_draw_pixel()                                  \
724   /* only draw if onscreen, not 0 or 15 */                        \
725   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
726   {                                                      \
727      /* are we high enough priority to be visible? */               \
728      if ((sprpri & 0x1f) < (pri[x] & 0x1f))                        \
729      {                                                   \
730         /* shadow/hilight mode? */                              \
731         if (pix == 14)                                       \
732            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
733                                                         \
734         /* regular draw */                                    \
735         else                                             \
736            dest[x] = pix | color;                              \
737      }                                                   \
738                                                         \
739      /* always mark priority so no one else draws here */            \
740      pri[x] = 0;                                             \
741   }                                                      \
742
743void segaic16_sprites_yboard_16b_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
744{
745   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x20000;
746   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
747   sega16sp_state *sega16sp = get_safe_token(device);
748   UINT16* data = sega16sp->spriteram;
749
750   /* first scan forward to find the end of the list */
751   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
752      if (data[2] & 0x8000)
753         break;
754
755   /* now scan backwards and render the sprites in order */
756   for (data -= 8; data >= sega16sp->spriteram; data -= 8)
757   {
758      int bottom  = data[0] >> 8;
759      int top     = data[0] & 0xff;
760      int xpos    = (data[1] & 0x1ff) - 0xb8;
761      int sprpri  = (data[1] >> 8) & 0x1e;   // 0x00 = high, 0x7f = low -- 0x71 = ship in gforce, 0x31 = strike fighter logo
762      int hide    = data[2] & 0x4000;
763      int flip    = data[2] & 0x100;
764      int pitch   = (INT8)(data[2] & 0xff);
765      UINT16 addr = data[3];
766      int bank    = sega16sp->bank[(data[4] >> 8) & 0xf];
767      int color   = sega16sp->colorbase + ((data[4] & 0x7f) << 4);
768      int vzoom   = (data[5] >> 5) & 0x1f;
769      int hzoom   = data[5] & 0x1f;
770      const UINT16 *spritedata;
771      int x, y, pix, xdelta = 1;
772
773      /* initialize the end address to the start address */
774      data[7] = addr;
775
776      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
777      if (hide || (top >= bottom) || bank == 255)
778         continue;
779
780      /* clamp to within the memory region size */
781      if (numbanks)
782         bank %= numbanks;
783      spritedata = spritebase + 0x10000 * bank;
784
785      /* reset the yzoom counter */
786      data[5] &= 0x03ff;
787
788      /* adjust positions for screen flipping */
789      if (sega16sp->flip)
790      {
791         int temp = top;
792         top = 224 - bottom;
793         bottom = 224 - temp;
794         xpos = 320 - xpos;
795         xdelta = -1;
796      }
797
798      /* loop from top to bottom */
799      for (y = top; y < bottom; y++)
800      {
801         /* advance a row */
802         addr += pitch;
803
804         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
805         data[5] += vzoom << 10;
806         if (data[5] & 0x8000)
807         {
808            addr += pitch;
809            data[5] &= ~0x8000;
810         }
811
812         /* skip drawing if not within the cliprect */
813         if (y >= cliprect->min_y && y <= cliprect->max_y)
814         {
815            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
816            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
817            int xacc;
818
819            /* compute the initial X zoom accumulator; this is verified on the real PCB */
820            xacc = 4 * hzoom;
821
822            /* non-flipped case */
823            if (!flip)
824            {
825               /* start at the word before because we preincrement below */
826               data[7] = addr - 1;
827               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
828               {
829                  UINT16 pixels = spritedata[++data[7]];
830
831                  /* draw four pixels */
832                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
833                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
834                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
835                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
836
837                  /* stop if the last pixel in the group was 0xf */
838                  if (pix == 15)
839                     break;
840               }
841            }
842
843            /* flipped case */
844            else
845            {
846               /* start at the word after because we predecrement below */
847               data[7] = addr + 1;
848               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )
849               {
850                  UINT16 pixels = spritedata[--data[7]];
851
852                  /* draw four pixels */
853                  pix = (pixels >>  0) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
854                  pix = (pixels >>  4) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
855                  pix = (pixels >>  8) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
856                  pix = (pixels >> 12) & 0xf; xacc = (xacc & 0x3f) + hzoom; if (xacc < 0x40) { yboard_16b_draw_pixel(); x += xdelta; }
857
858                  /* stop if the last pixel in the group was 0xf */
859                  if (pix == 15)
860                     break;
861               }
862            }
863         }
864      }
865   }
866}
867
868
869
870/*******************************************************************************************
871 *
872 *  Out Run/X-Board-style sprites
873 *
874 *      Offs  Bits               Usage
875 *       +0   e------- --------  Signify end of sprite list
876 *       +0   -h-h---- --------  Hide this sprite if either bit is set
877 *       +0   ----bbb- --------  Sprite bank
878 *       +0   -------t tttttttt  Top scanline of sprite + 256
879 *       +2   oooooooo oooooooo  Offset within selected sprite bank
880 *       +4   ppppppp- --------  Signed 7-bit pitch value between scanlines
881 *       +4   -------x xxxxxxxx  X position of sprite (position $BE is screen position 0)
882 *       +6   -s------ --------  Enable shadows
883 *       +6   --pp---- --------  Sprite priority, relative to tilemaps
884 *       +6   ------vv vvvvvvvv  Vertical zoom factor (0x200 = full size, 0x100 = half size, 0x300 = 2x size)
885 *       +8   y------- --------  Render from top-to-bottom (1) or bottom-to-top (0) on screen
886 *       +8   -f------ --------  Horizontal flip: read the data backwards if set
887 *       +8   --x----- --------  Render from left-to-right (1) or right-to-left (0) on screen
888 *       +8   ------hh hhhhhhhh  Horizontal zoom factor (0x200 = full size, 0x100 = half size, 0x300 = 2x size)
889 *       +E   dddddddd dddddddd  Scratch space for current address
890 *
891 *    Out Run only:
892 *       +A   hhhhhhhh --------  Height in scanlines - 1
893 *       +A   -------- -ccccccc  Sprite color palette
894 *
895 *    X-Board only:
896 *       +A   ----hhhh hhhhhhhh  Height in scanlines - 1
897 *       +C   -------- cccccccc  Sprite color palette
898 *
899 *******************************************************************************************/
900
901#define outrun_draw_pixel()                                     \
902   /* only draw if onscreen, not 0 or 15 */                        \
903   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
904   {                                                      \
905      /* are we high enough priority to be visible? */               \
906      if (sprpri > pri[x])                                    \
907      {                                                   \
908         /* shadow/hilight mode? */                              \
909         if (shadow && pix == 0xa)                              \
910            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
911                                                         \
912         /* regular draw */                                    \
913         else                                             \
914            dest[x] = pix | color;                              \
915      }                                                   \
916                                                         \
917      /* always mark priority so no one else draws here */            \
918      pri[x] = 0xff;                                          \
919   }                                                      \
920
921static void segaic16_sprites_xboard_outrun_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect, int type)
922{
923   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x40000;
924   const UINT32 *spritebase = (const UINT32 *)memory_region(machine, "gfx2");
925   sega16sp_state *sega16sp = get_safe_token(device);
926   UINT16* data = sega16sp->spriteram;
927
928   /* first scan forward to find the end of the list */
929   for (data = sega16sp->buffer; data < sega16sp->buffer + sega16sp->ramsize/2; data += 8)
930      if (data[0] & 0x8000)
931         break;
932
933   /* now scan backwards and render the sprites in order */
934   for (data -= 8; data >= sega16sp->buffer; data -= 8)
935   {
936      int hide    = (data[0] & 0x5000);
937      int bank    = (data[0] >> 9) & 7;
938      int top     = (data[0] & 0x1ff) - 0x100;
939      UINT16 addr = data[1];
940      int pitch   = (INT16)((data[2] >> 1) | ((data[4] & 0x1000) << 3)) >> 8;
941      int xpos    = data[2] & 0x1ff;
942      int shadow  = (data[3] >> 14) & 1;
943      int sprpri  = 1 << ((data[3] >> 12) & 3);
944      int vzoom   = data[3] & 0x7ff;
945      int ydelta  = (data[4] & 0x8000) ? 1 : -1;
946      int flip    = (~data[4] >> 14) & 1;
947      int xdelta  = (data[4] & 0x2000) ? 1 : -1;
948      int hzoom   = data[4] & 0x7ff;
949      int height  = ((type == SEGAIC16_SPRITES_OUTRUN) ? (data[5] >> 8) : (data[5] & 0xfff)) + 1;
950      int color   = sega16sp->colorbase + (((type == SEGAIC16_SPRITES_OUTRUN) ? (data[5] & 0x7f) : (data[6] & 0xff)) << 4);
951      int x, y, ytarget, yacc = 0, pix;
952      const UINT32 *spritedata;
953
954      /* adjust X coordinate */
955      /* note: the threshhold below is a guess. If it is too high, rachero will draw garbage */
956      /* If it is too low, smgp won't draw the bottom part of the road */
957      if (xpos < 0x80 && xdelta < 0)
958         xpos += 0x200;
959      xpos -= 0xbe;
960
961      /* initialize the end address to the start address */
962      data[7] = addr;
963
964      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
965      if (hide || height == 0)
966         continue;
967
968      /* clamp to within the memory region size */
969      if (numbanks)
970         bank %= numbanks;
971      spritedata = spritebase + 0x10000 * bank;
972
973      /* clamp to a maximum of 8x (not 100% confirmed) */
974      if (vzoom < 0x40) vzoom = 0x40;
975      if (hzoom < 0x40) hzoom = 0x40;
976
977      /* loop from top to bottom */
978      ytarget = top + ydelta * height;
979      for (y = top; y != ytarget; y += ydelta)
980      {
981         /* skip drawing if not within the cliprect */
982         if (y >= cliprect->min_y && y <= cliprect->max_y)
983         {
984            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
985            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);
986            int xacc = 0;
987
988            /* non-flipped case */
989            if (!flip)
990            {
991               /* start at the word before because we preincrement below */
992               data[7] = addr - 1;
993               for (x = xpos; (xdelta > 0 && x <= cliprect->max_x) || (xdelta < 0 && x >= cliprect->min_x); )
994               {
995                  UINT32 pixels = spritedata[++data[7]];
996
997                  /* draw four pixels */
998                  pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
999                  pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1000                  pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1001                  pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1002                  pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1003                  pix = (pixels >>  8) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1004                  pix = (pixels >>  4) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1005                  pix = (pixels >>  0) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1006
1007                  /* stop if the second-to-last pixel in the group was 0xf */
1008                  if ((pixels & 0x000000f0) == 0x000000f0)
1009                     break;
1010               }
1011            }
1012
1013            /* flipped case */
1014            else
1015            {
1016               /* start at the word after because we predecrement below */
1017               data[7] = addr + 1;
1018               for (x = xpos; (xdelta > 0 && x <= cliprect->max_x) || (xdelta < 0 && x >= cliprect->min_x); )
1019               {
1020                  UINT32 pixels = spritedata[--data[7]];
1021
1022                  /* draw four pixels */
1023                  pix = (pixels >>  0) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1024                  pix = (pixels >>  4) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1025                  pix = (pixels >>  8) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1026                  pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1027                  pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1028                  pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1029                  pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1030                  pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { outrun_draw_pixel(); x += xdelta; xacc += hzoom; } xacc -= 0x200;
1031
1032                  /* stop if the second-to-last pixel in the group was 0xf */
1033                  if ((pixels & 0x0f000000) == 0x0f000000)
1034                     break;
1035               }
1036            }
1037         }
1038
1039         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
1040         yacc += vzoom;
1041         addr += pitch * (yacc >> 9);
1042         yacc &= 0x1ff;
1043      }
1044   }
1045}
1046
1047void segaic16_sprites_outrun_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1048{
1049   segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_OUTRUN);
1050}
1051
1052void segaic16_sprites_xboard_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1053{
1054   segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_XBOARD);
1055}
1056
1057
1058/*******************************************************************************************
1059 *
1060 *  Y-Board-style sprites
1061 *
1062 *      Offs  Bits               Usage
1063 *       +0   e------- --------  Signify end of sprite list
1064 *       +0   -----iii iiiiiiii  Address of indirection table (/16)
1065 *       +2   bbbb---- --------  Upper 4 bits of bank index
1066 *       +2   ----xxxx xxxxxxxx  X position of sprite (position $600 is screen position 0)
1067 *       +4   bbbb---- --------  Lower 4 bits of bank index
1068 *       +4   ----yyyy yyyyyyyy  Y position of sprite (position $600 is screen position 0)
1069 *       +6   oooooooo oooooooo  Offset within selected sprite bank
1070 *       +8   hhhhhhhh hhhhhhhh  Height of sprite
1071 *       +A   -y------ --------  Render from top-to-bottom (1) or bottom-to-top (0) on screen
1072 *       +A   --f----- --------  Horizontal flip: read the data backwards if set
1073 *       +A   ---x---- --------  Render from left-to-right (1) or right-to-left (0) on screen
1074 *       +A   -----zzz zzzzzzzz  Zoom factor
1075 *       +C   -ccc---- --------  Sprite color
1076 *       +C   ----rrrr --------  Sprite priority
1077 *       +C   -------- pppppppp  Signed 8-bit pitch value between scanlines
1078 *       +E   ----nnnn nnnnnnnn  Index of next sprite
1079 *
1080 *  In addition to these parameters, the sprite area is clipped using scanline extents
1081 *  stored for every pair of scanlines in the rotation RAM. It's a bit of a cheat for us
1082 *  to poke our nose into the rotation structure, but there are no known cases of Y-board
1083 *  sprites without rotation RAM.
1084 *
1085 *******************************************************************************************/
1086
1087#define yboard_draw_pixel()                                     \
1088   /* only draw if onscreen */                                    \
1089   if (x >= minx && x <= maxx && ind < 0x1fe)                        \
1090      dest[x] = ind | colorpri;                                 \
1091
1092void segaic16_sprites_yboard_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1093{
1094   UINT8 numbanks = memory_region_length(machine, "gfx1") / 0x80000;
1095   const UINT64 *spritebase = (const UINT64 *)memory_region(machine, "gfx1");
1096   const UINT16 *rotatebase = rotate[0].buffer ? rotate[0].buffer : rotate[0].rotateram;
1097   UINT8 visited[0x1000];
1098   sega16sp_state *sega16sp = get_safe_token(device);
1099   int next = 0;
1100   int y;
1101   UINT16* data = sega16sp->spriteram;
1102
1103   /* reset the visited list */
1104   memset(visited, 0, sizeof(visited));
1105
1106   /* clear out any scanlines we might be using */
1107   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
1108      if (!(rotatebase[y & ~1] & 0xc000))
1109         memset(BITMAP_ADDR16(bitmap, y, cliprect->min_x), 0xff, (cliprect->max_x - cliprect->min_x + 1) * sizeof(UINT16));
1110
1111   /* now scan backwards and render the sprites in order */
1112   for (data = sega16sp->spriteram; !(data[0] & 0x8000) && !visited[next]; data = sega16sp->spriteram + next * 8)
1113   {
1114      int hide    = (data[0] & 0x5000);
1115      UINT16 *indirect = sega16sp->spriteram + ((data[0] & 0x7ff) << 4);
1116      int bank    = ((data[1] >> 8) & 0x10) | ((data[2] >> 12) & 0x0f);
1117      int xpos    = (data[1] & 0xfff) - 0x600;
1118      int top     = (data[2] & 0xfff) - 0x600;
1119      UINT16 addr = data[3];
1120      int height  = data[4];
1121      int ydelta  = (data[5] & 0x4000) ? 1 : -1;
1122      int flip    = (~data[5] >> 13) & 1;
1123      int xdelta  = (data[5] & 0x1000) ? 1 : -1;
1124      int zoom    = data[5] & 0x7ff;
1125      int colorpri= (data[6] << 1) & 0xfe00;
1126      int pitch   = (INT8)data[6];
1127      int x, y, ytarget, yacc = 0, pix, ind;
1128      const UINT64 *spritedata;
1129      UINT16 offs;
1130
1131      /* note that we've visited this entry and get the offset of the next one */
1132      visited[next] = 1;
1133      next = data[7] & 0xfff;
1134
1135      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */
1136      if (hide || height == 0)
1137         continue;
1138
1139      /* clamp to within the memory region size */
1140      if (numbanks)
1141         bank %= numbanks;
1142      spritedata = spritebase + 0x10000 * bank;
1143
1144      /* clamp to a maximum of 8x (not 100% confirmed) */
1145      if (zoom == 0) zoom = 1;
1146
1147      /* loop from top to bottom */
1148      ytarget = top + ydelta * height;
1149      for (y = top; y != ytarget; y += ydelta)
1150      {
1151         /* skip drawing if not within the cliprect */
1152         if (y >= cliprect->min_y && y <= cliprect->max_y)
1153         {
1154            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
1155            int minx = rotatebase[y & ~1];
1156            int maxx = rotatebase[y |  1];
1157            int xacc = 0;
1158
1159            /* bit 0x8000 from rotate RAM means that Y is above the top of the screen */
1160            if ((minx & 0x8000) && ydelta < 0)
1161               break;
1162
1163            /* bit 0x4000 from rotate RAM means that Y is below the bottom of the screen */
1164            if ((minx & 0x4000) && ydelta > 0)
1165               break;
1166
1167            /* if either bit is set, skip the rest for this scanline */
1168            if (!(minx & 0xc000))
1169            {
1170               /* clamp min/max to the cliprect */
1171               minx -= 0x600;
1172               maxx -= 0x600;
1173               if (minx < cliprect->min_x)
1174                  minx = cliprect->min_x;
1175               if (maxx > cliprect->max_x)
1176                  maxx = cliprect->max_x;
1177
1178               /* non-flipped case */
1179               if (!flip)
1180               {
1181                  /* start at the word before because we preincrement below */
1182                  offs = addr - 1;
1183                  for (x = xpos; (xdelta > 0 && x <= maxx) || (xdelta < 0 && x >= minx); )
1184                  {
1185                     UINT64 pixels = spritedata[++offs];
1186
1187                     /* draw four pixels */
1188                     pix = (pixels >> 60) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1189                     pix = (pixels >> 56) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1190                     pix = (pixels >> 52) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1191                     pix = (pixels >> 48) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1192                     pix = (pixels >> 44) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1193                     pix = (pixels >> 40) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1194                     pix = (pixels >> 36) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1195                     pix = (pixels >> 32) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1196                     pix = (pixels >> 28) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1197                     pix = (pixels >> 24) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1198                     pix = (pixels >> 20) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1199                     pix = (pixels >> 16) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1200                     pix = (pixels >> 12) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1201                     pix = (pixels >>  8) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1202                     pix = (pixels >>  4) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1203                     pix = (pixels >>  0) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1204
1205                     /* stop if the second-to-last pixel in the group was 0xf */
1206                     if (pix == 0x0f)
1207                        break;
1208                  }
1209               }
1210
1211               /* flipped case */
1212               else
1213               {
1214                  /* start at the word after because we predecrement below */
1215                  offs = addr + 1;
1216                  for (x = xpos; (xdelta > 0 && x <= maxx) || (xdelta < 0 && x >= minx); )
1217                  {
1218                     UINT64 pixels = spritedata[--offs];
1219
1220                     /* draw four pixels */
1221                     pix = (pixels >>  0) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1222                     pix = (pixels >>  4) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1223                     pix = (pixels >>  8) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1224                     pix = (pixels >> 12) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1225                     pix = (pixels >> 16) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1226                     pix = (pixels >> 20) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1227                     pix = (pixels >> 24) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1228                     pix = (pixels >> 28) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1229                     pix = (pixels >> 32) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1230                     pix = (pixels >> 36) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1231                     pix = (pixels >> 40) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1232                     pix = (pixels >> 44) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1233                     pix = (pixels >> 48) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1234                     pix = (pixels >> 52) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1235                     pix = (pixels >> 56) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1236                     pix = (pixels >> 60) & 0xf; ind = indirect[pix]; while (xacc < 0x200) { yboard_draw_pixel(); x += xdelta; xacc += zoom; } xacc -= 0x200;
1237
1238                     /* stop if the second-to-last pixel in the group was 0xf */
1239                     if (pix == 0x0f)
1240                        break;
1241                  }
1242               }
1243            }
1244         }
1245
1246         /* accumulate zoom factors; if we carry into the high bit, skip an extra row */
1247         yacc += zoom;
1248         addr += pitch * (yacc >> 9);
1249         yacc &= 0x1ff;
1250      }
1251   }
1252}
1253
1254/* bootlegs */
1255
1256/*
1257
1258 the system16a bootleg sprite hardware differs in subtle ways on a per game basis
1259 with each game having the words swapped around.
1260
1261 there are also some subtle, but important changes when compared to the original
1262 system16a sprites, mainly the increment of the address not happening until
1263 the end of the loop
1264
1265*/
1266
1267/* ignores the sprite priority until we understand priority better on the bootlegs */
1268#define system16a_bootleg_draw_pixel()                                    \
1269   /* only draw if onscreen, not 0 or 15 */                        \
1270   if (x >= cliprect->min_x && x <= cliprect->max_x && pix != 0 && pix != 15) \
1271   {                                                      \
1272      /* are we high enough priority to be visible? */               \
1273      if (sprpri || 1)                                    \
1274      {                                                   \
1275         /* shadow/hilight mode? */                              \
1276         if (color == sega16sp->colorbase + (0x3f << 4))                  \
1277            dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? palette.entries*2 : palette.entries;   \
1278                                                         \
1279         /* regular draw */                                    \
1280         else                                             \
1281            dest[x] = pix | color;                              \
1282      }                                                   \
1283                                                         \
1284      /* always mark priority so no one else draws here */            \
1285      pri[x] = 0xff;                                          \
1286   }                                                      \
1287
1288
1289/* make this an actual function */
1290#define system16a_bootleg_draw_core()                                       \
1291   {                                                               \
1292      const UINT16 *spritedata;                                          \
1293      int x, y, pix, xdelta = 1;                                          \
1294                                                                  \
1295      xpos += sega16sp->xoffs;                                             \
1296      xpos &= 0x1ff;                                                   \
1297                                                                  \
1298      xpos -= 0xbd;                                                   \
1299                                                                  \
1300      /* initialize the end address to the start address */                     \
1301      data[7] = addr;                                                \
1302                                                                  \
1303      /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */      \
1304      if ((top >= bottom) || bank == 255)                                    \
1305         continue;                                                   \
1306                                                                  \
1307      /* clamp to within the memory region size */                           \
1308      if (numbanks)                                                   \
1309         bank %= numbanks;                                             \
1310      spritedata = spritebase + 0x8000 * bank;                              \
1311                                                                  \
1312      /* adjust positions for screen flipping */                              \
1313      if (sega16sp->flip)                                                   \
1314      {                                                            \
1315         int temp = top;                                                \
1316         top = 224 - bottom;                                             \
1317         bottom = 224 - temp;                                          \
1318         xpos = 320 - xpos;                                             \
1319         xdelta = -1;                                                \
1320      }                                                            \
1321                                                                  \
1322      /* loop from top to bottom */                                       \
1323      for (y = top; y < bottom; y++)                                       \
1324      {                                                            \
1325                                                                  \
1326         /* skip drawing if not within the cliprect */                        \
1327         if (y >= cliprect->min_y && y <= cliprect->max_y)                     \
1328         {                                                         \
1329            UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);                        \
1330            UINT8 *pri = BITMAP_ADDR8(machine->priority_bitmap, y, 0);                  \
1331                                                                  \
1332            /* note that the System 16A sprites have a design flaw that allows the address */      \
1333            /* to carry into the flip flag, which is the topmost bit -- it is very important */      \
1334            /* to emulate this as the games compensate for it */                           \
1335                                                                              \
1336            /* non-flipped case */                                                   \
1337            if (!(addr & 0x8000))                                                   \
1338            {                                                                  \
1339               /* start at the word before because we preincrement below */                  \
1340               data[7] = addr - 1;                                                \
1341               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )                                 \
1342               {                                                               \
1343                  UINT16 pixels = spritedata[++data[7] & 0x7fff];                           \
1344                                                                              \
1345                  /* draw four pixels */                                             \
1346                  pix = (pixels >> 12) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1347                  pix = (pixels >>  8) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1348                  pix = (pixels >>  4) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1349                  pix = (pixels >>  0) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1350                                                                              \
1351                  /* stop if the last pixel in the group was 0xf */                        \
1352                  if (pix == 15)                                                   \
1353                     break;                                                      \
1354               }                                                               \
1355            }                                                                  \
1356                                                                              \
1357            /* flipped case */                                                      \
1358            else                                                               \
1359            {                                                                  \
1360               /* start at the word after because we predecrement below */                     \
1361               data[7] = addr + 1;                                                   \
1362               for (x = xpos; ((xpos - x) & 0x1ff) != 1; )                                 \
1363               {                                                               \
1364                  UINT16 pixels = spritedata[--data[7] & 0x7fff];                           \
1365                                                                              \
1366                  /* draw four pixels */                                             \
1367                  pix = (pixels >>  0) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1368                  pix = (pixels >>  4) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1369                  pix = (pixels >>  8) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1370                  pix = (pixels >> 12) & 0xf; system16a_bootleg_draw_pixel(); x += xdelta;      \
1371                                                                              \
1372                  /* stop if the last pixel in the group was 0xf */                        \
1373                  if (pix == 15)                                                   \
1374                     break;                                                      \
1375               }                                                               \
1376            }                                                                  \
1377         }                                                                     \
1378                                                                              \
1379         /* advance a row - must be done at the end on the bootlegs! */                        \
1380         addr += pitch;                                                            \
1381      }                                                                        \
1382   }                                                                           \
1383
1384
1385
1386void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1387{
1388   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
1389   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
1390   sega16sp_state *sega16sp = get_safe_token(device);
1391   UINT16* data = sega16sp->spriteram;
1392
1393   for (data = sega16sp->spriteram; data < sega16sp->spriteram+ sega16sp->ramsize/2; data += 8)
1394   {
1395      int bottom  = (data[4] >> 8);
1396      int top     = (data[4] & 0xff);
1397      int xpos    = (data[0]);
1398      int pitch   = (INT16)data[5];
1399      UINT16 addr = data[1];
1400      int color   = sega16sp->colorbase + (((data[6] >> 8) & 0x3f) << 4);
1401      int bank    = sega16sp->bank[(data[6] >> 4) & 0x7];
1402      int sprpri  = 1 << ((data[6] >> 0) & 0x3);
1403
1404      system16a_bootleg_draw_core();
1405   }
1406}
1407
1408/* 4 player passing shot is different to this.. */
1409void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1410{
1411   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
1412   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
1413   sega16sp_state *sega16sp = get_safe_token(device);
1414   UINT16* data = sega16sp->spriteram;
1415
1416   for (data = sega16sp->spriteram; data < sega16sp->spriteram+ sega16sp->ramsize/2; data += 8)
1417   {
1418      int bottom  = (data[1] >> 8)-1;
1419      int top     = (data[1] & 0xff)-1;
1420      int xpos    = (data[0]);
1421      int pitch   = (INT16)data[3];
1422      UINT16 addr = data[2];
1423      int color   = sega16sp->colorbase + (((data[5] >> 8) & 0x3f) << 4);
1424      int bank    = sega16sp->bank[(data[5] >> 4) & 0x7];
1425      int sprpri  = 1 << ((data[5] >> 0) & 0x3);
1426
1427      system16a_bootleg_draw_core();
1428   }
1429}
1430
1431void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine *machine, running_device *device, bitmap_t *bitmap, const rectangle *cliprect)
1432{
1433   UINT8 numbanks = memory_region_length(machine, "gfx2") / 0x10000;
1434   const UINT16 *spritebase = (const UINT16 *)memory_region(machine, "gfx2");
1435   sega16sp_state *sega16sp = get_safe_token(device);
1436   UINT16* data = sega16sp->spriteram;
1437
1438   for (data = sega16sp->spriteram; data < sega16sp->spriteram+ sega16sp->ramsize/2; data += 8)
1439   {
1440      int bottom  = (data[0] >> 8)-1;
1441      int top     = (data[0] & 0xff)-1;
1442      int xpos    = (data[1]);
1443      int pitch   = (INT16)data[2];
1444      UINT16 addr = data[3];
1445      int color   = sega16sp->colorbase + (((data[4] >> 8) & 0x3f) << 4);
1446      int bank    = sega16sp->bank[(data[4] >> 4) & 0x7];
1447      int sprpri  = 1 << ((data[4] >> 0) & 0x3);
1448
1449      system16a_bootleg_draw_core();
1450   }
1451}
1452
1453/*************************************
1454 *
1455 *  General sprite drawing
1456 *
1457 *************************************/
1458
1459void segaic16_sprites_draw(running_device *screen, bitmap_t *bitmap, const rectangle *cliprect, int which)
1460{
1461   running_device* device = 0;
1462   sega16sp_state *sega16sp;
1463
1464   if (!which)
1465      device = devtag_get_device(screen->machine,"segaspr1");
1466   else
1467      device = devtag_get_device(screen->machine,"segaspr2");
1468
1469   if (!device)
1470      fatalerror("segaic16_sprites_draw device not found\n");
1471
1472   sega16sp = get_safe_token(device);
1473
1474   if (!sega16sp->which)
1475      sega16sp->spriteram = segaic16_spriteram_0;
1476   else
1477      sega16sp->spriteram = segaic16_spriteram_1;
1478
1479   (*sega16sp->draw)(screen->machine, device, bitmap, cliprect);
1480}
1481
1482
1483
1484/*************************************
1485 *
1486 *  General sprite banking
1487 *
1488 *************************************/
1489
1490void segaic16_sprites_set_bank(running_machine *machine, int which, int banknum, int offset)
1491{
1492   running_device* device = 0;
1493
1494   if (!which)
1495      device = devtag_get_device(machine,"segaspr1");
1496   else
1497      device = devtag_get_device(machine,"segaspr2");
1498
1499   if (!device)
1500      fatalerror("segaic16_sprites_set_bank device not found\n");
1501
1502   sega16sp_state *sega16sp = get_safe_token(device);
1503
1504   if (sega16sp->bank[banknum] != offset)
1505   {
1506      running_device *screen = machine->primary_screen;
1507      video_screen_update_partial(screen, video_screen_get_vpos(screen));
1508      sega16sp->bank[banknum] = offset;
1509   }
1510}
1511
1512
1513
1514/*************************************
1515 *
1516 *  General sprite screen flipping
1517 *
1518 *************************************/
1519
1520void segaic16_sprites_set_flip(running_machine *machine, int which, int flip)
1521{
1522   running_device* device = 0;
1523
1524   if (!which)
1525      device = devtag_get_device(machine,"segaspr1");
1526   else
1527      device = devtag_get_device(machine,"segaspr2");
1528
1529   if (!device)
1530      fatalerror("segaic16_sprites_set_flip device not found\n");
1531
1532   sega16sp_state *sega16sp = get_safe_token(device);
1533
1534   flip = (flip != 0);
1535   if (sega16sp->flip != flip)
1536   {
1537      running_device *screen = machine->primary_screen;
1538      video_screen_update_partial(screen, video_screen_get_vpos(screen));
1539      sega16sp->flip = flip;
1540   }
1541}
1542
1543
1544
1545/*************************************
1546 *
1547 *  General sprite shadows
1548 *
1549 *************************************/
1550
1551void segaic16_sprites_set_shadow(running_machine *machine, int which, int shadow)
1552{
1553   running_device* device = 0;
1554
1555   if (!which)
1556      device = devtag_get_device(machine,"segaspr1");
1557   else
1558      device = devtag_get_device(machine,"segaspr2");
1559
1560   if (!device)
1561      fatalerror("segaic16_sprites_set_shadow device not found\n");
1562
1563   sega16sp_state *sega16sp = get_safe_token(device);
1564
1565   shadow = (shadow != 0);
1566   if (sega16sp->shadow != shadow)
1567   {
1568      running_device *screen = machine->primary_screen;
1569      video_screen_update_partial(screen, video_screen_get_vpos(screen));
1570      sega16sp->shadow = shadow;
1571   }
1572}
1573
1574
1575
1576/*************************************
1577 *
1578 *  General sprite buffer control
1579 *
1580 *************************************/
1581
1582static void segaic16_sprites_buffer(running_device* device)
1583{
1584   sega16sp_state *sega16sp = get_safe_token(device);
1585
1586   if (!sega16sp->which)
1587      sega16sp->spriteram = segaic16_spriteram_0;
1588   else
1589      sega16sp->spriteram = segaic16_spriteram_1;
1590
1591
1592   if (sega16sp->buffer)
1593   {
1594      UINT32 *src = (UINT32 *)sega16sp->spriteram;
1595      UINT32 *dst = (UINT32 *)sega16sp->buffer;
1596      int i;
1597
1598      /* swap the halves of the sprite RAM */
1599      for (i = 0; i < sega16sp->ramsize/4; i++)
1600      {
1601         UINT32 temp = *src;
1602         *src++ = *dst;
1603         *dst++ = temp;
1604      }
1605
1606      /* hack for thunderblade */
1607      *sega16sp->spriteram = 0xffff;
1608   }
1609
1610   /* we will render the sprites when the video update happens */
1611}
1612
1613
1614WRITE16_HANDLER( segaic16_sprites_draw_0_w )
1615{
1616   running_device* device = 0;
1617
1618   device = devtag_get_device(space->machine,"segaspr1");
1619
1620   if (!device)
1621      fatalerror("segaic16_sprites_draw_0_w device not found\n");
1622
1623   segaic16_sprites_buffer(device);
1624}
1625
1626
1627WRITE16_HANDLER( segaic16_sprites_draw_1_w )
1628{
1629   running_device* device = 0;
1630
1631   device = devtag_get_device(space->machine,"segaspr2");
1632
1633   if (!device)
1634      fatalerror("segaic16_sprites_draw_1_w device not found\n");
1635
1636   if (device)
1637      segaic16_sprites_buffer(device);
1638}
1639
1640
1641/*****************************************************************************
1642    DEVICE INTERFACE
1643*****************************************************************************/
1644
1645static DEVICE_START( sega16sp )
1646{
1647   sega16sp_state *sega16sp = get_safe_token(device);
1648   const sega16sp_interface *intf = get_interface(device);
1649   int i;
1650
1651   sega16sp->flip = 0;
1652   sega16sp->shadow = 0;
1653
1654   for (i=0;i<16;i++)
1655      sega16sp->bank[i] = i;// intf->bank[i];
1656
1657   sega16sp->which = intf->which;
1658   sega16sp->colorbase = intf->colorbase;
1659   sega16sp->ramsize = intf->ramsize;
1660   sega16sp->xoffs = intf->xoffs;
1661   sega16sp->draw = intf->draw;
1662
1663   if (intf->buffer)
1664      sega16sp->buffer = auto_alloc_array(device->machine, UINT16, sega16sp->ramsize/2);
1665
1666
1667   state_save_register_device_item(device, 0, sega16sp->flip);
1668   state_save_register_device_item(device, 0, sega16sp->shadow);
1669   state_save_register_device_item_array(device, 0, sega16sp->bank);
1670   state_save_register_device_item(device, 0, sega16sp->colorbase);
1671   state_save_register_device_item(device, 0, sega16sp->xoffs);
1672
1673   if (intf->buffer)
1674      state_save_register_device_item_pointer(device, 0, ((UINT8 *) sega16sp->buffer), sega16sp->ramsize);
1675
1676
1677}
1678
1679
1680DEVICE_GET_INFO( sega16sp )
1681{
1682   switch (state)
1683   {
1684      /* --- the following bits of info are returned as 64-bit signed integers --- */
1685      case DEVINFO_INT_TOKEN_BYTES:         info->i = sizeof(sega16sp_state);               break;
1686      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_VIDEO;               break;
1687
1688      /* --- the following bits of info are returned as pointers to data or functions --- */
1689      case DEVINFO_FCT_START:               info->start = DEVICE_START_NAME(sega16sp);      break;
1690      case DEVINFO_FCT_STOP:               /* Nothing */                           break;
1691      case DEVINFO_FCT_RESET:               /*info->reset = DEVICE_RESET_NAME(sega16sp);*/   break;
1692
1693      /* --- the following bits of info are returned as NULL-terminated strings --- */
1694      case DEVINFO_STR_NAME:               strcpy(info->s, "Sega System SH/HO/OR/16/18/X/Y Sprites");            break;
1695      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Sega Video ICs");               break;
1696      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                     break;
1697      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                  break;
1698      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright MAME Team");         break;
1699   }
1700}
src/mame/video/konicdev.c
r7972r7973
1038310383{
1038410384   k001604_state *k001604 = k001604_get_safe_token(device);
1038510385
10386   int x, y;
10386   int x/*, y*/;
1038710387   COMBINE_DATA(k001604->tile_ram + offset);
1038810388
1038910389   if (k001604->layer_size)
1039010390   {
1039110391      x = offset & 0xff;
10392      y = offset / 256;
10392      /*y = offset / 256;*/
1039310393   }
1039410394   else
1039510395   {
1039610396      x = offset & 0x7f;
10397      y = offset / 128;
10397      /*y = offset / 128;*/
1039810398   }
1039910399
1040010400   if (k001604->layer_size)
src/mame/video/segas16a.c
r7972r7973
2323
2424   /* initialize the tile/text layers */
2525   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1);
26
27   /* initialize the sprites */
28   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16A, 0x400, 0);
2926}
3027
3128
src/mame/video/segahang.c
r7972r7973
2424   /* initialize the tile/text layers */
2525   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2);
2626
27   /* initialize the sprites */
28   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_HANGON, 0x400, 0);
29
3027   /* initialize the road */
3128   segaic16_road_init(machine, 0, SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0);
3229}
r7972r7973
4037   /* initialize the tile/text layers */
4138   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2);
4239
43   /* initialize the sprites */
44   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_SHARRIER, 0x400, 0);
45
4640   /* initialize the road */
4741   segaic16_road_init(machine, 0, SEGAIC16_ROAD_SHARRIER, 0x038, 0x7c0, 0x7c0, 0);
4842}
src/mame/video/ppu2c0x.c
r7972r7973
203203   };
204204
205205   /* Loop through the emphasis modes (8 total) */
206   for (color_emphasis = 0; color_emphasis < 8; color_emphasis ++)
206   for (color_emphasis = 0; color_emphasis < 8; color_emphasis++)
207207   {
208208      /*
209209        double r_mod = 0.0;
r7972r7973
10711071         if ((data & PPU_CONTROL1_COLOR_EMPHASIS) != (ppu2c0x->regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS))
10721072         {
10731073            int i;
1074            for (i = 0; i <= 0x1f; i ++)
1074            for (i = 0; i <= 0x1f; i++)
10751075            {
10761076               UINT8 oldColor = ppu2c0x->palette_ram[i];
10771077
r7972r7973
12751275   memset(ppu2c0x, 0, sizeof(*ppu2c0x));
12761276   ppu2c0x->scanlines_per_frame = (int) device->get_config_int(PPU2C0XINFO_INT_SCANLINES_PER_FRAME);
12771277
1278   /* usually, no security value... */
12781279   ppu2c0x->security_value = 0;
12791280
1281   /* ...except for VS. games which specific PPU types */
12801282   if (device->type == PPU_2C05_01)
12811283      ppu2c0x->security_value = 0x1b;   // game (jajamaru) doesn't seem to ever actually check it
12821284
r7972r7973
14431445   }
14441446}
14451447
1446DEVICE_GET_INFO(ppu2c05)
1448DEVICE_GET_INFO(ppu2c05_01)
14471449{
14481450   switch (state)
14491451   {
r7972r7973
14531455   }
14541456}
14551457
1458DEVICE_GET_INFO(ppu2c05_02)
1459{
1460   DEVICE_GET_INFO_CALL(ppu2c05_01);
1461}
1462
1463DEVICE_GET_INFO(ppu2c05_03)
1464{
1465   DEVICE_GET_INFO_CALL(ppu2c05_01);
1466}
1467
1468DEVICE_GET_INFO(ppu2c05_04)
1469{
1470   DEVICE_GET_INFO_CALL(ppu2c05_01);
1471}
1472
14561473DEVICE_GET_INFO(ppu2c07)
14571474{
14581475   switch (state)
src/mame/video/ppu2c0x.h
r7972r7973
7676#define PPU_2C03B   DEVICE_GET_INFO_NAME(ppu2c03b)      // Vs. Unisystem, Playchoice 10
7777#define PPU_2C04   DEVICE_GET_INFO_NAME(ppu2c04)      // Vs. Unisystem (four versions with different colors)
7878/* The PPU_2C05 variants have different protection value, set at DEVICE_START, but otherwise are all the same... */
79#define PPU_2C05_01   DEVICE_GET_INFO_NAME(ppu2c05)   // Vs. Unisystem (Ninja Jajamaru Kun)
80#define PPU_2C05_02   DEVICE_GET_INFO_NAME(ppu2c05)   // Vs. Unisystem (Mighty Bomb Jack)
81#define PPU_2C05_03   DEVICE_GET_INFO_NAME(ppu2c05)   // Vs. Unisystem (Gumshoe)
82#define PPU_2C05_04   DEVICE_GET_INFO_NAME(ppu2c05)   // Vs. Unisystem (Top Gun)
79#define PPU_2C05_01   DEVICE_GET_INFO_NAME(ppu2c05_01)   // Vs. Unisystem (Ninja Jajamaru Kun)
80#define PPU_2C05_02   DEVICE_GET_INFO_NAME(ppu2c05_02)   // Vs. Unisystem (Mighty Bomb Jack)
81#define PPU_2C05_03   DEVICE_GET_INFO_NAME(ppu2c05_03)   // Vs. Unisystem (Gumshoe)
82#define PPU_2C05_04   DEVICE_GET_INFO_NAME(ppu2c05_04)   // Vs. Unisystem (Top Gun)
8383#define PPU_2C07   DEVICE_GET_INFO_NAME(ppu2c07)      // PAL NES
8484
8585/* callback datatypes */
r7972r7973
105105DEVICE_GET_INFO(ppu2c02);
106106DEVICE_GET_INFO(ppu2c03b);
107107DEVICE_GET_INFO(ppu2c04);
108DEVICE_GET_INFO(ppu2c05);
108DEVICE_GET_INFO(ppu2c05_01);
109DEVICE_GET_INFO(ppu2c05_02);
110DEVICE_GET_INFO(ppu2c05_03);
111DEVICE_GET_INFO(ppu2c05_04);
109112DEVICE_GET_INFO(ppu2c07);
110113
111114/* routines */
src/mame/video/segas16b.c
r7972r7973
2323
2424   /* initialize the tile/text layers */
2525   segaic16_tilemap_init(machine, 0, type, 0x000, 0, 2);
26
27   /* initialize the sprites */
28   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16B, 0x400, 0);
2926}
3027
3128
src/mame/video/taito_f3.c
r7972r7973
29222922   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
29232923   const int min_x=visarea->min_x,max_x=visarea->max_x;
29242924   const int min_y=visarea->min_y,max_y=visarea->max_y;
2925   int offs,spritecont,flipx,flipy,old_x,color,x,y;
2925   int offs,spritecont,flipx,flipy,/*old_x,*/color,x,y;
29262926   int sprite,global_x=0,global_y=0,subglobal_x=0,subglobal_y=0;
29272927   int block_x=0, block_y=0;
29282928   int last_color=0,last_x=0,last_y=0,block_zoom_x=0,block_zoom_y=0;
r7972r7973
29392939
29402940   color=0;
29412941   flipx=flipy=0;
2942   old_x=0;
2942   //old_x=0;
29432943   y=x=0;
29442944
29452945   sprite_top=0x1000;
src/mame/video/segas18.c
r7972r7973
4141   /* initialize the tile/text layers */
4242   segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8);
4343
44   /* initialize the sprites */
45   segaic16_sprites_init(machine, 0, SEGAIC16_SPRITES_16B, 0x400, 0);
46
4744   /* create the VDP */
4845   system18_vdp_start(machine);
4946
src/mame/layout/stisub.lay
r0r7973
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="double" defstate="0">
4      <rect state="1">
5         <color red="1.0" green="0.0" blue="0.0" />
6      </rect>
7      <rect state="0">
8         <color red="0.3" green="0.0" blue="0.0" />
9      </rect>
10      <text string="DOUBLE">
11         <color red="0.0" green="0.0" blue="0.0" />
12         <bounds x="0" y="0.1" width="1" height="0.4" />
13      </text>
14      <text string="INFO">
15         <color red="0.0" green="0.0" blue="0.0" />
16         <bounds x="0" y="0.5" width="1" height="0.4" />
17      </text>
18   </element>
19
20   <element name="take" defstate="0">
21      <rect state="1">
22         <color red="1.0" green="0.0" blue="0.0" />
23      </rect>
24      <rect state="0">
25         <color red="0.3" green="0.0" blue="0.0" />
26      </rect>
27      <text string="TAKE">
28         <color red="0.0" green="0.0" blue="0.0" />
29         <bounds x="0" y="0.1" width="1" height="0.4" />
30      </text>
31      <text string="STOP 1">
32         <color red="0.0" green="0.0" blue="0.0" />
33         <bounds x="0" y="0.5" width="1" height="0.4" />
34      </text>
35   </element>
36
37   <element name="bet" defstate="0">
38      <rect state="1">
39         <color red="1.0" green="0.0" blue="0.0" />
40      </rect>
41      <rect state="0">
42         <color red="0.3" green="0.0" blue="0.0" />
43      </rect>
44      <text string="BET">
45         <color red="0.0" green="0.0" blue="0.0" />
46         <bounds x="0" y="0.1" width="1" height="0.4" />
47      </text>
48      <text string="STOP 2">
49         <color red="0.0" green="0.0" blue="0.0" />
50         <bounds x="0" y="0.5" width="1" height="0.4" />
51      </text>
52   </element>
53
54   <element name="big" defstate="0">
55      <rect state="1">
56         <color red="1.0" green="0.0" blue="0.0" />
57      </rect>
58      <rect state="0">
59         <color red="0.3" green="0.0" blue="0.0" />
60      </rect>
61      <text string="BIG/RED ">
62         <color red="0.0" green="0.0" blue="0.0" />
63         <bounds x="0" y="0.1" width="1" height="0.4" />
64      </text>
65   </element>
66
67   <element name="small" defstate="0">
68      <rect state="1">
69         <color red="1.0" green="0.0" blue="0.0" />
70      </rect>
71      <rect state="0">
72         <color red="0.3" green="0.0" blue="0.0" />
73      </rect>
74      <text string="SMALL/BLACK">
75         <color red="0.0" green="0.0" blue="0.0" />
76         <bounds x="0" y="0.1" width="1" height="0.4" />
77      </text>
78      <text string="STOP 3">
79         <color red="0.0" green="0.0" blue="0.0" />
80         <bounds x="0" y="0.5" width="1" height="0.4" />
81      </text>
82   </element>
83
84   <element name="start" defstate="0">
85      <rect state="1">
86         <color red="1.0" green="1.0" blue="0.0" />
87      </rect>
88      <rect state="0">
89         <color red="0.2" green="0.2" blue="0.0" />
90      </rect>
91      <text string="START">
92         <color red="0.0" green="0.0" blue="0.0" />
93         <bounds x="0" y="0.1" width="1" height="0.4" />
94      </text>
95      <text string="STOP ALL">
96         <color red="0.0" green="0.0" blue="0.0" />
97         <bounds x="0" y="0.5" width="1" height="0.4" />
98      </text>
99   </element>
100
101   <element name="unknown" defstate="0">
102      <rect state="1">
103         <color red="1.0" green="1.0" blue="0.0" />
104      </rect>
105      <rect state="0">
106         <color red="0.0" green="0.0" blue="0.0" />
107      </rect>
108      <text string="?">
109         <color red="0.0" green="0.0" blue="0.0" />
110         <bounds x="0" y="0.2" width="1" height="0.6" />
111      </text>
112   </element>
113
114   <view name="Button Lamps">
115      <screen index="0">
116         <bounds left="0" top="0" right="4" bottom="3" />
117      </screen>
118      <bezel name="lamp0" element="small">
119         <bounds x="1.95" y="3.13" width="0.55" height="0.24" />
120      </bezel>
121      <bezel name="lamp1" element="double">
122         <bounds x="0" y="3.13" width="0.55" height="0.24" />
123      </bezel>
124      <bezel name="lamp2" element="start">
125         <bounds x="3.45" y="3.13" width="0.55" height="0.24" />
126      </bezel>
127      <bezel name="lamp3" element="bet">
128         <bounds x="1.3" y="3.13" width="0.55" height="0.24" />
129      </bezel>
130      <bezel name="lamp4" element="unknown">
131         <bounds x="3.25" y="3.13" width="0.10" height="0.24" />
132      </bezel>
133      <bezel name="lamp5" element="take">
134         <bounds x="0.65" y="3.13" width="0.55" height="0.24" />
135      </bezel>
136      <bezel name="lamp6" element="unknown">
137         <bounds x="3.25" y="3.13" width="0.10" height="0.24" />
138      </bezel>
139      <bezel name="lamp7" element="big">
140         <bounds x="2.6" y="3.13" width="0.55" height="0.24" />
141      </bezel>
142   </view>
143</mamelayout>
src/mame/layout/sstrangr.lay
r0r7973
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="overlay">
4      <rect>
5         <bounds left="0" top="0" right="224" bottom="256" />
6         <color red="1" green="1" blue="1" />
7      </rect>
8      <rect>
9         <bounds left="0" top="0" right="224" bottom="64" />
10         <color red="0.212" green="0.647" blue=".914" />
11      </rect>
12      <rect>
13         <bounds left="0" top="64" right="224" bottom="192" />
14         <color red="1" green="1" blue="0.322" />
15      </rect>
16      <rect>
17         <bounds left="0" top="192" right="224" bottom="256" />
18         <color red="0.212" green="0.647" blue=".914" />
19      </rect>
20   </element>
21
22   <view name="Color Overlay">
23      <screen index="0">
24         <bounds left="0" top="0" right="3" bottom="4" />
25      </screen>
26      <overlay name="overlay" element="overlay">
27         <bounds left="0" top="0" right="3" bottom="4" />
28      </overlay>
29   </view>
30</mamelayout>
src/mame/drivers/segaxbd.c
r7972r7973
14011401   MDRV_VIDEO_START(xboard)
14021402   MDRV_VIDEO_UPDATE(xboard)
14031403
1404   MDRV_SEGA16SP_ADD_XBOARD("segaspr1")
1405
14041406   /* sound hardware */
14051407   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
14061408
src/mame/drivers/mediagx.c
r7972r7973
12251225
12261226ROM_START( a51site4 )
12271227   ROM_REGION32_LE(0x40000, "bios", 0)
1228   ROM_LOAD("tinybios.rom", 0x00000, 0x40000, CRC(5ee189cc) SHA1(0b0d9321a4c59b1deea6854923e655a4d8c4fcfe))
1228   ROM_LOAD("a51s4_bios_07-11-98.u1", 0x00000, 0x40000, CRC(5ee189cc) SHA1(0b0d9321a4c59b1deea6854923e655a4d8c4fcfe)) /* Build date 07/11/98 string stored at 0x3fff5 */
1229   ROM_LOAD("a51s4_bios_09-15-98.u1", 0x00000, 0x40000, CRC(f8cd6a6b) SHA1(75f851ae21517b729a5596ce5e042ebfaac51778)) /* Build date 09/15/98 string stored at 0x3fff5 */
12291230
12301231   ROM_REGION(0x08100, "gfx1", 0)
12311232    ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
src/mame/drivers/lwings.c
r7972r7973
780780   MDRV_DRIVER_DATA(lwings_state)
781781
782782   /* basic machine hardware */
783   MDRV_CPU_ADD("maincpu", Z80, XTAL_12MHz/4) /* verified on pcb */
783   MDRV_CPU_ADD("maincpu", Z80, XTAL_12MHz/2)   /* Trojan is /4, but lwings needs more. Still needs to be verified by PCB */
784784   MDRV_CPU_PROGRAM_MAP(lwings_map)
785785   MDRV_CPU_VBLANK_INT("screen", lwings_interrupt)
786786
787   MDRV_CPU_ADD("soundcpu", Z80, XTAL_12MHz/4)        /* verified on pcb */
787   MDRV_CPU_ADD("soundcpu", Z80, XTAL_12MHz/4)   /* verified with trojan pcb */
788788   MDRV_CPU_PROGRAM_MAP(lwings_sound_map)
789   MDRV_CPU_PERIODIC_INT(irq0_line_hold,4*60) /* ??? */
789   MDRV_CPU_PERIODIC_INT(irq0_line_hold,4*60)   /* ??? */
790790
791791   MDRV_MACHINE_START(lwings)
792792   MDRV_MACHINE_RESET(lwings)
r7972r7973
811811   /* sound hardware */
812812   MDRV_SPEAKER_STANDARD_MONO("mono")
813813
814   MDRV_SOUND_ADD("2203a", YM2203, XTAL_12MHz/8)        /* verified on pcb */
814   MDRV_SOUND_ADD("2203a", YM2203, XTAL_12MHz/8)   /* verified with trojan pcb */
815815   MDRV_SOUND_ROUTE(0, "mono", 0.20)
816816   MDRV_SOUND_ROUTE(1, "mono", 0.20)
817817   MDRV_SOUND_ROUTE(2, "mono", 0.20)
818818   MDRV_SOUND_ROUTE(3, "mono", 0.10)
819819
820   MDRV_SOUND_ADD("2203b", YM2203, XTAL_12MHz/8)        /* verified on pcb */
820   MDRV_SOUND_ADD("2203b", YM2203, XTAL_12MHz/8)   /* verified with trojan pcb */
821821   MDRV_SOUND_ROUTE(0, "mono", 0.20)
822822   MDRV_SOUND_ROUTE(1, "mono", 0.20)
823823   MDRV_SOUND_ROUTE(2, "mono", 0.20)
r7972r7973
828828   MDRV_IMPORT_FROM( lwings )
829829
830830   MDRV_CPU_MODIFY("maincpu")
831   MDRV_CPU_REPLACE("maincpu", Z80, XTAL_12MHz/4)   /* verified by PCB */
831832   MDRV_CPU_PROGRAM_MAP(trojan_map)
832833
833   MDRV_CPU_ADD("adpcm", Z80, XTAL_12MHz/4)        /* verified on pcb */
834   MDRV_CPU_ADD("adpcm", Z80, XTAL_12MHz/4)   /* verified on pcb */
834835   MDRV_CPU_PROGRAM_MAP(trojan_adpcm_map)
835836   MDRV_CPU_IO_MAP(trojan_adpcm_io_map)
836837   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 4000)
r7972r7973
842843   MDRV_VIDEO_UPDATE(trojan)
843844
844845   /* sound hardware */
845   MDRV_SOUND_ADD("5205", MSM5205, XTAL_455kHz) /* verified on pcb */
846   MDRV_SOUND_ADD("5205", MSM5205, XTAL_455kHz)   /* verified on pcb */
846847   MDRV_SOUND_CONFIG(msm5205_config)
847848   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
848849MACHINE_DRIVER_END
src/mame/drivers/segaybd.c
r7972r7973
5050
5151static UINT16 *backupram;
5252
53/* callbacks to handle output */
54typedef void (*yboard_output_callback)(UINT16 data);
55static yboard_output_callback ybd_output_cb1, ybd_output_cb2;
56static UINT16 pdrift_bank;
57
58
5359/*************************************
5460 *
5561 *  Configuration
r7972r7973
6369   /* reset globals */
6470   state->vblank_irq_state = 0;
6571   state->timer_irq_state = 0;
72
73   ybd_output_cb1 = NULL;
74   ybd_output_cb2 = NULL;
6675}
6776
6877
r7972r7973
319328   {
320329      /* I/O ports */
321330      case 0x00/2:
331         break;
322332      case 0x02/2:
333         break;
323334      case 0x04/2:
335         break;
324336      case 0x06/2:
337         if (ybd_output_cb1)
338            ybd_output_cb1(data);
339         break;
325340      case 0x0a/2:
326341      case 0x0c/2:
327342         break;
328343
329344      /* miscellaneous output */
330345      case 0x08/2:
346
347
331348         /*
332349                D7 = /KILL
333350                D6 = CONT
r7972r7973
336353                D3 = XRES
337354                D2 = YRES
338355                D1-D0 = ADC0-1
339            */
356        */
340357         segaic16_set_display_enable(space->machine, data & 0x80);
341         if (((old ^ data) & 0x20) && !(data & 0x20)) watchdog_reset_w(space, 0, 0);
358         if (((old ^ data) & 0x20) && !(data & 0x20))
359            watchdog_reset_w(space, 0, 0);
342360         cpu_set_input_line(state->soundcpu, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
343361         cpu_set_input_line(state->subx, INPUT_LINE_RESET, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
344362         cpu_set_input_line(state->suby, INPUT_LINE_RESET, (data & 0x04) ? ASSERT_LINE : CLEAR_LINE);
345363         break;
346364
347365      /* mute */
366
348367      case 0x0e/2:
368         if (ybd_output_cb2)
369            ybd_output_cb2(data);
370
349371         /* D7 = /MUTE */
350372         /* D6-D0 = FLT31-25 */
351373         sound_global_enable(space->machine, data & 0x80);
r7972r7973
358380}
359381
360382
361
362383/*************************************
363384 *
364385 *  Analog ports
r7972r7973
384405   static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6" };
385406   int selected = ((offset & 3) == 3) ? (3 + (state->misc_io_data[0x08/2] & 3)) : (offset & 3);
386407   int value = input_port_read_safe(space->machine, ports[selected], 0xff);
408
387409   state->analog_data[offset & 3] = value;
388410}
389411
r7972r7973
10221044   MDRV_SCREEN_SIZE(342,262)   /* to be verified */
10231045   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
10241046
1047   MDRV_SEGA16SP_ADD_YBOARD_16B("segaspr1")
1048   MDRV_SEGA16SP_ADD_YBOARD("segaspr2")
1049
10251050   MDRV_PALETTE_LENGTH(8192*3)
10261051
10271052   MDRV_VIDEO_START(yboard)
r7972r7973
18981923
18991924/*************************************
19001925 *
1901 *  Generic driver initialization
1926 *  Output callbacks
19021927 *
1928 *  TODO: kokoroj2 and jpark (SW2)
1929 *
1930 *  Additional notes:
1931 *    - about jpark: the compression switch is broken/inoperative
1932 *      and because of that all piston data, which is in this
1933 *      section is frozen. bits x01, x04 and x10 when which == 0
1934 *      (IO chip 0), seem to have something to do with the sensor
1935 *      switches we need to fix
19031936 *************************************/
19041937
1905static DRIVER_INIT( generic_yboard )
1938static void pdrift_output_cb1( UINT16 data )
19061939{
1940   /* Note:  this is an approximation to get a relatively accurate bank value.  It is obviously not 100% */
1941
1942   /* for some stupid reason the data is set to all on in the debug menu so we need to check for that */
1943   if (data != 255)
1944   {
1945      /* this is a cheap hack to get some usable positional data in the service menu */
1946      /* these values probably manually turn the motor left and right */
1947      if (((data == 162) || (data == 161) || (data == 160)))
1948      {
1949         if ((data == 162))
1950         /* moving left */
1951         {
1952            /* in this rare instance, the bottom bits are used for positional data */
1953            output_set_value("bank_data_raw", data);
1954            output_set_value("vibration_motor", 0);
1955            switch (pdrift_bank)
1956            /* we want to go left one step at a time */
1957            {
1958               case 1:
1959                  /* all left */
1960                  output_set_value("bank_motor_position", 1);
1961                  pdrift_bank = 1;
1962                  break;
1963               case 2:
1964                  output_set_value("bank_motor_position", 1);
1965                  pdrift_bank = 1;
1966                  break;
1967               case 3:
1968                  output_set_value("bank_motor_position", 2);
1969                  pdrift_bank = 2;
1970                  break;
1971               case 4:
1972                  /* centered */
1973                  output_set_value("bank_motor_position", 3);
1974                  pdrift_bank = 3;
1975                  break;
1976               case 5:
1977                  output_set_value("bank_motor_position", 4);
1978                  pdrift_bank = 4;
1979                  break;
1980               case 6:
1981                  output_set_value("bank_motor_position", 5);
1982                  pdrift_bank = 5;
1983                  break;
1984               case 7:
1985                  /* all right */
1986                  output_set_value("bank_motor_position", 6);
1987                  pdrift_bank = 6;
1988                  break;
1989               default:
1990                  output_set_value("bank_motor_position", 4);
1991                  pdrift_bank = 4;
1992                  break;
1993
1994            }
1995         }
1996
1997         if ((data == 161))
1998         /* moving right */
1999         {
2000            /* in this rare instance, the bottom bits are used for positional data */
2001            output_set_value("bank_data_raw", data);
2002            output_set_value("vibration_motor", 0);
2003            switch (pdrift_bank)
2004            /* we want to go right one step at a time */
2005            {
2006               case 1:
2007                  /* all left */
2008                  output_set_value("bank_motor_position", 2);
2009                  pdrift_bank = 2;
2010                  break;
2011               case 2:
2012                  output_set_value("bank_motor_position", 3);
2013                  pdrift_bank = 3;
2014                  break;
2015               case 3:
2016                  output_set_value("bank_motor_position", 4);
2017                  pdrift_bank = 4;
2018                  break;
2019               case 4:
2020                  /* centered */
2021                  output_set_value("bank_motor_position", 5);
2022                  pdrift_bank = 5;
2023                  break;
2024               case 5:
2025                  output_set_value("bank_motor_position", 6);
2026                  pdrift_bank = 6;
2027                  break;
2028               case 6:
2029                  output_set_value("bank_motor_position", 7);
2030                  pdrift_bank = 7;
2031                  break;
2032               case 7:
2033                  /* all right */
2034                  output_set_value("bank_motor_position", 7);
2035                  pdrift_bank = 7;
2036                  break;
2037               default:
2038                  output_set_value("bank_motor_position", 4);
2039                  pdrift_bank = 4;
2040                  break;
2041
2042            }
2043
2044         }
2045      }
2046      else
2047      {
2048         /* the vibration value uses the first few bits to give a number between 0 and 7 */
2049         output_set_value("vibration_motor", data & 7);
2050         /* normalize the data and subtract the vibration value from it*/
2051
2052         pdrift_bank = (data - (data & 7));
2053         output_set_value("bank_data_raw", pdrift_bank);
2054
2055         /* position values from left to right */
2056         /* 56 48 40 120 72 80 88 */
2057
2058         /* the normalized values we'll use */
2059         /*   1  2  3   4  5  6  7 */
2060
2061         switch (pdrift_bank)
2062         {
2063            case 56:
2064               /* all left */
2065               output_set_value("bank_motor_position", 1);
2066               break;
2067            case 48:
2068               output_set_value("bank_motor_position", 2);
2069               break;
2070            case 40:
2071               output_set_value("bank_motor_position", 3);
2072               break;
2073            case 120:
2074               /* centered */
2075               output_set_value("bank_motor_position", 4);
2076               break;
2077            case 72:
2078               output_set_value("bank_motor_position", 5);
2079               break;
2080            case 80:
2081               output_set_value("bank_motor_position", 6);
2082               break;
2083            case 88:
2084               /* all right */
2085               output_set_value("bank_motor_position", 7);
2086               break;
2087               /* these are the only valid values but 24 pops up sometimes when we crash */
2088
2089         }
2090      }
2091   }
2092}
2093
2094static void gloc_output_cb1( UINT16 data )
2095{
2096   if ((data < 32))
2097   {
2098      output_set_value("right_motor_position", data);
2099
2100      /* normalization here prevents strange data from being transferred */
2101      /* we do this because for some odd reason */
2102      /* gloc starts with one piston all up and one all down.... at least data-wise it does */
2103      if ((data > 1) && (data < 29))
2104         output_set_value("right_motor_position_nor", data);
2105   }
2106
2107   if ((data < 40) && (data > 31))
2108      output_set_value("right_motor_speed", data - 32);
2109
2110   if ((data < 96) && (data > 63))
2111   {
2112      output_set_value("left_motor_position", data);
2113      /* normalized version... you know... for the kids */
2114      if (((data - 64) > 1) && ((data - 64) < 29))
2115         output_set_value("left_motor_position_nor", data - 64);
2116   }
2117
2118   if ((data < 104) && (data > 95))
2119      output_set_value("left_motor_speed", data - 96);
2120}
2121
2122static void pdrift_output_cb2( UINT16 data )
2123{
2124   output_set_value("start_lamp", BIT(data, 2));
2125   output_set_value("upright_wheel_motor", BIT(data, 1));
2126}
2127
2128static void gforce2_output_cb2( UINT16 data )
2129{
2130   output_set_value("start_lamp", BIT(data, 2));
2131}
2132
2133static void gloc_output_cb2( UINT16 data )
2134{
2135   output_set_value("start_lamp", BIT(data, 2));
2136   output_set_value("danger_lamp", BIT(data, 5));
2137   output_set_value("crash_lamp", BIT(data, 6));
2138}
2139
2140static void r360_output_cb2( UINT16 data )
2141{
2142   /* r360 cabinet */
2143   output_set_value("start_lamp", BIT(data, 2));
2144   /* even though the same ouput is used, I've split them to avoid confusion. */
2145   output_set_value("emergency_stop_lamp", BIT(data, 2));
2146}
2147
2148static void rchase_output_cb2( UINT16 data )
2149{
2150   output_set_value("left_start_lamp", BIT(data, 2));
2151   output_set_value("right_start_lamp", BIT(data, 1));
2152
2153   output_set_value("P1_Gun_Recoil", BIT(data, 6));
2154   output_set_value("P2_Gun_Recoil", BIT(data, 5));
2155}
2156
2157/*************************************
2158 *
2159 *  Game-Specific driver initialization
2160 *
2161 *************************************/
2162
2163static DRIVER_INIT( gforce2 )
2164{
19072165   yboard_generic_init(machine);
2166   ybd_output_cb2 = gforce2_output_cb2;
19082167}
19092168
2169static DRIVER_INIT( pdrift )
2170{
2171   /* because some of the output data isn't fully understood we need to "center" the motor */
2172   yboard_generic_init(machine);
19102173
2174   ybd_output_cb1 = pdrift_output_cb1;
2175   ybd_output_cb2 = pdrift_output_cb2;
2176}
19112177
2178static DRIVER_INIT( gloc )
2179{
2180   /* because some of the output data isn't fully understood we need to "center" the rams */
2181   output_set_value("left_motor_position_nor", 16);
2182   output_set_value("right_motor_position_nor", 16);
2183   yboard_generic_init(machine);
2184
2185   ybd_output_cb1 = gloc_output_cb1;
2186   ybd_output_cb2 = gloc_output_cb2;
2187}
2188
2189static DRIVER_INIT( r360 )
2190{
2191   yboard_generic_init(machine);
2192   ybd_output_cb2 = r360_output_cb2;
2193}
2194
2195static DRIVER_INIT( rchase )
2196{
2197   yboard_generic_init(machine);
2198   ybd_output_cb2 = rchase_output_cb2;
2199}
2200
19122201/*************************************
19132202 *
19142203 *  Game driver(s)
19152204 *
19162205 *************************************/
19172206
1918GAME( 1988, gforce2,  0,       yboard, gforce2,  generic_yboard, ROT0, "Sega", "Galaxy Force 2" , GAME_SUPPORTS_SAVE )
1919GAME( 1988, gforce2j, gforce2, yboard, gforce2,  generic_yboard, ROT0, "Sega", "Galaxy Force 2 (Japan)" , GAME_SUPPORTS_SAVE )
1920GAME( 1990, gloc,     0,       yboard, gloc,     generic_yboard, ROT0, "Sega", "G-LOC Air Battle (US)" , GAME_SUPPORTS_SAVE )
1921GAME( 1990, glocr360, gloc,    yboard, glocr360, generic_yboard, ROT0, "Sega", "G-LOC R360", GAME_SUPPORTS_SAVE )
1922GAMEL(1988, pdrift,   0,       yboard, pdrift,   generic_yboard, ROT0, "Sega", "Power Drift (World, Rev A)", GAME_SUPPORTS_SAVE, layout_pdrift )
1923GAMEL(1988, pdrifta,  pdrift,  yboard, pdrift,   generic_yboard, ROT0, "Sega", "Power Drift (World)", GAME_SUPPORTS_SAVE, layout_pdrift )
1924GAMEL(1988, pdrifte,  pdrift,  yboard, pdrifte,  generic_yboard, ROT0, "Sega", "Power Drift (World, Earlier)", GAME_SUPPORTS_SAVE, layout_pdrift )
1925GAMEL(1988, pdriftj,  pdrift,  yboard, pdriftj,  generic_yboard, ROT0, "Sega", "Power Drift (Japan)", GAME_SUPPORTS_SAVE, layout_pdrift )
1926GAME( 1991, rchase,   0,       yboard, rchase,   generic_yboard, ROT0, "Sega", "Rail Chase (World)", GAME_SUPPORTS_SAVE )
1927GAME( 1991, rchasej,  rchase,  yboard, rchase,   generic_yboard, ROT0, "Sega", "Rail Chase (Japan)", GAME_SUPPORTS_SAVE )
1928GAME( 1991, strkfgtr, 0,       yboard, strkfgtr, generic_yboard, ROT0, "Sega", "Strike Fighter (Japan)", GAME_SUPPORTS_SAVE )
2207GAME( 1988, gforce2,  0,       yboard, gforce2,  gforce2, ROT0, "Sega", "Galaxy Force 2" , GAME_SUPPORTS_SAVE )
2208GAME( 1988, gforce2j, gforce2, yboard, gforce2,  gforce2, ROT0, "Sega", "Galaxy Force 2 (Japan)" , GAME_SUPPORTS_SAVE )
2209GAME( 1990, gloc,     0,       yboard, gloc,     gloc, ROT0, "Sega", "G-LOC Air Battle (US)" , GAME_SUPPORTS_SAVE )
2210GAME( 1990, glocr360, gloc,    yboard, glocr360, r360, ROT0, "Sega", "G-LOC R360", GAME_SUPPORTS_SAVE )
2211GAMEL(1988, pdrift,   0,       yboard, pdrift,   pdrift, ROT0, "Sega", "Power Drift (World, Rev A)", GAME_SUPPORTS_SAVE, layout_pdrift )
2212GAMEL(1988, pdrifta,  pdrift,  yboard, pdrift,   pdrift, ROT0, "Sega", "Power Drift (World)", GAME_SUPPORTS_SAVE, layout_pdrift )
2213GAMEL(1988, pdrifte,  pdrift,  yboard, pdrifte,  pdrift, ROT0, "Sega", "Power Drift (World, Earlier)", GAME_SUPPORTS_SAVE, layout_pdrift )
2214GAMEL(1988, pdriftj,  pdrift,  yboard, pdriftj,  pdrift, ROT0, "Sega", "Power Drift (Japan)", GAME_SUPPORTS_SAVE, layout_pdrift )
2215GAME( 1991, rchase,   0,       yboard, rchase,   rchase, ROT0, "Sega", "Rail Chase (World)", GAME_SUPPORTS_SAVE )
2216GAME( 1991, rchasej,  rchase,  yboard, rchase,   rchase, ROT0, "Sega", "Rail Chase (Japan)", GAME_SUPPORTS_SAVE )
2217GAME( 1991, strkfgtr, 0,       yboard, strkfgtr, gloc, ROT0, "Sega", "Strike Fighter (Japan)", GAME_SUPPORTS_SAVE )
src/mame/drivers/namcops2.c
r7972r7973
251251   DISK_REGION("dvd")
252252ROM_END
253253
254ROM_START( timecrs3 )
255   ROM_REGION(0x200000, "bios", 0)
256   SYSTEM246_BIOS
257
258   ROM_REGION(0x840000, "key", ROMREGION_ERASE00)
259        ROM_LOAD( "tst1vera.ic002", 0x000000, 0x800000, CRC(2c7ede91) SHA1(b3d3547f5aac402da2fe76ef51dca3841a982a5e) )
260        ROM_LOAD( "tst1vera_spr.ic002", 0x800000, 0x040000, CRC(ee9c8132) SHA1(fb00e102389e2163d2c7efcfefd4f680f0b4d4e8) )
261
262   DISK_REGION("dvd")
263   DISK_IMAGE_READONLY( "tst1dvd0", 0, SHA1(f8a447d9a4224282516bea590f5217c751bdc4ae) )
264ROM_END
265
254266ROM_START( zgundmdx )
255267   ROM_REGION(0x200000, "bios", 0)
256268   SYSTEM246_BIOS
r7972r7973
270282GAME(2002, tekken4,    sys246, system246, system246, 0, ROT0, "Namco", "Tekken 4 (TEF3 Ver. C)", GAME_NO_SOUND|GAME_NOT_WORKING)
271283GAME(2002, tekken4a,  tekken4, system246, system246, 0, ROT0, "Namco", "Tekken 4 (TEF2 Ver. A)", GAME_NO_SOUND|GAME_NOT_WORKING)
272284GAME(2002, tekken4b,  tekken4, system246, system246, 0, ROT0, "Namco", "Tekken 4 (TEF1 Ver. A)", GAME_NO_SOUND|GAME_NOT_WORKING)
285GAME(2003, timecrs3,   sys246, system246, system246, 0, ROT0, "Namco", "Time Crisis 3 (TST1)", GAME_NO_SOUND|GAME_NOT_WORKING)
273286GAME(2003, zgundm,     sys246, system246, system246, 0, ROT0, "Capcom/Banpresto", "Mobile Suit Z-Gundam: A.E.U.G. vs Titans (ZGA1 Ver. A)", GAME_NO_SOUND|GAME_NOT_WORKING)
274287GAME(2004, fghtjam,    sys246, system246, system246, 0, ROT0, "Capcom/Namco", "Capcom Fighting Jam (JAM1 Ver. A)", GAME_NO_SOUND|GAME_NOT_WORKING)
275288GAME(2004, sukuinuf,   sys246, system246, system246, 0, ROT0, "Namco", "Quiz and Variety Suku Suku Inufuku 2 (IN2 Ver. A)", GAME_NO_SOUND|GAME_NOT_WORKING)
src/mame/drivers/gauntlet.c
r7972r7973
213213      {
214214         cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, (state->sound_reset_val & 1) ? CLEAR_LINE : ASSERT_LINE);
215215         atarigen_sound_reset(space->machine);
216         if (state->sound_reset_val & 1)
217         {
218            devtag_reset(space->machine, "ymsnd");
219            devtag_reset(space->machine, "tms");
220            tms5220_set_frequency(devtag_get_device(space->machine, "tms"), ATARI_CLOCK_14MHz/2 / 11);
221            atarigen_set_ym2151_vol(space->machine, 0);
222            atarigen_set_pokey_vol(space->machine, 0);
223            atarigen_set_tms5220_vol(space->machine, 0);
224         }
216225      }
217226   }
218227}
r7972r7973
251260   switch (offset & 7)
252261   {
253262      case 0:   /* music reset, bit D7, low reset */
263         if (((data>>7)&1) == 0) devtag_reset(space->machine, "ymsnd");
254264         break;
255265
256266      case 1:   /* speech write, bit D7, active low */
r7972r7973
536546   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
537547
538548   MDRV_SOUND_ADD("ymsnd", YM2151, ATARI_CLOCK_14MHz/4)
539   MDRV_SOUND_ROUTE(0, "lspeaker", 0.48)
540   MDRV_SOUND_ROUTE(1, "rspeaker", 0.48)
549   MDRV_SOUND_ROUTE(1, "lspeaker", 0.48)
550   MDRV_SOUND_ROUTE(0, "rspeaker", 0.48)
541551
542552   MDRV_SOUND_ADD("pokey", POKEY, ATARI_CLOCK_14MHz/8)
543553   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.32)
src/mame/drivers/mw8080bw.c
r7972r7973
431431static WRITE8_HANDLER( gunfight_io_w )
432432{
433433   mw8080bw_state *state = (mw8080bw_state *)space->machine->driver_data;
434
435434   if (offset & 0x01)
436435      gunfight_audio_w(space, 0, data);
437436
r7972r7973
440439
441440   if (offset & 0x04)
442441      mb14241_shift_data_w(state->mb14241, 0, data);
442
443443}
444444
445445
src/mame/drivers/sshangha.c
r7972r7973
464464}
465465
466466
467GAME( 1992, sshangha, 0,        sshangha, sshangha, sshangha, ROT0, "Hot-B.",  "Super Shanghai Dragon's Eye (Japan)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
467GAME( 1992, sshangha, 0,        sshangha, sshangha, sshangha, ROT0, "Hot-B",   "Super Shanghai Dragon's Eye (Japan)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
468468GAME( 1992, sshanghab,sshangha, sshanghb, sshangha, sshangha, ROT0, "bootleg", "Super Shanghai Dragon's Eye (World, bootleg)", 0 )
src/mame/drivers/namcos12.c
r7972r7973
11241124{
11251125   if( ACCESSING_BITS_0_15 )
11261126   {
1127
1128      /* blowback 1 */
1129      /* blowback 2 */
1130      /* Note: output label has been changed for the Engrish Impaired ;-) */
1131      output_set_value("Player1_Gun_Recoil", (~data & 0x02)>>1);
1132      output_set_value("Player2_Gun_Recoil", (~data & 0x01));
1133
11271134      /* start 1 */
1128      set_led_status(space->machine, 0, !(data & 0x08));
1135      output_set_value("P2_Start_lamp", (~data & 0x08)>>3);
11291136      /* start 2 */
1130      set_led_status(space->machine, 1, !(data & 0x04));
1131      /* blowback 1 */
1132      /* !(data & 0x02) */
1133      /* blowback 2 */
1134      /* !(data & 0x01) */
1137      output_set_value("P2_Start_lamp", (~data & 0x04)>>2);
1138
1139
11351140      verboselog( space->machine, 1, "system11gun_w: outputs (%08x %08x)\n", data, mem_mask );
11361141   }
11371142   if( ACCESSING_BITS_16_31 )
src/mame/drivers/photon.c
r7972r7973
1010    Following games were produced for this system:
1111    - Tetris
1212    - Python
13    - Treasure/Labyrinth
13    - Klad/Labyrinth
14
15    Use joystick left and right in Klad/Labyrinth attract mode to select a game to play.
1416*/
1517
1618#include "emu.h"
r7972r7973
164166   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
165167INPUT_PORTS_END
166168
167
168169static INTERRUPT_GEN( pk8000_interrupt )
169170{
170171   cpu_set_input_line(device, 0, HOLD_LINE);
r7972r7973
229230    0000...07FFh - ROM1 (D41)
230231    0800...0FFFh - ROM2 (D42)
231232    1000...17FFh - ROM3 (D43)
232    1800...1FFFh - not chip sealed (D44)
233    1800...1FFFh - not populated (D44)
233234    2000...27FFh - ROM5 (D45)
234235    2800...2FFFh - ROM6 (D46)
235236    3000...37FFh - ROM7 (D47)
236    3000...37FFh - ROM8 (D48)
237    3800...3FFFh - ROM8 (D48)
237238*/
238239ROM_START( phtetris )
239240   ROM_REGION( 0x20000, "maincpu", 0 )
r7972r7973
253254   ROM_LOAD( "foton_piton.bin", 0x10000, 0x1800, BAD_DUMP CRC(4eac925a) SHA1(26f9a18c7aed31b7daacdc003bafb60a5e6d6300) )
254255ROM_END
255256
257
258/*
259    Dump was made using custom adaptor, hence it is marked as bad dump.
260*/
261ROM_START( phklad )
262   ROM_REGION( 0x20000, "maincpu", 0 )
263   ROM_LOAD( "klad.bin", 0x10000, 0x4000, BAD_DUMP CRC(49cc7d65) SHA1(d966cfc1d973a533df8044a71fad37f7177da554) )
264ROM_END
265
256266GAME( 19??,  phtetris, 0,      photon, photon, 0, ROT0, "<unknown>", "Tetris (Photon System)", 0 )
257267GAME( 1989?, phpython,  0,     photon, photon, 0, ROT0, "<unknown>", "Python (Photon System)", 0 )
268GAME( 19??,  phklad,   0,      photon, photon, 0, ROT0, "<unknown>", "Klad / Labyrinth (Photon System)", 0 )
src/mame/drivers/pgm.c
r7972r7973
105105it's the only game that needs IRQ4 and Puzzli2 explicitly doesn't want IRQ4 to be
106106active.
107107
108Some dumps are suspicious (orlegend super clones are missing roms, drgw3k sets
108Some dumps are suspicious (orlegend super clones are missing roms, drgw3 sets
109109might not have the right protection rom)  In many cases the external protection
110110data roms change with each revision of the game.
111111
r7972r7973
147147    Oriental Legend
148148    function:
149149
150ASIC 12 + ASIC 25
151    these seem to be used together
152    ASIC 25 appears to perform some kind of bitswap operations
150ASIC 25 + ASIC 12
151    ASIC25 is a logic device (not MCU) which performs bitswap operations
152    ASIC12 is ... ? (rom overlays?)
153
153154    used by:
154155    Dragon World 2
155156
156ASIC 22 + ASIC 25
157    these seem to be used together, ASIC25 has an external software decrypted? data rom
158    ASIC 22 might be an updated version of ASIC12 ?
157ASIC 25 + ASIC 22
158    ASIC25 is a logic device (not MCU) which performs bitswap operations, and connects to the ASIC22.  It differs per region.
159    ASIC22 is an MCU and acts as an encrypted DMA device
160
161    (ASIC22 can be swapped between games with no side-effects, ASIC25 can't)
162
159163    used by:
160164    Dragon World 3
161165    The Killing Blade
162166
163167ASIC 25 + ASIC 28
168    ASIC25 (see above)
169    ASIC28 acts as an encrypted DMA device (updated version of ASIC22 with different encryption etc.)
170
171    used by:
164172    Oriental Legend Super
165173
166174ASIC 27 (55857E):
167175    performs a variety of calculations, quite complex, different per region, supplies region code
176
168177    used by:
169    Knights of Valour 1 / Plus
178    Knights of Valour 1 / (Plus?)
170179    Photo Y2k / Real and Fake
171180
172181ASIC 27A(55857F/55857G):
r7972r7973
292301#include "includes/pgm.h"
293302
294303UINT16 *pgm_mainram;
304static void IGS022_reset(running_machine* machine);
295305
296306static WRITE16_HANDLER( pgm_videoram_w )
297307{
r7972r7973
10981108   PORT_DIPSETTING(      0x0005, DEF_STR( World ) )
10991109INPUT_PORTS_END
11001110
1111static INPUT_PORTS_START( dw3 )
1112   PORT_INCLUDE ( pgm )
1113
1114   PORT_MODIFY("Region")   /* Region - supplied by protection device */
1115   PORT_DIPNAME( 0x000f, 0x0006, DEF_STR( Region ) )
1116   PORT_DIPSETTING(      0x0000, "0" )
1117   PORT_DIPSETTING(      0x0001, "1" )
1118   PORT_DIPSETTING(      0x0002, "2" )
1119   PORT_DIPSETTING(      0x0003, "3" )
1120   PORT_DIPSETTING(      0x0004, "4" )
1121   PORT_DIPSETTING(      0x0005, "5" )
1122   PORT_DIPSETTING(      0x0006, DEF_STR( World ) )
1123   PORT_DIPSETTING(      0x0007, "7" )
1124
1125INPUT_PORTS_END
1126
1127
11011128static INPUT_PORTS_START( olds )
11021129   PORT_INCLUDE ( pgm )
11031130
r7972r7973
13971424
13981425MACHINE_DRIVER_END
13991426
1427static MACHINE_RESET( dw3 );
1428
1429static MACHINE_DRIVER_START( dw3 )
1430   MDRV_IMPORT_FROM(pgm)
1431
1432   MDRV_CPU_MODIFY("maincpu")
1433   MDRV_CPU_PROGRAM_MAP(killbld_mem)
1434   MDRV_CPU_VBLANK_INT_HACK(drgw_interrupt,2) // needs an extra IRQ, puzzli2 doesn't want this irq!
1435
1436   MDRV_MACHINE_RESET(dw3)
1437
1438MACHINE_DRIVER_END
1439
14001440static MACHINE_RESET( olds );
14011441
14021442static MACHINE_DRIVER_START( olds )
r7972r7973
14611501/* take note of "gfx2" needed for expanding the 32x32x5bpp data and
14621502   "gfx4" needed for expanding the Sprite Colour Data */
14631503
1504#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
1505      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */
1506
1507#define PGM_68K_BIOS \
1508   ROM_SYSTEM_BIOS( 0, "v2",     "PGM Bios V2" ) \
1509   ROM_LOAD16_WORD_SWAP_BIOS( 0, "pgm_p02s.u20",    0x00000, 0x020000, CRC(78c15fa2) SHA1(885a6558e022602cc6f482ac9667ba9f61e75092) ) /* Version 2 (Label: IGS | PGM P02S | 1P0792D1 | J992438 )*/ \
1510   ROM_SYSTEM_BIOS( 1, "v1",     "PGM Bios V1" ) \
1511   ROM_LOAD16_WORD_SWAP_BIOS( 1, "pgm_p01s.u20",    0x00000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) ) /* Version 1 */ \
1512
1513
1514
14641515/* The Bios - NOT A GAME */
14651516ROM_START( pgm )
14661517   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1467   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x00000, 0x20000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )
1518   PGM_68K_BIOS
14681519
14691520   /* CPU2 = Z80, romless, code uploaded by 68k */
14701521
r7972r7973
14811532
14821533ROM_START( orlegend )
14831534   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1484   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1535   PGM_68K_BIOS
14851536   ROM_LOAD16_WORD_SWAP( "p0103.rom",    0x100000, 0x200000, CRC(d5e93543) SHA1(f081edc26514ca8354c13c7f6f89aba8e4d3e7d2) )
14861537
14871538   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
15131564
15141565ROM_START( orlegende )
15151566   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1516   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1567   PGM_68K_BIOS
15171568   ROM_LOAD16_WORD_SWAP( "p0102.rom",    0x100000, 0x200000, CRC(4d0f6cc5) SHA1(8d41f0a712fb11a1da865f5159e5e27447b4388a) )
15181569
15191570   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
15451596
15461597ROM_START( orlegendc )
15471598   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1548   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1599   PGM_68K_BIOS
15491600   ROM_LOAD16_WORD_SWAP( "p0101.160",    0x100000, 0x200000, CRC(b24f0c1e) SHA1(a2cf75d739681f091c24ef78ed6fc13aa8cfe0c6) )
15501601
15511602   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
15771628
15781629ROM_START( orlegendca )
15791630   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1580   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1631   PGM_68K_BIOS
15811632   ROM_LOAD16_WORD_SWAP( "p0101.102",    0x100000, 0x200000, CRC(7a22e1cb) SHA1(4fe0fde00521b0915146334ea7213f3eb7e2affc) )
15821633
15831634   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
16431694
16441695ROM_START( orlegend111c )
16451696   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1646   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1697   PGM_68K_BIOS
16471698   ROM_LOAD16_BYTE( "olv111ch.u6",     0x100001, 0x080000, CRC(5fb86373) SHA1(2fc58eff1f38754c75819fde666244b867ca4f05) )
16481699   ROM_LOAD16_BYTE( "olv111ch.u9",     0x100000, 0x080000, CRC(83cf09c8) SHA1(959780b45326059517f3008a356657f4f3d2908f) )
16491700   ROM_LOAD16_BYTE( "olv111ch.u7",     0x200001, 0x080000, CRC(6ee79faf) SHA1(039b4b07b8577f0d3022ae01210c00375624cb3c) )
r7972r7973
17111762
17121763ROM_START( orlegend105k )
17131764   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1714   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1765   PGM_68K_BIOS
17151766   ROM_LOAD16_BYTE( "olv105ko.u6",     0x100001, 0x080000, CRC(b86703fe) SHA1(a3529b45efd400ecd5e76f764b528ebce46e24ab) )
17161767   ROM_LOAD16_BYTE( "olv105ko.u9",     0x100000, 0x080000, CRC(5a108e39) SHA1(2033f4fe3f2dfd725dac535324f58348b9ac3914) )
17171768   ROM_LOAD16_BYTE( "olv105ko.u7",     0x200001, 0x080000, CRC(5712facc) SHA1(2d95ebd1703874e89ac3a206f8c1f0ece6e833e0) )
r7972r7973
18131864
18141865ROM_START( drgw2 )
18151866   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1816   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1867   PGM_68K_BIOS
18171868   ROM_LOAD16_WORD_SWAP( "v-110x.u2",    0x100000, 0x080000, CRC(1978106b) SHA1(af8a13d7783b755a58762c98bdc32cab845b2251) )
18181869
18191870   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
18381889
18391890ROM_START( drgw2c )
18401891   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1841   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1892   PGM_68K_BIOS
18421893   ROM_LOAD16_WORD_SWAP( "v-100c.u2",    0x100000, 0x080000, CRC(67467981) SHA1(58af01a3871b6179fe42ff471cc39a2161940043) )
18431894
18441895   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
18621913
18631914ROM_START( drgw2j )
18641915   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
1865   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
1916   PGM_68K_BIOS
18661917   ROM_LOAD16_WORD_SWAP( "v-100j.u2",    0x100000, 0x080000, CRC(f8f8393e) SHA1(ef0db668b4e4f661d4c1e95d57afe881bcdf13cc) )
18671918
18681919   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
18841935   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // (BIOS)
18851936ROM_END
18861937
1938
1939
18871940/*
18881941
1889Dragon World 3
1890Alta Co./IGS, 1998
1942Dragon World 3 (KOREA 106 Ver.)
1943(c)1998 IGS
18911944
1892Cart for IGS PGM system
1945PGM system
1946IGS PCB NO-0189
1947IGS PCB NO-0178
18931948
1894Top board of cart contains.....
18958MHz Xtal
189632.768kHz Xtal
1897UM6164 (RAM x 2)
1898MACH211 CPLD
1899IGS022 ASIC
1900IGS025 ASIC
19011x PAL
19022x 27C040 EPROMs (main 68k program)
19031x 27C512 EPROM (protection code?)
19041x 32MBit smt MASKROM (T0400)
19051949
1906Bottom board contains.....
19074x 32MBit smt MASKROMs (A0400, A0401, B0400, M0400)
1950DW3_V106.U12 [c3f6838b]
1951DW3_V106.U13 [28284e22]
19081952
1953
19091954*/
19101955
19111956ROM_START( drgw3 )
19121957   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1913   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
1914   ROM_LOAD16_BYTE( "dw3_v100.u12",     0x100001, 0x080000,  CRC(47243906) SHA1(9cd46e3cba97f049bcb238ceb6edf27a760ef831) )
1915   ROM_LOAD16_BYTE( "dw3_v100.u13",     0x100000, 0x080000,  CRC(b7cded21) SHA1(c1ae2af2e42227503c81bbcd2bd6862aa416bd78) )
1958   PGM_68K_BIOS
1959   ROM_LOAD16_BYTE( "dw3_v106.u12",     0x100001, 0x080000,  CRC(c3f6838b) SHA1(c135b1d4dd62af308139d40d03c29be7508fb1e7) )
1960   ROM_LOAD16_BYTE( "dw3_v106.u13",     0x100000, 0x080000,  CRC(28284e22) SHA1(4643a69881ddb7383ca10f3eb2aa2cf41be39e9f) )
19161961
19171962   /* CPU2 = Z80, romless, code uploaded by 68k */
19181963
1919   ROM_REGION( 0x010000, "user1", 0 ) /* Protection Data */
1920   ROM_LOAD( "dw3_v100.u15", 0x000000, 0x010000, CRC(03dc4fdf) SHA1(b329b04325d4f725231b1bb7862eedef2319b652) )
1964//  ROM_REGION( 0x40000, "user2", 0 ) /* RAM dump - to be removed once the DMA is hooked up */
1965//  ROM_LOAD16_WORD_SWAP( "dw3c_prot_ramdump", 0x0000, 0x4000, CRC(6b4fc08b) SHA1(61583637c2f1767df4bc637f922987c9510a584f) )
19211966
1967   ROM_REGION( 0x010000, "igs022data", 0 ) /* Protection Data - is it correct for this set? */
1968   ROM_LOAD16_WORD_SWAP( "dw3_v100.u15", 0x000000, 0x010000, CRC(03dc4fdf) SHA1(b329b04325d4f725231b1bb7862eedef2319b652) )
1969
19221970   ROM_REGION( 0xc00000, "gfx1", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
19231971   ROM_LOAD( "pgm_t01s.rom", 0x000000, 0x200000, CRC(1a7123a0) SHA1(cc567f577bfbf45427b54d6695b11b74f2578af3) ) // (BIOS)
19241972   ROM_LOAD( "dw3t0400.u18",   0x400000, 0x400000, CRC(b70f3357) SHA1(8733969d7d21f540f295a9f747a4bb8f0d325cf0) )
r7972r7973
19381986   ROM_LOAD( "dw3m0400.u1",  0x400000, 0x400000, CRC(031eb9ce) SHA1(0673ec194732becc6648c2ae1396e894aa269f9a) )
19391987ROM_END
19401988
1989
1990ROM_START( drgw3105 )
1991   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1992   PGM_68K_BIOS
1993   ROM_LOAD16_BYTE( "dw3_v105.u12",     0x100001, 0x080000,  CRC(c5e24318) SHA1(c6954495bbc72c3985df75aecf6afd6826c8e30e) )
1994   ROM_LOAD16_BYTE( "dw3_v105.u13",     0x100000, 0x080000,  CRC(8d6c9d39) SHA1(cb79303ab551e91f07e11414db4254d5b161d415) )
1995   //ROM_LOAD( "dw3c_prg.rom", 0x100000, 0x100000, CRC(e274cf03) SHA1(2ba532446bd5b5dbccf43a6d1b1f6b36842b2c8d) )
1996
1997//  ROM_REGION( 0x40000, "user2", 0 ) /* RAM dump - to be removed once the DMA is hooked up */
1998//  ROM_LOAD16_WORD_SWAP( "dw3c_prot_ramdump", 0x0000, 0x4000, CRC(6b4fc08b) SHA1(61583637c2f1767df4bc637f922987c9510a584f) )
1999
2000   /* CPU2 = Z80, romless, code uploaded by 68k */
2001
2002   ROM_REGION( 0x010000, "igs022data", 0 ) /* Protection Data - is it correct for this set? */
2003   ROM_LOAD16_WORD_SWAP( "dw3_v100.u15", 0x000000, 0x010000, CRC(03dc4fdf) SHA1(b329b04325d4f725231b1bb7862eedef2319b652) )
2004
2005   ROM_REGION( 0xc00000, "gfx1", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
2006   ROM_LOAD( "pgm_t01s.rom", 0x000000, 0x200000, CRC(1a7123a0) SHA1(cc567f577bfbf45427b54d6695b11b74f2578af3) ) // (BIOS)
2007   ROM_LOAD( "dw3t0400.u18",   0x400000, 0x400000, CRC(b70f3357) SHA1(8733969d7d21f540f295a9f747a4bb8f0d325cf0) )
2008
2009   ROM_REGION( 0xc00000/5*8, "gfx2", ROMREGION_ERASEFF ) /* Region for 32x32 BG Tiles */
2010   /* 32x32 Tile Data is put here for easier Decoding */
2011
2012   ROM_REGION( 0x1800000, "gfx3", 0 ) /* Sprite Colour Data */
2013   ROM_LOAD( "dw3a0400.u9",     0x0000000, 0x400000, CRC(dd7bfd40) SHA1(fb7ec5bf89a413c5208716083762a725ff63f5db) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
2014   ROM_LOAD( "dw3a0401.u10",    0x0400000, 0x400000, CRC(cab6557f) SHA1(1904dd86645eea27ac1ab8a2462b20f6531356f8) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
2015
2016   ROM_REGION( 0x1000000, "gfx4", 0 ) /* Sprite Masks + Colour Indexes */
2017   ROM_LOAD( "dw3b0400.u13",    0x0000000, 0x400000,  CRC(4bb87cc0) SHA1(71b2dc43fd11f7a6dffaba501e4e344b843583d8) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
2018
2019   ROM_REGION( 0x800000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
2020   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // (BIOS)
2021   ROM_LOAD( "dw3m0400.u1",  0x400000, 0x400000, CRC(031eb9ce) SHA1(0673ec194732becc6648c2ae1396e894aa269f9a) )
2022ROM_END
19412023/*
19422024
1943Dragon World 3 (KOREA 106 Ver.)
1944(c)1998 IGS
2025Dragon World 3
2026Alta Co./IGS, 1998
19452027
1946PGM system
1947IGS PCB NO-0189
1948IGS PCB NO-0178
2028Cart for IGS PGM system
19492029
2030Top board of cart contains.....
20318MHz Xtal
203232.768kHz Xtal
2033UM6164 (RAM x 2)
2034MACH211 CPLD
2035IGS022 ASIC
2036IGS025 ASIC
20371x PAL
20382x 27C040 EPROMs (main 68k program)
20391x 27C512 EPROM (protection code?)
20401x 32MBit smt MASKROM (T0400)
19502041
1951DW3_V106.U12 [c3f6838b]
1952DW3_V106.U13 [28284e22]
2042Bottom board contains.....
20434x 32MBit smt MASKROMs (A0400, A0401, B0400, M0400)
19532044
1954
19552045*/
19562046
1957ROM_START( drgw3k )
2047ROM_START( drgw3100 )
19582048   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1959   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
1960   ROM_LOAD16_BYTE( "dw3_v106.u12",     0x100001, 0x080000,  CRC(c3f6838b) SHA1(c135b1d4dd62af308139d40d03c29be7508fb1e7) )
1961   ROM_LOAD16_BYTE( "dw3_v106.u13",     0x100000, 0x080000,  CRC(28284e22) SHA1(4643a69881ddb7383ca10f3eb2aa2cf41be39e9f) )
2049   PGM_68K_BIOS
2050   ROM_LOAD16_BYTE( "dw3_v100.u12",     0x100001, 0x080000,  CRC(47243906) SHA1(9cd46e3cba97f049bcb238ceb6edf27a760ef831) )
2051   ROM_LOAD16_BYTE( "dw3_v100.u13",     0x100000, 0x080000,  CRC(b7cded21) SHA1(c1ae2af2e42227503c81bbcd2bd6862aa416bd78) )
19622052
19632053   /* CPU2 = Z80, romless, code uploaded by 68k */
19642054
1965   ROM_REGION( 0x010000, "user1", 0 ) /* Protection Data - is it correct for this set? */
1966   ROM_LOAD( "dw3_v100.u15", 0x000000, 0x010000, CRC(03dc4fdf) SHA1(b329b04325d4f725231b1bb7862eedef2319b652) )
2055//  ROM_REGION( 0x40000, "user2", 0 ) /* RAM dump - to be removed once the DMA is hooked up */
2056//  ROM_LOAD16_WORD_SWAP( "dw3c_prot_ramdump", 0x0000, 0x4000, CRC(6b4fc08b) SHA1(61583637c2f1767df4bc637f922987c9510a584f) )
19672057
2058   ROM_REGION( 0x010000, "igs022data", 0 ) /* Protection Data */
2059   ROM_LOAD16_WORD_SWAP( "dw3_v100.u15", 0x000000, 0x010000, CRC(03dc4fdf) SHA1(b329b04325d4f725231b1bb7862eedef2319b652) )
2060
19682061   ROM_REGION( 0xc00000, "gfx1", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
19692062   ROM_LOAD( "pgm_t01s.rom", 0x000000, 0x200000, CRC(1a7123a0) SHA1(cc567f577bfbf45427b54d6695b11b74f2578af3) ) // (BIOS)
19702063   ROM_LOAD( "dw3t0400.u18",   0x400000, 0x400000, CRC(b70f3357) SHA1(8733969d7d21f540f295a9f747a4bb8f0d325cf0) )
r7972r7973
19862079
19872080ROM_START( kov )
19882081   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1989   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2082   PGM_68K_BIOS
19902083   ROM_LOAD16_WORD_SWAP( "p0600.117",    0x100000, 0x400000, CRC(c4d19fe6) SHA1(14ef31539bfbc665e76c9703ee01b12228344052) )
19912084
19922085   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
20182111
20192112ROM_START( kov115 )
20202113   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
2021   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
2114   PGM_68K_BIOS
20222115   ROM_LOAD16_WORD_SWAP( "p0600.115",    0x100000, 0x400000, CRC(527a2924) SHA1(7e3b166dddc5245d7b408e78437c16fd2986d1d9) )
20232116
20242117   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
20812174
20822175ROM_START( kov100 )
20832176   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
2084   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
2177   PGM_68K_BIOS
20852178   ROM_LOAD16_BYTE( "sav111.u4",      0x100001, 0x080000, CRC(ae2f1b4e) SHA1(2ac9d84f5dee52f374941cfd68e2b98ecad436a8) )
20862179   ROM_LOAD16_BYTE( "sav111.u7",      0x100000, 0x080000, CRC(95eedf0e) SHA1(582a54e9a1eda7ff73e20f0e69d2d50141772378) )
20872180   ROM_LOAD16_BYTE( "sav111.u5",      0x200001, 0x080000, CRC(5fdd4aa8) SHA1(43c96e21ad4f11148e1e94a59c53780b2edd43ba) )
r7972r7973
21172210
21182211ROM_START( kovplus )
21192212   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2120   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) ) // (BIOS)
2213   PGM_68K_BIOS
21212214   ROM_LOAD16_WORD_SWAP( "p0600.119",    0x100000, 0x400000, CRC(e4b0875d) SHA1(e8382e131b0e431406dc2a05cc1ef128302d987c) )
21222215
21232216   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
21802273
21812274ROM_START( kovplusa )
21822275   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2183   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) ) // (BIOS)
2276   PGM_68K_BIOS
21842277   ROM_LOAD16_BYTE( "v119.u3",     0x100001, 0x080000, CRC(6750388f) SHA1(869f4ad27f2992cc62baa9a78bf7984a43ec4cc5) )
21852278   ROM_LOAD16_BYTE( "v119.u5",     0x100000, 0x080000, CRC(d4101ffd) SHA1(a327fd56eec65b07df9305cd93ef2c46bf8e40f3) )
21862279   ROM_LOAD16_BYTE( "v119.u4",     0x200001, 0x080000, CRC(8200ece6) SHA1(97081d2e8aed2ac6fbe5951890aecea18af5ce2e) )
r7972r7973
22162309
22172310ROM_START( kovsh )
22182311   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2219   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2312   PGM_68K_BIOS
22202313   ROM_LOAD16_WORD_SWAP( "p0600.322",    0x100000, 0x400000, CRC(7c78e5f3) SHA1(9b1e4bd63fb1294ebeb539966842273c8dc7683b) )
22212314
22222315   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
22522345
22532346ROM_START( kovsh103 )
22542347   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2255   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2348   PGM_68K_BIOS
22562349   ROM_LOAD16_WORD_SWAP( "p0600.103",    0x100000, 0x400000, CRC(f0b3da82) SHA1(4067beb69c049b51bce6154f4cf880600ca4de11) )
22572350
22582351   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
22782371   ROM_REGION( 0x1000000, "gfx4", 0 ) /* Sprite Masks + Colour Indexes */
22792372   ROM_LOAD( "b0600.rom",    0x0000000, 0x0800000, CRC(7d3cd059) SHA1(00cf994b63337e0e4ebe96453daf45f24192af1c) )
22802373   ROM_LOAD( "b0601.rom",    0x0800000, 0x0400000, CRC(a0bb1c2f) SHA1(0542348c6e27779e0a98de16f04f9c18158f2b28) )
2281   ROM_LOAD( "b0602.rom",    0x0c00000, 0x0100000, CRC(9df77934) SHA1(99a3fe337c13702c9aa2373bcd1bb1befd0e2a13) ) // tis dump had the same rom 4x bigger but with the data duplicated 4x, which is correct?
2374   ROM_LOAD( "b0602.rom",    0x0c00000, 0x0100000, CRC(9df77934) SHA1(99a3fe337c13702c9aa2373bcd1bb1befd0e2a13) ) // this dump had the same rom 4x bigger but with the data duplicated 4x, which is correct?
22822375
22832376   ROM_REGION( 0x800000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
22842377   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // (BIOS)
r7972r7973
22882381
22892382ROM_START( photoy2k )
22902383   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2291   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2384   PGM_68K_BIOS
22922385   ROM_LOAD16_WORD_SWAP( "v104.16m",     0x100000, 0x200000, CRC(e051070f) SHA1(a5a1a8dd7542a30632501af8d02fda07475fd9aa) )
22932386
22942387   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
23532446
23542447ROM_START( photoy2k102 )
23552448   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2356   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2449   PGM_68K_BIOS
23572450   ROM_LOAD16_BYTE( "v102.u4",     0x100001, 0x080000, CRC(a65eda9f) SHA1(6307cacf4a262e781753eff14700a0455837780c) )
23582451   ROM_LOAD16_BYTE( "v102.u6",     0x100000, 0x080000, CRC(b9ca5504) SHA1(058cf01316f233236ca9861349f515935283b75e) )
23592452   ROM_LOAD16_BYTE( "v102.u5",     0x200001, 0x080000, CRC(9201621b) SHA1(1ca3ebe7eec40614bfa8b911657fa2b51f2c51a4) )
r7972r7973
24592552*/
24602553
24612554
2555
2556/*
2557 the text on the chip are
2558-----------------
2559IGS
2560PGM P0300 V109
25611A0577Y3
2562J982846
2563-----------------
2564*/
2565
24622566ROM_START( killbld )
24632567   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2464   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2465   ROM_LOAD16_WORD_SWAP( "kb.u9", 0x100000, 0x200000, BAD_DUMP CRC(43da77d7) SHA1(f99e89da4587d6c9e3c2ae66fa139830d893fdda) ) // not verified to be correct
2568   PGM_68K_BIOS
2569   ROM_LOAD16_WORD_SWAP( "p0300_v109.u9", 0x100000, 0x200000, CRC(2fcee215) SHA1(855281a9090bfdf3da9f4d50c121765131a13400) )
24662570
2467   ROM_REGION( 0x4000, "user2", 0 ) /* dump of RAM shared with protection device, todo, emulate protection device instead! */
2468   ROM_LOAD( "kb.ram", 0x000000, 0x04000,  CRC(6994c507) SHA1(8264c56709488b72282d6ddfce3a4b188c6cc109) )
2469
24702571   /* CPU2 = Z80, romless, code uploaded by 68k */
24712572
2472   ROM_REGION( 0x010000, "user1", 0 ) /* Protection Data */
2573   ROM_REGION( 0x010000, "igs022data", 0 ) /* Protection Data */
24732574   ROM_LOAD16_WORD_SWAP( "kb_u2.rom", 0x000000, 0x010000,  CRC(de3eae63) SHA1(03af767ef764055bda528b5cc6a24b9e1218cca8) )
24742575
24752576   ROM_REGION( 0x800000, "gfx1", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
r7972r7973
25022603
25032604ROM_START( killbld104 )
25042605   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2505   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2606   PGM_68K_BIOS
25062607   ROM_LOAD16_BYTE( "kb_u3_v104.u3",     0x100001, 0x080000, CRC(6db1d719) SHA1(804002f014d275aaf0368fb7f904938fe4ac07ee) )
25072608   ROM_LOAD16_BYTE( "kb_u6_v104.u6",     0x100000, 0x080000, CRC(31ecc978) SHA1(82666d534e4151775063af6d39f575faba0f1047) )
2508   ROM_LOAD16_BYTE( "kb_u4_v104.u4",     0x200001, 0x080000, CRC(1ed8b2e7) SHA1(331c037640cfc1fe743cd0e65a1156c470b3303e) ) // order?
2509   ROM_LOAD16_BYTE( "kb_u5_v104.u5",     0x200000, 0x080000, CRC(a0bafc29) SHA1(b20db7c16353c6f87ed3c08c9d037b07336711f1) ) // order?
2609   ROM_LOAD16_BYTE( "kb_u4_v104.u4",     0x200001, 0x080000, CRC(1ed8b2e7) SHA1(331c037640cfc1fe743cd0e65a1156c470b3303e) )
2610   ROM_LOAD16_BYTE( "kb_u5_v104.u5",     0x200000, 0x080000, CRC(a0bafc29) SHA1(b20db7c16353c6f87ed3c08c9d037b07336711f1) )
25102611
2511   ROM_REGION( 0x4000, "user2", ROMREGION_ERASEFF )
2512
25132612   /* CPU2 = Z80, romless, code uploaded by 68k */
25142613
2515   ROM_REGION( 0x010000, "user1", 0 ) /* Protection Data */
2614   ROM_REGION( 0x010000, "igs022data", 0 ) /* Protection Data */
25162615   ROM_LOAD16_WORD_SWAP( "kb_u2_v104.u2", 0x000000, 0x010000,  CRC(c970f6d5) SHA1(399fc6f80262784c566363c847dc3fdc4fb37494) )
25172616
25182617   ROM_REGION( 0x800000, "gfx1", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
r7972r7973
25452644
25462645
25472646
2647
25482648/*
25492649Puzzle Star
25502650IGS, 1999
r7972r7973
25982698
25992699ROM_START( puzlstar )
26002700   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2601   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) ) // (BIOS)
2701   PGM_68K_BIOS
26022702   ROM_LOAD16_BYTE( "v100mg.u1",     0x100001, 0x080000, CRC(5788b77d) SHA1(7770aae6e686da92b2623c977d1bc8f019f48267) )
26032703   ROM_LOAD16_BYTE( "v100mg.u2",     0x100000, 0x080000, CRC(4c79d979) SHA1(3b92052a35994f2b3dd164930154184c45d5e2d0) )
26042704
r7972r7973
26832783
26842784ROM_START( olds )
26852785   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
2686   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
2786   PGM_68K_BIOS
26872787   ROM_LOAD16_BYTE( "sp_v101.u2",      0x100001, 0x080000,   CRC(08eb9661) SHA1(105946e72e562adb1a9fd794ca0fd2c91967eb56) )
26882788   ROM_LOAD16_BYTE( "sp_v101.u3",      0x100000, 0x080000,   CRC(0a358c1e) SHA1(95c7c3f069c5d05001e22535750f6b3cd7de105f) )
26892789   ROM_LOAD16_BYTE( "sp_v101.u4",      0x200001, 0x080000,   CRC(766570e0) SHA1(e7c3f5664ec69b662b82c2e1375555db7305390c) )
r7972r7973
26922792
26932793   /* CPU2 = Z80, romless, code uploaded by 68k */
26942794
2695   ROM_REGION( 0x010000, "user1", 0 ) /* ASIC25? Protection Data */
2795   ROM_REGION( 0x010000, "user1", 0 ) /* IGS028 Protection Data */
26962796   ROM_LOAD( "sp_v101.u6", 0x000000, 0x010000,  CRC(097046bc) SHA1(6d75db85cf4c79b63e837897785c253014b2126d) )
26972797
26982798   ROM_REGION( 0x4000, "user2", ROMREGION_ERASEFF ) /* its a dump of the shared protection rom/ram from pcb. */
r7972r7973
27302830
27312831ROM_START( olds100 )
27322832   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
2733   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
2833   PGM_68K_BIOS
27342834   ROM_LOAD16_BYTE( "v100-u2.040",      0x100001, 0x080000,  CRC(517c2a06) SHA1(bbf5b311fac9b0bb4d4129c0561e5e24f6963fa2) )
27352835   ROM_LOAD16_BYTE( "v100-u3.040",      0x100000, 0x080000,  CRC(d0e2b741) SHA1(2e671dbb4320d1f0c059b35efd33cdea26f12131) )
27362836   ROM_LOAD16_BYTE( "v100-u4.040",      0x200001, 0x080000,  CRC(32a6bdbd) SHA1(a93d7f4eae722a58eca9ec351ad5890cefda56f0) )
r7972r7973
27432843   // used to simulate encrypted DMA protection device for now ..
27442844   ROM_LOAD( "ram_dump", 0x000000, 0x04000, CRC(280cfb4e) SHA1(cd2bdcaa21347952c2bf38b105a204d327fde39e) )
27452845
2746   ROM_REGION( 0x010000, "user1", 0 ) /* ASIC25? Protection Data */
2846   ROM_REGION( 0x010000, "user1", 0 ) /* IGS028 Protection Data */
27472847   ROM_LOAD( "kd-u6.512", 0x000000, 0x010000,  CRC(e7613dda) SHA1(0d7c043b90e2f9a36a45066f22e3e305dc716676) )
27482848
27492849   ROM_REGION( 0xc00000, "gfx1",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
r7972r7973
27772877/* this is the set which the protection ram dump seems to be for.. */
27782878ROM_START( olds100a )
27792879   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code  */
2780   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )// (BIOS)
2880   PGM_68K_BIOS
27812881   /* this rom had a lame hack applied to it by the dumper, this was removed, hopefully it is correct now */
27822882   ROM_LOAD16_WORD_SWAP( "p0500.v10",    0x100000, 0x400000, CRC(8981fc87) SHA1(678d6705d06b99bca5951ff77708adadc4c4396b) )
27832883
27842884   /* CPU2 = Z80, romless, code uploaded by 68k */
27852885
2786   ROM_REGION( 0x010000, "user1", ROMREGION_ERASEFF ) /* ASIC25? Protection Data */
2886   ROM_REGION( 0x010000, "user1", ROMREGION_ERASEFF ) /* IGS028 Protection Data */
27872887   /* missing from this set .. */
27882888
27892889   ROM_REGION( 0x4000, "user2", ROMREGION_ERASEFF ) /* its a dump of the shared protection rom/ram from pcb. */
r7972r7973
28212921
28222922ROM_START( kov2 )
28232923   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2824   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2924   PGM_68K_BIOS
28252925   ROM_LOAD16_WORD_SWAP( "u18.107",      0x100000, 0x400000, CRC(661a5b2c) SHA1(125054fabc93d4f4cba869c3e6adf863650d30cf) )
28262926
28272927   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
28572957
28582958ROM_START( kov2106 )
28592959   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2860   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2960   PGM_68K_BIOS
28612961   ROM_LOAD16_WORD_SWAP( "u18.106",    0x100000, 0x400000, CRC(40051ad9) SHA1(ba2ddf267fe688d5dfed575aeeccbab10135b37b) )
28622962
28632963   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
28942994
28952995ROM_START( kov2103 )
28962996   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2897   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
2997   PGM_68K_BIOS
28982998   ROM_LOAD16_WORD_SWAP( "u18.103",    0x100000, 0x400000, CRC(98c32f76) SHA1(ec7e35e8071bb7097e415493be4e40be0ca19fd6) )
28992999
29003000   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
29313031
29323032ROM_START( kov2102 )
29333033   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2934   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3034   PGM_68K_BIOS
29353035   ROM_LOAD16_WORD_SWAP( "u18.102",    0x100000, 0x400000, CRC(a2489c37) SHA1(77ea7cdec211848296dafd45bee1d042133ea2a6) )
29363036
29373037   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
29673067
29683068ROM_START( kov2100 )
29693069   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
2970   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3070   PGM_68K_BIOS
29713071   ROM_LOAD16_WORD_SWAP( "igs_u18.rom",    0x100000, 0x400000, CRC(86205879) SHA1(f73d5b70b41d39be1cac75e474b025de2cce0b01) )
29723072
29733073   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
30033103
30043104ROM_START( kov2p )
30053105   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3006   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3106   PGM_68K_BIOS
30073107   ROM_LOAD16_WORD_SWAP( "v204-32m.rom",    0x100000, 0x400000, CRC(583e0650) SHA1(2e5656dd9c6cba9f84af9baa3f5f70cdccf9db47) )
30083108
30093109   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
30393139
30403140ROM_START( kov2p205 )
30413141   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3042   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3142   PGM_68K_BIOS
30433143   ROM_LOAD16_WORD_SWAP( "u8-27322.rom",    0x100000, 0x400000, CRC(3a2cc0de) SHA1(d7511478b34bfb03b2fb5b8268b60502d05b9414) )
30443144
30453145   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
30903190
30913191ROM_START( ddp2 )
30923192   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3093   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3193   PGM_68K_BIOS
30943194   ROM_LOAD16_WORD_SWAP( "v100.u8", 0x100000, 0x200000, CRC(0c8aa8ea) SHA1(57e33224622607a1df8daabf26ba063cf8a6d3fc) )
30953195
30963196   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
31223222
31233223ROM_START( ddp2a )
31243224   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3125   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3225   PGM_68K_BIOS
31263226   ROM_LOAD16_WORD_SWAP( "v102.u8", 0x100000, 0x200000, CRC(5a9ea040) SHA1(51eaec46c368f7cfc5245e64896092f52b1193e0) )
31273227
31283228   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
32083308*/
32093309ROM_START( puzzli2 )
32103310   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3211   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3311   PGM_68K_BIOS
32123312   ROM_LOAD16_BYTE( "2sp_v200.u3",     0x100001, 0x080000, CRC(2a5ba8a6) SHA1(4c87b849fd6f39152e3e2ef699b78ce24b3fb6d0) )
32133313   ROM_LOAD16_BYTE( "2sp_v200.u4",     0x100000, 0x080000, CRC(fa5c86c1) SHA1(11c219722b891b775c0f7f9bc8276cdd8f74d657) )
32143314
r7972r7973
33003400
33013401ROM_START( martmast )
33023402   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3303   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3403   PGM_68K_BIOS
33043404   ROM_LOAD16_WORD_SWAP( "v104_32m.u9",    0x100000, 0x400000, CRC(cfd9dff4) SHA1(328eaf6ac49a73265ee4e0f992b1b1312f49877b) )
33053405
33063406   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
33373437
33383438ROM_START( martmastc )
33393439   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3340   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3440   PGM_68K_BIOS
33413441   ROM_LOAD16_WORD_SWAP( "v104_32m.u9",    0x100000, 0x400000, CRC(cfd9dff4) SHA1(328eaf6ac49a73265ee4e0f992b1b1312f49877b) )
33423442
33433443   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
33743474
33753475ROM_START( martmastc102 )
33763476   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3377   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3477   PGM_68K_BIOS
33783478   ROM_LOAD16_WORD_SWAP( "martmast_u9-v102.322",    0x100000, 0x400000, CRC(bb24b92a) SHA1(442cb9e3f51727be82f71c078c5c3e49dc1a23f0) )
33793479
33803480   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
34623562
34633563ROM_START( dmnfrnt )
34643564   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3465   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3565   PGM_68K_BIOS
34663566   ROM_LOAD16_WORD_SWAP( "v102_16m.u5",    0x100000, 0x200000, CRC(3d4d481a) SHA1(95953b8f31343389405cc722b4177ff5adf67b62) )
34673567
34683568   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
34963596
34973597ROM_START( dmnfrnta )
34983598   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3499   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3599   PGM_68K_BIOS
35003600   ROM_LOAD16_WORD_SWAP( "v105_16m.u5",    0x100000, 0x200000, CRC(bda083bd) SHA1(58d6438737a2c43aa8bbcb7f34fb51375b781b1c) )
35013601
35023602   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
35303630
35313631ROM_START( theglad )
35323632   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3533   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3633   PGM_68K_BIOS
35343634   ROM_LOAD16_WORD_SWAP( "u6.rom",       0x100000, 0x080000, CRC(14c85212) SHA1(8d2489708e176a2c460498a13173be01f645b79e) )
35353635
35363636   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
35643664
35653665ROM_START( theglada )
35663666   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3567   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3667   PGM_68K_BIOS
35683668   ROM_LOAD16_WORD_SWAP( "v101.u6",      0x100000, 0x080000, CRC(f799e866) SHA1(dccc3c903357c40c3cf85ac0ae8fc12fb0f853a6) )
35693669
35703670   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
35983698
35993699ROM_START( oldsplus )
36003700   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3601   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3701   PGM_68K_BIOS
36023702   ROM_LOAD16_WORD_SWAP( "p05301.rom",   0x100000, 0x400000, CRC(923f7246) SHA1(818ade79e9724f5a2b0cc5a647ae5d4ee0374799) )
36033703
36043704   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
36303730
36313731ROM_START( kovshp )
36323732   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3633   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3733   PGM_68K_BIOS
36343734   ROM_LOAD16_WORD_SWAP( "p0600h.rom",   0x100000, 0x400000, CRC(e251e8e4) SHA1(af5b7c81632a39e1450d932951bed634c76b84e8) )
36353735
36363736   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
36623762
36633763ROM_START( killbldp )
36643764   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3665   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3765   PGM_68K_BIOS
36663766   ROM_LOAD16_WORD_SWAP( "v300x.u6",     0x100000, 0x080000, CRC(b7fb8ec9) SHA1(e71b2d74269a82c7155b9818821156e128b68b28) )
36673767
36683768   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
36973797
36983798ROM_START( svg )
36993799   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3700   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3800   PGM_68K_BIOS
37013801   ROM_LOAD16_WORD_SWAP( "u30.bin",      0x100000, 0x080000, CRC(34c18f3f) SHA1(42d1edd0dcfaa5e44861c6a1d4cb24f51ba23de8) )
37023802
37033803   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
37343834
37353835ROM_START( happy6 )
37363836   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3737   ROM_LOAD16_WORD_SWAP( "pgm_p01s.rom", 0x000000, 0x020000, CRC(e42b166e) SHA1(2a9df9ec746b14b74fae48b1a438da14973702ea) )  // (BIOS)
3837   PGM_68K_BIOS
37383838   ROM_LOAD16_WORD_SWAP( "happy6in1_v100cn.u5",      0x100000, 0x080000, CRC(a25418e8) SHA1(acd7e7b69956cb4ce8e26c6420cb97bb4bf404e7) )
37393839
37403840   /* CPU2 = Z80, romless, code uploaded by 68k */
r7972r7973
40924192   kov2_latch_init(machine);
40934193}
40944194
4095static DRIVER_INIT( dw3 )
4096{
4097   pgm_basic_init(machine);
40984195
4099//  memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xda0000, 0xdaffff, 0, 0, dw3_prot_r, dw3_prot_w);
4196/* The IGS022 is an MCU which performs encrypted DMA used by
4197 - The Killing Blade
4198 - Dragon World 3
41004199
4101   pgm_dw3_decrypt(machine);
4102}
4200 There is also an automatic transfer which happens on startup using params stored in the data ROM.
4201 This has been verified on real hardware running without any 68k game program.
41034202
4104/* Killing Blade uses some kind of DMA protection device which can copy data from a data rom.  The
4105   MCU appears to have an internal ROM as if you remove the data ROM then the shared ram is filled
4106   with a constant value.
4107
4108   The device can perform various decryption operations on the data it copies.  for now we're just
4109   using a dump of the shared RAM instead.  This will be improved later.
41104203*/
41114204
41124205
4113static WRITE16_HANDLER( killbld_prot_w )
4206static void IGS022_do_dma(running_machine* machine, UINT16 src, UINT16 dst, UINT16 size, UINT16 mode)
41144207{
4115//  mame_printf_debug("killbrd prot r\n");
4116//  return 0;
4117   pgm_state *state = (pgm_state *)space->machine->driver_data;
4118   offset &= 0xf;
4208   pgm_state *state = (pgm_state *)machine->driver_data;
4209   UINT16 param;
4210   /*
4211    P_SRC =0x300290 (offset from prot rom base)
4212    P_DST =0x300292 (words from 0x300000)
4213    P_SIZE=0x300294 (words)
4214    P_MODE=0x300296
41194215
4120   if (offset == 0)
4121      state->kb_cmd = data;
4122   else //offset==2
4216    Mode 5 direct
4217    Mode 6 swap nibbles and bytes
4218
4219    1,2,3 table based ops
4220    */
4221
4222   //mame_printf_debug("src %04x dst %04x size %04x mode %04x\n", src, dst, size, mode);
4223
4224   //if (src&1) mame_printf_debug("odd offset\n");
4225
4226   param = mode >> 8;
4227   mode &=0xf;  // what are the other bits?
4228
4229
4230   if ((mode == 0) || (mode == 1) || (mode == 2) || (mode == 3))
41234231   {
4124      logerror("%06X: ASIC25 W CMD %X  VAL %X", cpu_get_pc(space->cpu), state->kb_cmd, data);
4125      if (state->kb_cmd == 0)
4126         state->kb_reg = data;
4127      else if (state->kb_cmd == 2)
4232      /* mode3 applies a xor from a 0x100 byte table to the data being
4233           transferred
4234
4235           the table is stored at the start of the protection rom.
4236
4237           the param used with the mode gives a start offset into the table
4238
4239           odd offsets seem to change the table slightly (see rawDataOdd)
4240
4241       */
4242
4243      /*
4244        unsigned char rawDataOdd[256] = {
4245            0xB6, 0xA8, 0xB1, 0x5D, 0x2C, 0x5D, 0x4F, 0xC1,
4246            0xCF, 0x39, 0x3A, 0xB7, 0x65, 0x85, 0xD9, 0xEE,
4247            0xDB, 0x7B, 0x5F, 0x81, 0x03, 0x6D, 0xEB, 0x07,
4248            0x0F, 0xB5, 0x61, 0x59, 0xCD, 0x60, 0x06, 0x21,
4249            0xA0, 0x99, 0xDD, 0x27, 0x42, 0xD7, 0xC5, 0x5B,
4250            0x3B, 0xC6, 0x4F, 0xA2, 0x20, 0xF6, 0x61, 0x61,
4251            0x8C, 0x46, 0x8C, 0xCA, 0xE0, 0x0E, 0x2C, 0xE9,
4252            0xBA, 0x0F, 0x45, 0x6D, 0x36, 0x1C, 0x18, 0x37,
4253            0xE7, 0x85, 0x89, 0xA4, 0x94, 0x46, 0x30, 0x9B,
4254            0xB2, 0xF4, 0x41, 0x55, 0xA5, 0x63, 0x1C, 0xEF,
4255            0xB7, 0x18, 0xB3, 0xB1, 0xD4, 0x72, 0xA0, 0x1C,
4256            0x0B, 0x97, 0x02, 0xB6, 0xC5, 0x1F, 0x1B, 0x94,
4257            0xC3, 0x83, 0xAA, 0xAC, 0xD9, 0x44, 0x09, 0xD7,
4258            0x6C, 0xDB, 0x07, 0xA9, 0xAD, 0x64, 0x83, 0xF1,
4259            0x92, 0x09, 0xCD, 0x0E, 0x99, 0x2F, 0xBC, 0xF8,
4260            0x3C, 0x63, 0x8F, 0x0A, 0x33, 0x03, 0x84, 0x91,
4261            0x6C, 0xAC, 0x3A, 0x15, 0xCB, 0x67, 0xC7, 0x69,
4262            0xA1, 0x92, 0x99, 0x74, 0xEE, 0x90, 0x0D, 0xBE,
4263            0x57, 0x30, 0xD1, 0xBA, 0xE5, 0xDE, 0xFA, 0xD6,
4264            0x83, 0x8C, 0xE4, 0x43, 0x36, 0x5E, 0xCD, 0x84,
4265            0x1A, 0x18, 0x31, 0xB9, 0x20, 0x48, 0xE3, 0xA8,
4266            0x89, 0x32, 0xF0, 0x90, 0x21, 0x80, 0x33, 0xAE,
4267            0x3C, 0xA6, 0xB8, 0x8C, 0x72, 0x17, 0xD1, 0x0C,
4268            0x1A, 0x29, 0xFA, 0x38, 0x87, 0xC9, 0x6E, 0xC7,
4269            0x05, 0xDE, 0x85, 0x6E, 0x92, 0x7E, 0xD4, 0xED,
4270            0x5C, 0xD3, 0x03, 0xD4, 0xFE, 0xCB, 0x6C, 0x19,
4271            0x7A, 0x83, 0x79, 0x5B, 0xF6, 0x71, 0xBA, 0xF4,
4272            0x37, 0x53, 0xC9, 0xC1, 0xDE, 0xDB, 0xDE, 0xB1,
4273            0x64, 0x17, 0x31, 0x0E, 0xD7, 0xA2, 0x13, 0x8E,
4274            0x52, 0x8D, 0xCB, 0x19, 0x3D, 0x0B, 0x31, 0x58,
4275            0x4A, 0xDE, 0x0C, 0x01, 0x2B, 0x85, 0x2D, 0xE5,
4276            0x13, 0x22, 0x48, 0xB6, 0xF3, 0x2D, 0x00, 0x9A
4277        };
4278        */
4279      int x;
4280      UINT16 *PROTROM = (UINT16*)memory_region(machine, "igs022data");
4281
4282      for (x = 0; x < size; x++)
41284283      {
4129         if (data == 1)   //Execute cmd
4130         {
4131            UINT16 cmd = state->sharedprotram[0x200/2];
4132            //mame_printf_debug("command %04x\n", cmd);
4133            if (cmd == 0x6d)   //Store values to asic ram
4134            {
4135               UINT32 p1 = (state->sharedprotram[0x298/2] << 16) | state->sharedprotram[0x29a/2];
4136               UINT32 p2 = (state->sharedprotram[0x29c/2] << 16) | state->sharedprotram[0x29e/2];
4284         //UINT16 *RAMDUMP = (UINT16*)memory_region(space->machine, "user2");
4285         //UINT16 dat = RAMDUMP[dst + x];
41374286
4138               if ((p2 & 0xffff) == 0x9)   //Set value
4139               {
4140                  int reg = (p2 >> 16) & 0xffff;
4141                  if (reg & 0x200)
4142                     state->kb_regs[reg & 0xff] = p1;
4143               }
4144               if ((p2 & 0xffff) == 0x6)   //Add value
4145               {
4146                  int src1 = (p1 >> 16) & 0xff;
4147                  int src2 = (p1 >> 0) & 0xff;
4148                  int dst = (p2 >> 16) & 0xff;
4149                  state->kb_regs[dst] = state->kb_regs[src2] - state->kb_regs[src1];
4150               }
4151               if ((p2 & 0xffff) == 0x1)   //Add Imm?
4152               {
4153                  int reg = (p2 >> 16) & 0xff;
4154                  int imm = (p1 >> 0) & 0xffff;
4155                  state->kb_regs[reg] += imm;
4156               }
4157               if ((p2 & 0xffff) == 0xa)   //Get value
4158               {
4159                  int reg = (p1 >> 16) & 0xFF;
4160                  state->sharedprotram[0x29c/2] = (state->kb_regs[reg] >> 16) & 0xffff;
4161                  state->sharedprotram[0x29e/2] = state->kb_regs[reg] & 0xffff;
4162               }
4163            }
4164            if(cmd == 0x4f)   //memcpy with encryption / scrambling
4165            {
4166               UINT16 src = state->sharedprotram[0x290 / 2] >> 1; // ?
4167               UINT32 dst = state->sharedprotram[0x292 / 2];
4168               UINT16 size = state->sharedprotram[0x294 / 2];
4169               UINT16 mode = state->sharedprotram[0x296 / 2];
4287         UINT16 dat2 = PROTROM[src + x];
41704288
4289         UINT8 extraoffset = param&0xfe; // the lowest bit changed the table addressing in tests, see 'rawDataOdd' table instead.. it's still related to the main one, not identical
4290         UINT8* dectable = (UINT8*)memory_region(machine, "igs022data");//rawDataEven; // the basic decryption table is at the start of the mcu data rom! at least in killbld
4291         UINT16 extraxor = ((dectable[((x*2)+0+extraoffset)&0xff]) << 8) | (dectable[((x*2)+1+extraoffset)&0xff] << 0);
41714292
4172            //  int a=1;
4173            //  if(src==0x580)
4174            //      int a=1;
4175               /*
4176                    P_SRC =0x300290 (offset from prot rom base)
4177                    P_DST =0x300292 (words from 0x300000)
4178                    P_SIZE=0x300294 (words)
4179                    P_MODE=0x300296
4293         dat2 = ((dat2 & 0x00ff)<<8) | ((dat2 & 0xff00)>>8);
41804294
4181                    Mode 5 direct
4182                    Mode 6 swap nibbles and bytes
4295         //  mode==0 plain
4296         if (mode==3) dat2 ^= extraxor;
4297         if (mode==2) dat2 += extraxor;
4298         if (mode==1) dat2 -= extraxor;
41834299
4184                    1,2,3 unk.
4185                    */
4300         //if (dat!=dat2)
4301         //  printf("Mode %04x Param %04x Mismatch %04x %04x\n", mode, param, dat, dat2);
41864302
4187               //mame_printf_debug("src %04x dst %04x size %04x mode %04x\n", src, dst, size, mode);
4303         state->sharedprotram[dst + x] = dat2;
4304      }
41884305
4189               //if (src&1) mame_printf_debug("odd offset\n");
4306      /* hack, patches out some additional security checks... we need to emulate them instead!
4307          they occur before it displays the disclaimer, so if you remove the overlay patches it will display
4308          the highscore table before coming up with this error... */
4309      if ((mode==3) && (param==0x54) && (src*2==0x2120) && (dst*2==0x2600)) state->sharedprotram[0x2600 / 2] = 0x4e75;
41904310
4191               mode &=0xf;  // what are the other bits?
4311   }
4312   if (mode == 4)
4313   {
4314      mame_printf_debug("unhandled copy mode %04x!\n", mode);
4315      // not used by killing blade
4316      /* looks almost like a fixed value xor, but isn't */
4317   }
4318   else if (mode == 5)
4319   {
4320      /* mode 5 seems to be a straight copy */
4321      int x;
4322      UINT16 *PROTROM = (UINT16*)memory_region(machine, "igs022data");
4323      for (x = 0; x < size; x++)
4324      {
4325         UINT16 dat = PROTROM[src + x];
41924326
4193               if (mode == 1 || mode == 2 || mode == 3)
4194               {
4195                  /* for now, cheat -- the scramble isn't understood, it might
4196                           be state based */
4197                  int x;
4198                  UINT16 *RAMDUMP = (UINT16*)memory_region(space->machine, "user2");
4199                  for (x = 0; x < size; x++)
4200                  {
4201                     UINT16 dat;
42024327
4203                     dat = RAMDUMP[dst + x];
4204                     state->sharedprotram[dst + x] = dat;
4205                  }
4206               }
4207               else if (mode == 5)
4208               {
4209                  /* mode 5 seems to be a straight copy */
4210                  int x;
4211                  UINT16 *RAMDUMP = (UINT16*)memory_region(space->machine, "user2");
4212                  UINT16 *PROTROM = (UINT16*)memory_region(space->machine, "user1");
4213                  for (x = 0; x < size; x++)
4214                  {
4215                     UINT16 dat = PROTROM[src + x];
4328         state->sharedprotram[dst + x] = dat;
4329      }
4330   }
4331   else if (mode == 6)
4332   {
4333      /* mode 6 seems to swap bytes and nibbles */
4334      int x;
4335      UINT16 *PROTROM = (UINT16*)memory_region(machine, "igs022data");
4336      for (x = 0; x < size; x++)
4337      {
4338         UINT16 dat = PROTROM[src + x];
42164339
4217                     if (RAMDUMP[dst + x] != dat)
4218                        mame_printf_debug("Mismatch! %04x %04x\n", RAMDUMP[dst + x], dat);
4340         dat = ((dat & 0xf000) >> 12)|
4341              ((dat & 0x0f00) >> 4)|
4342              ((dat & 0x00f0) << 4)|
4343              ((dat & 0x000f) << 12);
42194344
4220                     state->sharedprotram[dst + x] = dat;
4221                  }
4222               }
4223               else if (mode == 6)
4224               {
4225                  /* mode 6 seems to swap bytes and nibbles */
4226                  int x;
4227                  UINT16 *RAMDUMP = (UINT16*)memory_region(space->machine, "user2");
4228                  UINT16 *PROTROM = (UINT16*)memory_region(space->machine, "user1");
4229                  for (x = 0; x < size; x++)
4230                  {
4231                     UINT16 dat = PROTROM[src + x];
4345         state->sharedprotram[dst + x] = dat;
4346      }
4347   }
4348   else if (mode == 7)
4349   {
4350      mame_printf_debug("unhandled copy mode %04x!\n", mode);
4351      // not used by killing blade
4352      /* weird mode, the params get left in memory? - maybe it's a NOP? */
4353   }
4354   else
4355   {
4356      mame_printf_debug("unhandled copy mode %04x!\n", mode);
4357      // not used by killing blade
4358      /* invalid? */
42324359
4233                     dat = ((dat & 0xf000) >> 12)|
4234                          ((dat & 0x0f00) >> 4)|
4235                          ((dat & 0x00f0) << 4)|
4236                          ((dat & 0x000f) << 12);
4360   }
4361}
42374362
4238                     if (RAMDUMP[dst + x] != dat)
4239                        mame_printf_debug("Mismatch! Mode 6 %04x %04x\n", RAMDUMP[dst + x], dat);
4363// the internal MCU boot code automatically does this DMA
4364// and puts the version # of the data rom in ram
4365static void IGS022_reset(running_machine* machine)
4366{
4367   int i;
4368   UINT16 *PROTROM = (UINT16*)memory_region(machine, "igs022data");
4369   pgm_state *state = (pgm_state *)machine->driver_data;
4370   UINT16 tmp;
42404371
4241                     state->sharedprotram[dst + x] = dat;
4242                  }
4243               }
4244               else
4245               {
4246                  mame_printf_debug("unknown copy mode!\n");
4247               }
4248               /* hack.. it jumps here but there isn't valid code even when we do
4249                       use what was in ram.. probably some more protection as the game
4250                       still doesn't behave 100% correctly :-/
4372   // fill ram with A5 patern
4373   for (i = 0; i < 0x4000/2; i++)
4374      state->sharedprotram[i] = 0xa55a;
42514375
4252                       the code is copied in 'mode 3' but even the code put here on
4253                       the real ram dump is corrupt??? something _very_ strange is
4254                       going on.. maybe more rom overlays, or ram overlays too??
4376   // the auto-dma
4377   UINT16 src = PROTROM[0x100 / 2];
4378   UINT32 dst = PROTROM[0x102 / 2];
4379   UINT16 size = PROTROM[0x104/ 2];
4380   UINT16 mode = PROTROM[0x106 / 2];
42554381
4256                    */
4257               state->sharedprotram[0x2600 / 2] = 0x4e75;
4382   src = ((src & 0xff00) >> 8) | ((src & 0x00ff) << 8);
4383   dst = ((dst & 0xff00) >> 8) | ((dst & 0x00ff) << 8);
4384   size = ((size & 0xff00) >> 8) | ((size & 0x00ff) << 8);
4385   mode &= 0xff;
42584386
4387   src >>= 1;
42594388
4260            }
4389   printf("Auto-DMA %04x %04x %04x %04x\n",src,dst,size,mode);
4390
4391   IGS022_do_dma(machine,src,dst,size,mode);
4392
4393   // there is also a version ID? (or is it some kind of checksum) that is stored in the data rom, and gets copied..
4394   // Dragon World 3 checks it
4395   tmp = PROTROM[0x114/2];
4396   tmp = ((tmp & 0xff00) >> 8) | ((tmp & 0x00ff) << 8);
4397   state->sharedprotram[0x2a2/2] = tmp;
4398}
4399
4400static void IGS022_handle_command(running_machine* machine)
4401{
4402   pgm_state *state = (pgm_state *)machine->driver_data;
4403   UINT16 cmd = state->sharedprotram[0x200/2];
4404   //mame_printf_debug("command %04x\n", cmd);
4405   if (cmd == 0x6d)   //Store values to asic ram
4406   {
4407      UINT32 p1 = (state->sharedprotram[0x298/2] << 16) | state->sharedprotram[0x29a/2];
4408      UINT32 p2 = (state->sharedprotram[0x29c/2] << 16) | state->sharedprotram[0x29e/2];
4409
4410      if ((p2 & 0xffff) == 0x9)   //Set value
4411      {
4412         int reg = (p2 >> 16) & 0xffff;
4413         if (reg & 0x200)
4414            state->kb_regs[reg & 0xff] = p1;
4415      }
4416      if ((p2 & 0xffff) == 0x6)   //Add value
4417      {
4418         int src1 = (p1 >> 16) & 0xff;
4419         int src2 = (p1 >> 0) & 0xff;
4420         int dst = (p2 >> 16) & 0xff;
4421         state->kb_regs[dst] = state->kb_regs[src2] - state->kb_regs[src1];
4422      }
4423      if ((p2 & 0xffff) == 0x1)   //Add Imm?
4424      {
4425         int reg = (p2 >> 16) & 0xff;
4426         int imm = (p1 >> 0) & 0xffff;
4427         state->kb_regs[reg] += imm;
4428      }
4429      if ((p2 & 0xffff) == 0xa)   //Get value
4430      {
4431         int reg = (p1 >> 16) & 0xFF;
4432         state->sharedprotram[0x29c/2] = (state->kb_regs[reg] >> 16) & 0xffff;
4433         state->sharedprotram[0x29e/2] = state->kb_regs[reg] & 0xffff;
4434      }
4435   }
4436   if(cmd == 0x4f)   //memcpy with encryption / scrambling
4437   {
4438      UINT16 src = state->sharedprotram[0x290 / 2] >> 1; // ?
4439      UINT32 dst = state->sharedprotram[0x292 / 2];
4440      UINT16 size = state->sharedprotram[0x294 / 2];
4441      UINT16 mode = state->sharedprotram[0x296 / 2];
4442
4443      IGS022_do_dma(machine, src,dst,size,mode);
4444   }
4445
4446}
4447
4448
4449static WRITE16_HANDLER( killbld_igs025_prot_w )
4450{
4451//  mame_printf_debug("killbrd prot r\n");
4452//  return 0;
4453   pgm_state *state = (pgm_state *)space->machine->driver_data;
4454   offset &= 0xf;
4455
4456   if (offset == 0)
4457      state->kb_cmd = data;
4458   else //offset==2
4459   {
4460      logerror("%06X: ASIC25 W CMD %X  VAL %X\n", cpu_get_pc(space->cpu), state->kb_cmd, data);
4461      if (state->kb_cmd == 0)
4462         state->kb_reg = data;
4463      else if (state->kb_cmd == 2)
4464      {
4465         if (data == 1)   //Execute cmd
4466         {
4467            IGS022_handle_command(space->machine);
42614468            state->kb_reg++;
42624469         }
42634470      }
r7972r7973
42684475   }
42694476}
42704477
4271static READ16_HANDLER( killbld_prot_r )
4478static READ16_HANDLER( killbld_igs025_prot_r )
42724479{
42734480//  mame_printf_debug("killbld prot w\n");
42744481   pgm_state *state = (pgm_state *)space->machine->driver_data;
r7972r7973
42894496         res = (protvalue >> (8 * (state->kb_ptr - 1))) & 0xff;
42904497      }
42914498   }
4292   logerror("%06X: ASIC25 R CMD %X  VAL %X", cpu_get_pc(space->cpu), state->kb_cmd, res);
4499   logerror("%06X: ASIC25 R CMD %X  VAL %X\n", cpu_get_pc(space->cpu), state->kb_cmd, res);
42934500   return res;
42944501}
42954502
4503
4504
42964505static MACHINE_RESET( killbld )
42974506{
4298   pgm_state *state = (pgm_state *)machine->driver_data;
4299   int i;
4300
43014507   MACHINE_RESET_CALL(pgm);
4302
4303   /* fill the protection ram with a5 */
4304   for (i = 0; i < 0x4000/2; i++)
4305      state->sharedprotram[i] = 0xa5a5;
4508   /* fill the protection ram with a5 + auto dma */
4509   IGS022_reset(machine);
43064510}
43074511
43084512
4513
4514
4515/* ASIC025/ASIC022 don't provide rom patches like the DW2 protection does, the previous dump was bad :-) */
43094516static DRIVER_INIT( killbld )
43104517{
43114518   pgm_state *state = (pgm_state *)machine->driver_data;
4312   UINT16 *mem16 = (UINT16 *)memory_region(machine, "maincpu");
43134519
43144520   pgm_basic_init(machine);
43154521   pgm_killbld_decrypt(machine);
43164522
4317   /* this isn't a hack.. doing a rom dump while the game is running shows the
4318       rom space to look like this.. there may be more overlays / enables tho */
4523   memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xd40000, 0xd40003, 0, 0, killbld_igs025_prot_r, killbld_igs025_prot_w);
43194524
4320   /* the game actually performs a CRC check of the rom during the 'Please Wait'
4321       screen, the checksum expected is that of the patched rom.  if the checksum
4322       fails the please wait screen doesn't last as long and the region supplied
4323       by the protection device is ignored and the attract sequence appears out
4324       of order */
4325   mem16[0x108a2c / 2] = 0xb6aa;
4326   mem16[0x108a30 / 2] = 0x6610;
4327   mem16[0x108a32 / 2] = 0x13c2;
4328   mem16[0x108a34 / 2] = 0x0080;
4329   mem16[0x108a36 / 2] = 0x9c76;
4330   mem16[0x108a38 / 2] = 0x23c3;
4331   mem16[0x108a3a / 2] = 0x0080;
4332   mem16[0x108a3c / 2] = 0x9c78;
4333   mem16[0x108a3e / 2] = 0x1002;
4334   mem16[0x108a40 / 2] = 0x6054;
4335   mem16[0x108a42 / 2] = 0x5202;
4336   mem16[0x108a44 / 2] = 0x0c02;
4337
4338   memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xd40000, 0xd40003, 0, 0, killbld_prot_r, killbld_prot_w);
4339
43404525   state->kb_cmd = 0;
43414526   state->kb_reg = 0;
43424527   state->kb_ptr = 0;
r7972r7973
43484533   state_save_register_global_array(machine, state->kb_regs);
43494534}
43504535
4536static MACHINE_RESET( dw3 )
4537{
4538   pgm_state *state = (pgm_state *)machine->driver_data;
4539
4540
4541   MACHINE_RESET_CALL(pgm);
4542   /* fill the protection ram with a5 + auto dma */
4543   IGS022_reset(machine);
4544
4545   /* game won't boot unless various values are in protection RAM
4546     - these should almost certainly end up there as the result of executing the protection
4547       commands are startup, but which, and how? */
4548
4549//  state->sharedprotram[0x200/2] = 0x006d;
4550   state->sharedprotram[0x202/2] = 0x007c; // it cares about this, operation status flag?
4551
4552//  state->sharedprotram[0x20c/2] = 0x0000;
4553//  state->sharedprotram[0x20e/2] = 0x0007;
4554//  state->sharedprotram[0x210/2] = 0x0000;
4555//  state->sharedprotram[0x212/2] = 0x0004;
4556//  state->sharedprotram[0x214/2] = 0x0000;
4557//  state->sharedprotram[0x216/2] = 0x0007;
4558//  state->sharedprotram[0x218/2] = 0x0000;
4559//  state->sharedprotram[0x21a/2] = 0x0004;
4560
4561//  state->sharedprotram[0x288/2] = 0x0000;
4562//  state->sharedprotram[0x28a/2] = 0x00c2;
4563//  state->sharedprotram[0x28c/2] = 0x0000;
4564//  state->sharedprotram[0x28e/2] = 0x00c2;
4565//  state->sharedprotram[0x290/2] = 0x0500;
4566//  state->sharedprotram[0x292/2] = 0x1000;
4567//  state->sharedprotram[0x294/2] = 0x00c3;
4568//  state->sharedprotram[0x296/2] = 0x7104;
4569//  state->sharedprotram[0x298/2] = 0x0000;
4570//  state->sharedprotram[0x29a/2] = 0x0003;
4571//  state->sharedprotram[0x29c/2] = 0x0108;
4572//  state->sharedprotram[0x29e/2] = 0x0009;
4573
4574//  state->sharedprotram[0x2a2/2] = 0x84f6; // it cares about this, it's the version number of the data rom, copied automatically!
4575
4576//  state->sharedprotram[0x2ac/2] = 0x006d;
4577//  state->sharedprotram[0x2ae/2] = 0x0000;
4578
4579//  state->sharedprotram[0x2b0/2] = 0xaf56;
4580
4581
4582}
4583
4584
4585
4586static int reg;
4587static int ptr=0;
4588
4589#define DW3BITSWAP(s,d,bs,bd)  d=((d&(~(1<<bd)))|(((s>>bs)&1)<<bd))
4590static UINT8 dw3_swap;
4591static WRITE16_HANDLER( drgw3_igs025_prot_w )
4592{
4593   pgm_state *state = (pgm_state *)space->machine->driver_data;
4594
4595   offset&=0xf;
4596
4597   if(offset==0)
4598      state->kb_cmd=data;
4599   else //offset==2
4600   {
4601      printf("%06X: ASIC25 W CMD %X  VAL %X\n",cpu_get_pc(space->cpu),state->kb_cmd,data);
4602      if(state->kb_cmd==0)
4603         reg=data;
4604      else if(state->kb_cmd==3)   //??????????
4605      {
4606         dw3_swap = data;
4607
4608         printf("SWAP %02x\n",dw3_swap);
4609      }
4610      //else if(kb_cmd==4)
4611      //  ptr=data;
4612      else if(state->kb_cmd==0x20)
4613         ptr++;
4614   }
4615}
4616
4617static READ16_HANDLER( drgw3_igs025_prot_r )
4618{
4619//  mame_printf_debug("killbld prot w\n");
4620   pgm_state *state = (pgm_state *)space->machine->driver_data;
4621
4622   UINT16 res ;
4623
4624   offset&=0xf;
4625   res=0;
4626
4627   if(offset==1)
4628   {
4629      if(state->kb_cmd==0)   //swap
4630      {
4631            UINT8 v1=(dw3_swap+1)&0x7F;
4632            UINT8 v2=0;
4633            DW3BITSWAP(v1,v2,7,0);
4634            DW3BITSWAP(v1,v2,6,1);
4635            DW3BITSWAP(v1,v2,5,2);
4636            DW3BITSWAP(v1,v2,4,3);
4637            DW3BITSWAP(v1,v2,3,4);
4638            DW3BITSWAP(v1,v2,2,5);
4639            DW3BITSWAP(v1,v2,1,6);
4640            DW3BITSWAP(v1,v2,0,7);
4641
4642            res=v2;
4643
4644      }
4645      else if(state->kb_cmd==1)
4646      {
4647         res=reg&0x7f;
4648      }
4649      else if(state->kb_cmd==5)
4650      {
4651         UINT32 protvalue;
4652         protvalue = 0x60000|input_port_read(space->machine, "Region");
4653         res=(protvalue>>(8*(ptr-1)))&0xff;
4654
4655
4656      }
4657   }
4658   logerror("%06X: ASIC25 R CMD %X  VAL %X\n",cpu_get_pc(space->cpu),state->kb_cmd,res);
4659   return res;
4660}
4661
4662
4663static DRIVER_INIT( drgw3 )
4664{
4665   pgm_basic_init(machine);
4666
4667/*
4668    pgm_state *state = (pgm_state *)machine->driver_data;
4669
4670    {
4671        int x;
4672        UINT16 *RAMDUMP = (UINT16*)memory_region(machine, "user2");
4673        for (x=0;x<(0x4000/2);x++)
4674        {
4675            state->sharedprotram[x] = RAMDUMP[x];
4676            if((x>=0x100)&&(x<0x110)) printf("data 0x%4x, offset:%x\n",state->sharedprotram[x],x);
4677        }
4678    }
4679*/
4680   memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xDA5610, 0xDA5613, 0, 0, drgw3_igs025_prot_r, drgw3_igs025_prot_w);
4681
4682   pgm_dw3_decrypt(machine);
4683}
4684
43514685static DRIVER_INIT( puzzli2 )
43524686{
43534687   /* this protection emulation is wrong
r7972r7973
46314965   Partially Working, playable, but some imperfections
46324966   -----------------------------------------------------------------------------------------------------------------------*/
46334967
4634GAME( 1998, killbld,      pgm,       killbld, killbld,  killbld,    ROT0,   "IGS", "The Killing Blade (ver. 109, Chinese Board)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // it's playable, but there are some things unclear about the protection
4635GAME( 1998, killbld104,   killbld,   killbld, killbld,  killbld,    ROT0,   "IGS", "The Killing Blade (ver. 104)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // this set doesn't work, needs the DMA device emulating properly rather than using extracted data
4968 // it's playable, but one of the protection checks is still patched
4969GAME( 1998, killbld,      pgm,       killbld, killbld,  killbld,    ROT0,   "IGS", "The Killing Blade (ver. 109, Chinese Board)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
4970GAME( 1998, killbld104,   killbld,   killbld, killbld,  killbld,    ROT0,   "IGS", "The Killing Blade (ver. 104)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
46364971
46374972GAME( 1998, olds,         pgm,       olds,    olds,     olds,       ROT0,   "IGS", "Oriental Legend Special / Xi You Shi E Zhuan Super (ver. 101, Korean Board)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
46384973GAME( 1998, olds100,      olds,      olds,    olds,     olds,       ROT0,   "IGS", "Oriental Legend Special / Xi You Shi E Zhuan Super (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
r7972r7973
46414976/* -----------------------------------------------------------------------------------------------------------------------
46424977   NOT Working (mostly due to needing internal protection roms dumped)
46434978   -----------------------------------------------------------------------------------------------------------------------*/
4644GAME( 1998, drgw3,        pgm,       pgm,     sango,    dw3,        ROT0,   "IGS", "Dragon World 3 (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
4645GAME( 1998, drgw3k,       drgw3,     pgm,     sango,    dw3,        ROT0,   "IGS", "Dragon World 3 (ver. 106, Korean Board)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
46464979
4980// should have DMA protection, like killbld, as well as the math / bitswap / memory manipulation stuff, but it never attempts to trigger the DMA? - we currently have a RAM dump to allow it to boot, but I think this stuff should be DMA copied into RAM, like killbld
4981GAME( 1998, drgw3,        pgm,       dw3,     dw3,      drgw3,      ROT0,   "IGS", "Dragon World 3 (ver. 106, Korean Board)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
4982GAME( 1998, drgw3105,     drgw3,     dw3,     dw3,      drgw3,      ROT0,   "IGS", "Dragon World 3 (ver. 105)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
4983GAME( 1998, drgw3100,     drgw3,     dw3,     dw3,      drgw3,      ROT0,   "IGS", "Dragon World 3 (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // Japan Only?
4984
46474985GAME( 1999, kov,          pgm,       kov,     sango,    kov,        ROT0,   "IGS", "Knights of Valour / Sangoku Senki (ver. 117)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */                 // V0008 04/27/99 10:33:33
46484986GAME( 1999, kov115,       kov,       kov,     sango,    kov,        ROT0,   "IGS", "Knights of Valour / Sangoku Senki (ver. 115)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */                 // V0006 02/22/99 11:53:18
46494987GAME( 1999, kov100,       kov,       kov,     sango,    kov,        ROT0,   "IGS", "Knights of Valour / Sangoku Senki (ver. 100, Japanese Board)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */ // V0002 01/31/99 01:54:16
r7972r7973
46645002GAME( 2002, dmnfrnt,      pgm,       svg,     sango,    dmnfrnt,    ROT0,   "IGS", "Demon Front (ver. 102)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
46655003GAME( 2002, dmnfrnta,     dmnfrnt,   svg,     sango,    dmnfrnt,    ROT0,   "IGS", "Demon Front (ver. 105)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
46665004
5005/* Games below this point are known to have an 'execute only' internal ROM area covering an area at the start of the internal ROM.  This can't be read when running code from either internal or external ROM space. */
5006
46675007GAME( 2003, theglad,      pgm,       svg,     sango,    theglad,    ROT0,   "IGS", "The Gladiator (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
46685008GAME( 2003, theglada,     theglad,   svg,     sango,    theglad,    ROT0,   "IGS", "The Gladiator (ver. 101)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
46695009
src/mame/drivers/skyarmy.c
r7972r7973
133133      pal = BITSWAP8(spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
134134
135135      sx = spriteram[offs+3];
136      sy = 242-spriteram[offs];
136      sy = 240-(spriteram[offs]+1);
137137      flipy = (spriteram[offs+1]&0x80)>>7;
138138      flipx = (spriteram[offs+1]&0x40)>>6;
139139
src/mame/drivers/qix.c
r7972r7973
12641264{
12651265   const address_space *mainspace = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
12661266   const address_space *videospace = cputag_get_address_space(machine, "videocpu", ADDRESS_SPACE_PROGRAM);
1267   const UINT8 *patch;
1267   //const UINT8 *patch;
12681268   UINT8 *rom, *decrypted;
12691269   int i;
12701270
r7972r7973
12831283     ********************************/
12841284
12851285   i = 0;
1286   patch = memory_region(machine, "user1");
1286   //patch = memory_region(machine, "user1");
12871287   rom = memory_region(machine, "maincpu");
12881288   decrypted = auto_alloc_array(machine, UINT8, 0x6000);
12891289
r7972r7973
12961296   }
12971297
12981298   i = 0;
1299   patch = memory_region(machine, "user2");
1299   //patch = memory_region(machine, "user2");
13001300   rom = memory_region(machine, "videocpu");
13011301   decrypted = auto_alloc_array(machine, UINT8, 0x6000);
13021302
src/mame/drivers/vicdual.c
r7972r7973
24822482   ROM_LOAD( "epr-274.u42", 0x3000, 0x0800, CRC(d69eb098) SHA1(fd3e67d18b5891aa65aab5967d49810c5d88dcee) )
24832483   ROM_LOAD( "epr-275.u41", 0x3800, 0x0800, CRC(1c7d90cc) SHA1(8483825d9811c925407328836ae10f98b011c3dd) )
24842484
2485   ROM_REGION( 0x0020, "proms", 0 )
2485   ROM_REGION( 0x0020, "proms", ROMREGION_INVERT )
24862486   ROM_LOAD( "pr-69.u11", 0x0000, 0x0020, CRC(c94dd091) SHA1(f88cfb033ff83adb7375652be1fa32ba489d8418) )
24872487
24882488   ROM_REGION( 0x0040, "user1", 0 )   /* timing PROMs */
src/mame/drivers/namcos23.c
r7972r7973
3232    - Serial number data is at offset 0x201 in the BIOS.  Until the games are running
3333      and displaying it I'm not going to meddle with it though.
3434
35    - Point roms are accessed for checksumming through a port at a200000x:
36      - reset the port by writing 0000 to a2000006
37      - write offset >> 16  to a2000004
38      - write offset & ffff to a2000004 (yes, same address, hence the reset)
39      - read 2 bytes from one rom at a200000a
40      - read 2 bytes from one rom at a200000c
41
4235    - Add the sh2 in Gunmen Wars (no rom, controls the camera)
4336
4437    - Super System 23 tests irqs in the post.  timecrs2c's code can
r7972r7973
11841177static UINT16 ctl_inp_buffer[2];
11851178
11861179static UINT16 c417_ram[0x10000], c417_adr = 0;
1180static UINT32 c417_pointrom_adr = 0;
11871181
11881182static UINT16 c412_sdram_a[0x100000]; // Framebuffers, probably
11891183static UINT16 c412_sdram_b[0x100000];
r7972r7973
12851279static READ16_HANDLER(s23_c417_r)
12861280{
12871281   switch(offset) {
1282      /* According to timecrs2c, +0 is the status word with bits being:
1283           15: test mode flag (huh?)
1284           10: fifo data ready
1285           9:  cmd ram data ready
1286           8:  matrix busy
1287           7:  output unit busy (inverted)
1288           6:  hokan/tenso unit busy
1289           5:  point unit busy
1290           4:  access unit busy
1291           3:  c403 busy (inverted)
1292           2:  2nd c435 busy (inverted)
1293           1:  1st c435 busy (inverted)
1294           0:  xcpreq
1295         */
12881296   case 0: return 0x8e | (video_screen_get_vblank(space->machine->primary_screen) ? 0x0000 : 0x8000);
12891297   case 1: return c417_adr;
12901298   case 4:
12911299      //      logerror("c417_r %04x = %04x (%08x, %08x)\n", c417_adr, c417_ram[c417_adr], cpu_get_pc(space->cpu), (unsigned int)cpu_get_reg(space->cpu, MIPS3_R31));
12921300      return c417_ram[c417_adr];
1301   case 5:
1302      if(c417_pointrom_adr >= ptrom_limit)
1303         return 0xffff;
1304      return ptrom[c417_pointrom_adr] >> 16;
1305   case 6:
1306      if(c417_pointrom_adr >= ptrom_limit)
1307         return 0xffff;
1308      return ptrom[c417_pointrom_adr];
1309
12931310   }
12941311
12951312   logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(space->cpu), (unsigned int)cpu_get_reg(space->cpu, MIPS3_R31));
r7972r7973
13001317{
13011318    switch(offset) {
13021319    case 0:
1303       if (data == 1)
1304   {
1305      logerror("c417_w: raise IRQ 2\n");
1306      cputag_set_input_line(space->machine, "maincpu", MIPS3_IRQ2, ASSERT_LINE);
1307   }
1308       break;
1320      logerror("p3d PIO %04x\n", data);
1321      break;
13091322    case 1:
13101323        COMBINE_DATA(&c417_adr);
13111324        break;
1312
1325   case 2:
1326      c417_pointrom_adr = (c417_pointrom_adr << 16) | data;
1327      break;
1328   case 3:
1329      c417_pointrom_adr = 0;
1330      break;
13131331    case 4:
13141332      //        logerror("c417_w %04x = %04x (%08x, %08x)\n", c417_adr, data, cpu_get_pc(space->cpu), (unsigned int)cpu_get_reg(space->cpu, MIPS3_R31));
13151333        COMBINE_DATA(c417_ram + c417_adr);
r7972r7973
13551373static READ16_HANDLER(s23_c412_r)
13561374{
13571375   switch(offset) {
1376   case 3:
1377      // 0001 = busy, 0002 = game uploads things
1378      return 0x0002;
13581379   case 8: return c412_adr;
13591380   case 9: return c412_adr >> 16;
13601381   case 10: return s23_c412_ram_r(space, c412_adr, mem_mask);
r7972r7973
15221543static READ16_HANDLER(s23_c361_r)
15231544{
15241545   switch(offset) {
1525   case 5: return video_screen_get_vpos(space->machine->primary_screen)*2;
1546   case 5: return video_screen_get_vpos(space->machine->primary_screen)*2 | (video_screen_get_vblank(space->machine->primary_screen) ? 1 : 0);
15261547   case 6: return video_screen_get_vblank(space->machine->primary_screen);
15271548   }
15281549   logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(space->cpu), (unsigned int)cpu_get_reg(space->cpu, MIPS3_R31));
r7972r7973
20752096
20762097      namcos23_poly_entry *p = render_polys + render_poly_count;
20772098
2078      p->vertex_count = poly_zclip_if_less(ne, pv, p->pv, 4, 0.001);
2099      p->vertex_count = poly_zclip_if_less(ne, pv, p->pv, 4, 0.001f);
20792100
20802101      if(p->vertex_count >= 3) {
20812102         for(int i=0; i<p->vertex_count; i++) {
r7972r7973
21992220   c361_timer = timer_alloc(machine, c361_timer_cb, 0);
22002221   timer_adjust_oneshot(c361_timer, attotime_never, 0);
22012222}
2223
22022224static ADDRESS_MAP_START( gorgon_map, ADDRESS_SPACE_PROGRAM, 32 )
2225   ADDRESS_MAP_GLOBAL_MASK(0xfffffff)
22032226   AM_RANGE(0x00000000, 0x003fffff) AM_RAM
22042227   AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE( p3d_r, p3d_w )
22052228   AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16( s23_c417_r, s23_c417_w, 0xffffffff )
r7972r7973
22272250   AM_RANGE(0x0f200000, 0x0f201fff) AM_RAM
22282251
22292252   AM_RANGE(0x0fc00000, 0x0fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0)
2230   AM_RANGE(0x1fc00000, 0x1fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0)
22312253ADDRESS_MAP_END
22322254
22332255static ADDRESS_MAP_START( ss23_map, ADDRESS_SPACE_PROGRAM, 32 )
2234   AM_RANGE(0x00000000, 0x003fffff) AM_RAM
2256   ADDRESS_MAP_GLOBAL_MASK(0xfffffff)
2257   AM_RANGE(0x00000000, 0x00ffffff) AM_RAM
22352258   AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE( p3d_r, p3d_w )
22362259   AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16( s23_c417_r, s23_c417_w, 0xffffffff )
22372260   AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE(&namcos23_shared_ram)
r7972r7973
22392262   AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM
22402263   AM_RANGE(0x06000000, 0x0600ffff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) // Backup
22412264   AM_RANGE(0x06200000, 0x06203fff) AM_RAM                             // C422
2242   AM_RANGE(0x06400000, 0x0640000f) AM_READWRITE16( s23_c422_r, s23_c422_w, 0xffffffff )   // C422 registers
2243   AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE(&namcos23_charram)   // text layer characters (shown as CGRAM in POST)
2265   AM_RANGE(0x06400000, 0x0640000f) AM_READWRITE16( s23_c422_r, s23_c422_w, 0xffffffff ) // C422 registers
2266   AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE( s23_txtchar_w ) AM_BASE(&namcos23_charram) // text layer characters (shown as CGRAM in POST)
22442267   AM_RANGE(0x06804000, 0x0681dfff) AM_RAM
22452268   AM_RANGE(0x0681e000, 0x0681ffff) AM_RAM_WRITE( namcos23_textram_w ) AM_BASE(&namcos23_textram)
2246   AM_RANGE(0x06820000, 0x0682000f) AM_READWRITE16( s23_c361_r, s23_c361_w, 0xffffffff )   // C361
2247   AM_RANGE(0x06a08000, 0x06a081ff) AM_RAM   // Blending control (C404 too?)
2248   AM_RANGE(0x06a08200, 0x06a087ff) AM_RAM   // GAMMA (C404)
2269   AM_RANGE(0x06820000, 0x0682000f) AM_READWRITE16( s23_c361_r, s23_c361_w, 0xffffffff ) // C361
2270   AM_RANGE(0x06a08000, 0x06a087ff) AM_RAM // Blending control & GAMMA (C404)
22492271   AM_RANGE(0x06a10000, 0x06a3ffff) AM_RAM_WRITE( namcos23_paletteram_w ) AM_BASE_GENERIC(paletteram)
2250   AM_RANGE(0x08000000, 0x08ffffff) AM_ROM AM_REGION("data", 0x0000000) AM_MIRROR(0x01000000)   // data ROMs
2251   AM_RANGE(0x0a000000, 0x0affffff) AM_ROM AM_REGION("data", 0x1000000) AM_MIRROR(0x01000000)
2272   AM_RANGE(0x08000000, 0x08ffffff) AM_ROM AM_REGION("data", 0x0000000) AM_MIRROR(0x1000000) // data ROMs
2273   AM_RANGE(0x0a000000, 0x0affffff) AM_ROM AM_REGION("data", 0x1000000) AM_MIRROR(0x1000000)
22522274   AM_RANGE(0x0c000000, 0x0c00001f) AM_READWRITE16( s23_c412_r, s23_c412_w, 0xffffffff )
22532275   AM_RANGE(0x0c400000, 0x0c400007) AM_READWRITE16( s23_c421_r, s23_c421_w, 0xffffffff )
22542276   AM_RANGE(0x0d000000, 0x0d00000f) AM_READWRITE16( s23_ctl_r, s23_ctl_w, 0xffffffff )
22552277   AM_RANGE(0x0e800000, 0x0e800003) AM_READ( s23_unk_status_r )
22562278   AM_RANGE(0x0fc00000, 0x0fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0)
2257   AM_RANGE(0x1fc00000, 0x1fffffff) AM_WRITENOP AM_ROM AM_REGION("user1", 0)
22582279ADDRESS_MAP_END
22592280
22602281static READ32_HANDLER( gmen_trigger_sh2 )
r7972r7973
26022623   PORT_START("H8PORT")
26032624
26042625   // No idea if start is actually there, but we need buttons to pass error screens
2605   // You can go to the pcb test mode by pressing start, but it crashes...
2626   // You can go to the pcb test mode by pressing start, and it doesn't crash anymore somehow
2627   // Use start1 to select, start1+start2 to exit, up/down to navigate
26062628   PORT_START("P1")
26072629   PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START1 )
2608   PORT_BIT( 0xff7, IP_ACTIVE_LOW, IPT_UNKNOWN )
2630   PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_START2 )
2631   PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2632   PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2633   PORT_BIT( 0xd07, IP_ACTIVE_LOW, IPT_UNKNOWN )
26092634
26102635   PORT_START("P2")
2611   PORT_BIT( 0xfff, IP_ACTIVE_LOW, IPT_START2 )
2636   PORT_BIT( 0xfff, IP_ACTIVE_LOW, IPT_UNKNOWN )
26122637
26132638   PORT_START("TC2P0")
26142639   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/naomi.c
r7972r7973
1717
1818Sega Naomi is Dreamcast based Arcade hardware.
1919
20Current Compatibility notes (GD-rom games only)
21|----------|-------|-----|------|------|------|--------------------------------|-----------------------------------------------------|
22|romname   | Pl(s) | Rot | Test | Boot | Game | Control Type                   | Notes                                               |
23|----------|-------|-----|------|------|------|--------------------------------|-----------------------------------------------------|
24|gundmgd   |   1   |  H  | Yes  | Yes  | Yes  | joystick with 4 buttons        |                                                     |
25|sfz3ugd   |   2   |  H  | Yes  | Yes  | No   | joystick with 6 buttons        | Hangs after pressing start                          |
26|cvsgd     |   2   |  H  | Yes  | Yes  | Yes  | joystick with 4 buttons        | 2 + 2 extra buttons                                 |
27|gundmxgd  |   1   |  H  | Yes  | Yes  | Yes  | joystick with 4 buttons        |                                                     |
28|cvs2gd    |   2   |  H  | Yes  | Yes  | Yes  | joystick with 6 buttons        |                                                     |
29|ikaruga   |   2   |  V  | Yes  | Yes  | Yes  | joystick with 2 buttons        |                                                     |
30|ggxx      |   2   |  H  | Yes  | Yes  | Yes  | joystick with 5 buttons        |                                                     |
31|moeru     |   2   |  H  | No   | No   | No   | joystick with 3 buttons        | Broken i/o, stuck at the "now loading" msg          |
32|chocomk   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 2 buttons        |                                                     |
33|quizqgd   |   2   |  V  | Yes  | Yes  | Yes  | joystick with 4 buttons        | Can play without joystick                           |
34|ggxxrl    |   2   |  H  | Yes  | Yes  | Yes  | joystick with 5 buttons        |                                                     |
35|tetkiwam  |   2   |  H  | No   | No   | No   | joystick with 3 buttons        | Black screen, tests the SCIF (UART) regs?           |
36|shikgam2  |   2   |  V  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o, crashes on the proper gameplay          |
37|usagui    |   1   |  H  | Yes  | Yes  | No   | mahjong panel                  |                                                     |
38|bdrdown   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 3 buttons        |                                                     |
39|psyvar2   |   1   |  V  | Yes  | Yes  | No   | joystick with 2 buttons        | Broken i/o? Hangs after pressing start              |
40|cfield    |   1   |  H  | Yes  | Yes  | Yes  | joystick with 3 buttons        |                                                     |
41|trizeal   |   2   |  V  | No   | No   | No   | joystick with 3 buttons        |                                                     |
42|meltybld  |   2   |  H  | Yes  | Yes  | Yes  | joystick with 4 buttons        | Crashes in attract mode                             |
43|senko     |   2   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        | Senko no Londe SP (undumped) uses 5 buttons         |
44|senkoo    |   2   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        |                                                     |
45|ss2005    |   1   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        | Calls a YUV FMV, crashes due of that                |
46|radirgy   |   1   |  V  | Yes  | Yes  | Yes  | joystick with 3 buttons        |                                                     |
47|ggxxsla   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 5 buttons        |                                                     |
48|kurucham  |   2   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o, crashes in attract with wrong mask      |
49|undefeat  |   2   |  V  | No   | No   | No   | joystick with 2 buttons        | Stuck at the "now loading" msg                      |
50|trgheart  |   1   |  V  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o                                          |
51|jingystm  |   2   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o                                          |
52|meltyb    |   2   |  H  | Yes  | Yes  | Yes  | joystick with 5 buttons        | Crashes in attract mode                             |
53|meltyba   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 5 buttons        | Crashes in attract mode                             |
54|karous    |   1   |  V  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o                                          |
55|takoron   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 3 buttons        |                                                     |
56--------------------------------------------------------------------------------------------------------------------------------------
57|confmiss  |   2   |  H  | Yes  | Yes  | No   | lightgun                       |                                                     |
58|sprtjam   |   2   |  H  | Yes  | Yes  | Yes  | joystick with 2 buttons        |                                                     |
59|slashout  |   1   |  H  | Yes  | Yes  | Yes  | joystick with 4 buttons        |                                                     |
60|spkrbtl   |   2   |  H  | Yes  | Yes  | No   | joystick with 4 buttons        | Crashes when loading the gameplay                   |
61|monkeyba  |   1   |  H  | Yes  | Yes  | No   | ad stick                       | Crashes when loading the gameplay                   |
62|dygolf    |   2   |  H  | No   | No   | No   | trackball + 4 buttons          | Moans about the jvs settings                        |
63|wsbbgd    |   2   |  H  | No   | No   | No   | ad stick + 2 buttons           | Moans about the jvs settings                        |
64|vtennisg  |   2   |  H  | Yes  | Yes  | No   | joystick with 2 buttons        | Broken gfxs, crashes after a while                  |
65|vathlete  |   2   |  H  | Yes  | Yes  | No   | joystick with 3 buttons        | Broken i/o                                          |
66|vtennis2  |   2   |  H  | No   | No   | No   | joystick with 3 buttons        |                                                     |
67|keyboard  |   2   |  H  | Yes  | Yes  | No   | keyboard                       | Broken i/o, crashes after a while                   |
68|lupinsho  |   2   |  H  | Yes  | Yes  | No   | lightgun                       | Broken i/o, crashes after a while                   |
69|luptype   |   2   |  H  | Yes  | Yes  | No   | keyboard                       | Broken i/o, ARM cpu crashes when inserting a coin   |
70|mok       |   2   |  H  | Yes  | Yes  | No   | lightgun                       | Broken i/o                                          |
71|ngdup23a  |   2   |  H  | Yes  | Yes  | Yes  | n/a                            | Missing DIMM emulation                              |
72|ngdup23c  |   2   |  H  | Yes  | Yes  | Yes  | n/a                            | Missing DIMM emulation                              |
73|puyofev   |   2   |  H  | Yes  | Yes  | No   | joystick with 2 buttons        | Broken i/o? Hangs after pressing start              |
74--------------------------------------------------------------------------------------------------------------------------------------
20ToDo:
21- many games needs proper per-game JVS settings, at least to let them boot:
22  - lightgun games (confmiss, lupinsho, mok);
23  - dygolf (trackball + 4 buttons / not actually needed to let it boot, just press start to bypass the moan msg);
24  - wsbbgd (ad stick + 2 buttons);
25  - monkeyba (ad stick, not actually needed to let it boot, but crashes at the proper gameplay, so it might);
26  - otrigger ?
27  - smarinef ?
28  - crackndj ?
29  - shootpl / shootopl ?
30  - kick4csh ?
7531
76Test: If it enters into test mode (not actually working test mode, i.e. if inputs doesn't work)
77Boot: If game boots and draws some gfxs
78Game: If game can be coined up and can actually be played without problems.
79If the three aforementioned are all yes and there aren't any notes, game is fully working.
32- tetkiwam, keyboard, vtennis2, vtennisg, monkeyba: they all crashes at some point, might be due of a bad FPU opcode;
8033
34- meltybld, meltyb, meltyba: crashes in attract mode;
8135
36- all games that uses YUV just updates one frame then dies, why?
37
38- all or almost all games seems to have issues with the sound loops, for example sfz3ugd keeps to say "This-This-This ..." at start-up
39  instead of completing the phrase;
40
41- luptype: ARM crashes when you insert a coin;
42
43- suchie3: used to boot (at least go over the I/O test), it doesn't now, might be protection related.
44
45- ngdup23a, ngdup23c: missing DIMM emulation, hence they can't possibly work, emulate the DIMM means to add an extra SH-4 ...
46
47- totd: emulation exits at some point during attract mode without any output.
48
49- spkrbtl: ARM CPU crashes sometimes? Also, it crashes when entering into the gameplay.
50
8251---------------------------------------------------------------------------------------------------------------------------------------------------
8352
8453Guru's Readme
r7972r7973
199168
200169
201170
202Sega NAOMI ROM cart usage
171NAOMI ROM cart usage
203172-------------------------
173There are 3 know types of carts manufactured by Sega: 171-7919A, 171-7978B, 171-8132B
174There are also 2 types of carts manufactured by Namco: MASK-B, MASK-C
204175
205176837-13668  171-7919A (C) Sega 1998
206|----------------------------------------------------------|
207|IC1   IC2   IC3   IC4   IC5   IC6         CN2             |
208|ROM1  ROM2  ROM3  ROM4  ROM5  ROM6                     JP1|
209|                                              IC42        |
210|                                       71256              |
211|                                       71256         IC22 |
212|            IC7  IC8  IC9  IC10  IC11                     |
177|---------------------------------------------------------|
178|                                       ----CN2----       -|
179|IC1   IC2   IC3   IC4   IC5   IC6                      JP1|
180|ROM1  ROM2  ROM3  ROM4  ROM5  ROM6            IC42        |
181|                                        IC45              |
182|                                        IC44         IC22 |
183|            IC7  IC8  IC9  IC10  IC11                     | male side
213184|            ROM7 ROM8 ROM9 ROM10 ROM11        IC41        |
214185|                                                          |
215186|                                              28MHz       |
216187|                                                          |
217|    CN3              X76F100               CN1            |
188|        ----CN3----        IC37        ----CN1----        |
218189|----------------------------------------------------------|
219190Notes:
220      Not all MASKROM positions are populated.
221      All MASKROMs (IC1 to IC21) are SOP44, either 32M or 64M
222191      The other side of the cart PCB just has more locations for
223      SOP44 MASKROMs... IC12 to IC21 (ROM12 to ROM21)
192      SOP44 MASKROMs... IC12S to IC21S (ROM12 to ROM21)
224193
225      IC22    - DIP42 EPROM, either 27C160 or 27C322
226      JP1     - Sets the size of the EPROM. 1-2 = 32M, 2-3 = 16M
227      IC41    - Xilinx XC9536 (PLCC44)
228      IC42    - SEGA 315-5881 (QFP100). Probably some kind of FPGA or CPLD. Usually different per game.
229                On the end of the number, -JPN means it requires Japanese BIOS, -COM will run with any BIOS
230      X76F100 - Xicor X76F100 secured EEPROM (SOIC8)
231      71256   - IDT 71256 32kx8 SRAM (SOJ28)
232      CN1/2/3 - connectors joining to main board
194  IC1-IC21S - MaskROM (SOP44), either 32M or 64M. Not all positions are populated.
195      IC22  - EPROM (DIP42), either 27C160 or 27C322
196      JP1   - JUMPER Sets the size of the EPROM. 1-2 = 32M, 2-3 = 16M
197      IC37  - FLASHROM (SOIC8) Xicor X76F100 Secure SerialFlash
198      IC41  - Sega 315-6213 Xilinx XC9536 (PLCC44)
199      IC42  - SEGA 315-5581 (QFP100). Probably some kind of FPGA or CPLD. Usually different per game.
200              On the end of the number, -JPN means it requires Japanese BIOS, -COM will run with any BIOS
201 IC44-IC45  - SRAM (SOJ28) 32kx8, either IDT71256 or CY7C199
202   CN1/2/3  - connectors joining to main board
233203
204Games known to use this PCB include....
205                                        Sticker    EPROM        # of SOP44
206Game                                    on cart    IC22#        MASKROMs   IC41#     IC42#          Notes
207--------------------------------------------------------------------------------------------------------------------------
20818 Wheeler Deluxe (Rev A)               840-0023C  22285A       20 (64Mb)  315-6213  317-0273-COM
209Airline Pilots                          840-0005C  21739        11 (64Mb)  315-6213  317-0251-COM
210Airline Pilots (Rev A)                  840-0005C  21739A       11 (64Mb)  315-6213  317-0251-COM
211Cosmic Smash                            840-0044C  23428         8 (64Mb)  315-6213  317-0289-COM   joystick + 2 buttons
212Cosmic Smash (Rev A)                    840-0044C  23428A        8 (64Mb)  315-6213  317-0289-COM   joystick + 2 buttons
213Crazy Taxi                              840-0002C  21684        13 (64Mb)  315-6213  317-0248-COM
214Dead Or Alive 2                         841-0003C  22121        21 (64Mb)  315-6213  317-5048-COM   joystick + 3 buttons
215Dead Or Alive 2 Millenium               841-0003C  DOA2 Ver.M   21 (64Mb)  315-6213  317-5048-COM   joystick + 3 buttons
216Death Crimson OX                        841-0016C  23524        10 (64Mb)  315-6213  317-5066-COM
217Dengen Tenshi Taisen Janshi Shangri-La  841-0004C  22060        12 (64Mb)  315-6213  317-5050-JPN
218Derby Owners Club                       840-0016C  22099B       14 (64Mb)  315-6213  317-0262-JPN   touch panel + 2 buttons + card reader
219Dynamite Baseball '99 / World Series'99 840-0019C  22141B       19 (64Mb)  315-6213  317-0269-JPN   requires special panel (joystick + 2 buttons + bat controller for each player)
220Dynamite Baseball Naomi                 840-0001C  21575        21 (64Mb)  315-6213  317-0246-JPN   requires special panel (joystick + 2 buttons + bat controller for each player)
221Ferrari F355 Challenge                  834-13842  21902        21 (64Mb)  315-6213  317-0254-COM
222Ferrari F355 Challenge 2 Twin           840-0042C  23399        21 (64Mb)  315-6213  317-0287-COM   2 know BIOS 22850 (USA), 22851 (EXP)
223Ferrari F355 Challenge Twin             834-13950  22848        21 (64Mb)  315-6213  317-0267-COM   2 know BIOS 22850 (USA), 22851 (EXP)
224Giant Gram Pro Wrestle 2                840-0007C  21820         9 (64Mb)  315-6213  317-0253-JPN   joystick + 3 buttons
225Guilty Gear X                           841-0013C  23356        14 (64Mb)  315-6213  317-5063-COM
226Gun Spike / Cannon Spike                841-0012C  23210        12 (64Mb)  315-6213  317-5060-COM
227Heavy Metal Geo Matrix                  HMG016007  23716A       11 (64Mb)  315-6213  317-5071-COM   joystick + 2 buttons
228Idol Janshi Suchie-Pai 3                841-0002C  21979        14 (64Mb)  315-6213  317-5047-JPN   requires special I/O board and mahjong panel
229Jumbo! Safari (Rev A)                   840-0013C  22826A        8 (64Mb)  315-6213  317-0264-COM
230OutTrigger                              840-0017C  22163        19 (64Mb)  315-6213  317-0266-COM   requires analog controllers/special panel
231Power Stone                             841-0001C  21597         8 (64Mb)  315-6213  317-5046-COM   joystick + 3 buttons
232Power Stone 2                           841-0008C  23127         9 (64Mb)  315-6213  317-5054-COM   joystick + 3 buttons
233Samba de Amigo                          840-0020C  22966B       16 (64Mb)  315-6213  317-0270-COM   will boot but requires special controller to play it
234Sega Marine Fishing                     840-0027C  22221        10 (64Mb)  315-6213  not populated  ROM 3&4 not populated. Requires special I/O board and fishing controller
235Sega Strike Fighter (Rev A)             840-0035C  23323A       20 (64Mb)  315-6213  317-0281-COM
236Slashout                                840-0041C  23341        17 (64Mb)  315-6213  317-0286-COM   joystick + 4 buttons
237Spawn                                   841-0005C  22977B       10 (64Mb)  315-6213  317-5051-COM   joystick + 4 buttons
238The Typing of the Dead                  840-0026C  23021A       20 (64Mb)  315-6213  not populated
239Toy Fighter / Waffupu                   840-0011C  22035        10 (64Mb)  315-6212  317-0257-COM   joystick + 3 buttons
240Virtua NBA                              840-0021C  23073        21 (64Mb)  315-6213  not populated
241Virtua Striker 2 2000                   840-0010C  21929C       14 (64Mb)  315-6213  317-0258-COM   joystick + 3 buttons (+1x 32Mb)
242Virtua Tennis / Power Smash             840-0015C  22927        11 (64Mb)  315-6213  317-0263-COM
243Zombie Revenge                          840-0003C  21707        19 (64Mb)  315-6213  317-0249-COM   joystick + 3 buttons
244
245
246
247837-13801  171-7978B (C) Sega 1999
248|---------------------------------------------------------|
249|                                       ----CN2----       -|
250|                                                     JP1  |
251|IC18  IC20  IC22  IC24  IC26  IC28            OSC1        |
252|ROM2  ROM4  ROM6  ROM8  ROM10 ROM12                       |
253|                                            ----     IC11 |
254|                                           |IC1 |         | male side
255|   IC29  IC31  IC33  IC35  IC37            |    |         |
256|   ROM13 ROM15 ROM17 ROM19 ROM21            ----          |
257|                                    IC14        IC15      |
258|                                                          |
259|        ----CN3----                    ----CN1----        |
260|----------------------------------------------------------|
261
262 |---------------------------------------------------------|
263|-       ----CN2----                                       |
264|                                                          |
265|                IC27S  IC25S  IC23S  IC21S  IC19S  IC17S  |
266|                ROM11  ROM9   ROM7   ROM5   ROM3   ROM1   |
267|                                                          |
268|                                                          | female side
269|                   IC38S  IC36S  IC34S  IC32S  IC30S      |
270|       IC13S       ROM22  ROM20  ROM18  ROM16  ROM14      |
271|                                                          |
272|                                                          |
273|        ----CN1----                    ----CN3----        |
274|----------------------------------------------------------|
275Notes:
276
277      OSC1  - oscillator 50.0000MHz
278      IC1   - FPGA ACTEL A54SX32A (QFP208) SEGA part number 317-xxxx-yyy; -JPN means it requires Japanese BIOS, -COM will run with any BIOS
279      IC11  - EPROM (DIP42), either 27C160 or 27C322
280      JP1   - JUMPER Sets the size of the EPROM. 1-2 = 32M, 2-3 = 16M
281      IC13S - EEPROM (SOIC8) 25LC040 serial EEPROM
282      IC14  - 256 x 9 AsyncFIFO, 5.0V (SOP28)
283      IC15  - SRAM (SOJ28) 32kx8, IDT71256
284IC17S-IC38S - MaskROM (SOP44), either 32M or 64M
285   CN1/2/3  - connectors joining to main board
286
287Games known to use this PCB include....
288                                        Sticker    EPROM   # of SOP44
289Game                                    on cart    IC11#   MASKROMs   IC1#      label IC1#    Notes
290---------------------------------------------------------------------------------------------------------------------
291Giant Gram 2000                         840-0039C  23373   20 (64Mb)  A54SX32   317-0296-COM
292Kick '4' Cash                           840-0140C  24212   16 (64Mb)  A54SX32A  317-0397-COM
293Marvel Vs. Capcom 2                     841-0007B  23085A  14 (64Mb)  A54SX32   317-5058-COM  +2x 32Mb
294Quiz Ah Megamisama                      840-0030C  23227   16 (64Mb)  A54SX32   317-0280-JPN
295Shootout Pool                           840-0098C  23844    4 (64mb)  A54SX32   317-0336-COM
296Shootout Pool - Shootout Pool Prize     840-0128C  24065    4 (64mb)  A54SX32   317-0367-COM
297Virtua Fighter 4 Evolution              840-0106B  23934   20 (64Mb)  A54SX32   317-0339-COM
298Virtua Tennis 2 / Power Smash 2         840-0084C  22327   18 (64Mb)  A54SX32   317-0320-COM
299Virtua Tennis 2 / Power Smash 2 (Rev A) 840-0084C  22327A  18 (64Mb)  A54SX32   317-0320-COM
300
301
302
303837-14114-01  171-8132B (C) Sega 2000
304|---------------------------------------------------------|
305|      IC11  IC10  IC9                  ----CN2----       -|
306|      21/22 19/20 17/18            IC44 IC45              |
307|                                            IC27          |
308|                                                          |
309|IC8   IC7   IC6   IC5                       JP2      IC22 |
310|15/16 13/14 11/12 9/10                                    | male side
311|                                            IC41 OSC1     |
312|IC4   IC3   IC2   IC1               IC42          JP1     |
313|7/8   5/6   3/4   1/2                                     |
314|                                                          |
315|        ----CN3----                    ----CN1----        |
316|----------------------------------------------------------|
317
318Notes:
319
320      OSC1  - oscillator 28.000MHz
321  IC1-IC11  - MaskROM (TSOP48), 128M
322      IC22  - EPROM (DIP42), either 27C160 or 27C322
323      JP1   - JUMPER Sets the size of the EPROM. 1-2 = 32M, 2-3 = 16M
324      IC27  - PLD Sega 315-6319A ALTERA EPM7032 (PLCC44)
325      IC41  - Sega 315-6213 Xilinx XC9536 (PLCC44)
326      IC42  - SEGA 315-5581 (QFP100). Probably some kind of FPGA or CPLD. Usually different per game.
327              On the end of the number, -JPN means it requires Japanese BIOS, -COM will run with any BIOS
328 IC44-IC45  - SRAM (SOJ28) 32kx8, either IDT71256 or CY7C199
329      JP2   - JUMPER unknown function
330   CN1/2/3  - connectors joining to main board
331
332   Games known to use this PCB include....
333                                        Sticker    EPROM   # of SOP44
334Game                                    on cart    IC22#   MASKROMs    IC27#      IC41#     IC42#         Notes
335-----------------------------------------------------------------------------------------------------------------------
336Capcom Vs. SNK Millennium Fight 2000    841-0011C  23511A   7 (128Mb)  315-6219   315-6213  317-5059-COM  (000804)
337Capcom Vs. SNK Millennium Fight 2000    841-0011C  23511A   7 (128Mb)  315-6319   315-6213  317-5059-COM  (000904)
338Derby Owners Club 2                     840-0083C  22306B  11 (128Mb)  315-6319A  315-6213  not populated
339Derby Owners Club World Edition (Rev C) 840-0088C  22336C   7 (128Mb)  315-6319A  315-6213  not populated
340Giga Wing 2                             841-0014C  22270    5 (128Mb)  315-6319A  315-6213  317-5064-COM
341Moero Justice Gakuen / Project Justice  841-0015C  23548A  11 (128Mb)  315-6319A  315-6213  317-5065-COM
342Samba de Amigo Ver.2000                 840-0047C  23600    ? (128Mb)  315-6319A  315-6213  317-0295-COM
343The King of Route 66 (Rev A)            840-0087C  23819A   ? (128Mb)  ?          ?         ?
344Wild Riders                             840-0046C  23622   10 (128Mb)  315-6319A  315-6213  317-0301-COM
345WWF Royal Rumble                        840-0040C  22261    8 (128Mb)  315-6319   315-6213  317-0285-COM
346Zero Gunner 2                           841-0020C  23689    ? (128Mb)  315-6319A  315-6213  317-5073-COM
347
348
349
234350      Note! Generally, games that require a special I/O board or controller will not boot at all with a
235351            standard NAOMI I/O board. Usually they display a message saying the I/O board is not acceptable
236352            or not connected properly.
237353
238354
239Games known to use this PCB include....
240355
241                           Sticker    EPROM        # of SOP44
242Game                       on cart    IC22#        MASKROMs   IC41#      IC42#          Notes
243--------------------------------------------------------------------------------------------------------------
244Cosmic Smash               840-0044C  23428A       8          315-6213   317-0289-COM   joystick + 2 buttons
245Dead Or Alive 2            841-0003C  22121        21         315-6213   317-5048-COM   joystick + 3 buttons
246Dead Or Alive 2 Millenium  841-0003C  DOA2 Ver.M   21         315-6213   317-5048-COM   joystick + 3 buttons
247Derby Owners Club          840-0016C  22099B       14         315-6213   317-0262-JPN   touch panel + 2 buttons + card reader
248Dynamite Baseball '99      840-0019C  22141B       19         315-6213   317-0269-JPN   requires special panel (joystick + 2 buttons + bat controller for each player)
249Dynamite Baseball Naomi    840-0001C  21575        21         315-6213   317-0246-JPN   requires special panel (joystick + 2 buttons + bat controller for each player)
250Giant Gram Pro Wrestle 2   840-0007C  21820        9          315-6213   317-0253-JPN   joystick + 3 buttons
251Heavy Metal Geo Matrix     HMG016007  23716A       11         315-6213   317-5071-COM   joystick + 2 buttons
252Idol Janshi Suchie-Pai 3   841-0002C  21979        14         315-6213   317-5047-JPN   requires special I/O board and mahjong panel
253Out Trigger                840-0017C  22163        19         315-6213   317-0266-COM   requires analog controllers/special panel
254Power Stone                841-0001C  21597        8          315-6213   317-5046-COM   joystick + 3 buttons
255Power Stone 2              841-0008C  23127        9          315-6213   317-5054-COM   joystick + 3 buttons
256Samba de Amigo             840-0020C  22966B       16         315-6213   317-0270-COM   will boot but requires special controller to play it
257Sega Marine Fishing        840-0027C  22221        10         315-6213   not populated  ROM 3&4 not populated. Requires special I/O board and fishing controller
258Slash Out                  840-0041C  23341        17         315-6213   317-0286-COM   joystick + 4 buttons
259Spawn                      841-0005C  22977B       10         315-6213   317-5051-COM   joystick + 4 buttons
260Toy Fighter                840-0011C  22035        10         315-6212   317-0257-COM   joystick + 3 buttons
261Virtua Striker 2 2000      840-0010C  21929C       15         315-6213   317-0258-COM   joystick + 3 buttons
262Zombie Revenge             840-0003C  21707        19         315-6213   317-0249-COM   joystick + 3 buttons
263
264
265356Sega I/O boards
266357---------------
267358
r7972r7973
10601151                                             /* MD2 MD1 MD0 MD6 MD4 MD3 MD5 MD7 MD8 */
10611152static const struct sh4_config sh4cpu_config = {  1,  0,  1,  0,  0,  0,  1,  1,  0, CPU_CLOCK };
10621153
1063static INTERRUPT_GEN( naomi_vblank )
1064{
1065   dc_vblank(device->machine);
1066}
1067
10681154static READ64_HANDLER( naomi_arm_r )
10691155{
10701156   return *((UINT64 *)dc_sound_ram+offset);
r7972r7973
12341320
123513217 0x1C000000 - 0x1FFFFFFF(SH4 Internal area)
12361322
1323
1324
12371325*/
12381326
12391327/*
r7972r7973
12771365
12781366static ADDRESS_MAP_START( naomi_map, ADDRESS_SPACE_PROGRAM, 64 )
12791367   /* Area 0 */
1280   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_SHARE("share3") AM_REGION("maincpu", 0) // BIOS
1281   AM_RANGE(0xa0000000, 0xa01fffff) AM_ROM AM_SHARE("share3")  // non cachable access to  0x00000000 - 0x001fffff
1368   AM_RANGE(0x00000000, 0x001fffff) AM_MIRROR(0xa2000000) AM_ROM AM_REGION("maincpu", 0) // BIOS
12821369
1283   AM_RANGE(0x00200000, 0x00207fff) AM_RAM                                             // bios uses it (battery backed ram ?)
1284   AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE( dc_sysctrl_r, dc_sysctrl_w )
1285   AM_RANGE(0x005f6c00, 0x005f6cff) AM_READWRITE( naomi_maple_r, naomi_maple_w )
1286   AM_RANGE(0x005f7000, 0x005f70ff) AM_DEVREADWRITE("rom_board", naomibd_r, naomibd_w)
1287   AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE( dc_g1_ctrl_r, dc_g1_ctrl_w )
1288   AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE( dc_g2_ctrl_r, dc_g2_ctrl_w )
1289   AM_RANGE(0x005f7c00, 0x005f7cff) AM_READWRITE( pvr_ctrl_r, pvr_ctrl_w )
1290   AM_RANGE(0x005f8000, 0x005f9fff) AM_READWRITE( pvr_ta_r, pvr_ta_w )
1291   AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( dc_modem_r, dc_modem_w )
1292   AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE( "aica", dc_aica_reg_r, dc_aica_reg_w )
1293   AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w )
1294   AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE( naomi_arm_r, naomi_arm_w )           // sound RAM (8 MB)
1370   AM_RANGE(0x00200000, 0x00207fff) AM_MIRROR(0x02000000) AM_RAM                                             // bios uses it (battery backed ram ?)
1371   AM_RANGE(0x005f6800, 0x005f69ff) AM_MIRROR(0x02000000) AM_READWRITE( dc_sysctrl_r, dc_sysctrl_w )
1372   AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_READWRITE( naomi_maple_r, naomi_maple_w )
1373   AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVREADWRITE("rom_board", naomibd_r, naomibd_w)
1374   AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_READWRITE( dc_g1_ctrl_r, dc_g1_ctrl_w )
1375   AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE( dc_g2_ctrl_r, dc_g2_ctrl_w )
1376   AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_READWRITE( pvr_ctrl_r, pvr_ctrl_w )
1377   AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_READWRITE( pvr_ta_r, pvr_ta_w )
1378   AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE( dc_modem_r, dc_modem_w )
1379   AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_DEVREADWRITE( "aica", dc_aica_reg_r, dc_aica_reg_w )
1380   AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_READWRITE( dc_rtc_r, dc_rtc_w )
1381   AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE( naomi_arm_r, naomi_arm_w )           // sound RAM (8 MB)
12951382
1383   /* External Device */
1384   AM_RANGE(0x01010098, 0x0101009f) AM_MIRROR(0x02000000) AM_RAM   // Naomi 2 BIOS tests this, needs to read back as written
1385   AM_RANGE(0x0103ff00, 0x0103ffff) AM_MIRROR(0x02000000) AM_READWRITE( naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known
12961386
1297   AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE( naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known
1298
1299   AM_RANGE(0x03010098, 0x0301009f) AM_RAM   // Naomi 2 BIOS tests this, needs to read back as written
1300
13011387   /* Area 1 */
1302   AM_RANGE(0x04000000, 0x04ffffff) AM_RAM   AM_BASE( &dc_texture_ram )      // texture memory 64 bit access
1303   AM_RANGE(0x05000000, 0x05ffffff) AM_RAM AM_BASE( &dc_framebuffer_ram ) // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now
1388   AM_RANGE(0x04000000, 0x04ffffff) AM_MIRROR(0x02000000) AM_RAM AM_BASE( &dc_texture_ram )      // texture memory 64 bit access
1389   AM_RANGE(0x05000000, 0x05ffffff) AM_MIRROR(0x02000000) AM_RAM AM_BASE( &dc_framebuffer_ram ) // apparently this actually accesses the same memory as the 64-bit texture memory access, but in a different format, keep it apart for now
13041390
13051391   /* Area 2*/
1306   AM_RANGE(0x08000000, 0x0bffffff) AM_NOP // 'Unassigned'
1392   AM_RANGE(0x08000000, 0x09ffffff) AM_MIRROR(0x02000000) AM_NOP // 'Unassigned'
13071393
13081394   /* Area 3 */
1309   AM_RANGE(0x0c000000, 0x0dffffff) AM_RAM AM_BASE(&naomi_ram64) AM_SHARE("share4")
1395   AM_RANGE(0x0c000000, 0x0dffffff) AM_MIRROR(0xa2000000) AM_RAM AM_BASE(&naomi_ram64)
13101396
1311   AM_RANGE(0x0e000000, 0x0fffffff) AM_RAM AM_SHARE("share4")// mirror
1312
1313   AM_RANGE(0x8c000000, 0x8dffffff) AM_RAM AM_SHARE("share4") // RAM access through cache
1314
1315   AM_RANGE(0xac000000, 0xadffffff) AM_RAM AM_SHARE("share4") // written here by totd
1316
13171397   /* Area 4 */
1318   AM_RANGE(0x10000000, 0x107fffff) AM_WRITE( ta_fifo_poly_w )
1319   AM_RANGE(0x10800000, 0x10ffffff) AM_WRITE( ta_fifo_yuv_w )
1320   AM_RANGE(0x11000000, 0x11ffffff) AM_WRITE( ta_texture_directpath0_w ) // access to texture / fraembfufer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue
1398   AM_RANGE(0x10000000, 0x107fffff) AM_MIRROR(0x02000000) AM_WRITE( ta_fifo_poly_w )
1399   AM_RANGE(0x10800000, 0x10ffffff) AM_MIRROR(0x02000000) AM_WRITE( ta_fifo_yuv_w )
1400   AM_RANGE(0x11000000, 0x11ffffff) AM_WRITE( ta_texture_directpath0_w ) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue)
13211401   /*       0x12000000 -0x13ffffff Mirror area of  0x10000000 -0x11ffffff */
1322   AM_RANGE(0x12000000, 0x127fffff) AM_WRITE( ta_fifo_poly_w )
1323   AM_RANGE(0x12800000, 0x12ffffff) AM_WRITE( ta_fifo_yuv_w )
1324   AM_RANGE(0x13000000, 0x13ffffff) AM_WRITE( ta_texture_directpath1_w )  // access to texture / fraembfufer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue
1402   AM_RANGE(0x13000000, 0x13ffffff) AM_WRITE( ta_texture_directpath1_w ) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue)
13251403
13261404   /* Area 5 */
13271405   //AM_RANGE(0x14000000, 0x17ffffff) AM_NOP // MPX Ext.
r7972r7973
15011579};
15021580
15031581
1504
15051582static ADDRESS_MAP_START( dc_audio_map, ADDRESS_SPACE_PROGRAM, 32 )
15061583   ADDRESS_MAP_UNMAP_HIGH
15071584   AM_RANGE(0x00000000, 0x007fffff) AM_RAM   AM_BASE( &dc_sound_ram )                /* shared with SH-4 */
r7972r7973
15811658   PORT_START("IN0")
15821659   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service")
15831660   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
1584   PORT_START("IN1")
1585   PORT_DIPNAME( 0x01, 0x00, "SYSA" )
1586   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1587   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1588   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1589   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1590   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1591   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1592   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1593   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1594   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1595   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1596   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1597   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1598   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1599   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1600   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1601   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1602   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1603   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1604   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1605   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1606   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1607   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1608   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1609   PORT_START("IN2")
1610   PORT_DIPNAME( 0x01, 0x00, "SYSB" )
1611   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1612   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1613   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1614   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1615   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1616   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1617   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1618   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1619   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1620   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1621   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1622   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1623   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1624   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1625   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1626   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1627   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1628   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1629   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1630   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1631   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1632   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1633   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1634   PORT_START("IN3")
1635   PORT_DIPNAME( 0x01, 0x00, "SYSC" )
1636   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1637   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1638   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1639   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1640   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1641   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1642   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1643   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1644   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1645   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1646   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1647   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1648   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1649   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1650   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1651   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1652   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1653   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1654   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1655   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1656   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1657   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1658   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1659   PORT_START("IN4")
1660   PORT_DIPNAME( 0x01, 0x00, "SYSD" )
1661   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1662   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1663   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1664   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1665   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1666   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1667   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1668   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1669   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1670   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1671   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1672   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1673   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1674   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1675   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1676   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1677   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1678   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1679   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1680   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1681   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1682   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1683   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
16841661
1662   PORT_START("KEY1")
1663   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) //TODO: mahjong panel test & service buttons are presumably here
1664
1665   PORT_START("KEY2")
1666   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
1667   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
1668   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
1669   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
1670   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
1671   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
1672   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
1673   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
1674   PORT_START("KEY3")
1675   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
1676   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
1677   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
1678   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
1679   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
1680   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
1681   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
1682   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
1683   PORT_START("KEY4")
1684   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
1685   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
1686   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
1687   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
1688   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
1689   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
1690   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
1691   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
1692   PORT_START("KEY5")
1693   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
1694   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
1695   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
1696   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
1697   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
1698   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
1699   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
1700   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
16851701   PORT_START("COINS")
16861702   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[0])
16871703   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[1])
r7972r7973
18081824   MDRV_CPU_CONFIG(sh4cpu_config)
18091825   MDRV_CPU_PROGRAM_MAP(naomi_map)
18101826   MDRV_CPU_IO_MAP(naomi_port)
1811   MDRV_CPU_VBLANK_INT("screen", naomi_vblank)
18121827
18131828   MDRV_CPU_ADD("soundcpu", ARM7, ((XTAL_33_8688MHz*2)/3)/8)   // AICA bus clock is 2/3rds * 33.8688.  ARM7 gets 1 bus cycle out of each 8.
18141829   MDRV_CPU_PROGRAM_MAP(dc_audio_map)
r7972r7973
25662581
25672582*/
25682583
2569ROM_START( derbyocb )
2584ROM_START( derbyoc )
25702585   ROM_REGION( 0x200000, "maincpu", 0)
25712586   NAOMI_BIOS
25722587   NAOMI_DEFAULT_EEPROM
r7972r7973
25892604   ROM_LOAD("mpr-22098.ic14",  0x7000000, 0x0800000, CRC(f9824d2e) SHA1(f20f8cc2b1bef9077ede1cb874da8f2a335d39de) )
25902605ROM_END
25912606
2592ROM_START( derbyoc )
2607ROM_START( derbyocw )
25932608   ROM_REGION( 0x200000, "maincpu", 0)
25942609   NAOMI_BIOS
25952610   NAOMI_DEFAULT_EEPROM
r7972r7973
29512966
29522967   ROM_REGION( 0xa800000, "user1", ROMREGION_ERASEFF)
29532968        ROM_LOAD( "epr-21585.ic22", 0x0000000, 0x200000, CRC(b23d1a0c) SHA1(9e77980d1aa980c879886e53cc76a16d7a9d43a1) )
2954        ROM_LOAD( "mpr-21565.ic1",  0x0800000, 0x800000, CRC(88fb0562) SHA1(185a0eab68d86617cb6325d64c48a2dd4854622b) )
2955        ROM_LOAD( "mpr-21566.ic2",  0x1000000, 0x800000, CRC(5f4dd576) SHA1(5483c3949e587bbcca7e8fc7db9aff4cd2a33f02) )
2956        ROM_LOAD( "mpr-21567.ic3",  0x1800000, 0x800000, CRC(3e62fca4) SHA1(8cdebdebabc88160f458e1e779d9ebb4e6a14523) )
2957        ROM_LOAD( "mpr-21568.ic4",  0x2000000, 0x800000, CRC(6f73a852) SHA1(d5fd4c0800b3a1ea04231018fcaba79184fa1d87) )
2958        ROM_LOAD( "mpr-21569.ic5",  0x2800000, 0x800000, CRC(c7950445) SHA1(4f56768f07703452ef92d183e4ee654ab9711283) )
2959        ROM_LOAD( "mpr-21570.ic6",  0x3000000, 0x800000, CRC(5a812247) SHA1(7636661da0cc9bd5a1a2062f9f3ef65889c86fd5) )
2960        ROM_LOAD( "mpr-21571.ic7",  0x3800000, 0x800000, CRC(17e9414a) SHA1(9f291c4dd9a049eeed88d80867f7fca1d15c6095) )
2961        ROM_LOAD( "mpr-21572.ic8",  0x4000000, 0x800000, CRC(5d2d8134) SHA1(a2941b6afd0302822133d932064d1aad873b1c04) )
2962        ROM_LOAD( "mpr-21573.ic9",  0x4800000, 0x800000, CRC(eacaf26d) SHA1(21e35def0ed998a70cc982f373feb50b7974612a) )
2963        ROM_LOAD( "mpr-21574.ic10", 0x5000000, 0x800000, CRC(1e3686be) SHA1(7ec1b3c9c94882c5fe7b6ba6ffe9220e90824870) )
2964        ROM_LOAD( "mpr-21575.ic11", 0x5800000, 0x800000, CRC(5ada00a2) SHA1(981c65310c89e7a26e2b2c3e57623e78f6ad33d0) )
2965        ROM_LOAD( "mpr-21576.ic12", 0x6000000, 0x800000, CRC(9eff6247) SHA1(9257492fc3e48516897002dd3ff247093af27d87) )
2966        ROM_LOAD( "mpr-21577.ic13", 0x6800000, 0x800000, CRC(8a80b16a) SHA1(ffeb061b31027ac322c14b9050c686b2b844d2e1) )
2967        ROM_LOAD( "mpr-21578.ic14", 0x7000000, 0x800000, CRC(7ae20daf) SHA1(b36d8e490ac477db178b8df08f7997448308d3fd) )
2968        ROM_LOAD( "mpr-21579.ic15", 0x7800000, 0x800000, CRC(fbb8641b) SHA1(6cb44f0a3f80eb68a218bba97b2395961c596b9c) )
2969        ROM_LOAD( "mpr-21580.ic16", 0x8000000, 0x800000, CRC(3881ec23) SHA1(e4b87a6c6fd6a2eeda8e0e5ae7bed01b18386e54) )
2970        ROM_LOAD( "mpr-21581.ic17", 0x8800000, 0x800000, CRC(66bff6e4) SHA1(f87d618231b71b65952fc7ea7ccabdd208622a00) )
2971        ROM_LOAD( "mpr-21582.ic18", 0x9000000, 0x800000, CRC(8cd2f654) SHA1(77eb7061caaf0288aad04ed88c4247d27617f338) )
2972        ROM_LOAD( "mpr-21583.ic19", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
2973        ROM_LOAD( "mpr-21584.ic20", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
2969        ROM_LOAD( "mpr-21386.ic1",  0x0800000, 0x800000, CRC(88fb0562) SHA1(185a0eab68d86617cb6325d64c48a2dd4854622b) )
2970        ROM_LOAD( "mpr-21387.ic2",  0x1000000, 0x800000, CRC(5f4dd576) SHA1(5483c3949e587bbcca7e8fc7db9aff4cd2a33f02) )
2971        ROM_LOAD( "mpr-21388.ic3",  0x1800000, 0x800000, CRC(3e62fca4) SHA1(8cdebdebabc88160f458e1e779d9ebb4e6a14523) )
2972        ROM_LOAD( "mpr-21389.ic4",  0x2000000, 0x800000, CRC(6f73a852) SHA1(d5fd4c0800b3a1ea04231018fcaba79184fa1d87) )
2973        ROM_LOAD( "mpr-21390.ic5",  0x2800000, 0x800000, CRC(c7950445) SHA1(4f56768f07703452ef92d183e4ee654ab9711283) )
2974        ROM_LOAD( "mpr-21391.ic6",  0x3000000, 0x800000, CRC(5a812247) SHA1(7636661da0cc9bd5a1a2062f9f3ef65889c86fd5) )
2975        ROM_LOAD( "mpr-21392.ic7",  0x3800000, 0x800000, CRC(17e9414a) SHA1(9f291c4dd9a049eeed88d80867f7fca1d15c6095) )
2976        ROM_LOAD( "mpr-21393.ic8",  0x4000000, 0x800000, CRC(5d2d8134) SHA1(a2941b6afd0302822133d932064d1aad873b1c04) )
2977        ROM_LOAD( "mpr-21394.ic9",  0x4800000, 0x800000, CRC(eacaf26d) SHA1(21e35def0ed998a70cc982f373feb50b7974612a) )
2978        ROM_LOAD( "mpr-21395.ic10", 0x5000000, 0x800000, CRC(1e3686be) SHA1(7ec1b3c9c94882c5fe7b6ba6ffe9220e90824870) )
2979        ROM_LOAD( "mpr-21396.ic11", 0x5800000, 0x800000, CRC(5ada00a2) SHA1(981c65310c89e7a26e2b2c3e57623e78f6ad33d0) )
2980        ROM_LOAD( "mpr-21397.ic12", 0x6000000, 0x800000, CRC(9eff6247) SHA1(9257492fc3e48516897002dd3ff247093af27d87) )
2981        ROM_LOAD( "mpr-21398.ic13", 0x6800000, 0x800000, CRC(8a80b16a) SHA1(ffeb061b31027ac322c14b9050c686b2b844d2e1) )
2982        ROM_LOAD( "mpr-21399.ic14", 0x7000000, 0x800000, CRC(7ae20daf) SHA1(b36d8e490ac477db178b8df08f7997448308d3fd) )
2983        ROM_LOAD( "mpr-21400.ic15", 0x7800000, 0x800000, CRC(fbb8641b) SHA1(6cb44f0a3f80eb68a218bba97b2395961c596b9c) )
2984        ROM_LOAD( "mpr-21401.ic16", 0x8000000, 0x800000, CRC(3881ec23) SHA1(e4b87a6c6fd6a2eeda8e0e5ae7bed01b18386e54) )
2985        ROM_LOAD( "mpr-21402.ic17", 0x8800000, 0x800000, CRC(66bff6e4) SHA1(f87d618231b71b65952fc7ea7ccabdd208622a00) )
2986        ROM_LOAD( "mpr-21403.ic18", 0x9000000, 0x800000, CRC(8cd2f654) SHA1(77eb7061caaf0288aad04ed88c4247d27617f338) )
2987        ROM_LOAD( "mpr-21404.ic19", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
2988        ROM_LOAD( "mpr-21405.ic20", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
29742989ROM_END
29752990
2991ROM_START( hotd2o )
2992   ROM_REGION( 0x200000, "maincpu", 0)
2993   HOTD2_BIOS
2994   NAOMI_DEFAULT_EEPROM
2995
2996   ROM_REGION( 0xa800000, "user1", ROMREGION_ERASEFF)
2997        ROM_LOAD( "epr-21385.ic22", 0x0000000, 0x200000, CRC(dedffe5f) SHA1(98b2a4c67ecb30cb096b9cea9061d904cf495937) )
2998        ROM_LOAD( "mpr-21386.ic1",  0x0800000, 0x800000, CRC(88fb0562) SHA1(185a0eab68d86617cb6325d64c48a2dd4854622b) )
2999        ROM_LOAD( "mpr-21387.ic2",  0x1000000, 0x800000, CRC(5f4dd576) SHA1(5483c3949e587bbcca7e8fc7db9aff4cd2a33f02) )
3000        ROM_LOAD( "mpr-21388.ic3",  0x1800000, 0x800000, CRC(3e62fca4) SHA1(8cdebdebabc88160f458e1e779d9ebb4e6a14523) )
3001        ROM_LOAD( "mpr-21389.ic4",  0x2000000, 0x800000, CRC(6f73a852) SHA1(d5fd4c0800b3a1ea04231018fcaba79184fa1d87) )
3002        ROM_LOAD( "mpr-21390.ic5",  0x2800000, 0x800000, CRC(c7950445) SHA1(4f56768f07703452ef92d183e4ee654ab9711283) )
3003        ROM_LOAD( "mpr-21391.ic6",  0x3000000, 0x800000, CRC(5a812247) SHA1(7636661da0cc9bd5a1a2062f9f3ef65889c86fd5) )
3004        ROM_LOAD( "mpr-21392.ic7",  0x3800000, 0x800000, CRC(17e9414a) SHA1(9f291c4dd9a049eeed88d80867f7fca1d15c6095) )
3005        ROM_LOAD( "mpr-21393.ic8",  0x4000000, 0x800000, CRC(5d2d8134) SHA1(a2941b6afd0302822133d932064d1aad873b1c04) )
3006        ROM_LOAD( "mpr-21394.ic9",  0x4800000, 0x800000, CRC(eacaf26d) SHA1(21e35def0ed998a70cc982f373feb50b7974612a) )
3007        ROM_LOAD( "mpr-21395.ic10", 0x5000000, 0x800000, CRC(1e3686be) SHA1(7ec1b3c9c94882c5fe7b6ba6ffe9220e90824870) )
3008        ROM_LOAD( "mpr-21396.ic11", 0x5800000, 0x800000, CRC(5ada00a2) SHA1(981c65310c89e7a26e2b2c3e57623e78f6ad33d0) )
3009        ROM_LOAD( "mpr-21397.ic12", 0x6000000, 0x800000, CRC(9eff6247) SHA1(9257492fc3e48516897002dd3ff247093af27d87) )
3010        ROM_LOAD( "mpr-21398.ic13", 0x6800000, 0x800000, CRC(8a80b16a) SHA1(ffeb061b31027ac322c14b9050c686b2b844d2e1) )
3011        ROM_LOAD( "mpr-21399.ic14", 0x7000000, 0x800000, CRC(7ae20daf) SHA1(b36d8e490ac477db178b8df08f7997448308d3fd) )
3012        ROM_LOAD( "mpr-21400.ic15", 0x7800000, 0x800000, CRC(fbb8641b) SHA1(6cb44f0a3f80eb68a218bba97b2395961c596b9c) )
3013        ROM_LOAD( "mpr-21401.ic16", 0x8000000, 0x800000, CRC(3881ec23) SHA1(e4b87a6c6fd6a2eeda8e0e5ae7bed01b18386e54) )
3014        ROM_LOAD( "mpr-21402.ic17", 0x8800000, 0x800000, CRC(66bff6e4) SHA1(f87d618231b71b65952fc7ea7ccabdd208622a00) )
3015        ROM_LOAD( "mpr-21403.ic18", 0x9000000, 0x800000, CRC(8cd2f654) SHA1(77eb7061caaf0288aad04ed88c4247d27617f338) )
3016        ROM_LOAD( "mpr-21404.ic19", 0x9800000, 0x800000, CRC(6cf6e705) SHA1(68d7e9becefe27b556e0c5d7ba00efd2d1fb71ca) )
3017        ROM_LOAD( "mpr-21405.ic20", 0xa000000, 0x800000, CRC(495e6265) SHA1(57936367fec0000691641525682fb8aefc4e4f56) )
3018ROM_END
3019
29763020/*
29773021SYSTEMID: NAOMI
29783022JAP: GIANT GRAM
r7972r7973
45134557/* 0007C */ GAME( 1999, ggram2,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Giant Gram (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45144558/* 0010C */ GAME( 1999, vs2_2k,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Virtua Striker 2 Ver. 2000 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45154559/* 0011C */ GAME( 1999, toyfight, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Toy Fighter", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4560/* 0012C */ GAME( 1999, smlg99,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Super Major League '99", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45164561/* 0013C */ GAME( 1999, jambo,    naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Jambo! Safari (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45174562/* 0015C */ GAME( 1999, vtennis,  naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Power Smash (JPN) / Virtua Tennis (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4518/* 0016C */ GAME( 1999, derbyoc,  naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club (JPN, USA, EXP, KOR, AUS Ver. C)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4519/* 0016C */ GAME( 1999, derbyocb, derbyoc,  naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club (JPN, USA, EXP, KOR, AUS Ver. B)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4563/* 0016C */ GAME( 1999, derbyoc,  naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45204564/* 0017C */ GAME( 1999, otrigger, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "OutTrigger (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45214565/* 0018C */ GAME( 1999, sgtetris, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Sega Tetris", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45224566/* 0019C */ GAME( 1999, dybb99,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Dynamite Baseball '99 (JPN) / World Series '99 (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4523/* 00??C */ GAME( 1999, smlg99,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Super Major League '99", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45244567/* 0020C */ GAME( 1999, samba,    naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Samba De Amigo (JPN)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45254568/* 0021C */ GAME( 2000, virnba,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Virtua NBA (JPN, USA, EXP, KOR, AUS)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45264569/* 0021C */ GAME( 2000, virnbao,  virnba,   naomi,    naomi,    naomi, ROT0, "Sega",            "Virtua NBA (JPN, USA, EXP, KOR, AUS) (original)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45274570/* 0026C */ GAME( 2000, totd,     naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "The Typing of the Dead (JPN, USA, EXP, KOR, AUS)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45284571/* 0027C */ GAME( 2000, smarinef, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Sega Marine Fishing", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45294572/* 0030C */ GAME( 2000, qmegamis, naomi,    naomi,    naomi,    qmegamis, ROT0, "Sega",            "Quiz Ah Megamisama (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4530/* 0035B */ GAME( 2000, sstrkfgt, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Sega Strike Fighter (rev. A)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4573/* 0035B */ GAME( 2000, sstrkfgt, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Sega Strike Fighter (Rev A)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45314574/* 0037C */ GAME( 2000, 18wheelr, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "18 Wheeler (JPN)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45324575/* 0039C */ GAME( 2000, gram2000, naomi,    naomi,    naomi,    gram2000, ROT0, "Sega",            "Giant Gram 2000 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45334576/* 0040C */ GAME( 2000, wwfroyal, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "WWF Royal Rumble (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45344577/* 0041C */ GAME( 2000, slasho,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Slashout (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45354578/* 0043C */ GAME( 2000, crackndj, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Crackin' DJ", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4536/* 0044C */ GAME( 2001, csmash,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (rev. A)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4579/* 0044C */ GAME( 2001, csmash,   naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (Rev A)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45374580/* 0044C */ GAME( 2001, csmasho,  csmash,   naomi,    naomi,    naomi, ROT0, "Sega",            "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (original)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45384581/* 0083C */ GAME( 2001, derbyoc2, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club II (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45394582/* 0084C */ GAME( 2001, vtenis2c, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Power Smash 2 / Virtua Tennis 2 (cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4583/* 0088C */ GAME( 2001, derbyocw, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Derby Owners Club World Edition (Rev C) (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45404584/* 0098C */ GAME( 2001, shootopl, naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Shootout Pool", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45414585/* 0128C */ GAME( 2001, shootpl,  naomi,    naomi,    naomi,    naomi, ROT0, "Sega",            "Shootout Pool (JPN, USA, KOR, AUS) / Shootout Pool Prize (EXP)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4542/* 0140B */ GAME( 2004, kick4csh, naomi,    naomi,    naomi,    kick4csh, ROT0, "Sega",         "Kick '4' Cash", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4586/* 0140C */ GAME( 2004, kick4csh, naomi,    naomi,    naomi,    kick4csh, ROT0, "Sega",         "Kick '4' Cash", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45434587
45444588/* 841-xxxxx ("Licensed by Sega" games)*/
45454589/* 0001C */ GAME( 1999, pstone,   naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Power Stone (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
r7972r7973
45564600/* 0013C */ GAME( 2000, ggx,      naomi,    naomi,    naomi,    naomi,    ROT0, "Arc System Works","Guilty Gear X (JPN)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45574601/* 0014C */ GAME( 2000, gwing2,   naomi,    naomi,    naomi,    naomi, ROT0, "Takumi / Capcom", "Giga Wing 2 (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45584602/* 0015C */ GAME( 2000, pjustic,  naomi,    naomi,    naomi,    naomi, ROT0, "Capcom",          "Moero Justice Gakuen (JPN) / Project Justice (USA, EXP, KOR, AUS) ", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4559/* 0016  */ GAME( 2000, deathcox, naomi,    naomi,    naomi,    naomi,    ROT0, "Ecole",           "Death Crimson OX (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4560/* xxxx  */ GAME( 2001, hmgeo,    naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Heavy Metal Geomatrix (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4603/* 0016C */ GAME( 2000, deathcox, naomi,    naomi,    naomi,    naomi,    ROT0, "Ecole",           "Death Crimson OX (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4604/* HMG016007 */ GAME( 2001, hmgeo,    naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom",          "Heavy Metal Geomatrix (JPN, USA, EUR, ASI, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45614605
45624606/* Games with incomplete dumps */
4563/* xxxx */ GAME( 2001, gunsur2,  naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom / Namco",  "Gun Survivor 2: Bio Hazard Code Veronica", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4607/* 25709801 */ GAME( 2001, gunsur2,  naomi,    naomi,    naomi,    naomi,    ROT0, "Capcom / Namco",  "Gun Survivor 2: Bio Hazard Code Veronica", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45644608
45654609/* Games with game specific bios sets */
45664610GAME( 1998, hod2bios, 0,        naomi,    naomi,    0,     ROT0, "Sega",            "Naomi House of the Dead 2 Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
4567GAME( 1999, hotd2,    hod2bios, naomi,    naomi,    0,     ROT0, "Sega",            "House of the Dead 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4611/* 834-13636 */ GAME( 1999, hotd2,    hod2bios, naomi,    naomi,    0,     ROT0, "Sega",            "House of the Dead 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4612/* 834-13636 */ GAME( 1999, hotd2o,   hotd2,    naomi,    naomi,    0,     ROT0, "Sega",            "House of the Dead 2 (original)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45684613GAME( 1999, f355bios, 0,        naomi,    naomi,    0,     ROT0, "Sega",            "Naomi Ferrari F355 Challenge Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
4569GAME( 1999, f355,     f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4570GAME( 1999, f355twin, f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge (Twin)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4571GAME( 1999, f355twn2, f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge 2 (Twin)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4614/* 834-13842 */ GAME( 1999, f355,     f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4615/* 834-13950 */ GAME( 1999, f355twin, f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge (Twin)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4616/* 840-0042C */ GAME( 1999, f355twn2, f355bios, naomi,    naomi,    0,     ROT0, "Sega",            "Ferrari F355 Challenge 2 (Twin)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45724617GAME( 1999, airlbios, 0,   naomi,    naomi,    0,     ROT0, "Sega",            "Naomi Airline Pilots Deluxe Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
45734618GAME( 1999, alpiltdx, airlbios, naomi,    naomi,    0,     ROT0, "Sega",            "Airline Pilots Deluxe", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4574GAME( 1999, alpilota, alpiltdx, naomi,    naomi,    0,     ROT0, "Sega",            "Airline Pilots (Rev. A)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
4619/* 840-0005C */ GAME( 1999, alpilota, alpiltdx, naomi,    naomi,    0,     ROT0, "Sega",            "Airline Pilots (Rev A)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
45754620
45764621/**********************************************
45774622 *
r7972r7973
57385783
57395784/* GDL-xxxx ("licensed by Sega" games) */
57405785GAME( 2001, gundmgd,   naomigd,  naomigd,  naomi,    naomi,   ROT0,   "Capcom",                 "Mobile Suit Gundam: Federation VS Zeon (GDL-0001)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5741GAME( 2001, sfz3ugd,   naomigd,  naomigd,  naomi,    naomi,  ROT0,   "Capcom",                 "Street Fighter Zero 3 Upper (GDL-0002)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
5786GAME( 2001, sfz3ugd,   naomigd,  naomigd,  naomi,    sfz3ugd, ROT0,   "Capcom",                 "Street Fighter Zero 3 Upper (GDL-0002)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
57425787//GDL-0003
57435788GAME( 2001, cvsgd,     naomigd,  naomigd,  naomi,    naomi,   ROT0,   "Capcom / SNK",           "Capcom Vs. SNK Millenium Fight 2000 Pro (GDL-0004)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
57445789//GDL-0005 Doki Doki Idol Star Seeker
r7972r7973
58275872//GDS-0026 Initial D Arcade Stage Ver. 2 (Japan) (NAOMI 2)
58285873//GDS-0027 Initial D Arcade Stage Ver. 2 (Export) (NAOMI 2)
58295874//GDS-0028
5830//GDS-0029
5875//GDS-0029 Club Kart Cycraft Edition
58315876//GDS-0030
58325877GAME( 2003, puyofev,   naomigd,  naomigd,  naomi,    naomi,  ROT0, "Sega",          "Puyo Puyo Fever (GDS-0031)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
58335878//GDS-0032 Initial D Arcade Stage Ver. 3 (Japan)
r7972r7973
58365881//GDS-0035
58375882//GDS-0036 Virtua Fighter 4 Final Tuned
58385883//GDS-0037? Puyo Puyo Fever (Export)
5884//GDS-0038
5885//GDS-0039 Initial D: Arcade Stage Ver. 3 Cycraft Edition
58395886
58405887
58415888/**********************************************
r7972r7973
62536300GAME( 2001, naomi2,   0,        naomi,    naomi,    0, ROT0, "Sega",            "Naomi 2 Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
62546301
62556302//Naomi 2 Cart Games
6303/* 840-xxxxx (Sega games)*/
62566304/* Complete Dumps */
6257GAME( 2001, vstrik3c, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Striker 3 (Cart) (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6258GAME( 2001, wldrider, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6259GAME( 2001, vf4cart,  naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6260GAME( 2001, vf4evoct,  naomi2,  naomi,   naomi,    vf4evoct,  ROT0,  "Sega",          "Virtua Fighter 4 Evolution (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6261GAME( 2002, clubkrte, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Club Kart: European Session", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6305/* 0046C */ GAME( 2001, wldrider, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6306/* 0061C */ GAME( 2001, vstrik3c, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Striker 3 (Cart) (USA, EXP, KOR, AUS)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6307/* 0080C */ GAME( 2001, vf4cart,  naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Virtua Fighter 4 (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6308/* 0106C */ GAME( 2001, vf4evoct, naomi2,  naomi,    naomi,    vf4evoct,  ROT0,  "Sega",          "Virtua Fighter 4 Evolution (Cartridge)", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6309/* 0139C */ GAME( 2002, clubkrte, naomi2,  naomi,    naomi,    0,  ROT0,  "Sega",          "Club Kart: European Session", GAME_UNEMULATED_PROTECTION|GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
62626310
62636311/* GDS-xxxx (Sega first party games) */
62646312GAME( 2001, vstrik3, naomi2,  naomigd,    naomi,    naomi2,  ROT0, "Sega",          "Virtua Striker 3 (GDS-0006)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
r7972r7973
65706618   AW_BIOS
65716619
65726620   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
6573        ROM_LOAD( "ax2201p01.ic18", 0x0000000, 0x0800000, CRC(ecc4a5c7) SHA1(97c2ef2be95b39bc978474a8243740df50255a8b) )
6621    ROM_LOAD( "ax2201p01.ic18", 0x0000000, 0x0800000, CRC(ecc4a5c7) SHA1(97c2ef2be95b39bc978474a8243740df50255a8b) )
6622    /* these are taken from the above set, game *seems* to work fine with these ... */
6623   ROM_LOAD( "ax2201m01.ic11", 0x1000000, 0x1000000, CRC(22ea665b) SHA1(292c92c9ae43eea2d1c27cedfb89c3956b8dea32) )
6624   ROM_LOAD( "ax2202m01.ic12", 0x2000000, 0x1000000, CRC(7fad1bea) SHA1(89f3f88af48973a4685955d86ef97a1487b8e7a8) )
6625   ROM_LOAD( "ax2203m01.ic13", 0x3000000, 0x1000000, CRC(78986ca4) SHA1(5a6c8c12955573f33361d2c6f20f85de35ac7bae) )
6626   ROM_LOAD( "ax2204m01.ic14", 0x4000000, 0x1000000, CRC(6ffbeb04) SHA1(975062cf364589dbdd5c5cb5ca945f76d87fc120) )
6627   ROM_LOAD( "ax2205m01.ic15", 0x5000000, 0x1000000, CRC(2851b791) SHA1(566ef95ea066b7bf548986085670242be217befc) )
6628   ROM_LOAD( "ax2206m01.ic16", 0x6000000, 0x1000000, CRC(e53eb965) SHA1(f50cd53a5859f081d8a278d24a519c9d9b49ab96) )
65746629ROM_END
65756630
65766631ROM_START( kov7sprt )
r7972r7973
66496704GAME( 2005, ngbc,     awbios,   aw,    aw,    ngbc,     ROT0, "Sammy / SNK Playmore",            "Neo-Geo Battle Coliseum", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
66506705GAME( 2005, fotns,    awbios,   aw,    aw,    fotns,    ROT0, "Sega / Arc System Works",         "Fist Of The North Star", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
66516706GAME( 2005, kofnw,    awbios,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6652GAME( 2005, kofnwj,   awbios,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave (Japan)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
6707GAME( 2005, kofnwj,   kofnw,   aw,    aw,    kofnw,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters Neowave (Japan)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
66536708GAME( 2005, xtrmhunt, awbios,   aw,    aw,    xtrmhunt, ROT0, "Sammy",                           "Extreme Hunting", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
66546709GAME( 2006, xtrmhnt2, awbios,   aw,    aw,    xtrmhnt2, ROT0, "Sega",                            "Extreme Hunting 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
src/mame/drivers/galdrvr.c
r7972r7973
31663166   ROM_LOAD( "warofbug.clr", 0x0000, 0x0020, CRC(8688e64b) SHA1(ed13414257f580b98b50c9892a14159c55e7838d) )
31673167ROM_END
31683168
3169/*  Galaxian hardware mods for War of the Bugs warofbug/warofbugg
3170
3171(WotB using daughterboard that plugs into Z80 socket - has a socketed PAL, two other 20-pin ICs,
3172a 16-pin IC (all with their markings sanded off) and five EPROMs)
3173
3174On the Galaxian board:
3175
31762B, 74LS366 - cut pin 15 OR pin 1 (this disables the stars)
31778E, 74LS139 - cut pin 11 only, join the stub left ON THE CHIP to pin 13 on the chip
3178
3179Cut the track on the bottom of the board going to pin 21 of IC 1K
3180(2716 eprom).
3181
3182Cut the track on the bottom of the board going to pin 21 of IC 1H
3183(2716 eprom).
3184
3185Join pins 21 of IC's 1H and 1K together and connect both to +5 volts
3186(although I've seen one set of docs saying to connect to pin 1 of
3187ic 2N (7408) instead)  */
3188
3189ROM_START( warofbugg )
3190   ROM_REGION( 0x4000, "maincpu", 0 )
3191   ROM_LOAD( "wotbg-u-1.bin",   0x0000, 0x0800, CRC(f43ff0a8) SHA1(b87abeb8af9105fa8fba78f9a68363bd89066e7f) )
3192   ROM_LOAD( "wotbg-v-2.bin",   0x0800, 0x0800, CRC(eb7a028b) SHA1(8c822ae11d3cc04f749a7cd639d15b9fc830ab35) )
3193   ROM_LOAD( "wotbg-w-3.bin",   0x1000, 0x0800, CRC(693e0e50) SHA1(00b19969cee0f95bfb8251c2df133ff2c9ae3b00) )
3194   ROM_LOAD( "wotbg-y-4.bin",   0x1800, 0x0800, CRC(885d4982) SHA1(4aeaf514a9413a9cb9a971fd258c6cf46ca66fc4) )
3195   ROM_LOAD( "wotbg-z-5.bin",   0x2000, 0x0800, CRC(60041ef2) SHA1(cced5837a037ac5cd8fa6260d69d8e33de5ecd48) )
3196
3197   ROM_REGION( 0x1000, "gfx1", 0 )
3198   ROM_LOAD( "warofbug.1k",  0x0000, 0x0800, CRC(8100fa85) SHA1(06641c431cace36dec98b87555f62e72f3e53a31) )
3199   ROM_LOAD( "warofbug.1j",  0x0800, 0x0800, CRC(d1220ae9) SHA1(e892bc8b0b71d8b07503e474e9c30e6cab460682) )
3200
3201   ROM_REGION( 0x0020, "proms", 0 )
3202   ROM_LOAD( "warofbug.clr", 0x0000, 0x0020, CRC(8688e64b) SHA1(ed13414257f580b98b50c9892a14159c55e7838d) )
3203ROM_END
3204
31693205ROM_START( redufo ) /* Galaxian bootleg hardware known as Artic Multi-System */
31703206   ROM_REGION( 0x4000, "maincpu", 0 )
31713207   ROM_LOAD( "ru1a",         0x0000, 0x0800, CRC(5a8e4f37) SHA1(c0957ede91e2dc3f80e4912b877843aed5d15779) )
r7972r7973
58505886
58515887/* these games require the coin lockout mechanism to be disabled */
58525888GAME( 1981, warofbug, 0,        galaxian, warofbug, nolock,   ROT90,  "Armenia", "War of the Bugs or Monsterous Manouvers in a Mushroom Maze", GAME_SUPPORTS_SAVE )
5889GAME( 1981, warofbugg,warofbug, galaxian, warofbug, nolock,   ROT90,  "Armenia", "War of the Bugs or Monsterous Manouvers in a Mushroom Maze (German)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
58535890GAME( 1981, redufo,   0,        galaxian, redufo,   nolock,   ROT90,  "bootleg", "Defend the Terra Attack on the Red UFO", GAME_SUPPORTS_SAVE )
58545891GAME( 19??, exodus,   redufo,   galaxian, exodus,   nolock,   ROT90,  "Subelectro", "Exodus (bootleg?)", GAME_SUPPORTS_SAVE )
58555892GAME( 1983, tdpgal,   0,        galaxian, tdpgal,   nolock,   ROT90,  "Design Labs / Thomas Automatics", "Triple Draw Poker", GAME_SUPPORTS_SAVE )
src/mame/drivers/deco156.c
r7972r7973
4747   /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
4848   state->pf1_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
4949   state->pf2_rowscroll = auto_alloc_array(machine, UINT16, 0x800/2);
50   machine->generic.paletteram.u16 =  auto_alloc_array(machine, UINT16, 0x1000/2);
5150
5251   /* and register the allocated ram so that save states still work */
5352   state_save_register_global_pointer(machine, state->pf1_rowscroll, 0x800/2);
5453   state_save_register_global_pointer(machine, state->pf2_rowscroll, 0x800/2);
55   state_save_register_global_pointer(machine, machine->generic.paletteram.u16, 0x1000/2);
5654}
5755
5856/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
src/mame/drivers/hitpoker.c
r7972r7973
495495{
496496   UINT8 *ROM = memory_region(machine, "maincpu");
497497
498   #if 1
499498   ROM[0x1220] = 0x01; //patch eeprom write?
500499   ROM[0x1221] = 0x01;
501500   ROM[0x1222] = 0x01;
502501
503502   ROM[0x10c6] = 0x01;
504503   ROM[0x10c7] = 0x01; //patch the checksum routine
505   #endif
506504}
507505
508506ROM_START( hitpoker )
src/mame/drivers/slapshot.c
r7972r7973
205205   }
206206}
207207
208
208209static READ16_HANDLER( opwolf3_adc_r )
209210{
210211   static const char *const adcnames[] = { "GUN1X", "GUN1Y", "GUN2X", "GUN2Y" };
r7972r7973
214215
215216static WRITE16_HANDLER( opwolf3_adc_req_w )
216217{
218   switch (offset)
219   {
220   case 0:
221   /* gun outputs... not 100% sure they are correct yet */
222   /* p2 gun recoil seems ever so slighty slower than p1 */
223   /* also you get a false fire every once in a while on the p1 gun */
224
225   if (((data & 0x100) == 0x100) && ((data & 0x400)==0))
226      output_set_value("Player1_Gun_Recoil",1);
227   else
228      output_set_value("Player1_Gun_Recoil",0);
229
230   if (((data & 0x100) == 0x100) && ((data & 0x400)==0x400))
231      output_set_value("Player2_Gun_Recoil",1);
232   else
233      output_set_value("Player2_Gun_Recoil",0);
234   break;
235   }
217236   slapshot_state *state = (slapshot_state *)space->machine->driver_data;
218237
219238   /* 4 writes a frame - one for each analogue port */
r7972r7973
237256   reset_sound_region(space->machine);
238257}
239258
259
260
261
262
263
240264static WRITE16_HANDLER( slapshot_msb_sound_w )
241265{
242266   slapshot_state *state = (slapshot_state *)space->machine->driver_data;
r7972r7973
291315   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE8("mk48t08", timekeeper_r, timekeeper_w, 0xff00)   /* nvram (only low bytes used) */
292316   AM_RANGE(0xb00000, 0xb0001f) AM_DEVWRITE8("tc0360pri", tc0360pri_w, 0xff00)   /* priority chip */
293317   AM_RANGE(0xc00000, 0xc0000f) AM_DEVREADWRITE("tc0640fio", tc0640fio_halfword_byteswap_r, tc0640fio_halfword_byteswap_w)
294   AM_RANGE(0xc00020, 0xc0002f) AM_READ(slapshot_service_input_r)   /* service mirror */
318   AM_RANGE(0xc00020, 0xc0002f) AM_READ(slapshot_service_input_r)    /* service mirror */
295319   AM_RANGE(0xd00000, 0xd00003) AM_READWRITE(slapshot_msb_sound_r, slapshot_msb_sound_w)
296320   AM_RANGE(0xe00000, 0xe00007) AM_READWRITE(opwolf3_adc_r, opwolf3_adc_req_w)
297321ADDRESS_MAP_END
src/mame/drivers/vsnes.c
r7972r7973
4444- Goonies
4545- Soccer
4646- T.K.O. Boxing *
47  (Manual states this is an RP2C04-0004 - though the pallete doesn't agree)
4748
4849RP2C04-0004:
4950- Clu Clu Land
r7972r7973
167168{
168169   coin_counter_w( space->machine, 0, data & 0x01 );
169170   coin = data;
170   if( data & 0xfe ) //"bnglngby" and "cluclu"
171
172    //"bnglngby" and "cluclu"
173   if( data & 0xfe )
171174   {
172175      logerror("vsnes_coin_counter_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(space->cpu), data);
173176   }
r7972r7973
184187   coin_counter_w( space->machine, 1, data & 0x01 );
185188   if( data & 0xfe ) //vsbball service mode
186189   {
187      //do something?
190   //do something?
188191      logerror("vsnes_coin_counter_1_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(space->cpu), data);
189192   }
190193
r7972r7973
212215   AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac1", dac_w)
213216   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes1", nes_psg_r, nes_psg_w)
214217   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_0_w)
215   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes1", psg_4015_r, psg_4015_w)  /* PSG status / first control register */
218   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes1", psg_4015_r, psg_4015_w)   /* PSG status / first control register */
216219   AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_r, vsnes_in0_w)
217   AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) AM_DEVWRITE("nes1", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
220   AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) AM_DEVWRITE("nes1", psg_4017_w)   /* IN1 - input port 2 / PSG second control register */
218221   AM_RANGE(0x4020, 0x4020) AM_READWRITE(vsnes_coin_counter_r, vsnes_coin_counter_w)
219222   AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("extra1")
220223   AM_RANGE(0x8000, 0xffff) AM_ROM
r7972r7973
228231   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_1_w)
229232   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE("nes2", psg_4015_r, psg_4015_w)   /* PSG status / first control register */
230233   AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_1_r, vsnes_in0_1_w)
231   AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_1_r) AM_DEVWRITE("nes2", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
234   AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_1_r) AM_DEVWRITE("nes2", psg_4017_w)   /* IN1 - input port 2 / PSG second control register */
232235   AM_RANGE(0x4020, 0x4020) AM_WRITE(vsnes_coin_counter_1_w)
233236   AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("extra2")
234237   AM_RANGE(0x8000, 0xffff) AM_ROM
r7972r7973
241244   PORT_START("IN0")
242245   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* BUTTON A on a nes */
243246   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* BUTTON B on a nes */
244   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )            /* SELECT on a nes */
245   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )            /* START on a nes */
247   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )         /* SELECT on a nes */
248   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )         /* START on a nes */
246249   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
247250   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
248251   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r7972r7973
251254   PORT_START("IN1")
252255   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)   /* BUTTON A on a nes */
253256   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)   /* BUTTON B on a nes */
254   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )            /* SELECT on a nes */
255   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )            /* START on a nes */
257   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )         /* SELECT on a nes */
258   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )         /* START on a nes */
256259   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
257260   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
258261   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
259262   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
260263
261264   PORT_START("COINS")
262   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* serial pin from controller */
265   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )         /* serial pin from controller */
263266   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
264   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1) /* service credit? */
265   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 0 of dsw goes here */
266   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 1 of dsw goes here */
267   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)   /* service credit? */
268   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 0 of dsw goes here */
269   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 1 of dsw goes here */
267270   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
268271   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
269272   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r7972r7973
296299   PORT_START("IN0")
297300   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* BUTTON A on a nes */
298301   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* BUTTON B on a nes */
299   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )            /* SELECT on a nes */
300   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START3 )            /* START on a nes */
302   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )         /* SELECT on a nes */
303   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START3 )         /* START on a nes */
301304   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
302305   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
303306   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r7972r7973
306309   PORT_START("IN1")
307310   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)   /* BUTTON A on a nes */
308311   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)   /* BUTTON B on a nes */
309   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )            /* SELECT on a nes */
310   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START4 )            /* START on a nes */
312   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )         /* SELECT on a nes */
313   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START4 )         /* START on a nes */
311314   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
312315   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
313316   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
314317   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
315318
316319   PORT_START("COINS")
317   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* serial pin from controller */
320   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )         /* serial pin from controller */
318321   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
319   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1) /* service credit? */
320   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 0 of dsw goes here */
321   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 1 of dsw goes here */
322   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)   /* service credit? */
323   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 0 of dsw goes here */
324   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 1 of dsw goes here */
322325   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
323326   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
324   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) /* this bit masks irqs - dont change */
327   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )         /* this bit masks irqs - dont change */
325328
326329   /* Right Side Controls */
327330   PORT_START("IN2")
r7972r7973
337340   PORT_START("IN3")
338341   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(4)   /* BUTTON A on a nes */
339342   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4)   /* BUTTON B on a nes */
340   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("2nd Side 2 Player Start") PORT_CODE(KEYCODE_EQUALS) /* SELECT on a nes */
341   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("2nd Side 4 Player Start") PORT_CODE(KEYCODE_BACKSPACE) /* START on a nes */
343   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("2nd Side 2 Player Start") PORT_CODE(KEYCODE_EQUALS)   /* SELECT on a nes */
344   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("2nd Side 4 Player Start") PORT_CODE(KEYCODE_BACKSPACE)   /* START on a nes */
342345   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
343346   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
344347   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
345348   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
346349
347350   PORT_START("COINS2")
348   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* serial pin from controller */
351   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )         /* serial pin from controller */
349352   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
350   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_IMPULSE(1) /* service credit? */
351   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 0 of dsw goes here */
352   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 1 of dsw goes here */
353   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_IMPULSE(1)   /* service credit? */
354   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 0 of dsw goes here */
355   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 1 of dsw goes here */
353356   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_IMPULSE(1)
354357   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN4 ) PORT_IMPULSE(1)
355   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) /* this bit masks irqs - dont change */
358   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )         /* this bit masks irqs - dont change */
356359
357360   /* Both sides also have a DSW (#0 & #1) which are defined per game, below */
358361INPUT_PORTS_END
r7972r7973
401404   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
402405   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
403406   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
404   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )   /* sprite hit */
405   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )   /* gun trigger */
407   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )         /* sprite hit */
408   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )         /* gun trigger */
406409
407410   PORT_START("IN1")
408411   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
r7972r7973
415418   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
416419
417420   PORT_START("COINS")
418   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* serial pin from controller */
421   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )         /* serial pin from controller */
419422   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
420   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1) /* service credit? */
421   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 0 of dsw goes here */
422   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   /* bit 1 of dsw goes here */
423   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)   /* service credit? */
424   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 0 of dsw goes here */
425   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )         /* bit 1 of dsw goes here */
423426   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
424427   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
425428   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r7972r7973
436439   PORT_INCLUDE( vsnes )
437440
438441   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
439   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
442   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
440443   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
441444   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
442445   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
445448   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
446449   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
447450   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
448   PORT_DIPNAME( 0x08, 0x00, "Lives per Coin" )
451   PORT_DIPNAME( 0x08, 0x00, "Lives per Coin" )      PORT_DIPLOCATION("SW1:!4")
449452   PORT_DIPSETTING(   0x00, "3 - 12 Max" )
450453   PORT_DIPSETTING(   0x08, "2 - 9 Max" )
451   PORT_DIPNAME( 0x30, 0x00, "Bonus" )
454   PORT_DIPNAME( 0x30, 0x00, "Bonus" )         PORT_DIPLOCATION("SW1:!5,!6")
452455   PORT_DIPSETTING(   0x00, "30k and Every 50k" )
453456   PORT_DIPSETTING(   0x20, "50k and Every 100k" )
454457   PORT_DIPSETTING(   0x10, "100k and Every 150k" )
455458   PORT_DIPSETTING(   0x30, "200k and Every 200k" )
456   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
457   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
459   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!7")
460   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
458461   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )
459   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
462   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!8")
460463   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
461464   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
462465INPUT_PORTS_END
r7972r7973
465468   PORT_INCLUDE( vsnes )
466469
467470   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
468   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
471   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:!1")
469472   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
470473   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
471   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
474   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:!2")
472475   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
473476   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
474   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
477   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!3")
475478   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
476479   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
477   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
478   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
479   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
480   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
481   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
482   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
483   PORT_DIPNAME( 0xE0, 0x00, DEF_STR( Coinage ) )
480   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!4,!5")
481   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
482   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
483   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
484   PORT_DIPSETTING(   0x18, DEF_STR( Hard ) )
485   PORT_DIPNAME( 0xE0, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!6,!7,!8")
484486   PORT_DIPSETTING(   0xc0, DEF_STR( 5C_1C ) )
485487   PORT_DIPSETTING(   0xa0, DEF_STR( 4C_1C ) )
486488   PORT_DIPSETTING(   0x80, DEF_STR( 3C_1C ) )
r7972r7973
491493   PORT_DIPSETTING(   0xe0, DEF_STR( Free_Play ) )
492494INPUT_PORTS_END
493495
494/*
495Stroke Play Off On
496Hole in 1 +5 +4
497Double Eagle +4 +3
498Eagle +3 +2
499Birdie +2 +1
500Par +1 0
501Bogey 0 -1
502Other 0 -2
503
504Match Play OFF ON
505Win Hole +1 +2
506Tie 0 0
507Lose Hole -1 -2
508*/
509
510496static INPUT_PORTS_START( golf )
511497   PORT_INCLUDE( vsnes_rev )
512498
513499   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
514   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )
500   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
515501   PORT_DIPSETTING(   0x07, DEF_STR( 4C_1C ) )
516502   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
517503   PORT_DIPSETTING(   0x05, DEF_STR( 2C_1C ) )
r7972r7973
520506   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
521507   PORT_DIPSETTING(   0x04, DEF_STR( 1C_4C ) )
522508   PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
523   PORT_DIPNAME( 0x08, 0x00, "Hole Size" )
509   PORT_DIPNAME( 0x08, 0x00, "Hole Size" )         PORT_DIPLOCATION("SW1:!4")
524510   PORT_DIPSETTING(   0x00, "Large" )
525511   PORT_DIPSETTING(   0x08, "Small" )
526   PORT_DIPNAME( 0x10, 0x00, "Points per Stroke" )
512   PORT_DIPNAME( 0x10, 0x00, "Points per Stroke" )      PORT_DIPLOCATION("SW1:!5")
527513   PORT_DIPSETTING(   0x00, DEF_STR( Easier ) )
528514   PORT_DIPSETTING(   0x10, DEF_STR( Harder ) )
529   PORT_DIPNAME( 0x60, 0x00, "Starting Points" )
515/*
516Stroke Play OFF/ON
517Hole in 1   +5  +4
518Double Eagle    +4  +3
519Eagle       +3  +2
520Birdie      +2  +1
521Par     +1   0
522Bogey        0  -1
523Other        0  -2
524
525Match Play  OFF/ON
526Win Hole    +1  +2
527Tie      0   0
528Lose Hole   -1  -2
529*/
530   PORT_DIPNAME( 0x60, 0x00, "Starting Points" )      PORT_DIPLOCATION("SW1:!6,7")
530531   PORT_DIPSETTING(   0x00, "10" )
531532   PORT_DIPSETTING(   0x40, "13" )
532533   PORT_DIPSETTING(   0x20, "16" )
533534   PORT_DIPSETTING(   0x60, "20" )
534   PORT_DIPNAME( 0x80, 0x00, "Difficulty Vs. Computer" )
535   PORT_DIPNAME( 0x80, 0x00, "Difficulty Vs. Computer" )   PORT_DIPLOCATION("SW1:!8")
535536   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
536537   PORT_DIPSETTING(   0x80, DEF_STR( Hard ) )
537538INPUT_PORTS_END
r7972r7973
541542   PORT_INCLUDE( golf )
542543
543544   PORT_MODIFY("IN0")
544   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START3 )            /* START on a nes */
545   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START3 )      /* START on a nes */
545546
546547   PORT_MODIFY("IN1")
547   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START4 )            /* START on a nes */
548   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START4 )      /* START on a nes */
548549INPUT_PORTS_END
549550
550551static INPUT_PORTS_START( vstennis )
551552   PORT_INCLUDE( vsnes_dual )
552553
553554   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
554   PORT_DIPNAME( 0x03, 0x00, "Difficulty Vs. Computer" )
555   PORT_DIPNAME( 0x03, 0x00, "Difficulty Vs. Computer" )   PORT_DIPLOCATION("SW1:!1,!2")
555556   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
556557   PORT_DIPSETTING(   0x02, DEF_STR( Normal ) )
557   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
558   PORT_DIPSETTING(   0x03, DEF_STR( Very_Hard ) )
559   PORT_DIPNAME( 0x0c, 0x00, "Difficulty Vs. Player" )
558   PORT_DIPSETTING(   0x01, DEF_STR( Medium ) )
559   PORT_DIPSETTING(   0x03, DEF_STR( Hard ) )
560   PORT_DIPNAME( 0x0c, 0x00, "Difficulty Vs. Player" )   PORT_DIPLOCATION("SW1:!3,!4")
560561   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
561562   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
562   PORT_DIPSETTING(   0x04, DEF_STR( Hard ) )
563   PORT_DIPSETTING(   0x0c, DEF_STR( Very_Hard ) )
564   PORT_DIPNAME( 0x10, 0x00, "Raquet Size" )
563   PORT_DIPSETTING(   0x04, DEF_STR( Medium ) )
564   PORT_DIPSETTING(   0x0c, DEF_STR( Hard ) )
565   PORT_DIPNAME( 0x10, 0x00, "Raquet Size" )      PORT_DIPLOCATION("SW1:!5")
565566   PORT_DIPSETTING(   0x00, "Large" )
566567   PORT_DIPSETTING(   0x10, "Small" )
567   PORT_DIPNAME( 0x20, 0x00, "Extra Score" )
568   PORT_DIPNAME( 0x20, 0x00, "Extra Score" )      PORT_DIPLOCATION("SW1:!6")
568569   PORT_DIPSETTING(   0x00, "1 Set" )
569570   PORT_DIPSETTING(   0x20, "1 Game" )
570   PORT_DIPNAME( 0x40, 0x00, "Court Color" )
571   PORT_DIPNAME( 0x40, 0x00, "Court Color" )      PORT_DIPLOCATION("SW1:!7")
571572   PORT_DIPSETTING(   0x00, "Green" )
572573   PORT_DIPSETTING(   0x40, "Blue" )
573   PORT_DIPNAME( 0x80, 0x00, "Copyright" )
574   PORT_DIPNAME( 0x80, 0x00, "Copyright" )         PORT_DIPLOCATION("SW1:!8")
574575   PORT_DIPSETTING(   0x00, DEF_STR( Japan ) )
575576   PORT_DIPSETTING(   0x80, DEF_STR( USA ) )
576577
577578   PORT_START("DSW1")   /* DSW1 - bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
578   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
579   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )
579   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW2:!1")
580   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!2,!3")
580581   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
581582   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
582583   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
583584   PORT_DIPSETTING(   0x06, DEF_STR( Free_Play ) )
584   PORT_DIPNAME( 0x08, 0x08, "Doubles 4 Player" )
585   PORT_DIPSETTING(   0x00, "2 Credits" )
586   PORT_DIPSETTING(   0x08, "4 Credits" )
587   PORT_DIPNAME( 0x10, 0x10, "Doubles Vs CPU" )
588   PORT_DIPSETTING(   0x00, "1 Credit" )
589   PORT_DIPSETTING(   0x10, "2 Credits" )
590   PORT_DIPNAME( 0x60, 0x00, "Rackets Per Game" )
585   PORT_DIPNAME( 0x18, 0x08, "Game Mode - Credits: 1VsC/2VsC/1Vs1/2Vs2" )   PORT_DIPLOCATION("SW2:!4,!5")
586   PORT_DIPSETTING(   0x00, "A - 1/1/1/1" )
587   PORT_DIPSETTING(   0x10, "B - 1/2/1/2" )
588   PORT_DIPSETTING(   0x08, "C - 2/2/2/2" )
589   PORT_DIPSETTING(   0x18, "D - 2/2/4/4" )
590   PORT_DIPNAME( 0x60, 0x00, "Rackets Per Game" )      PORT_DIPLOCATION("SW2:!6,!7")
591591   PORT_DIPSETTING(   0x60, "2" )
592592   PORT_DIPSETTING(   0x00, "3" )
593593   PORT_DIPSETTING(   0x40, "4" )
594594   PORT_DIPSETTING(   0x20, "5" )
595   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
595   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW2:!8")
596596   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
597597   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
598598INPUT_PORTS_END
r7972r7973
601601   PORT_INCLUDE( vsnes_dual )
602602
603603   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
604   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
604   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!1,!2")
605605   PORT_DIPSETTING(   0x00, "3" )
606606   PORT_DIPSETTING(   0x02, "4" )
607607   PORT_DIPSETTING(   0x01, "5" )
608608   PORT_DIPSETTING(   0x03, "6" )
609   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
610   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
611   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
612   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
613   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
614   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
615   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
616   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
617   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
618   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
619   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
620   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
621   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
622   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
623   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
624   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
625   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
626   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
609   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!3" )
610   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
611   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
612   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
613   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
614   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
627615
628616   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
629   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )
617   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!1,!2,!3")
630618   PORT_DIPSETTING(   0x07, DEF_STR( 4C_1C ) )
631619   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
632620   PORT_DIPSETTING(   0x05, DEF_STR( 2C_1C ) )
r7972r7973
635623   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
636624   PORT_DIPSETTING(   0x04, DEF_STR( 1C_4C ) )
637625   PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
638   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
639   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
640   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
641   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
642   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
643   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
644   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
645   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
646   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
647   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
648   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
649   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
650   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
651   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
652   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
626   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
627   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )
628   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW2:!6" )
629   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW2:!7" )
630   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW2:!8" )
653631INPUT_PORTS_END
654632
655633static INPUT_PORTS_START( balonfgt )
656634   PORT_INCLUDE( vsnes_dual )
657635
658636   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
659   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
637   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
660638   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
661639   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
662640   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
665643   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
666644   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
667645   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
668   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
669   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
670   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
671   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
672   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
673   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
674   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
675   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
676   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
677   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
678   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
679   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
680   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
646   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
647   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
648   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
649   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
650   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW1:!8")
681651
682652   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
683   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
653   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!1,!2")
684654   PORT_DIPSETTING(   0x00, "3" )
685655   PORT_DIPSETTING(   0x02, "4" )
686656   PORT_DIPSETTING(   0x01, "5" )
687657   PORT_DIPSETTING(   0x03, "6" )
688   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
689   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
690   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
691   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
692   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
693   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
694   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
695   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
696   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
697   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
698   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
699   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
700   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
701   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
702   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
703   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
704   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
705   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
658   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW2:!3" )
659   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
660   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )
661   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW2:!6" )
662   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW2:!7" )
663   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW2:!8" )
706664INPUT_PORTS_END
707665
708666static INPUT_PORTS_START( vsmahjng )
709667   PORT_INCLUDE( vsnes_dual )
710668
711669   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
712   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
713   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
714   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
715   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
716   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
717   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
718   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
719   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
720   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
721   PORT_DIPNAME( 0x08, 0x00, "Infinite Time" )
722   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
723   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
724   PORT_DIPNAME( 0x30, 0x00, "Time" )
670   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "SW1:!1" )
671   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x00, "SW1:!2" )
672   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!3" )
673   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
674   PORT_DIPNAME( 0x30, 0x00, "Time" )         PORT_DIPLOCATION("SW1:!5,!6")
725675   PORT_DIPSETTING(   0x30, "30" )
726676   PORT_DIPSETTING(   0x10, "45" )
727677   PORT_DIPSETTING(   0x20, "60" )
728678   PORT_DIPSETTING(   0x00, "90" )
729   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
730   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
731   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
732   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
733   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
734   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
679   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
680   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
735681
736682   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
737   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
738   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )
683   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW2:!1")
684   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!2,!3")
739685   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
740686   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
741687   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
742688   PORT_DIPSETTING(   0x06, DEF_STR( Free_Play ) )
743   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
744   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
745   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
746   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
747   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
748   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
749   PORT_DIPNAME( 0x60, 0x20, "Starting Points" )
689   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
690   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )
691   PORT_DIPNAME( 0x60, 0x20, "Starting Points" )      PORT_DIPLOCATION("SW2:!6,!7")
750692   PORT_DIPSETTING(   0x60, "15000" )
751693   PORT_DIPSETTING(   0x20, "20000" )
752694   PORT_DIPSETTING(   0x40, "25000" )
753695   PORT_DIPSETTING(   0x00, "30000" )
754   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
696   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW2:!8")
755697   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
756698   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
757699INPUT_PORTS_END
r7972r7973
759701static INPUT_PORTS_START( vsbball )
760702   PORT_INCLUDE( vsnes_dual )
761703
704   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
705   PORT_DIPNAME( 0x03, 0x02, "Player Defense Strength" )   PORT_DIPLOCATION("SW1:!1,!2")
706   PORT_DIPSETTING(   0x00, "Weak" )
707   PORT_DIPSETTING(   0x02, DEF_STR( Normal ) )
708   PORT_DIPSETTING(   0x01, DEF_STR( Medium ) )
709   PORT_DIPSETTING(   0x03, "Strong" )
710   PORT_DIPNAME( 0x0c, 0x08, "Player Offense Strength" )   PORT_DIPLOCATION("SW1:!3,!4")
711   PORT_DIPSETTING(   0x00, "Weak" )
712   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
713   PORT_DIPSETTING(   0x04, DEF_STR( Medium ) )
714   PORT_DIPSETTING(   0x0c, "Strong" )
715   PORT_DIPNAME( 0x30, 0x20, "Computer Defense Strength" )   PORT_DIPLOCATION("SW1:!5,!6")
716   PORT_DIPSETTING(   0x00, "Weak" )
717   PORT_DIPSETTING(   0x20, DEF_STR( Normal ) )
718   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
719   PORT_DIPSETTING(   0x30, "Strong" )
720   PORT_DIPNAME( 0xc0, 0x80, "Computer Offense Strength" ) PORT_DIPLOCATION("SW1:!7,!8")
721   PORT_DIPSETTING(   0x00, "Weak" )
722   PORT_DIPSETTING(   0x80, DEF_STR( Normal ) )
723   PORT_DIPSETTING(   0x40, DEF_STR( Medium ) )
724   PORT_DIPSETTING(   0xc0, "Strong" )
725
762726   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
763   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
764   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )
727   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW2:!1")
728   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!2,!3")
765729   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
766730   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
767731   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
768732   PORT_DIPSETTING(   0x06, DEF_STR( Free_Play ) )
769   PORT_DIPNAME( 0x38, 0x00, "Starting Points" )
770   PORT_DIPSETTING(    0x00, "80 Pts" )
771   PORT_DIPSETTING(    0x20, "100 Pts" )
772   PORT_DIPSETTING(    0x10, "150 Pts" )
773   PORT_DIPSETTING(    0x30, "200 Pts" )
774   PORT_DIPSETTING(    0x08, "250 Pts" )
775   PORT_DIPSETTING(    0x28, "300 Pts" )
776   PORT_DIPSETTING(    0x18, "350 Pts" )
777   PORT_DIPSETTING(    0x38, "400 Pts" )
778   PORT_DIPNAME( 0x40, 0x00, "Bonus Play" ) //?
733   PORT_DIPNAME( 0x38, 0x00, "Starting Points" )      PORT_DIPLOCATION("SW2:!4,!5,!6")
734   PORT_DIPSETTING(   0x00, "80 Pts" )
735   PORT_DIPSETTING(   0x20, "100 Pts" )
736   PORT_DIPSETTING(   0x10, "150 Pts" )
737   PORT_DIPSETTING(   0x30, "200 Pts" )
738   PORT_DIPSETTING(   0x08, "250 Pts" )
739   PORT_DIPSETTING(   0x28, "300 Pts" )
740   PORT_DIPSETTING(   0x18, "350 Pts" )
741   PORT_DIPSETTING(   0x38, "400 Pts" )
742   PORT_DIPNAME( 0x40, 0x00, "Bonus Play" )      PORT_DIPLOCATION("SW2:!7")
779743   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
780744   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
781   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
745   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW2:!8")
782746   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
783747   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
784748
785   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
786   PORT_DIPNAME( 0x03, 0x02, "Player Defense Strenght" )
787   PORT_DIPSETTING(   0x00, "Weak" )
788   PORT_DIPSETTING(   0x02, DEF_STR( Normal ) )
789   PORT_DIPSETTING(   0x01, "Strong" )
790   PORT_DIPSETTING(   0x03, "Very Strong" )
791   PORT_DIPNAME( 0x0c, 0x08, "Player Offense Strenght" )
792   PORT_DIPSETTING(   0x00, "Weak" )
793   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
794   PORT_DIPSETTING(   0x04, "Strong" )
795   PORT_DIPSETTING(   0x0c, "Very Strong" )
796   PORT_DIPNAME( 0x30, 0x20, "Computer Defense Strenght" )
797   PORT_DIPSETTING(   0x00, "Weak" )
798   PORT_DIPSETTING(   0x20, DEF_STR( Normal ) )
799   PORT_DIPSETTING(   0x10, "Strong" )
800   PORT_DIPSETTING(   0x30, "Very Strong" )
801   PORT_DIPNAME( 0xc0, 0x80, "Computer Offense Strenght" )
802   PORT_DIPSETTING(   0x00, "Weak" )
803   PORT_DIPSETTING(   0x80, DEF_STR( Normal ) )
804   PORT_DIPSETTING(   0x40, "Strong" )
805   PORT_DIPSETTING(   0xc0, "Very Strong" )
806749INPUT_PORTS_END
807750
808751static INPUT_PORTS_START( vsbballj )
809752   PORT_INCLUDE( vsnes_dual )
810753
811754   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
812   PORT_DIPNAME( 0x03, 0x02, "Player Defense Strenght" )
755   PORT_DIPNAME( 0x03, 0x02, "Player Defense Strength" )   PORT_DIPLOCATION("SW1:!1,!2")
813756   PORT_DIPSETTING(   0x00, "Weak" )
814757   PORT_DIPSETTING(   0x02, DEF_STR( Normal ) )
815   PORT_DIPSETTING(   0x01, "Strong" )
816   PORT_DIPSETTING(   0x03, "Very Strong" )
817   PORT_DIPNAME( 0x0c, 0x08, "Player Offense Strenght" )
758   PORT_DIPSETTING(   0x01, DEF_STR( Medium ) )
759   PORT_DIPSETTING(   0x03, "Strong" )
760   PORT_DIPNAME( 0x0c, 0x08, "Player Offense Strength" )   PORT_DIPLOCATION("SW1:!3,!4")
818761   PORT_DIPSETTING(   0x00, "Weak" )
819762   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
820   PORT_DIPSETTING(   0x04, "Strong" )
821   PORT_DIPSETTING(   0x0c, "Very Strong" )
822   PORT_DIPNAME( 0x30, 0x20, "Computer Defense Strenght" )
763   PORT_DIPSETTING(   0x04, DEF_STR( Medium ) )
764   PORT_DIPSETTING(   0x0c, "Strong" )
765   PORT_DIPNAME( 0x30, 0x20, "Computer Defense Strength" )   PORT_DIPLOCATION("SW1:!5,!6")
823766   PORT_DIPSETTING(   0x00, "Weak" )
824767   PORT_DIPSETTING(   0x20, DEF_STR( Normal ) )
825   PORT_DIPSETTING(   0x10, "Strong" )
826   PORT_DIPSETTING(   0x30, "Very Strong" )
827   PORT_DIPNAME( 0xc0, 0x80, "Computer Offense Strenght" )
768   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
769   PORT_DIPSETTING(   0x30, "Strong" )
770   PORT_DIPNAME( 0xc0, 0x80, "Computer Offense Strength" )   PORT_DIPLOCATION("SW1:!7,!8")
828771   PORT_DIPSETTING(   0x00, "Weak" )
829772   PORT_DIPSETTING(   0x80, DEF_STR( Normal ) )
830   PORT_DIPSETTING(   0x40, "Strong" )
831   PORT_DIPSETTING(   0xc0, "Very Strong" )
773   PORT_DIPSETTING(   0x40, DEF_STR( Medium ) )
774   PORT_DIPSETTING(   0xc0, "Strong" )
832775
833776   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
834   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
835   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )
777   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW2:!1")
778   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!2,!3")
836779   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
837780   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
838781   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
839782   PORT_DIPSETTING(   0x06, DEF_STR( Free_Play ) )
840   PORT_DIPNAME( 0x38, 0x00, "Starting Points" )
841   PORT_DIPSETTING(    0x00, "80 Pts" )
842   PORT_DIPSETTING(    0x20, "100 Pts" )
843   PORT_DIPSETTING(    0x10, "150 Pts" )
844   PORT_DIPSETTING(    0x30, "200 Pts" )
845   PORT_DIPSETTING(    0x08, "250 Pts" )
846   PORT_DIPSETTING(    0x28, "300 Pts" )
847   PORT_DIPSETTING(    0x18, "350 Pts" )
848   PORT_DIPSETTING(    0x38, "400 Pts" )
849   PORT_DIPNAME( 0x40, 0x00, "Bonus Play" ) //?
783   PORT_DIPNAME( 0x38, 0x00, "Starting Points" )      PORT_DIPLOCATION("SW2:!4,!5,!6")
784   PORT_DIPSETTING(   0x00, "80 Pts" )
785   PORT_DIPSETTING(   0x20, "100 Pts" )
786   PORT_DIPSETTING(   0x10, "150 Pts" )
787   PORT_DIPSETTING(   0x30, "200 Pts" )
788   PORT_DIPSETTING(   0x08, "250 Pts" )
789   PORT_DIPSETTING(   0x28, "300 Pts" )
790   PORT_DIPSETTING(   0x18, "350 Pts" )
791   PORT_DIPSETTING(   0x38, "400 Pts" )
792   PORT_DIPNAME( 0x40, 0x00, "Bonus Play" )      PORT_DIPLOCATION("SW2:!7")
850793   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
851794   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
852   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
795   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW2:!8")
853796   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
854797   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
855798INPUT_PORTS_END
r7972r7973
859802   PORT_INCLUDE( vsnes_dual_rev )
860803
861804   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
862   PORT_DIPNAME( 0x07, 0x00, "Coinage (Left Side)" )
805   PORT_DIPNAME( 0x07, 0x00, "Coinage (Left Side)" )   PORT_DIPLOCATION("SW1:!1,!2,!3")
863806   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
864807   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
865808   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
868811   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
869812   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
870813   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
871   PORT_DIPNAME( 0x18, 0x00, "Lives (Left Side)" )
814   PORT_DIPNAME( 0x18, 0x00, "Lives (Left Side)" )      PORT_DIPLOCATION("SW1:!4,!5")
872815   PORT_DIPSETTING(   0x00, "3" )
873816   PORT_DIPSETTING(   0x10, "4" )
874817   PORT_DIPSETTING(   0x08, "5" )
875818   PORT_DIPSETTING(   0x18, "7" )
876   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
819   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
820   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
821   PORT_DIPNAME( 0x80, 0x00, "Service Mode (Left Side)" )   PORT_TOGGLE PORT_CODE(KEYCODE_F2)   PORT_DIPLOCATION("SW1:!8")
877822   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
878   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
879   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
880   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
881   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
882   PORT_DIPNAME( 0x80, 0x00, "Service Mode (Left Side)" ) PORT_TOGGLE PORT_CODE(KEYCODE_F2)
883   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
884823   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
885824
886825   PORT_START("DSW1")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
887   PORT_DIPNAME( 0x07, 0x00, "Coinage (Right Side)" )
826   PORT_DIPNAME( 0x07, 0x00, "Coinage (Right Side)" )   PORT_DIPLOCATION("SW2:!1,!2,!3")
888827   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
889828   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
890829   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
893832   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
894833   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
895834   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
896   PORT_DIPNAME( 0x18, 0x00, "Lives (Right Side)" )
835   PORT_DIPNAME( 0x18, 0x00, "Lives (Right Side)" )   PORT_DIPLOCATION("SW2:!4,!5")
897836   PORT_DIPSETTING(   0x00, "3" )
898837   PORT_DIPSETTING(   0x10, "4" )
899838   PORT_DIPSETTING(   0x08, "5" )
900839   PORT_DIPSETTING(   0x18, "7" )
901   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
840   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW2:!6" )
841   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW2:!7" )
842   PORT_DIPNAME( 0x80, 0x00, "Service Mode (Right Side)" )   PORT_TOGGLE PORT_CODE(KEYCODE_F1)   PORT_DIPLOCATION("SW2:!8")
902843   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
903   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
904   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
905   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
906   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
907   PORT_DIPNAME( 0x80, 0x00, "Service Mode (Right Side)" ) PORT_TOGGLE PORT_CODE(KEYCODE_F1)
908   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
909844   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
910845INPUT_PORTS_END
911846
r7972r7973
913848   PORT_INCLUDE( vsnes_rev )
914849
915850   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
916   PORT_DIPNAME( 0x03, 0x00, "Drop Rate Increases After" )
851   PORT_DIPNAME( 0x03, 0x03, "Drop Rate Increases After" )   PORT_DIPLOCATION("SW1:!1,!2")
917852   PORT_DIPSETTING(   0x00, "7 Pills" )
918853   PORT_DIPSETTING(   0x01, "8 Pills" )
919854   PORT_DIPSETTING(   0x02, "9 Pills" )
920855   PORT_DIPSETTING(   0x03, "10 Pills" )
921   PORT_DIPNAME( 0x0c, 0x00, "Virus Level" )
856   PORT_DIPNAME( 0x0c, 0x04, "Virus Level" )      PORT_DIPLOCATION("SW1:!3,!4")
922857   PORT_DIPSETTING(   0x00, "1" )
923858   PORT_DIPSETTING(   0x04, "3" )
924859   PORT_DIPSETTING(   0x08, "5" )
925860   PORT_DIPSETTING(   0x0c, "7" )
926   PORT_DIPNAME( 0x30, 0x00, "Drop Speed Up" )
861   PORT_DIPNAME( 0x30, 0x00, "Drop Speed Up" )      PORT_DIPLOCATION("SW1:!5,!6")
927862   PORT_DIPSETTING(   0x00, "Slow" )
928863   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
929864   PORT_DIPSETTING(   0x20, "Fast" )
930865   PORT_DIPSETTING(   0x30, "Fastest" )
931   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Free_Play ) )
866   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Free_Play ) )   PORT_DIPLOCATION("SW1:!7")
932867   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
933868   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
934   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
869   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!8")
935870   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
936871   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
937872INPUT_PORTS_END
r7972r7973
940875   PORT_INCLUDE( vsnes_rev )
941876
942877   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
943   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
878   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2")
944879   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
945880   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
946881   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
947882   PORT_DIPSETTING(   0x01, DEF_STR( 1C_2C ) )
948   PORT_DIPNAME( 0x0c, 0x0c, "Max. 1p/in, 2p/in, Min" )
883   PORT_DIPNAME( 0x0c, 0x0c, "1p/inn, 2p/inn, Time/Min" )   PORT_DIPLOCATION("SW1:!3,!4")
949884   PORT_DIPSETTING(   0x04, "2, 1, 3" )
950885   PORT_DIPSETTING(   0x0c, "2, 2, 4" )
951886   PORT_DIPSETTING(   0x00, "3, 2, 6" )
952887   PORT_DIPSETTING(   0x08, "4, 3, 7" )
953   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
888   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!5")
954889   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
955890   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
956   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )
891   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!6,!7,!8")
957892   PORT_DIPSETTING(   0x00, "RP2C04-0001" )
958893   PORT_DIPSETTING(    0x20, "RP2C03" )
959894   PORT_DIPSETTING(   0x40, "RP2C04-0002" )
r7972r7973
968903   PORT_INCLUDE( vsnes_rev )
969904
970905   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
971   PORT_DIPNAME( 0x01, 0x01, "Credits for 2 Players" )
906   PORT_DIPNAME( 0x01, 0x01, "Credits for 2 Players" )   PORT_DIPLOCATION("SW1:!1")
972907   PORT_DIPSETTING(   0x00, "1" )
973908   PORT_DIPSETTING(   0x01, "2" )
974   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Lives ) )
909   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!2")
975910   PORT_DIPSETTING(   0x00, "3" )
976911   PORT_DIPSETTING(   0x02, "5" )
977   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
912   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!3")
978913   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
979914   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
980   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
981   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
982   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
983   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
984   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
985   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
986   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
987   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
988   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
989   PORT_DIPNAME( 0xc0, 0x00, "PPU Type" )
915   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
916   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
917   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
918   PORT_DIPNAME( 0xc0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!7,!8")
990919   PORT_DIPSETTING(   0x00, "RP2C04-0001" )
991920   PORT_DIPSETTING(   0x40, "RP2C04-0002" )
992921   PORT_DIPSETTING(   0x80, "RP2C04-0003" )
r7972r7973
997926   PORT_INCLUDE( vsnes_rev )
998927
999928   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1000   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
929   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
1001930   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
1002931   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
1003932   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
1006935   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
1007936   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
1008937   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1009   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1010   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1011   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
1012   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1013   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1014   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
1015   PORT_DIPNAME( 0x60, 0x00, DEF_STR( Lives ) )
938   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
939   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
940   PORT_DIPNAME( 0x60, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!6,!7")
1016941   PORT_DIPSETTING(   0x60, "2" )
1017942   PORT_DIPSETTING(   0x00, "3" )
1018943   PORT_DIPSETTING(   0x40, "4" )
1019944   PORT_DIPSETTING(   0x20, "5" )
1020   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1021   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1022   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
945   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
1023946INPUT_PORTS_END
1024947
1025948static INPUT_PORTS_START( cstlevna )
1026949   PORT_INCLUDE( vsnes )
1027950
1028951   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1029   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
952   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
1030953   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
1031954   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
1032955   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
1035958   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
1036959   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
1037960   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1038   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )
961   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4")
1039962   PORT_DIPSETTING(   0x08, "2" )
1040963   PORT_DIPSETTING(   0x00, "3" )
1041   PORT_DIPNAME( 0x30, 0x00, "Bonus" )
1042   PORT_DIPSETTING(   0x00, "100k" )
1043   PORT_DIPSETTING(   0x20, "200k" )
1044   PORT_DIPSETTING(   0x10, "300k" )
1045   PORT_DIPSETTING(   0x30, "400k" )
1046   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )   // Damage taken
1047   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )            // Normal
1048   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )               // Double
1049   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
1050   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1051   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
964/* As near as I can tell, there is no adjustable bonus level where the manual states there should be (SW1:5,6).
965   The bonus lives, regardless of settings, are at 30000 and every 50000 thereafter.  Until someone can figure out
966   what these dips do - they will be kept UNKNOWN */
967   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
968   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
969   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!7")   // Damage taken
970   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )                  // Normal
971   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )                  // Double
972   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW1:!8" )      // Manual states "Must be Set to "OFF"
1052973INPUT_PORTS_END
1053974
1054975static INPUT_PORTS_START( iceclimb )
1055976   PORT_INCLUDE( vsnes_rev )
1056977
1057978   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1058   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
979   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
1059980   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
1060981   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
1061982   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
1064985   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
1065986   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
1066987   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1067   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
988   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4,!5")
1068989   PORT_DIPSETTING(   0x00, "3" )
1069990   PORT_DIPSETTING(   0x10, "4" )
1070991   PORT_DIPSETTING(   0x08, "5" )
1071992   PORT_DIPSETTING(   0x18, "7" )
1072   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) )
1073   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
993   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!6")
994   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
1074995   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
1075   PORT_DIPNAME( 0x40, 0x00, "Time before bear appears" ) //?
996   PORT_DIPNAME( 0x40, 0x00, "Time before bear appears" )   PORT_DIPLOCATION("SW1:!7")
1076997   PORT_DIPSETTING(   0x00, "Long" )
1077998   PORT_DIPSETTING(   0x40, "Short" )
1078   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
1079   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1080   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
999   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW1:!8" )
10811000INPUT_PORTS_END
10821001
10831002/* Same as 'iceclimb', but different buttons mapping and input protection */
r7972r7973
10851004   PORT_INCLUDE( iceclimb )
10861005
10871006   PORT_MODIFY("IN0")   /* IN0 */
1088   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL ) // protection /* START on a nes */
1007   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL )      // protection /* START on a nes */
10891008
10901009   PORT_MODIFY("IN1")   /* IN1 */
1091   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL ) // protection /* START on a nes */
1010   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL )      // protection /* START on a nes */
10921011
10931012   PORT_MODIFY("COINS")   /* IN2 */
1094   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1013   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
10951014   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
10961015   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
10971016INPUT_PORTS_END
r7972r7973
11001019   PORT_INCLUDE( vsnes )
11011020
11021021   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1103   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1022   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
11041023   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
11051024   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
11061025   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
11091028   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
11101029   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
11111030   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1112   PORT_DIPNAME( 0x18, 0x00, "Bonus" )
1031   PORT_DIPNAME( 0x18, 0x00, "Bonus Bike" )      PORT_DIPLOCATION("SW1:!4,!5")
11131032   PORT_DIPSETTING(   0x00, "100k and Every 50k" )
11141033   PORT_DIPSETTING(   0x10, "Every 100k" )
11151034   PORT_DIPSETTING(   0x08, "100k Only" )
11161035   PORT_DIPSETTING(   0x18, DEF_STR( None ) )
1117   PORT_DIPNAME( 0x20, 0x00, "1st Half Qualifying Time" )
1118   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1036   PORT_DIPNAME( 0x20, 0x00, "1st Half Qualifying Time" )   PORT_DIPLOCATION("SW1:!6")
1037   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
11191038   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
1120   PORT_DIPNAME( 0x40, 0x00, "2nd Half Qualifying Time" )
1121   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1039   PORT_DIPNAME( 0x40, 0x00, "2nd Half Qualifying Time" )   PORT_DIPLOCATION("SW1:!7")
1040   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
11221041   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )
1123   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
1124   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1125   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1042   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
11261043INPUT_PORTS_END
11271044
11281045static INPUT_PORTS_START( jajamaru )
11291046   PORT_INCLUDE( vsnes_rev )
11301047
11311048   PORT_MODIFY("IN0")   /* IN0 */
1132   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START2 )            /* START on a nes */
1049   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START2 )      /* START on a nes */
11331050
11341051   PORT_MODIFY("IN1")   /* IN1 */
1135   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )             /* SELECT on a nes */
1052   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )      /* SELECT on a nes */
11361053
11371054   PORT_MODIFY("COINS")   /* IN2 */
1138   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1055   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
11391056   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
11401057   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
11411058
11421059   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1143   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1060   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
11441061   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
11451062   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
11461063   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
11491066   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
11501067   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
11511068   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1152   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
1069   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4,!5")
11531070   PORT_DIPSETTING(   0x00, "3" )
11541071   PORT_DIPSETTING(   0x10, "4" )
11551072   PORT_DIPSETTING(   0x08, "5" )
1156   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1073   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
1074   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
1075   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!8")
11571076   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1158   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1159   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1160   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1161   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1162   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
1163   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
11641077   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
11651078INPUT_PORTS_END
11661079
r7972r7973
11681081   PORT_INCLUDE( vsnes )
11691082
11701083   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1171   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1084   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
11721085   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
11731086   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
11741087   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
11771090   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
11781091   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
11791092   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1180   PORT_DIPNAME( 0x18, 0x00, "Time" )
1181   PORT_DIPSETTING(   0x00, "280" )
1093   PORT_DIPNAME( 0x18, 0x00, "Time" )         PORT_DIPLOCATION("SW1:!4,!5")
1094   PORT_DIPSETTING(   0x00, "280 (Easy)" )
11821095   PORT_DIPSETTING(   0x10, "250" )
11831096   PORT_DIPSETTING(   0x08, "220" )
1184   PORT_DIPSETTING(   0x18, "200" )
1185   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1186   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1187   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1188   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1189   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1190   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1191   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1192   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1193   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1097   PORT_DIPSETTING(   0x18, "200 (Hard)" )
1098   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
1099   PORT_DIPNAME( 0x40, 0x00, "Enemies" )         PORT_DIPLOCATION("SW1:!7")
1100   PORT_DIPSETTING(   0x40, "More" )
1101   PORT_DIPSETTING(   0x00, "Less" )
1102   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
11941103INPUT_PORTS_END
11951104
11961105static INPUT_PORTS_START( machridj )
11971106   PORT_INCLUDE( vsnes )
11981107
11991108   PORT_MODIFY("IN0")   /* IN0 */
1200   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )            /* SELECT on a nes */
1201   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )            /* START on a nes */
1109   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )      /* SELECT on a nes */
1110   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )      /* START on a nes */
12021111
12031112   PORT_MODIFY("IN1")   /* IN1 */
1204   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )            /* SELECT on a nes */
1205   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )            /* START on a nes */
1113   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )      /* SELECT on a nes */
1114   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )      /* START on a nes */
12061115
12071116   PORT_MODIFY("COINS")   /* IN2 */
1208   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1117   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
12091118   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
12101119   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
12111120
12121121   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1213   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1122   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
12141123   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
12151124   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
12161125   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
12191128   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
12201129   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
12211130   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1222   PORT_DIPNAME( 0x18, 0x00, "Km 1st Race" ) //?
1223   PORT_DIPSETTING(   0x00, "12" )
1224   PORT_DIPSETTING(   0x10, "15" )
1225   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1226   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1227   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1228   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1229   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1230   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1231   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1232   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1233   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1131   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
1132   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
1133   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
1134   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
1135   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
12341136INPUT_PORTS_END
12351137
12361138static INPUT_PORTS_START( suprmrio )
12371139   PORT_INCLUDE( vsnes )
12381140
12391141   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1240   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1142   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
12411143   PORT_DIPSETTING(   0x02, DEF_STR( 3C_1C ) )
12421144   PORT_DIPSETTING(   0x04, DEF_STR( 2C_1C ) )
12431145   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
r7972r7973
12461148   PORT_DIPSETTING(   0x05, DEF_STR( 1C_4C ) )
12471149   PORT_DIPSETTING(   0x03, DEF_STR( 1C_5C ) )
12481150   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1249   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )
1151   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4")
12501152   PORT_DIPSETTING(   0x08, "2" )
12511153   PORT_DIPSETTING(   0x00, "3" )
1252   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
1253   PORT_DIPSETTING(   0x00, "100" )
1254   PORT_DIPSETTING(   0x20, "150" )
1255   PORT_DIPSETTING(   0x10, "200" )
1256   PORT_DIPSETTING(   0x30, "250" )
1257   PORT_DIPNAME( 0x40, 0x00, "Timer" )
1258   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1154   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!5,!6")
1155   PORT_DIPSETTING(   0x00, "100 Coins" )
1156   PORT_DIPSETTING(   0x20, "150 Coins" )
1157   PORT_DIPSETTING(   0x10, "200 Coins" )
1158   PORT_DIPSETTING(   0x30, "250 Coins" )
1159   PORT_DIPNAME( 0x40, 0x00, "Timer" )         PORT_DIPLOCATION("SW1:!7")
1160   PORT_DIPSETTING(   0x00, "Slow" )
12591161   PORT_DIPSETTING(   0x40, "Fast" )
1260   PORT_DIPNAME( 0x80, 0x80, "Continue Lives" )
1162   PORT_DIPNAME( 0x80, 0x80, "Continue Lives" )      PORT_DIPLOCATION("SW1:!8")
12611163   PORT_DIPSETTING(   0x80, "3" )
12621164   PORT_DIPSETTING(   0x00, "4" )
12631165INPUT_PORTS_END
r7972r7973
12661168   PORT_INCLUDE( vsnes_zapper )
12671169
12681170   PORT_START("DSW0")   /* IN3 */
1269   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1171   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
12701172   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
12711173   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
12721174   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
12751177   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
12761178   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
12771179   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1278   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )
1180   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!4,!5")
12791181   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
12801182   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
1281   PORT_DIPSETTING(   0x10, DEF_STR( Hard ) )
1282   PORT_DIPSETTING(   0x18, DEF_STR( Hardest ) )
1283   PORT_DIPNAME( 0x20, 0x20, "Misses per game" )
1183   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
1184   PORT_DIPSETTING(   0x18, DEF_STR( Hard ) )
1185   PORT_DIPNAME( 0x20, 0x20, "Misses per game" )      PORT_DIPLOCATION("SW1:!6")
12841186   PORT_DIPSETTING(   0x00, "3" )
12851187   PORT_DIPSETTING(   0x20, "5" )
1286   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) )
1188   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!7,!8")
12871189   PORT_DIPSETTING(   0x00, "30000" )
12881190   PORT_DIPSETTING(   0x40, "50000" )
12891191   PORT_DIPSETTING(   0x80, "80000" )
r7972r7973
12941196   PORT_INCLUDE( vsnes_zapper )
12951197
12961198   PORT_START("DSW0")   /* IN3 */
1297   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1199   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
12981200   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
12991201   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
13001202   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
13031205   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
13041206   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
13051207   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1306   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )
1208   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!4,!5")
13071209   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
13081210   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
1309   PORT_DIPSETTING(   0x10, DEF_STR( Hard ) )
1310   PORT_DIPSETTING(   0x18, DEF_STR( Hardest ) )
1311   PORT_DIPNAME( 0x20, 0x20, "Misses per game" )
1211   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
1212   PORT_DIPSETTING(   0x18, DEF_STR( Hard ) )
1213   PORT_DIPNAME( 0x20, 0x20, "Misses per game" )      PORT_DIPLOCATION("SW1:!6")
13121214   PORT_DIPSETTING(   0x00, "3" )
13131215   PORT_DIPSETTING(   0x20, "5" )
1314   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) )
1216   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!7,!8")
13151217   PORT_DIPSETTING(   0x00, "30000" )
13161218   PORT_DIPSETTING(   0x40, "50000" )
13171219   PORT_DIPSETTING(   0x80, "80000" )
r7972r7973
13221224   PORT_INCLUDE( vsnes_zapper )
13231225
13241226   PORT_START("DSW0")   /* IN3 */
1325   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1227   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
13261228   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
13271229   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
13281230   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
13311233   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
13321234   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
13331235   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1334   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )
1236   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!4,!5")
13351237   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
13361238   PORT_DIPSETTING(   0x08, DEF_STR( Normal ) )
13371239   PORT_DIPSETTING(   0x10, DEF_STR( Hard ) )
13381240   PORT_DIPSETTING(   0x18, DEF_STR( Hardest ) )
1339   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Lives ) )
1241   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!6")
13401242   PORT_DIPSETTING(   0x20, "3" )
13411243   PORT_DIPSETTING(   0x00, "5" )
1342   PORT_DIPNAME( 0x40, 0x00, "Bullets per Balloon" )
1244   PORT_DIPNAME( 0x40, 0x00, "Bullets per Balloon" )   PORT_DIPLOCATION("SW1:!7")
13431245   PORT_DIPSETTING(   0x00, "3" )
13441246   PORT_DIPSETTING(   0x40, "2" )
1345   PORT_DIPNAME( 0x80, 0x00, "1 Bonus Man Awarded at 50k" )
1346   PORT_DIPSETTING(   0x00, "80000" )
1347   PORT_DIPSETTING(   0x80, "100000" )
1247   PORT_DIPNAME( 0x80, 0x00, "Bonus Man Awarded" )      PORT_DIPLOCATION("SW1:!8")
1248   PORT_DIPSETTING(   0x00, "At 50000" )
1249   PORT_DIPSETTING(   0x80, DEF_STR( None ) )
13481250INPUT_PORTS_END
13491251
13501252static INPUT_PORTS_START( vsfdf )
13511253   PORT_INCLUDE( vsnes_zapper )
13521254
13531255   PORT_START("DSW0")   /* IN3 */
1354   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1256   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
13551257   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
13561258   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
13571259   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
13601262   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
13611263   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
13621264   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1363   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1364   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1365   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
1366   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1367   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1368   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
1369   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1370   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1371   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1372   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1373   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1374   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1375   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1376   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1377   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1265   PORT_DIPNAME( 0x18, 0x10, "Health Awarded At" )      PORT_DIPLOCATION("SW1:!4,!5")
1266   PORT_DIPSETTING(   0x00, "20k/60k" )
1267   PORT_DIPSETTING(   0x08, "20k/60k/Every 60k" )
1268   PORT_DIPSETTING(   0x10, "10k/50k")
1269   PORT_DIPSETTING(   0x18, "10k/50k/Every 50k" )
1270   PORT_DIPNAME( 0x60, 0x00, "Difficulty (Damage)" )   PORT_DIPLOCATION("SW1:!6,!7")
1271   PORT_DIPSETTING(   0x40, DEF_STR( Easy ) )
1272   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1273   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
1274   PORT_DIPSETTING(   0x60, DEF_STR( Hardest) )
1275   PORT_DIPNAME( 0x80, 0x00, "Difficulty (Enemy)" )   PORT_DIPLOCATION("SW1:!8")
1276   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1277   PORT_DIPSETTING(   0x80, DEF_STR( Hard ) )
13781278INPUT_PORTS_END
13791279
13801280static INPUT_PORTS_START( vstetris )
13811281   PORT_INCLUDE( vsnes_rev )
13821282
13831283   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1384   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
1385   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1386   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
1387   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1388   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1389   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
1390   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )
1284   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "SW1:!1" )
1285   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x00, "SW1:!2" )
1286   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!3,!4")
13911287   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
13921288   PORT_DIPSETTING(   0x04, DEF_STR( Normal ) )
1393   PORT_DIPSETTING(   0x08, DEF_STR( Hard ) )
1394   PORT_DIPSETTING(   0x0c, DEF_STR( Very_Hard ) )
1395   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1396   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1397   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
1398   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )
1289   PORT_DIPSETTING(   0x08, DEF_STR( Medium ) )
1290   PORT_DIPSETTING(   0x0c, DEF_STR( Hard ) )
1291   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
1292   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!6,!7,!8")
13991293   PORT_DIPSETTING(   0x00, "RP2C04-0001" )
14001294   PORT_DIPSETTING(    0x20, "RP2C03" )
14011295   PORT_DIPSETTING(   0x40, "RP2C04-0002" )
r7972r7973
14111305   PORT_INCLUDE( vsnes_rev )
14121306
14131307   PORT_MODIFY("IN0")
1414   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )            /* START on a nes */
1308   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )      /* START on a nes */
14151309
14161310   PORT_MODIFY("IN1")
1417   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )            /* SELECT on a nes */
1311   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )      /* SELECT on a nes */
14181312
14191313   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1420   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
1314   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!1,!2")
14211315   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
14221316   PORT_DIPSETTING(   0x01, DEF_STR( Normal ) )
14231317   PORT_DIPSETTING(   0x02, DEF_STR( Medium ) )
14241318   PORT_DIPSETTING(   0x03, DEF_STR( Hard ) )
1425   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
1319   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!3")
14261320   PORT_DIPSETTING(   0x00, "2" )
14271321   PORT_DIPSETTING(   0x04, "3" )
1428   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) )
1322   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!4,!5")
14291323   PORT_DIPSETTING(   0x18, DEF_STR( 3C_1C ) )
14301324   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
14311325   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
14321326   PORT_DIPSETTING(   0x08, DEF_STR( 1C_2C ) )
1433   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )
1327   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!6,!7,!8")
14341328   PORT_DIPSETTING(   0x00, "RP2C04-0001" )
14351329   PORT_DIPSETTING(    0x20, "RP2C03" )
14361330   PORT_DIPSETTING(   0x40, "RP2C04-0002" )
r7972r7973
14461340
14471341   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
14481342   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )
1449   PORT_DIPSETTING(   0x07, DEF_STR( 4C_1C ) )
1343   PORT_DIPSETTING(   0x07, DEF_STR( 4C_1C ) )   PORT_DIPLOCATION("SW1:!1,!2,!3")
14501344   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
14511345   PORT_DIPSETTING(   0x05, DEF_STR( 2C_1C ) )
14521346   PORT_DIPSETTING(   0x01, DEF_STR( 1C_1C ) )
r7972r7973
14541348   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
14551349   PORT_DIPSETTING(   0x04, DEF_STR( 1C_4C ) )
14561350   PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
1457   PORT_DIPNAME( 0x08, 0x00, "Side Drain Walls" )
1351   PORT_DIPNAME( 0x08, 0x00, "Side Drain Walls" )      PORT_DIPLOCATION("SW1:!4")
14581352   PORT_DIPSETTING(   0x00, DEF_STR( High ) )
14591353   PORT_DIPSETTING(   0x08, DEF_STR( Low ) )
1460   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Bonus_Life ) )
1354   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!5")
14611355   PORT_DIPSETTING(   0x00, "50000" )
14621356   PORT_DIPSETTING(   0x10, "70000" )
1463   PORT_DIPNAME( 0x60, 0x00, "Balls" )
1357   PORT_DIPNAME( 0x60, 0x00, "Balls" )         PORT_DIPLOCATION("SW1:!6,!7")
14641358   PORT_DIPSETTING(   0x60, "2" )
14651359   PORT_DIPSETTING(   0x00, "3" )
14661360   PORT_DIPSETTING(   0x40, "4" )
14671361   PORT_DIPSETTING(   0x20, "5" )
1468   PORT_DIPNAME( 0x80, 0x00, "Ball speed" )
1469   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1362   PORT_DIPNAME( 0x80, 0x00, "Ball speed" )      PORT_DIPLOCATION("SW1:!8")
1363   PORT_DIPSETTING(   0x00, "Slow" )
14701364   PORT_DIPSETTING(   0x80, "Fast" )
14711365INPUT_PORTS_END
14721366
r7972r7973
14811375   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)      /* Left flipper */
14821376
14831377   PORT_START("COIN")   /* IN2 */
1484   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1378   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
14851379   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
14861380   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
14871381INPUT_PORTS_END
r7972r7973
14901384   PORT_INCLUDE( vsnes )
14911385
14921386   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1493   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1387   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
14941388   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
14951389   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
14961390   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
14991393   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
15001394   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
15011395   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1502   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )
1396   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4")
15031397   PORT_DIPSETTING(   0x00, "4" )
15041398   PORT_DIPSETTING(   0x08, "3" )
1505   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
1399   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!5,!6")
15061400   PORT_DIPSETTING(   0x00, "40000" )
15071401   PORT_DIPSETTING(   0x20, "50000" )
15081402   PORT_DIPSETTING(   0x10, "60000" )
15091403   PORT_DIPSETTING(   0x30, "70000" )
1510   PORT_DIPNAME(0x40,  0x00, "Timer" )
1404   PORT_DIPNAME(0x40,  0x00, "Timer" )         PORT_DIPLOCATION("SW1:!7")
15111405   PORT_DIPSETTING(   0x00, "Slow" )
15121406   PORT_DIPSETTING(   0x40, "Fast" )
1513   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
1407   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!8")
15141408   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
15151409   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
15161410INPUT_PORTS_END
r7972r7973
15191413   PORT_INCLUDE( vsnes_rev )
15201414
15211415   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1522   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1416   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
15231417   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
15241418   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
15251419   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
15281422   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
15291423   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
15301424   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1531   PORT_DIPNAME( 0x18, 0x08, "Points Timer" )
1425   PORT_DIPNAME( 0x18, 0x08, "Points Timer" )      PORT_DIPLOCATION("SW1:!4,!5")
15321426   PORT_DIPSETTING(   0x00, "600 Pts" )
15331427   PORT_DIPSETTING(   0x10, "800 Pts" )
15341428   PORT_DIPSETTING(   0x08, "1000 Pts" )
15351429   PORT_DIPSETTING(   0x18, "1200 Pts" )
1536   PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
1430   PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!6,!7")
15371431   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
15381432   PORT_DIPSETTING(   0x40, DEF_STR( Normal ) )
1539   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
1540   PORT_DIPSETTING(   0x60, DEF_STR( Very_Hard ) )
1541   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
1542   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1543   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1433   PORT_DIPSETTING(   0x20, DEF_STR( Medium ) )
1434   PORT_DIPSETTING(   0x60, DEF_STR( Hard ) )
1435   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW1:!8" )
15441436INPUT_PORTS_END
15451437
15461438static INPUT_PORTS_START( vsgradus )
15471439   PORT_INCLUDE( vsnes_rev )
15481440
15491441   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1550   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1442   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
15511443   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
15521444   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
15531445   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
15561448   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
15571449   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
15581450   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1559   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )
1451   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4")
15601452   PORT_DIPSETTING(   0x08, "3" )
15611453   PORT_DIPSETTING(   0x00, "4" )
1562   PORT_DIPNAME( 0x30, 0x00, "Bonus" )
1454   PORT_DIPNAME( 0x30, 0x00, "Bonus" )         PORT_DIPLOCATION("SW1:!5,!6")
15631455   PORT_DIPSETTING(   0x00, "100k" )
15641456   PORT_DIPSETTING(   0x20, "200k" )
15651457   PORT_DIPSETTING(   0x10, "300k" )
15661458   PORT_DIPSETTING(   0x30, "400k" )
1567   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
1568   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
1459   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!7")
1460   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
15691461   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )
1570   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
1462   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!8")
15711463   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
15721464   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
15731465INPUT_PORTS_END
r7972r7973
15761468   PORT_INCLUDE( vsnes )
15771469
15781470   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1579   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1471   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
15801472   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
15811473   PORT_DIPSETTING(   0x05, DEF_STR( 4C_1C ) )
15821474   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
r7972r7973
15851477   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
15861478   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
15871479   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1588   PORT_DIPNAME( 0x08, 0x00, "Freestyle Points" )
1480   PORT_DIPNAME( 0x08, 0x00, "Freestyle Points" )      PORT_DIPLOCATION("SW1:!4")
15891481   PORT_DIPSETTING(   0x00, "Left / Right" )
15901482   PORT_DIPSETTING(   0x08, "Hold Time" )
1591   PORT_DIPNAME( 0x30, 0x10, DEF_STR( Difficulty ) )
1483   PORT_DIPNAME( 0x30, 0x10, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!5,!6")
15921484   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
15931485   PORT_DIPSETTING(   0x10, DEF_STR( Normal ) )
1594   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
1595   PORT_DIPSETTING(   0x30, DEF_STR( Hardest ) )
1596   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )
1486   PORT_DIPSETTING(   0x20, DEF_STR( Medium ) )
1487   PORT_DIPSETTING(   0x30, DEF_STR( Hard ) )
1488   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("SW1:!7")
15971489   PORT_DIPSETTING(   0x40, DEF_STR( No ) )
15981490   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
1599   PORT_DIPNAME( 0x80, 0x00, "Inverted input" )
1491   PORT_DIPNAME( 0x80, 0x00, "Inverted input" )      PORT_DIPLOCATION("SW1:!8")
16001492   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
16011493   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
16021494INPUT_PORTS_END
r7972r7973
16051497   PORT_INCLUDE( vsnes_dual )
16061498
16071499   PORT_START("DSW0")
1608   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1500   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2")
16091501   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
16101502   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
16111503   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
16121504   PORT_DIPSETTING(   0x02, DEF_STR( 1C_2C ) )
1613   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1614   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1615   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
1616   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1617   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1618   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
1619   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1620   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1621   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
1622   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )
1505   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!3" )
1506   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
1507   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
1508   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!6,!7,!8")
16231509   PORT_DIPSETTING(   0x00, "RP2C03" )
16241510   PORT_DIPSETTING(    0x20, "RP2C04-0001" )
16251511//  PORT_DIPSETTING(    0x40, "RP2C03" )
r7972r7973
16371523   PORT_INCLUDE( vsnes )
16381524
16391525   PORT_MODIFY("COINS")   /* IN2 */
1640   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1526   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
16411527   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
16421528   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
16431529
16441530   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1645   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1531   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2")
16461532   PORT_DIPSETTING(   0x03, DEF_STR( 3C_1C ) )
16471533   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
16481534   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
16491535   PORT_DIPSETTING(   0x01, DEF_STR( 1C_2C ) )
1650   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1651   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1652   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
1653   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1654   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1655   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
1656   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1657   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1658   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
1659   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )
1536   PORT_DIPNAME( 0x0C, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:!3,!4")
1537   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
1538   PORT_DIPSETTING(   0x04, DEF_STR( Normal ) )
1539   PORT_DIPSETTING(   0x08, DEF_STR( Hard ) )
1540   PORT_DIPSETTING(   0x0C, DEF_STR( Very_Hard ) )
1541   PORT_DIPUNUSED_DIPLOC( 0x10, 0x00, "SW1:!5" )
1542   PORT_DIPNAME( 0xe0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!6,!7,!8")
16601543   PORT_DIPSETTING(   0x00, "RP2C04-0003" )
16611544//  PORT_DIPSETTING(    0x20, "RP2C03" )
16621545//  PORT_DIPSETTING(    0x40, "RP2C03" )
r7972r7973
16711554   PORT_INCLUDE( vsnes_rev )
16721555
16731556   PORT_MODIFY("IN0")   /* IN0 */
1674   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL ) // protection /* START on a nes */
1557   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL )      // protection /* START on a nes */
16751558
16761559   PORT_MODIFY("IN1")   /* IN1 */
1677   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL ) // protection /* START on a nes */
1560   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SPECIAL )      // protection /* START on a nes */
16781561
16791562   PORT_MODIFY("COINS")   /* IN2 */
1680   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1563   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
16811564   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
16821565   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
16831566   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SPECIAL )
16841567
16851568   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1686   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1569   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
16871570   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
16881571   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
16891572   PORT_DIPSETTING(   0x01, DEF_STR( 2C_1C ) )
r7972r7973
16921575   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
16931576   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
16941577   PORT_DIPSETTING(   0x07, DEF_STR( Free_Play ) )
1695   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
1578   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4")
16961579   PORT_DIPSETTING(   0x00, "2" )
16971580   PORT_DIPSETTING(   0x08, "3" )
1698   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1699   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1700   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1701   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1702   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1703   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1704   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1705   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1706   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1581   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW1:!5" )
1582   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
1583   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
1584   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
17071585INPUT_PORTS_END
17081586
17091587static INPUT_PORTS_START( mightybj )
17101588   PORT_INCLUDE( vsnes )
17111589
17121590   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1713   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
1591   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!1,!2,!3")
17141592   PORT_DIPSETTING(   0x07, DEF_STR( 5C_1C ) )
17151593   PORT_DIPSETTING(   0x03, DEF_STR( 4C_1C ) )
17161594   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
r7972r7973
17191597   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
17201598   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
17211599   PORT_DIPSETTING(   0x06, DEF_STR( 1C_4C ) )
1722   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
1600   PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW1:!4,!5")
17231601   PORT_DIPSETTING(   0x10, "2" )
17241602   PORT_DIPSETTING(   0x00, "3" )
17251603   PORT_DIPSETTING(   0x08, "4" )
17261604   PORT_DIPSETTING(   0x18, "5" )
1727   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1728   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1729   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
1730   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1731   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1732   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
1733   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1734   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1735   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
1605   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW1:!6" )
1606   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW1:!7" )
1607   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!8" )
17361608INPUT_PORTS_END
17371609
17381610static INPUT_PORTS_START( supxevs )
17391611   PORT_INCLUDE( vsnes )
17401612
17411613   PORT_MODIFY("IN1")   /* IN1 */
1742   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )            /* SELECT on a nes */
1614   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )      /* SELECT on a nes */
17431615
17441616   PORT_MODIFY("COINS")   /* IN2 */
1745   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) /* service credit? */
1617   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )      /* service credit? */
17461618   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
17471619   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
17481620
17491621   PORT_START("DSW0")   /* bit 0 and 1 read from bit 3 and 4 on $4016, rest of the bits read on $4017 */
1750   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
1751   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1752   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
1753   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1754   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1755   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
1756   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1757   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1758   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
1759   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1760   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
1761   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
1762   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) )
1622   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "SW1:!1" )
1623   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x00, "SW1:!2" )
1624   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!3" )
1625   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!4" )
1626   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:!5,!6")
17631627   PORT_DIPSETTING(   0x30, DEF_STR( 3C_1C ) )
17641628   PORT_DIPSETTING(   0x20, DEF_STR( 2C_1C ) )
17651629   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
17661630   PORT_DIPSETTING(   0x10, DEF_STR( 1C_2C ) )
1767   PORT_DIPNAME( 0xc0, 0x00, "PPU Type" )
1631   PORT_DIPNAME( 0xc0, 0x00, "PPU Type" )         PORT_DIPLOCATION("SW1:!7,!8")
17681632   PORT_DIPSETTING(   0x00, "RP2C04-0001" )
17691633   PORT_DIPSETTING(   0x40, "RP2C04-0002" )
17701634   PORT_DIPSETTING(   0x80, "RP2C04-0003" )
r7972r7973
24162280   ROM_REGION( 0x10000,"gfx1", 0 ) /* PPU memory */
24172281   ROM_LOAD( "tkochr.bin",  0x0000, 0x10000, CRC(21275ba5) SHA1(160131586aeeca848deabff258a2ce5f62b17c5f) )
24182282
2419   /* also compatible with 2C03 via dipswitches */
2283   /* also compatible with 2C03 via dipswitches
2284        Manual clearly states "RP2C04 0004" as PPU type, but the palette files argue that this is incorrect */
24202285   PALETTE_2C04_0003
24212286ROM_END
24222287
r7972r7973
25602425
25612426   ROM_REGION( 0x4000,"gfx1", 0 ) /* PPU memory */
25622427   ROM_LOAD( "bb-2b",  0x0000, 0x2000, CRC(3ff8bec3) SHA1(28c1bf89ed1046243ca8cf122cefa0752c242577) )
2563   ROM_LOAD( "bb-2a",  0x2000, 0x2000, CRC(ebb88502) SHA1(010fdffbd1cddcde8176aaaae5ca8e9c3411c02a) )
2428   ROM_LOAD( "bb-2a",  0x2000, 0x2000, CRC(13b20cfd) SHA1(cb333cbea09557a9d2bdc351fabc61fc7760c35d) )
25642429
2430/*  ROM_LOAD( "bb-2a",  0x2000, 0x2000, CRC(ebb88502) SHA1(010fdffbd1cddcde8176aaaae5ca8e9c3411c02a) )
2431This rom dump is suspected either bad or an operator hacked version.  The GFX roms for all the other Vs. Baseball sets have mirrored
2432GFX roms.  In this case, the bb-8a "gfx2" dump was placed in this slot to allow the Service Mode to green light all the roms.
2433
2434FC /b shows:
2435Comparing files bb-2a and bb-8a.
243600000E0A: 40 00
243700000E79: 40 00
2438*/
2439
25652440   ROM_REGION( 0x10000,"sub",0 ) /* 6502 memory */
25662441   ROM_LOAD( "bb-6d",  0x08000, 0x02000, CRC(7ec792bc) SHA1(92d1f8809db89a8d99f7ea1d2ba3f9be69195866) )
25672442   ROM_LOAD( "bb-6c",  0x0a000, 0x02000, CRC(b631f8aa) SHA1(0ee8a8def9512552037fdac1a14a3ea9393bb943) )
src/mame/drivers/legionna.c
r7972r7973
20782078   ROM_COPY( "adpcm", 0xe0000, 0x1e0000, 0x20000 )
20792079ROM_END
20802080
2081/* slight changes in the program roms compared to above set, all remaining roms were the same */
2082ROM_START( cupsocsb2 )
2083   ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
2084   ROM_LOAD16_BYTE( "4", 0x00001, 0x80000, CRC(83db76f8) SHA1(ffcd0a728de58871b945c15cc27da374b587e170) )
2085   ROM_LOAD16_BYTE( "5", 0x00000, 0x80000, CRC(c01e88c6) SHA1(8f90261792343c92ddd877ab8a2480b5aac82961) )
20812086
2087   ROM_REGION( 0x10000, "audiocpu", 0 )   /* Z80 code */
2088   ROM_LOAD( "sc_01.bin",    0x000000, 0x08000, CRC(cea39d6d) SHA1(f0b79c03ffafdd1e57673d6d4836becbe415110b) )
2089   ROM_CONTINUE(           0x000000, 0x08000 )
20822090
2091   ROM_REGION( 0x020000, "gfx1", 0 )
2092   ROM_LOAD16_BYTE( "seibu6.7x",    0x000000, 0x010000, CRC(21c1e1b8) SHA1(30928c8ef98bf32ba0bf795ddadba1c95fcffe9d) )
2093   ROM_LOAD16_BYTE( "seibu5.7y",    0x000001, 0x010000, CRC(955d9fd7) SHA1(782451e8e85f7ba285d6cacd9d3fdcf48bde60bc) )
2094
2095   ROM_REGION( 0x200000, "gfx2", 0 )
2096   ROM_LOAD( "obj.8c",       0x000000, 0x100000, CRC(e2377895) SHA1(1d1c7f31a08a464139cdaf383a5e1ade0717dc9f) )
2097   ROM_RELOAD(               0x100000, 0x100000 )
2098
2099   ROM_REGION( 0x100000, "gfx3", 0 )   /* MBK tiles */
2100   ROM_LOAD( "back-1.4y",    0x000000, 0x100000, CRC(3dfea0ec) SHA1(8f41d267e488e07831946ef898d593897f10bfe2) )
2101
2102   ROM_REGION( 0x100000, "gfx4", 0 )   /* not used */
2103   ROM_COPY("gfx3",0x00000,0x00000,0x100000)
2104
2105   ROM_REGION( 0x080000, "gfx5", 0 )   /* BK3 tiles */
2106   ROM_LOAD( "back-2.6y",    0x000000, 0x080000, CRC(e07712af) SHA1(2a0285d6a1e0141838e898252b8d922a6263b05f) )
2107
2108   ROM_REGION( 0x080000, "gfx6", 0 )   /* LBK tiles */
2109   ROM_COPY( "gfx5", 0x00000, 0x00000, 0x080000 )
2110
2111   /*bootleg GFX roms,for now load the original roms*/
2112   ROM_REGION( 0x500000, "user2", 0 )
2113   ROM_LOAD( "sc_07.bin", 0x000000, 0x080000, CRC(dcb29d01) SHA1(72b4234622605f0ab03f21fdb6a61c6dac36000d) )
2114   ROM_LOAD( "sc_06.bin", 0x080000, 0x080000, CRC(2dc70e05) SHA1(f1d0beb8428a7e1d7c7818e6719abdc543b2fa80) )
2115   ROM_LOAD( "sc_13.bin", 0x100000, 0x010000, CRC(229bddd8) SHA1(0924bf29db9c5a970546f154e7752697fdce6a58) )
2116   ROM_LOAD( "sc_12.bin", 0x110000, 0x010000, CRC(dabfa826) SHA1(0db587c846755491b169ef7751ba8e7cdc2607e6) )
2117   ROM_LOAD( "sc_08.bin", 0x200000, 0x080000, CRC(637120f3) SHA1(b4b2ad192e46ff80d4cb440d7fb6dac215a353ed) )
2118   ROM_LOAD( "sc_09.bin", 0x280000, 0x080000, CRC(695b6342) SHA1(dfccb43789021ba2568b9284ae61e64f7f89b152) )
2119   ROM_LOAD( "sc_14.bin", 0x300000, 0x080000, CRC(566086c2) SHA1(b7d09ce978f99ecc0d1975b31330ed49317701d5) )
2120   ROM_LOAD( "sc_15.bin", 0x380000, 0x080000, CRC(8fd87e65) SHA1(acc9fd0289fa9ab60bec16d3e642039380e5180a) )
2121   ROM_LOAD( "sc_10.bin", 0x400000, 0x080000, CRC(27e172b8) SHA1(ed86db2f42c8061607d46f2407b0130aaf692a02) )
2122   ROM_LOAD( "sc_11.bin", 0x480000, 0x080000, CRC(0cd5ca5e) SHA1(a59665e543e9383355de2576e6693348ec356591) )
2123
2124   ROM_REGION( 0x100000, "adpcm", ROMREGION_ERASEFF )   /* ADPCM samples */
2125   ROM_LOAD( "sc_02.bin",    0x000000, 0x020000, CRC(a70d4f03) SHA1(c2482e624c8a828a94206a36d10c1021ad8ca1d0) )
2126   ROM_LOAD( "sc_03.bin",    0x080000, 0x080000, CRC(6e254d12) SHA1(857779dbd276b688201a8ea3afd5817e38acad2e) )
2127
2128   ROM_REGION( 0x200000, "oki", ROMREGION_ERASEFF )
2129   ROM_COPY( "adpcm", 0x00000, 0x000000, 0x20000 ) //bank 0
2130   ROM_COPY( "adpcm", 0x00000, 0x020000, 0x20000 )
2131   ROM_COPY( "adpcm", 0x00000, 0x100000, 0x20000 ) //bank 4
2132   ROM_COPY( "adpcm", 0x80000, 0x120000, 0x20000 )
2133   ROM_COPY( "adpcm", 0x00000, 0x140000, 0x20000 ) //bank 5
2134   ROM_COPY( "adpcm", 0xa0000, 0x160000, 0x20000 )
2135   ROM_COPY( "adpcm", 0x00000, 0x180000, 0x20000 ) //bank 6
2136   ROM_COPY( "adpcm", 0xc0000, 0x1a0000, 0x20000 )
2137   ROM_COPY( "adpcm", 0x00000, 0x1c0000, 0x20000 ) //bank 7
2138   ROM_COPY( "adpcm", 0xe0000, 0x1e0000, 0x20000 )
2139ROM_END
2140
20832141#define CUPSOC_DEBUG_MODE 1
20842142
20852143static DRIVER_INIT( cupsoc )
r7972r7973
21232181GAME( 1992, cupsoca,  cupsoc,   cupsoc,   cupsoc,   0,        ROT0, "Seibu", "Seibu Cup Soccer (set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
21242182GAME( 1992, cupsocs,  cupsoc,   cupsoc,   cupsoc,   0,        ROT0, "Seibu", "Seibu Cup Soccer :Selection: (set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
21252183GAME( 1992, cupsocs2, cupsoc,   cupsoc,   cupsoc,   0,        ROT0, "Seibu", "Seibu Cup Soccer :Selection: (set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
2126GAME( 1992, cupsocsb, cupsoc,   cupsocbl, cupsoc,   cupsoc,   ROT0, "bootleg", "Seibu Cup Soccer :Selection: (bootleg)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
2184GAME( 1992, cupsocsb, cupsoc,   cupsocbl, cupsoc,   cupsoc,   ROT0, "bootleg", "Seibu Cup Soccer :Selection: (bootleg, set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
2185GAME( 1992, cupsocsb2,cupsoc,  cupsocbl, cupsoc,   cupsoc,   ROT0, "bootleg", "Seibu Cup Soccer :Selection: (bootleg, set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
21272186GAME( 1992, olysoc92, cupsoc,   cupsoc,   cupsoc,   0,        ROT0, "Seibu", "Olympic Soccer '92", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
src/mame/drivers/aristmk4.c
r7972r7973
2525      It also provides the real time clock DS1287 to the CPU.
2626
2727
28      27/04/10 - FrasheR
29      2 x Sound Chips connected to the 6522 VIA.
30      Notes
31      The VIA uses Port A to write to the D0-D7 on the AY8910s. Port B hooks first 4 bits up to BC1/BC2/BDIR and A9 on AY1 and A8 on AY2
32      The remaining 4 bits are connected to other hardware, read via the VIA.
33
34      The AY8910 named ay1 has writes on PORT B to the ZN434 DA convertor.
35      The AY8910 named ay2 has writes to lamps and the light tower on Port A and B. I
36      -- I have not coded these and such a warning will be received when data is written to port A and port B of AY2.
37
2838***********************************************************************************************************************************************/
2939
3040#define MAIN_CLOCK   XTAL_12MHz
r7972r7973
4050
4151
4252static UINT8 *mkiv_vram;
53static UINT8 psg_data;
54static int AY8910_1;
55static int AY8910_2;
4356
4457static VIDEO_START(aristmk4)
4558{
r7972r7973
243256
244257static READ8_DEVICE_HANDLER(via_a_r)
245258{
246    return 0;
259   int psg_ret=0;
260
261       if (AY8910_1&0x03) // SW1 read.
262          {
263         psg_ret = ay8910_r(devtag_get_device(device->machine, "ay1"), 0);
264         //logerror("PSG porta ay1 returned %02X\n",psg_ret);
265      }
266
267   else
268      if (AY8910_2&0x03) //i don't think we read anything from Port A on ay2, Can be removed once game works ok.
269         {
270            psg_ret = ay8910_r(devtag_get_device(device->machine, "ay2"), 0);
271            //logerror("PSG porta ay2 returned %02X\n",psg_ret);
272         };
273   return psg_ret;
274
247275}
248276
249277static READ8_DEVICE_HANDLER(via_b_r)
250278{
251    return 0;
279   // Not expecting to read anything from port B on the AY8910's ( controls BC1, BC2 and BDIR )
280   // However there are extra 4 bits not going to the AY8910's on the schematics, which get read in here.
281   // These haven't been implemented as yet as they're not fully understood.
282   /*   OPTA1  - Bit4  */
283   /*   OPTB2  - Bit5  */
284   /*   HOPCO1 - Bit6  */
285   /*   CBOPT1 - Bit7  */
286
287   return 0x00;
288
252289}
253290
254291static WRITE8_DEVICE_HANDLER(via_a_w)
255{
292{   //via_b_w will handle sending the data to the ay8910, so just write the data for it to use later
256293
294   //logerror("VIA port A write %02X\n",data);
295   psg_data = data;
296
257297}
258298
259299static WRITE8_DEVICE_HANDLER(via_b_w)
260300{
301   AY8910_1 = ( data & 0x0F ) ; //only need first 4 bits per schematics
302                                 //NOTE: when bit 4 is off, we write to AY1, when bit 4 is on, we write to AY2
303   AY8910_2 = AY8910_1;
261304
305   if ( AY8910_2 & 0x08 ) // is bit 4 on ?
306      {
307         AY8910_2  = (AY8910_2 | 0x02) ; // bit 2 is turned on as bit 4 hooks to bit 2 in the schematics
308         AY8910_1  = 0x00; // write only to ay2
309      }
310   else
311      {
312         AY8910_2 = 0x00; // write only to ay1
313      };
314
315   //only need bc1/bc2 and bdir so drop bit 4.
316
317   AY8910_1 = (AY8910_1 & 0x07);
318   AY8910_2 = (AY8910_2 & 0x07);
319
320   //PSG ay1
321
322   switch(AY8910_1)
323   {
324
325      case 0x00:   //INACT -Nothing to do here. Inactive PSG
326         break;
327
328      case 0x03:  //READ - Nothing to do here. The read happens in via_a_r
329         break;
330
331      case 0x06:  //WRITE
332         {
333            ay8910_data_w( devtag_get_device(device->machine, "ay1"), 0 , psg_data );
334            //logerror("VIA Port A write data ay1: %02X\n",psg_data);
335            break;
336         }
337
338      case 0x07:  //LATCH Address (set register)
339         {
340            ay8910_address_w( devtag_get_device(device->machine, "ay1"), 0 , psg_data );
341            //logerror("VIA Port B write register ay1: %02X\n",psg_data);
342            break;
343         }
344
345      default:
346         //logerror("Unknown PSG state on ay1: %02X\n",AY8910_1);
347         break;
348   }
349
350   //PSG ay2
351
352   switch(AY8910_2)
353   {
354
355      case 0x00:   //INACT - Nothing to do here. Inactive PSG
356         break;
357
358      case 0x02:   //INACT - '010' Nothing to do here. Inactive PSG. this will only happen on ay2 due to the bit 2 swap on 'inactive'
359         break;
360
361      case 0x03:  //READ - Nothing to do here. The read happens in via_a_r
362         break;
363
364      case 0x06:  //WRITE
365         {
366            ay8910_data_w( devtag_get_device(device->machine, "ay2"), 0 , psg_data );
367            //logerror("VIA Port A write data ay2: %02X\n",psg_data);
368            break;
369         }
370
371      case 0x07:  //LATCH Address (set register)
372         {
373            ay8910_address_w( devtag_get_device(device->machine, "ay2"), 0 , psg_data );
374            //logerror("VIA Port B write register ay2: %02X\n",psg_data);
375            break;
376         }
377
378      default:
379         //logerror("Unknown PSG state on ay2: %02X\n",AY8910_2);
380         break;
381
382   }
383
262384}
263385
386static READ8_DEVICE_HANDLER(via_ca2_r)
387{
388    //logerror("Via Port CA2 read %02X\n",0) ;
389   // CA2 is connected to CDSOL1 on schematics ?
264390
391   return 0 ;
265392
393}
394
395static READ8_DEVICE_HANDLER(via_cb2_r)
396{
397    //logerror("Via Port CB2 read %02X\n",0) ;
398    // CB2 is connected to HOPMO1 on schematics ?
399
400   return 0 ;
401
402}
403
404
405static WRITE8_DEVICE_HANDLER(via_ca2_w)
406{
407    //logerror("Via Port CA2 write %02X\n",data) ;
408}
409
410
411static WRITE8_DEVICE_HANDLER(via_cb2_w)
412{
413    //logerror("Via Port CB2 write %02X\n",data) ;
414}
415
416
417static WRITE8_DEVICE_HANDLER(zn434_w)
418{
419
420   // Introducted to prevent warning in log for write to AY1 PORT B
421   // this is a write to the ZN434 DA convertors..
422
423}
424
425
266426static ADDRESS_MAP_START( aristmk4_map, ADDRESS_SPACE_PROGRAM, 8 )
267427   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&mkiv_vram) // video ram -  chips U49 / U50
268428   AM_RANGE(0x0800, 0x17ff) AM_RAM
r7972r7973
364524{
365525   AY8910_LEGACY_OUTPUT,
366526   AY8910_DEFAULT_LOADS,
527   DEVCB_INPUT_PORT("DSW1"),
528    DEVCB_NULL,
367529   DEVCB_NULL,
368   DEVCB_NULL,
369   DEVCB_NULL,
370   DEVCB_NULL
530   DEVCB_HANDLER(zn434_w) // Port write to set Vout of the DA convertors ( 2 x ZN434 )
371531};
372532
373
374533static const ay8910_interface ay8910_config2 =
375534{
376535   AY8910_LEGACY_OUTPUT,
377536   AY8910_DEFAULT_LOADS,
378   DEVCB_INPUT_PORT("DSW1"),
379    DEVCB_NULL,
380   DEVCB_NULL,
381   DEVCB_NULL
537   DEVCB_NULL, // Port A read
538   DEVCB_NULL, // Port B read
539   DEVCB_NULL, // Port A write - goes to lamps on the buttons x8
540   DEVCB_NULL  // Port B write - goes to lamps on the buttons x4 and light tower x4
382541};
383542
384/*
543
385544static const via6522_interface via_interface =
386545{
387    // DEVCB_HANDLER(via_a_in), DEVCB_HANDLER(via_b_in),
388    // DEVCB_HANDLER(input_ca1), DEVCB_HANDLER(input_cb1), DEVCB_HANDLER(input_ca2), DEVCB_HANDLER(input_cb2),
389    /// DEVCB_NULL, DEVCB_HANDLER(output_b),
390    // DEVCB_HANDLER(output_ca1), DEVCB_HANDLER(output_cb1), DEVCB_HANDLER(output_ca2), DEVCB_HANDLER(output_cb2),
391   //  DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
392}; */
546   /*inputs : A/B               */ DEVCB_HANDLER(via_a_r),DEVCB_HANDLER(via_b_r),
547   /*inputs : CA/B1,CA/B2       */ DEVCB_NULL,DEVCB_NULL,DEVCB_HANDLER(via_ca2_r),DEVCB_HANDLER(via_cb2_r),
548   /*outputs: A/B               */ DEVCB_HANDLER(via_a_w), DEVCB_HANDLER(via_b_w),
549   /*outputs: CA/B1,CA/B2       */ DEVCB_NULL,DEVCB_NULL,DEVCB_HANDLER(via_ca2_w),DEVCB_HANDLER(via_cb2_w),
550   /*irq                        */ DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
393551
394static const via6522_interface via_interface =
395{
396   /*inputs : A/B         */ DEVCB_HANDLER(via_a_r),DEVCB_HANDLER(via_b_r),
397   /*inputs : CA/B1,CA/B2 */ DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,
398   /*outputs: A/B         */ DEVCB_HANDLER(via_a_w), DEVCB_HANDLER(via_b_w),
399   /*outputs: CA/B1,CA/B2 */ DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,
400   /*irq                  */ DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
552   // CA1 is connected to +5V, CB1 is not connected.
401553};
402554
403555static const pia6821_interface aristmk4_pia1_intf =
r7972r7973
492644    MDRV_MC6845_ADD("crtc", MC6845, MAIN_CLOCK/8, mc6845_intf)
493645
494646    MDRV_SPEAKER_STANDARD_MONO("mono")
647
495648    // the Mark IV has X 2 AY8910 sound chips which are tied to the VIA
496    MDRV_SOUND_ADD("ay1", AY8910, MAIN_CLOCK/8)
649    MDRV_SOUND_ADD("ay1", AY8910 , MAIN_CLOCK/8)
650    MDRV_SOUND_CONFIG(ay8910_config1)
497651    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
498    MDRV_SOUND_ADD("ay2", AY8910, MAIN_CLOCK/8)
652
653    MDRV_SOUND_ADD("ay2", AY8910 , MAIN_CLOCK/8)
654    MDRV_SOUND_CONFIG(ay8910_config2)
499655    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
500656
501657MACHINE_DRIVER_END
r7972r7973
817973   //...
818974}
819975
820GAME( 1994, eforest,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 12XF528902", GAME_NOT_WORKING|GAME_NO_SOUND )
821GAME( 1995, eforesta,eforest, aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 4VXFC818", GAME_NOT_WORKING|GAME_NO_SOUND )
822GAME( 1996, eforestb,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 3VXFC5343 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
823GAME( 1994, 3bagflnz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "3 Bags Full - 3VXFC5345 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
824GAME( 1996, blkrhino,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Black Rhino - 3VXFC5344 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
825GAME( 1996, kgbird,         0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "K.G Bird - 4VXFC5341 (New Zealand, 87.98%)", GAME_NOT_WORKING|GAME_NO_SOUND )
826GAME( 1996, kgbirda,kgbird,   aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "K.G Bird - 4VXFC5341 (New Zealand, 91.97%)", GAME_NOT_WORKING|GAME_NO_SOUND )
827GAME( 1998, swtht2nz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Sweet Hearts II - 1VXFC5461 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
828GAME( 1996, goldenc,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Golden Canaries - 1VXFC5462", GAME_NOT_WORKING|GAME_NO_SOUND )
829GAME( 1996, topgear,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Top Gear - 4VXFC969", GAME_NOT_WORKING|GAME_NO_SOUND )
830GAME( 1996, wtigernz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "White Tiger - 3VXFC5342 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
831GAME( 1998, phantomp,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Phantom Pays - 4VXFC5431 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
832GAME( 2000, coralr2,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Coral Riches II - 1VXFC5472 (New Zealand)", GAME_NOT_WORKING|GAME_NO_SOUND )
976GAME( 1994, eforest,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 12XF528902", GAME_NOT_WORKING )
977GAME( 1995, eforesta,eforest, aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 4VXFC818", GAME_NOT_WORKING )
978GAME( 1996, eforestb,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Enchanted Forest - 3VXFC5343 (New Zealand)", GAME_NOT_WORKING )
979GAME( 1994, 3bagflnz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "3 Bags Full - 3VXFC5345 (New Zealand)", GAME_NOT_WORKING )
980GAME( 1996, blkrhino,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Black Rhino - 3VXFC5344 (New Zealand)", GAME_NOT_WORKING )
981GAME( 1996, kgbird,         0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "K.G Bird - 4VXFC5341 (New Zealand, 87.98%)", GAME_NOT_WORKING )
982GAME( 1996, kgbirda,kgbird,   aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "K.G Bird - 4VXFC5341 (New Zealand, 91.97%)", GAME_NOT_WORKING )
983GAME( 1998, swtht2nz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Sweet Hearts II - 1VXFC5461 (New Zealand)", GAME_NOT_WORKING )
984GAME( 1996, goldenc,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Golden Canaries - 1VXFC5462", GAME_NOT_WORKING )
985GAME( 1996, topgear,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Top Gear - 4VXFC969", GAME_NOT_WORKING )
986GAME( 1996, wtigernz,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "White Tiger - 3VXFC5342 (New Zealand)", GAME_NOT_WORKING )
987GAME( 1998, phantomp,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Phantom Pays - 4VXFC5431 (New Zealand)", GAME_NOT_WORKING )
988GAME( 2000, coralr2,      0,aristmk4, aristmk4, aristmk4, ROT0,  "Aristocrat", "Coral Riches II - 1VXFC5472 (New Zealand)", GAME_NOT_WORKING )
src/mame/drivers/micro3d.c
r7972r7973
66
77    Games supported:
88        * F-15 Strike Eagle [2 sets]
9        * B.O.T.S.S. - Battle of the Solar System
9        * B.O.T.S.S. - Battle of the Solar System [2 sets]
1010        * Tank Battle (prototype)
1111
1212    TODO:
r7972r7973
1414        * DS1267 Volume control
1515
1616    Known issues:
17        * Games are running too smoothly!
1718        * F-15 controls need tweaking
19        * botssa will hit a divide-by-zero error if the throttle is
20          not calibrated first in service mode.
1821
1922****************************************************************************/
2023
r7972r7973
123126   PORT_BIT( 0xccf5, IP_ACTIVE_LOW, IPT_UNUSED )
124127INPUT_PORTS_END
125128
129static INPUT_PORTS_START( botssa )
130   PORT_INCLUDE( micro3d )
131
132   PORT_MODIFY("INPUTS_A_B")
133   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(botssa_hwchk_r, NULL)
134   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
135   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 )   PORT_NAME("Shield")
136   PORT_SERVICE( 0x0400, IP_ACTIVE_LOW )
137   PORT_BIT( 0x7800, IP_ACTIVE_LOW, IPT_UNUSED )
138
139   PORT_START("INPUTS_C_D")
140   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )
141   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 )
142   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Trigger")
143   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Blaster")
144   PORT_BIT( 0xccff, IP_ACTIVE_LOW, IPT_UNUSED )
145
146   PORT_START("JOYSTICK_X")
147   PORT_BIT( 0xfff, 0x000, IPT_AD_STICK_X ) PORT_MINMAX(0xc1, 0xc0) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_REVERSE
148
149   PORT_START("JOYSTICK_Y")
150   PORT_BIT(0xfff, 0x000, IPT_AD_STICK_Y ) PORT_MINMAX(0xc1, 0x0c0) PORT_SENSITIVITY(25) PORT_KEYDELTA(200)
151
152   PORT_START("THROTTLE")
153   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_NAME("Throttle")
154INPUT_PORTS_END
155
126156static INPUT_PORTS_START( tankbatl )
127157   PORT_INCLUDE( micro3d )
128158
r7972r7973
504534   ROM_LOAD( "110-00013-001.u17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) )
505535ROM_END
506536
537ROM_START( botssa )
538   /* Host PCB (MPG DW-00011C-0011-01) */
539   ROM_REGION( 0x180000, "maincpu", 0 )
540   ROM_LOAD16_BYTE( "110-00153-100.u67", 0x000001, 0x20000, CRC(338aa9c3) SHA1(3d10329a5df80ab1761fd3953eb3872a72f26bef) )
541   ROM_LOAD16_BYTE( "110-00153-101.u91", 0x000000, 0x20000, CRC(3278279e) SHA1(570935988c776283cdcd5aa13d71a75f0a466099) )
542   ROM_LOAD16_BYTE( "110-00153-102.u68", 0x040001, 0x20000, CRC(258d2687) SHA1(5b765d14a0a8dc4ef58453bbb7780068c168d268) )
543   ROM_LOAD16_BYTE( "110-00153-103.u92", 0x040000, 0x20000, CRC(1dde7ffa) SHA1(5363af00c8c896eccfad38ace5dfeb3bf96a73a1) )
544   ROM_LOAD16_BYTE( "110-00013-004.u69", 0x080001, 0x20000, CRC(72a607ca) SHA1(1afc85380be12c429808c48f1502736a4c8b98e5) )
545   ROM_LOAD16_BYTE( "110-00013-005.u93", 0x080000, 0x20000, CRC(f37680ae) SHA1(51f1ee805b7d1b2b078c612c572e12846de623b9) )
546   ROM_LOAD16_BYTE( "110-00013-006.u70", 0x0c0001, 0x20000, CRC(57a1c728) SHA1(2bdc831be739ada0f4f4adec7974da453878db0e) )
547   ROM_LOAD16_BYTE( "110-00013-007.u94", 0x0c0000, 0x20000, CRC(4c9e16af) SHA1(1f8acc9bb85fe1bf459b4358b9bf9cf9847e6a36) )
548   ROM_LOAD16_BYTE( "110-00013-008.u71", 0x100001, 0x20000, CRC(cfc0333e) SHA1(9f290769129a61189870faef45c3f061eb7b5c07) )
549   ROM_LOAD16_BYTE( "110-00013-009.u95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) )
550   ROM_FILL(                     0x140000, 0x40000, 0xff )
551
552   /* Dr Math PCB (MPG 010-00002-001) */
553   ROM_REGION32_BE( 0x100000, "drmath", 0 )
554   ROMX_LOAD( "110-00013-122.u134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324), ROM_SKIP(7) )
555   ROMX_LOAD( "110-00013-125.u126", 0x000001, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c), ROM_SKIP(7) )
556   ROMX_LOAD( "110-00013-123.u114", 0x000002, 0x08000, CRC(04ba6ed1) SHA1(012be71c6b955beda2bd0ff376dcaab51b226723), ROM_SKIP(7) )
557   ROMX_LOAD( "110-00013-224.u107", 0x000003, 0x08000, CRC(220db5d3) SHA1(3bfbe0eb97282c4ce449fd44e8e141de74f08eb0), ROM_SKIP(7) )
558   ROMX_LOAD( "110-00013-118.u135", 0x000004, 0x08000, CRC(2903e682) SHA1(027ed6524e9d4490632f10aeb22150c2fbc4eec2), ROM_SKIP(7) )
559   ROMX_LOAD( "110-00013-121.u127", 0x000005, 0x08000, CRC(198a636b) SHA1(356b8948aafb98cb5e6ee7b5ad6ea9e5998265e5), ROM_SKIP(7) )
560   ROMX_LOAD( "110-00013-219.u115", 0x000006, 0x08000, CRC(9c9dbac1) SHA1(4c66971884190598e128684ece2e15a1c80b94ed), ROM_SKIP(7) )
561   ROMX_LOAD( "110-00013-120.u108", 0x000007, 0x08000, CRC(dafa173a) SHA1(a19980b92a5e74ebe395be36313701fdb527a46a), ROM_SKIP(7) )
562
563   ROM_REGION16_BE( 0x80000, "vertex", 0 )
564   ROM_LOAD16_BYTE( "110-00013-014.u153", 0x00001, 0x20000, CRC(0eee0557) SHA1(8abe52cad31e59cf814fd9f64f4e42ddb4aa8c93) )
565   ROM_LOAD16_BYTE( "110-00013-015.u154", 0x00000, 0x20000, CRC(68564122) SHA1(410d2db74e574774b2eadd7fdf891feef5d8a93f) )
566   ROM_LOAD16_BYTE( "110-00013-016.u167", 0x40001, 0x20000, CRC(60c6cb26) SHA1(0e2bf65793715e12d8fd7f87fd3336a9d00ee7e6) )
567   ROM_LOAD16_BYTE( "110-00013-017.u160", 0x40000, 0x20000, CRC(d8b89379) SHA1(aa08e111c1505a4ad55b14659f8e21fd39cfcb16) )
568
569   ROM_REGION16_LE( 0x40000, "tms34010", 0 )
570   ROM_LOAD16_BYTE( "110-00023-201.u101", 0x000000, 0x20000, CRC(7dc05f7d) SHA1(4d202b229cf4690d92491311e9ff14034b19c35c) )
571   ROM_LOAD16_BYTE( "110-00023-204.u97",  0x000001, 0x20000, CRC(925fd08a) SHA1(fb06413debbffcd63b018f374f25b0d8e419c739) )
572
573   /* Video Graphics PCB (MPG DW-010-00002-002) */
574   ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 )
575   ROM_LOAD16_BYTE( "110-00023-205.u124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) )
576   ROM_LOAD16_BYTE( "110-00023-206.u121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) )
577   ROM_LOAD16_BYTE( "110-00023-207.u130", 0x040000, 0x20000, CRC(0d8cf60f) SHA1(d8021c6bc15beb5a0e6c86b91f8ed0389b1311a5) )
578   ROM_LOAD16_BYTE( "110-00023-208.u133", 0x040001, 0x20000, CRC(a4db3137) SHA1(ef266cc17e33a2c63cda3332e266bf943e464e7f) )
579   ROM_LOAD16_BYTE( "110-00023-203.u114", 0x080000, 0x20000, CRC(b1dacbb1) SHA1(323531b6919eed4a963d6aad871f1fd34203e698) )
580   ROM_LOAD16_BYTE( "110-00023-202.u108", 0x080001, 0x20000, CRC(ac0d3179) SHA1(f4c67d59d913ead0f8a6d42e2ca66857ebf01602) )
581
582   /* Sound PCB (MPG 010-00018-002) */
583   ROM_REGION( 0x10000, "audiocpu", 0 )
584   ROM_LOAD( "110-00014-001.u2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) )
585
586   ROM_REGION( 0x40000, "upd7759", 0 )
587   ROM_LOAD( "110-00013-001.u17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) )
588ROM_END
589
507590ROM_START( tankbatl )
508591   ROM_REGION( 0x180000, "maincpu", 0 )
509592   ROM_LOAD16_BYTE( "lo_u67",    0x000001, 0x20000, CRC(97aabac0) SHA1(12a0719d3332a63e912161200b0a942c27c1f5da) )
r7972r7973
562645
563646GAME( 1991, f15se,    0,     micro3d, f15se,    micro3d, ROT0, "Microprose Games Inc.", "F-15 Strike Eagle (rev. 2.2 02/25/91)", GAME_IMPERFECT_SOUND )
564647GAME( 1991, f15se21 , f15se, micro3d, f15se,    micro3d, ROT0, "Microprose Games Inc.", "F-15 Strike Eagle (rev. 2.1 02/04/91)", GAME_IMPERFECT_SOUND )
565GAME( 1992, botss,    0,     micro3d, botss,    micro3d, ROT0, "Microprose Games Inc.", "Battle of the Solar System (rev. 1.1)", GAME_IMPERFECT_SOUND )
648GAME( 1992, botss,    0,     micro3d, botss,    micro3d, ROT0, "Microprose Games Inc.", "Battle of the Solar System (rev. 1.1 3/24/92)", GAME_IMPERFECT_SOUND )
649GAME( 1992, botssa,   botss, micro3d, botssa,   botssa,  ROT0, "Microprose Games Inc.", "Battle of the Solar System (rev. 1.1a 7/23/92)", GAME_IMPERFECT_SOUND )
566650GAME( 1992, tankbatl, 0,     micro3d, tankbatl, micro3d, ROT0, "Microprose Games Inc.", "Tank Battle (prototype rev. 4/21/92)",  GAME_IMPERFECT_SOUND )
src/mame/drivers/gei.c
r7972r7973
115115   }
116116}
117117
118static PALETTE_INIT(quizvid)
119{
120   int i;
121
122   for (i = 0; i < 8; i++ )
123   {
124      palette_set_color(machine, i, MAKE_RGB(pal1bit(i >> 1), pal1bit(i), pal1bit(i >> 2)));
125   }
126}
127
118128static WRITE8_DEVICE_HANDLER( lamps_w )
119129{
120130   /* 5 button lamps */
r7972r7973
10861096
10871097   MDRV_CPU_MODIFY("maincpu")
10881098   MDRV_CPU_PROGRAM_MAP(quizvid_map)
1099
1100   MDRV_PALETTE_INIT(quizvid)
10891101MACHINE_DRIVER_END
10901102
10911103static MACHINE_DRIVER_START( gselect )
r7972r7973
15251537   ROM_LOAD( "10-19s-1.e2",  0x08000, 0x4000, BAD_DUMP CRC(22b45aeb) SHA1(006c3072cc44c6fde9b4d15163dc70707bbd5a9c) ) /* Self test reports this ROM bad */
15261538ROM_END
15271539
1528ROM_START( reelfun ) /* v7.01 */
1540ROM_START( reelfun ) /* v7.03 */
15291541   ROM_REGION( 0x38000, "maincpu", 0 )
1530   ROM_LOAD( "reelfun.cnt",          0x00000, 0x4000, CRC(d9d1e92b) SHA1(337f66a37b3734d565b3ff3d912e0f690fd7c445) )
1542   ROM_LOAD( "reelfun.cnt",          0x00000, 0x4000, CRC(ce42e0ea) SHA1(87f703b14aa819c54e54b42e639448521c01f76b) )
15311543   ROM_LOAD( "reelfun.prg",          0x08000, 0x2000, CRC(615d846a) SHA1(ffa1c47393f4f364aa34d14cf3ac2f56d9eaecb0) )   /* banked */
15321544   ROM_LOAD( "reelfun-1-title",      0x10000, 0x8000, CRC(0e165fbc) SHA1(a3a5b7db72ab86efe973f649f5dfe5133830e3fc) )   /* banked ROMs for solution data */
15331545   ROM_LOAD( "reelfun-2-place",      0x18000, 0x8000, CRC(a0066bfd) SHA1(b6f031ab50eb396be79e79e06f2101400683ec3e) )
r7972r7973
15361548   ROM_LOAD( "reelfun-5-song_title", 0x30000, 0x8000, CRC(cce01c45) SHA1(c484f5828928edf39335cedf21acab0b9e2a6881) )
15371549ROM_END
15381550
1551ROM_START( reelfun1 ) /* v7.01 */
1552   ROM_REGION( 0x38000, "maincpu", 0 )
1553   ROM_LOAD( "reelfun701.cnt",       0x00000, 0x4000, CRC(d9d1e92b) SHA1(337f66a37b3734d565b3ff3d912e0f690fd7c445) )
1554   ROM_LOAD( "reelfun.prg",          0x08000, 0x2000, CRC(615d846a) SHA1(ffa1c47393f4f364aa34d14cf3ac2f56d9eaecb0) )   /* banked */
1555   ROM_LOAD( "reelfun-1-title",      0x10000, 0x8000, CRC(0e165fbc) SHA1(a3a5b7db72ab86efe973f649f5dfe5133830e3fc) )   /* banked ROMs for solution data */
1556   ROM_LOAD( "reelfun-2-place",      0x18000, 0x8000, CRC(a0066bfd) SHA1(b6f031ab50eb396be79e79e06f2101400683ec3e) )
1557   ROM_LOAD( "reelfun-3-phrase",     0x20000, 0x8000, CRC(199e36b0) SHA1(d9dfe39c9a4fca1169150f8941f8ebc499dfbaf5) )
1558   ROM_LOAD( "reelfun-4-person",     0x28000, 0x8000, CRC(49b0710b) SHA1(a38b3251bcb8683d43bdb903036970140a9735e6) )
1559   ROM_LOAD( "reelfun-5-song_title", 0x30000, 0x8000, CRC(cce01c45) SHA1(c484f5828928edf39335cedf21acab0b9e2a6881) )
1560ROM_END
1561
15391562ROM_START( findout )
15401563   ROM_REGION( 0x38000, "maincpu", 0 )
15411564   ROM_LOAD( "12.bin",       0x00000, 0x4000, CRC(21132d4c) SHA1(e3562ee2f46b3f022a852a0e0b1c8fb8164f64a3) )
r7972r7973
18111834GAME( 1982, gs4002a,  gs4002,   gselect,  gselect,  0,       ROT0, "Greyhound Electronics", "Selection (Version 40.02TMB, set 2)",     GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18121835
18131836GAME( 1982, amuse,    0,        amuse,    gepoker,  0,       ROT0, "Greyhound Electronics", "Amuse (Version 50.08 IBA)",               GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1814GAME( 1982, amuse1, 0,          amuse1,   gepoker,  0,       ROT0, "Greyhound Electronics", "Amuse (Version 30.08 IBA)",               GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1837GAME( 1982, amuse1,   amuse,    amuse1,   gepoker,  0,       ROT0, "Greyhound Electronics", "Amuse (Version 30.08 IBA)",               GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18151838
18161839GAME( 1984, gepoker,  0,        gepoker,  gepoker,  0,       ROT0, "Greyhound Electronics", "Poker (Version 50.02 ICB, set 1)",        GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18171840GAME( 1984, gepoker1, gepoker,  gepoker,  gepoker,  0,       ROT0, "Greyhound Electronics", "Poker (Version 50.02 ICB, set 2)",        GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
r7972r7973
18431866
18441867GAME( 1986, quiz,     0,        findout,  quiz,     0,       ROT0, "Italian bootleg",       "Quiz (Revision 2)",                       GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18451868
1846GAME( 1986, quizvid,  0,        quizvid,  quiz,     0,       ROT0, "Greyhound Electronics", "Video Quiz",                              GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1869GAME( 1986, quizvid,  0,        quizvid,  quiz,     0,       ROT0, "bootleg",              "Video Quiz",                              GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18471870
1848GAME( 1986, reelfun,  0,        findout,  reelfun,  0,       ROT0, "Grayhound Electronics", "Reel Fun (Version 7.01)",                 GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1871GAME( 1986, reelfun,  0,        findout,  reelfun,  0,       ROT0, "Grayhound Electronics", "Reel Fun (Version 7.03)",                 GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1872GAME( 1986, reelfun1, reelfun,  findout,  reelfun,  0,       ROT0, "Grayhound Electronics", "Reel Fun (Version 7.01)",                 GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18491873GAME( 1987, findout,  0,        findout,  findout,  0,       ROT0, "Elettronolo",           "Find Out (Version 4.04)",                 GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
18501874
18511875GAME( 1987, suprpokr, 0,        suprpokr, suprpokr, 0,       ROT0, "Grayhound Electronics", "Super Poker",                             GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mame/drivers/segas32.c
r7972r7973
1010
1111****************************************************************************
1212
13
1314Slip Stream (950515 HISPANIC)
1415Sega, 1995
1516
r7972r7973
312313
313314MIB.42
314315
315***************************************************************************/
316***************************************************************************
317Output Notes:
318All outputs are hooked up properly with the following exceptions:
319radm:  Motors aren't hooked up, as the board isn't emulated. Also the 2nd and 3rd lamps "die" when the cabinet dip is set to deluxe.
320    They probably get moved over to the motor driver board.
316321
322radr:  See radm
323
324kokoroj: This driver isn't finished enough to flesh out the outputs, but a space has been reserved in the output functions.
325
326jpark:  Since the piston driver board isn't fully emulated, they aren't hooked up.  offset 0c of the common chip function seems to have something to do with it.
327
328orunners:  Interleaved with the dj and << >> buttons is the data the drives the lcd display.
329****************************************************************************/
330
317331#include "emu.h"
318332#include "cpu/z80/z80.h"
319333#include "cpu/v60/v60.h"
r7972r7973
383397static UINT8 sound_dummy_value;
384398static UINT16 sound_bank;
385399
400
386401/* I/O chips and custom I/O */
387402static UINT8 misc_io_data[2][0x10];
388403static read16_space_func custom_io_r[2];
r7972r7973
391406static UINT8 analog_value[4];
392407static UINT8 sonic_last[6];
393408
409/* callbacks to handle output */
410typedef void (*sys32_output_callback)(int which, UINT16 data);
411static sys32_output_callback segas32_sw1_output, segas32_sw2_output, segas32_sw3_output;
412
394413static void (*system32_prot_vblank)(running_device *device);
395414
396415
397
398416/*************************************
399417 *
400418 *  Prototypes
r7972r7973
683701      case 0x08/2:
684702      case 0x0a/2:
685703      case 0x0c/2:
704         if (segas32_sw2_output)
705            segas32_sw2_output(which, data);
686706         break;
687707
688708      /* miscellaneous output */
689709      case 0x06/2:
710         if (segas32_sw1_output)
711            segas32_sw1_output(which, data);
712
690713         if (which == 0)
691714         {
692715            running_device *device = devtag_get_device(space->machine, "eeprom");
r7972r7973
789812{
790813   /* only LSB matters */
791814   if (!ACCESSING_BITS_0_7)
792      return;
815   return;
793816
794817   if (custom_io_w[0])
795818      (*custom_io_w[0])(space, offset, data, mem_mask);
r7972r7973
812835static WRITE32_HANDLER( io_expansion_0_w )
813836{
814837   /* only LSB matters */
838
839
815840   if (ACCESSING_BITS_0_7)
816841   {
842      /* harddunk uses bits 4,5 for output lamps */
843      if (segas32_sw3_output)
844         segas32_sw3_output(0, data & 0xff);
845
817846      if (custom_io_w[0])
818847         (*custom_io_w[0])(space, offset*2+0, data, mem_mask);
819848      else
820849         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(space->cpu), offset, data & 0xff);
850
821851   }
822852   if (ACCESSING_BITS_16_23)
823853   {
r7972r7973
37713801   custom_io_r[0] = custom_r;
37723802   custom_io_w[0] = custom_w;
37733803   system32_prot_vblank = NULL;
3804   segas32_sw1_output = NULL;
3805   segas32_sw2_output = NULL;
3806   segas32_sw3_output = NULL;
37743807}
37753808
37763809
3810/*************************************
3811 *
3812 *  Output callbacks
3813 *
3814 *  TODO: kokoroj2 and jpark (SW2)
3815 *
3816 *  Additional notes:
3817 *    - about jpark: the compression switch is broken/inoperative
3818 *      and because of that all piston data, which is in this
3819 *      section is frozen. bits x01, x04 and x10 when which == 0
3820 *      (IO chip 0), seem to have something to do with the sensor
3821 *      switches we need to fix
3822 *************************************/
37773823
3824static void radm_sw1_output( int which, UINT16 data )
3825{
3826   if (which == 0)
3827      output_set_value("Start_lamp", BIT(data, 2));
3828}
3829
3830static void radm_sw2_output( int which, UINT16 data )
3831{
3832   if (which == 0)
3833   {
3834      output_set_value("Wiper_lamp", BIT(data, 0));
3835      output_set_value("Lights_lamp", BIT(data, 1));
3836   }
3837}
3838
3839static void radr_sw2_output( int which, UINT16 data )
3840{
3841   if (which == 0)
3842   {
3843      output_set_value("Entry_lamp", BIT(data, 0));
3844      output_set_value("Winner_lamp", BIT(data, 1));
3845   }
3846}
3847
3848static void alien3_sw1_output( int which, UINT16 data )
3849{
3850   if (which == 0)
3851   {
3852      output_set_value("Player1_Gun_Recoil", BIT(data, 2));
3853      output_set_value("Player2_Gun_Recoil", BIT(data, 3));
3854   }
3855}
3856
3857static void arescue_sw1_output( int which, UINT16 data )
3858{
3859   if (which == 0)
3860   {
3861      output_set_value("Start_lamp", BIT(data, 2));
3862      output_set_value("Back_lamp", BIT(data, 4));
3863   }
3864}
3865
3866static void f1lap_sw1_output( int which, UINT16 data )
3867{
3868   if (which == 0)
3869   {
3870      output_set_value("lamp0", BIT(data, 2));
3871      output_set_value("lamp1", BIT(data, 3));
3872   }
3873}
3874
3875static void jpark_sw1_output( int which, UINT16 data )
3876{
3877   if (which == 0)
3878   {
3879      output_set_value("Left_lamp", BIT(data, 2));
3880      output_set_value("Right_lamp", BIT(data, 3));
3881   }
3882}
3883
3884static void orunners_sw1_output( int which, UINT16 data )
3885{
3886   /* note ma = monitor A and mb = Monitor B */
3887   if (which == 0)
3888   {
3889      output_set_value("MA_Check_Point_lamp", BIT(data, 1));
3890      output_set_value("MA_Race_Leader_lamp", BIT(data, 3));
3891      output_set_value("MA_Steering_Wheel_lamp", BIT(data, 4));
3892   }
3893   else
3894   {
3895      output_set_value("MB_Check_Point_lamp", BIT(data, 1));
3896      output_set_value("MB_Race_Leader_lamp", BIT(data, 3));
3897      output_set_value("MB_Steering_Wheel_lamp", BIT(data, 4));
3898   }
3899}
3900
3901static void orunners_sw2_output( int which, UINT16 data )
3902{
3903   /* note ma = monitor A and mb = Monitor B */
3904   /* also note that the remaining bits are for the game's lcd display */
3905   /* the bijokkoy driver might be used as an example for handling these outputs */
3906   if (which == 0)
3907   {
3908      output_set_value("MA_DJ_Music_lamp", BIT(data, 0));
3909      output_set_value("MA_<<_>>_lamp", BIT(data, 1));
3910   }
3911   else
3912   {
3913      output_set_value("MB_DJ_Music_lamp", BIT(data, 0));
3914      output_set_value("MB_<<_>>_lamp", BIT(data, 1));
3915   }
3916}
3917
3918static void harddunk_sw1_output( int which, UINT16 data )
3919{
3920   if (which == 0)
3921   {
3922      output_set_value("1P_Start_lamp", BIT(data, 2));
3923      output_set_value("2P_Start_lamp", BIT(data, 3));
3924   }
3925   else
3926   {
3927      output_set_value("4P_Start_lamp", BIT(data, 2));
3928      output_set_value("5P_Start_lamp", BIT(data, 3));
3929   }
3930}
3931
3932static void harddunk_sw2_output( int which, UINT16 data )
3933{
3934   if (which == 0)
3935      output_set_value("Left_Winner_lamp", BIT(data, 0));
3936   else
3937      output_set_value("Right_Winner_lamp", BIT(data, 0));
3938}
3939
3940static void harddunk_sw3_output( int which, UINT16 data )
3941{
3942   output_set_value("3P_Start_lamp", BIT(data, 4));
3943   output_set_value("6P_Start_lamp", BIT(data, 5));
3944}
3945
3946static void titlef_sw1_output( int which, UINT16 data )
3947{
3948   if (which == 0)
3949   {
3950      output_set_value("Blue_Button_1P_lamp", BIT(data, 2));
3951      output_set_value("Blue_Button_2P_lamp", BIT(data, 3));
3952   }
3953   else
3954   {
3955      output_set_value("Red_Button_1P_lamp", BIT(data, 2));
3956      output_set_value("Red_Button_2P_lamp", BIT(data, 3));
3957   }
3958}
3959
3960static void titlef_sw2_output( int which, UINT16 data )
3961{
3962   if (which == 0)
3963      output_set_value("Blue_Corner_lamp", BIT(data, 0));
3964   else
3965      output_set_value("Red_Corner_lamp", BIT(data, 0));
3966}
3967
3968static void scross_sw1_output( int which, UINT16 data )
3969{
3970   /* note ma = monitor A and mb = Monitor B */
3971   if (which == 0)
3972      output_set_value("MA_Start_lamp", BIT(data, 2));
3973   else
3974      output_set_value("MB_Start_lamp", BIT(data, 2));
3975}
3976
3977static void scross_sw2_output( int which, UINT16 data )
3978{
3979   /* Note:  I'm not an expert on digits, so I didn't know the right map to use, I just added it manually and it seems to work fine. */
3980   if (which == 0)
3981      output_set_value("MA_Digit", data);
3982   else
3983      output_set_value("MB_Digit", data);
3984}
3985
37783986/*************************************
37793987 *
37803988 *  Game-specific driver inits
r7972r7973
37843992static DRIVER_INIT( alien3 )
37853993{
37863994   segas32_common_init(analog_custom_io_r, analog_custom_io_w);
3995   segas32_sw1_output = alien3_sw1_output;
37873996}
37883997
37893998static READ16_HANDLER( arescue_handshake_r )
r7972r7973
38074016
38084017   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x810000, 0x810001, 0, 0, arescue_handshake_r);
38094018   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x81000e, 0x81000f, 0, 0, arescue_slavebusy_r);
4019
4020   segas32_sw1_output = arescue_sw1_output;
38104021}
38114022
38124023
r7972r7973
38644075   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x818000, 0x818003, 0, 0, dual_pcb_masterslave);
38654076
38664077   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x810048, 0x810049, 0, 0, f1en_comms_echo_w);
4078
4079   segas32_sw1_output = radm_sw1_output;
38674080}
38684081
38694082
38704083static DRIVER_INIT( f1lap )
38714084{
38724085   segas32_common_init(analog_custom_io_r, analog_custom_io_w);
4086   segas32_sw1_output = f1lap_sw1_output;
38734087}
38744088
38754089
r7972r7973
38854099static DRIVER_INIT( harddunk )
38864100{
38874101   segas32_common_init(extra_custom_io_r, NULL);
4102   segas32_sw1_output = harddunk_sw1_output;
4103   segas32_sw2_output = harddunk_sw2_output;
4104   segas32_sw3_output = harddunk_sw3_output;
38884105}
38894106
38904107
r7972r7973
39034120
39044121   pROM[0xC15A8/2] = 0xCD70;
39054122   pROM[0xC15AA/2] = 0xD8CD;
4123
4124   segas32_sw1_output = jpark_sw1_output;
39064125}
39074126
39084127
39094128static DRIVER_INIT( orunners )
39104129{
39114130   segas32_common_init(analog_custom_io_r, orunners_custom_io_w);
4131   segas32_sw1_output = orunners_sw1_output;
4132   segas32_sw2_output = orunners_sw2_output;
39124133}
39134134
39144135
39154136static DRIVER_INIT( radm )
39164137{
39174138   segas32_common_init(analog_custom_io_r, analog_custom_io_w);
4139   segas32_sw1_output = radm_sw1_output;
4140   segas32_sw2_output = radm_sw2_output;
39184141}
39194142
39204143
39214144static DRIVER_INIT( radr )
39224145{
39234146   segas32_common_init(analog_custom_io_r, analog_custom_io_w);
4147   segas32_sw1_output = radm_sw1_output;
4148   segas32_sw2_output = radr_sw2_output;
39244149}
39254150
39264151
r7972r7973
39294154   running_device *multipcm = devtag_get_device(machine, "sega");
39304155   segas32_common_init(analog_custom_io_r, analog_custom_io_w);
39314156   memory_install_write8_device_handler(cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_PROGRAM), multipcm, 0xb0, 0xbf, 0, 0, scross_bank_w);
4157
4158   segas32_sw1_output = scross_sw1_output;
4159   segas32_sw2_output = scross_sw2_output;
39324160}
39334161
39344162
r7972r7973
39754203static DRIVER_INIT( titlef )
39764204{
39774205   segas32_common_init(NULL, NULL);
4206   segas32_sw1_output = titlef_sw1_output;
4207   segas32_sw2_output = titlef_sw2_output;
39784208}
39794209
39804210
src/mame/drivers/segas16a.c
r7972r7973
19831983   MDRV_SCREEN_SIZE(342,262)   /* to be verified */
19841984   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
19851985
1986   MDRV_SEGA16SP_ADD_16A("segaspr1")
1987
19861988   MDRV_GFXDECODE(segas16a)
19871989   MDRV_PALETTE_LENGTH(2048*3)
19881990
src/mame/drivers/segahang.c
r7972r7973
10581058static MACHINE_DRIVER_START( hangon )
10591059   MDRV_IMPORT_FROM(hangon_base)
10601060   MDRV_IMPORT_FROM(sound_board_2203)
1061
1062   MDRV_SEGA16SP_ADD_HANGON("segaspr1")
10611063MACHINE_DRIVER_END
10621064
10631065
r7972r7973
10681070   /* not sure about these speeds, but at 6MHz, the road is not updated fast enough */
10691071   MDRV_CPU_REPLACE("maincpu", M68000, 10000000)
10701072   MDRV_CPU_REPLACE("sub", M68000, 10000000)
1073
1074   MDRV_SEGA16SP_ADD_HANGON("segaspr1")
10711075MACHINE_DRIVER_END
10721076
10731077
r7972r7973
10781082   MDRV_CPU_ADD("mcu", I8751, 8000000)
10791083   MDRV_CPU_IO_MAP(mcu_io_map)
10801084   MDRV_CPU_VBLANK_INT("screen", irq0_line_pulse)
1085
1086   MDRV_SEGA16SP_ADD_SHARRIER("segaspr1")
10811087MACHINE_DRIVER_END
10821088
10831089
10841090static MACHINE_DRIVER_START( enduror )
10851091   MDRV_IMPORT_FROM(sharrier_base)
10861092   MDRV_IMPORT_FROM(sound_board_2151)
1093
1094   MDRV_SEGA16SP_ADD_SHARRIER("segaspr1")
10871095MACHINE_DRIVER_END
10881096
10891097
10901098static MACHINE_DRIVER_START( enduror1 )
10911099   MDRV_IMPORT_FROM(sharrier_base)
10921100   MDRV_IMPORT_FROM(sound_board_2203)
1101
1102   MDRV_SEGA16SP_ADD_SHARRIER("segaspr1")
10931103MACHINE_DRIVER_END
10941104
10951105
10961106static MACHINE_DRIVER_START( endurob2 )
10971107   MDRV_IMPORT_FROM(sharrier_base)
10981108   MDRV_IMPORT_FROM(sound_board_2203x2)
1109
1110   MDRV_SEGA16SP_ADD_SHARRIER("segaspr1")
10991111MACHINE_DRIVER_END
11001112
11011113
src/mame/drivers/statriv2.c
r7972r7973
2424*     it generates lots of errors in error.log, even though the  *
2525*     sound seems to make sense. Can someone with a PCB stomach  *
2626*     the game long enough to verify one way or the other?       *
27*                                                                *
28* RF: Reworked the Status Fun Casino inputs. Lowered the CPU     *
29*     clock to get it working properly. Added technical notes.   *
30*                                                                *
2731******************************************************************
2832
2933******************************************************************
r7972r7973
330334
331335static INPUT_PORTS_START( funcsino )
332336   PORT_START("IN0")
333   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Bet")
334   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Deal")
335   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Draw")
336   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Card 1")
337   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Card 2")
338   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Card 3")
339   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Card 4")
340   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Card 5")
337   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_BET )
338   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )
339   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )     PORT_NAME("Draw")      PORT_CODE(KEYCODE_3)
340   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Discard 1 / Horse 1 / Point")
341   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Discard 2 / Horse 2")
342   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Discard 3 / Horse 3")
343   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Discard 4 / Horse 4")
344   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Discard 5 / Horse 5 / No Point")
341345
342346   PORT_START("IN1")
343   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Stand")
344   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Select Game")
347   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stand")         PORT_CODE(KEYCODE_4)
348   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Select Game")   PORT_CODE(KEYCODE_S)
345349   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(latched_coin_r, "COIN")
346350   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
347351   PORT_DIPNAME( 0x10, 0x10, "DIP switch? 10" )
r7972r7973
606610   MDRV_GFXDECODE(vertical)
607611MACHINE_DRIVER_END
608612
613static MACHINE_DRIVER_START( funcsino )
614   /* basic machine hardware */
615   MDRV_IMPORT_FROM(statriv2)
609616
617    MDRV_CPU_REPLACE("maincpu", 8085A, MASTER_CLOCK/2)   /* 3 MHz?? seems accurate */
618MACHINE_DRIVER_END
610619
620
621
611622/*************************************
612623 *
613624 *  ROM definitions
r7972r7973
656667   ROM_LOAD( "prom.u22", 0x0040, 0x0100, NO_DUMP ) /* Soldered in */
657668ROM_END
658669
670/*
671
672Fun Casino
673Status Game Corp., 1982
674
6758085
676xtal 12.44MHz
6778255
678TMS9937
679AY3-8910
6805101 RAM x2
6812114 RAM x6
6822732 EPROMs x4
68374S287 PROM x1
68474S288 PROM x2
6854-position DSW x1
686
687*/
659688ROM_START( funcsino )
660689   ROM_REGION( 0x10000, "maincpu", 0 )
661690   ROM_LOAD( "u7", 0x0000, 0x1000, CRC(e7380a81) SHA1(dbc9646a33bd61cdfab9f8a5ac7db996cfc0eaf9) )
r7972r7973
10831112 *************************************/
10841113
10851114GAME( 1981, statusbj, 0,        statriv2,  statusbj, 0,         ROT0, "Status Games", "Status Black Jack (V1.0c)", GAME_SUPPORTS_SAVE )
1086GAME( 1981, funcsino, 0,        statriv2,  funcsino, 0,         ROT0, "Status Games", "Status Fun Casino (V1.3s)", GAME_SUPPORTS_SAVE )
1115GAME( 1981, funcsino, 0,        funcsino,  funcsino, 0,         ROT0, "Status Games", "Status Fun Casino (V1.3s)", GAME_SUPPORTS_SAVE )
10871116GAME( 1981, tripdraw, 0,        statriv2,  funcsino, 0,         ROT0, "Status Games", "Tripple Draw (V3.1 s)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
10881117GAME( 1984, hangman,  0,        statriv2,  hangman,  addr_lmh,  ROT0, "Status Games", "Hangman", GAME_SUPPORTS_SAVE )
10891118GAME( 1984, trivquiz, 0,        statriv2,  statriv2, addr_lhx,  ROT0, "Status Games", "Triv Quiz", GAME_SUPPORTS_SAVE )
src/mame/drivers/taito_l.c
r7972r7973
29472947GAME( 1990, palamed,   0,        palamed,  palamed,  0,        ROT0,   "Taito Corporation", "Palamedes (Japan)", 0 )
29482948GAME( 1993, cachat,    0,        cachat,   cachat,   0,        ROT0,   "Taito Corporation", "Cachat (Japan)", 0 )
29492949GAME( 1993, tubeit,    cachat,   cachat,   tubeit,   0,        ROT0,   "Taito Corporation", "Tube-It", 0 )  // No (c) message
2950GAME( 199?, cubybop,   0,        cachat,   cubybop,  0,        ROT0,   "Taito Corporation", "Cuby Bop (Location Test)", 0 ) // No (c) message
29512950
2952GAME( 1992, plgirls,   0,        cachat,   plgirls,  0,        ROT270, "Hot-B.",  "Play Girls", 0 )
2951GAME( 199?, cubybop,   0,        cachat,   cubybop,  0,        ROT0,   "Hot-B",   "Cuby Bop (Location Test)", 0 ) // No (c) message, but Hot-B company logo in tile gfx
2952GAME( 1992, plgirls,   0,        cachat,   plgirls,  0,        ROT270, "Hot-B",   "Play Girls", 0 )
29532953GAME( 1992, lagirl,    plgirls,  cachat,   plgirls,  0,        ROT270, "bootleg", "LA Girl", 0 ) /* bootleg hardware with changed title & backgrounds */
2954GAME( 1993, plgirls2,  0,        cachat,   plgirls2, 0,        ROT270, "Hot-B.",  "Play Girls 2", 0 )
2954GAME( 1993, plgirls2,  0,        cachat,   plgirls2, 0,        ROT270, "Hot-B",   "Play Girls 2", 0 )
29552955
29562956GAME( 1990, evilston,  0,        evilston, evilston, evilston, ROT270, "Spacy Industrial, Ltd.", "Evil Stone", 0 )
src/mame/drivers/feversoc.c
r7972r7973
11/*******************************************************************************************
22
3Fever Soccer (c) 2000 Seibu
3Fever Soccer (c) 2004 Seibu
44
55A down-grade of the Seibu SPI Hardware with SH-2 as main cpu.
66
r7972r7973
1616
1717Seibu Kaihatsu Inc.
1818
19PCB (c) 2000 SYS_SH2B + SYS_SH2B Rom Board
19PCB (c) 2004 SYS_SH2B + SYS_SH2B Rom Board
2020
2121Very simple PCB contains:
2222
src/mame/drivers/sstrangr.c
r7972r7973
99#include "cpu/i8085/i8085.h"
1010#include "deprecat.h"
1111
12#include "sstrangr.lh"
1213
14
1315#define NUM_PENS   (8)
1416
1517class sstrangr_state
r7972r7973
298300ROM_END
299301
300302
301GAME( 1978, sstrangr, 0,        sstrangr, sstrangr, 0, ROT270, "Yachiyo Electronics, Ltd.", "Space Stranger", GAME_NO_SOUND )
303GAMEL( 1978, sstrangr, 0,        sstrangr, sstrangr, 0, ROT270, "Yachiyo Electronics, Ltd.", "Space Stranger", GAME_NO_SOUND, layout_sstrangr )
302304GAME( 1979, sstrangr2,sstrangr, sstrngr2, sstrngr2, 0, ROT270, "Yachiyo Electronics, Ltd.", "Space Stranger 2", GAME_NO_SOUND )
src/mame/drivers/segas18.c
r7972r7973
5858 *************************************/
5959
6060static UINT16 *workram;
61static UINT16 has_guns;
6162
6263
6364/*************************************
r7972r7973
293294      case 0x08/2:
294295      case 0x0a/2:
295296      case 0x0c/2:
297      if (has_guns == 1)
298      /* outputs for lghost only */
299      {
300      output_set_value("P1_Gun_Recoil",(~data & 0x01));
301      output_set_value("P2_Gun_Recoil",(~data & 0x02)>>1);
302      output_set_value("P3_Gun_Recoil",(~data & 0x04)>>2);
303      }
304
296305         break;
297306
298307      /* miscellaneous output */
r7972r7973
13091318   MDRV_VIDEO_START(system18)
13101319   MDRV_VIDEO_UPDATE(system18)
13111320
1321   MDRV_SEGA16SP_ADD_16B("segaspr1")
1322
13121323   /* sound hardware */
13131324   MDRV_SPEAKER_STANDARD_MONO("mono")
13141325
r7972r7973
22482259
22492260static DRIVER_INIT( lghost )
22502261{
2262   has_guns=1;
22512263   segas1x_state *state = (segas1x_state *)machine->driver_data;
22522264
22532265   DRIVER_INIT_CALL(generic_5987);
src/mame/drivers/astrocorp.c
r7972r7973
620620
621621Skill Drop Georgia
622622
623"Sep 13 2002 09:17:54" in code rom.
623"Sep 13 2002 09:17:54" in code rom and AAI276832 on sticker.
624624
625AAI276832 on sticker
625No specific PCB model or numer....
626626
627 Astro V02 0022 160pin PQFP ("ASTRO02" silkscreened under chip)
628 JX-1689F1028N GRC586.V5 (68K core, has direct connection to program roms)
629 Lattice IspLSI 1016 60LJ socketted FPGA
630 OKI 6295 clone chip (AD-65 or U6295)
631
632EEPROM Atmel 93C46
633Batery 3.6V
634OSC    24.000MHz
635
636PC1 is a push button for test mode
637VR1 is for sound volume
638
639      +---------+   +----------------------------+ +----+
640  +---+Connector+---+         Connector          +-+    |
641  |                                                  VR1|
642  |                                                     |
643+-+             +------+                                |
644|      ULN2003A |IspLSI| UT6264CPC     ROM#4*           |
645|  ULN2003A     | 1016 |             +---------+        |
646|8              +------++----------+ |ROM#6 U26|        |
647|                       |ROM#2  U20| +---------+  +----+|
648|L        +-------+     +----------+   ROM#3*     |6295||
649|i        | JX-   |                               +----+|
650|n        | 1689F | +--------------+                    |
651|e        | 1028N | |  ROM#7 U100  |                    |
652|r        +-------+ +--------------+                    |
653|                                    +----------+   +---+
654|C                      +----------+ |          |   |   |
655|o                      |ROM#1  U21| |  Astro   |   | R |
656|n                      +----------+ |  V02     |   | O |
657|n                                   |  0022    |   | M |
658|e                                   +----------+   | # |
659|c                       UT6264CPC                  | 5 |
660|t                                                  |   |
661|o                                                  +---+
662|r     93C46              6116      6116      RAM1      |
663|                                                  24MHz|
664+-+ BAT1 PC1              6116      6116      RAM1      |
665  +-----------------------------------------------------+
666
667ROM#1 & ROM#2 are 32pin sockets
668ROM#7 is a 40pin socket
669ROM#3 & ROM#4 at U25 & U27 are optional unpopulated 32pin sockets and overlap with ROM#6
670ROM#6 is 29F1610MC flash rom
671
672RAM1 are SEC KM681000BLG-7L RAM chips
673
627674***************************************************************************/
628675
629676ROM_START( skilldrp )
630677   ROM_REGION( 0x40000, "maincpu", 0 )
631   ROM_LOAD16_WORD_SWAP( "7-skill_drop_g1.0s.bc133", 0x00000, 0x40000, CRC(f968b783) SHA1(1d693b1d460e659ca94aae8625ea26e120053f84) )
678   ROM_LOAD16_WORD_SWAP( "7-skill_drop_g1.0s.u100", 0x00000, 0x40000, CRC(f968b783) SHA1(1d693b1d460e659ca94aae8625ea26e120053f84) )
632679
633680   ROM_REGION( 0x200000, "sprites", 0 )
634681   ROM_LOAD( "mx29f1610amc.u26", 0x000000, 0x200000, CRC(4fdac800) SHA1(bcafceb6c34866c474714347e23f9e819b5fcfa6) )
635682
636683   ROM_REGION( 0x80000, "oki", 0 )
637   ROM_LOAD( "5-skill_drop.bc52", 0x00000, 0x80000, CRC(a479e06d) SHA1(ee690d39188b8a43652c4aa5bf8267c1f6632d2f) )
684   ROM_LOAD( "5-skill_drop", 0x00000, 0x80000, CRC(a479e06d) SHA1(ee690d39188b8a43652c4aa5bf8267c1f6632d2f) ) /* No chip location just "ROM#5" silkscreened under socket */
638685
639686   ROM_REGION16_BE( 0x80, "eeprom", 0 )
640   ROM_LOAD( "skilldrp.nv", 0x00, 0x80, CRC(57886a3d) SHA1(bad8fa2ec2262ccb5ef8ec50959aec3f3bf8b90b) )
687   ROM_LOAD( "skilldrp.u6", 0x00, 0x80, CRC(57886a3d) SHA1(bad8fa2ec2262ccb5ef8ec50959aec3f3bf8b90b) )
641688ROM_END
642689
643690static DRIVER_INIT( showhand )
src/mame/drivers/crystal.c
r7972r7973
124124
125125#define IDLE_LOOP_SPEEDUP
126126
127class crystal_state
128{
129public:
130   static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, crystal_state(machine)); }
131
132   crystal_state(running_machine &machine) { }
133
134   /* memory pointers */
135   UINT32 *  workram;
136   UINT32 *  textureram;
137   UINT32 *  frameram;
138   UINT32 *  sysregs;
139   UINT32 *  vidregs;
140//  UINT32 *  nvram;    // currently this uses generic nvram handling
141
127142#ifdef IDLE_LOOP_SPEEDUP
128static UINT8 FlipCntRead;
143   UINT8    FlipCntRead;
129144#endif
130145
131static UINT32 *workram,*textureram,*frameram;
132static UINT32 *sysregs,*vidregs;
133static UINT32 Bank;
134static UINT8 FlipCount,IntHigh;
135static UINT32 Timerctrl[4];
136static emu_timer *Timer[4];
137static UINT32 FlashCmd,PIO;
138static UINT32 DMActrl[2];
139static UINT8 OldPort4;
140static UINT32 *ResetPatch;
146   UINT32    Bank;
147   UINT8     FlipCount, IntHigh;
148   UINT32    Timerctrl[4];
149   emu_timer *Timer[4];
150   UINT32    FlashCmd, PIO;
151   UINT32    DMActrl[2];
152   UINT8     OldPort4;
153   UINT32    *ResetPatch;
141154
142static void IntReq(running_machine *machine, int num)
155   running_device *maincpu;
156   running_device *ds1302;
157   running_device *vr0video;
158};
159
160static void IntReq( running_machine *machine, int num )
143161{
144   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
145   UINT32 IntEn=memory_read_dword(space, 0x01800c08);
146   UINT32 IntPend=memory_read_dword(space, 0x01800c0c);
147   if(IntEn & (1 << num))
162   crystal_state *state = (crystal_state *)machine->driver_data;
163   const address_space *space = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
164   UINT32 IntEn = memory_read_dword(space, 0x01800c08);
165   UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
166   if (IntEn & (1 << num))
148167   {
149168      IntPend |= (1 << num);
150169      memory_write_dword(space, 0x01800c0c, IntPend);
151      cputag_set_input_line(machine, "maincpu", SE3208_INT, ASSERT_LINE);
170      cpu_set_input_line(state->maincpu, SE3208_INT, ASSERT_LINE);
152171   }
153172#ifdef IDLE_LOOP_SPEEDUP
154   FlipCntRead = 0;
155   cputag_resume(machine, "maincpu", SUSPEND_REASON_SPIN);
173   state->FlipCntRead = 0;
174   cpu_resume(state->maincpu, SUSPEND_REASON_SPIN);
156175#endif
157176}
158177
159static READ32_HANDLER(FlipCount_r)
178static READ32_HANDLER( FlipCount_r )
160179{
180   crystal_state *state = (crystal_state *)space->machine->driver_data;
181
161182#ifdef IDLE_LOOP_SPEEDUP
162183   UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
163   FlipCntRead++;
164   if(FlipCntRead >= 16 && !IntPend && FlipCount != 0)
165      cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_SPIN, 1);
184   state->FlipCntRead++;
185   if (state->FlipCntRead >= 16 && !IntPend && state->FlipCount != 0)
186      cpu_suspend(state->maincpu, SUSPEND_REASON_SPIN, 1);
166187#endif
167   return ((UINT32) FlipCount)<<16;
188   return ((UINT32) state->FlipCount) << 16;
168189}
169190
170static WRITE32_HANDLER(FlipCount_w)
191static WRITE32_HANDLER( FlipCount_w )
171192{
172   if(mem_mask & 0x00ff0000)
193   crystal_state *state = (crystal_state *)space->machine->driver_data;
194
195   if (mem_mask & 0x00ff0000)
173196   {
174197      int fc = (data >> 16) & 0xff;
175      if(fc == 1)
176         FlipCount++;
177      else if(fc == 0)
178         FlipCount = 0;
198      if (fc == 1)
199         state->FlipCount++;
200      else if (fc == 0)
201         state->FlipCount = 0;
179202   }
180203}
181204
182static READ32_HANDLER(Input_r)
205static READ32_HANDLER( Input_r )
183206{
184   if(offset == 0)
207   crystal_state *state = (crystal_state *)space->machine->driver_data;
208
209   if (offset == 0)
185210      return input_port_read(space->machine, "P1_P2");
186   else if(offset == 1)
211   else if (offset == 1)
187212      return input_port_read(space->machine, "P3_P4");
188   else if(offset == 2)
213   else if( offset == 2)
189214   {
190215      UINT8 Port4 = input_port_read(space->machine, "SYSTEM");
191      if(!(Port4 & 0x10) && ((OldPort4^Port4) & 0x10))   //coin buttons trigger IRQs
216      if (!(Port4 & 0x10) && ((state->OldPort4 ^ Port4) & 0x10))   //coin buttons trigger IRQs
192217         IntReq(space->machine, 12);
193      if(!(Port4 & 0x20) && ((OldPort4^Port4) & 0x20))
218      if (!(Port4 & 0x20) && ((state->OldPort4 ^ Port4) & 0x20))
194219         IntReq(space->machine, 19);
195      OldPort4 = Port4;
220      state->OldPort4 = Port4;
196221      return /*dips*/input_port_read(space->machine, "DSW") | (Port4 << 16);
197222   }
198223   return 0;
199224}
200225
201static WRITE32_HANDLER(IntAck_w)
226static WRITE32_HANDLER( IntAck_w )
202227{
228   crystal_state *state = (crystal_state *)space->machine->driver_data;
203229   UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
204   if(mem_mask & 0xff)
230
231   if (mem_mask & 0xff)
205232   {
206233      IntPend &= ~(1 << (data & 0x1f));
207234      memory_write_dword(space, 0x01800c0c, IntPend);
208      if(!IntPend)
209         cputag_set_input_line(space->machine, "maincpu", SE3208_INT, CLEAR_LINE);
235      if (!IntPend)
236         cpu_set_input_line(state->maincpu, SE3208_INT, CLEAR_LINE);
210237   }
211   if(mem_mask & 0xff00)
212      IntHigh = (data >> 8) & 7;
238   if (mem_mask & 0xff00)
239      state->IntHigh = (data >> 8) & 7;
213240}
214241
215static IRQ_CALLBACK(icallback)
242static IRQ_CALLBACK( icallback )
216243{
244   crystal_state *state = (crystal_state *)device->machine->driver_data;
217245   const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
218246   UINT32 IntPend = memory_read_dword(space, 0x01800c0c);
219247   int i;
220248
221   for(i = 0; i < 32; ++i)
249   for (i = 0; i < 32; ++i)
222250   {
223      if(IntPend & (1 << i))
251      if (BIT(IntPend, i))
224252      {
225         return (IntHigh << 5) | i;
253         return (state->IntHigh << 5) | i;
226254      }
227255   }
228256   return 0;      //This should never happen
229257}
230258
231static WRITE32_HANDLER(Banksw_w)
259static WRITE32_HANDLER( Banksw_w )
232260{
233   Bank=(data>>1)&7;
234   if(Bank<=2)
235      memory_set_bankptr(space->machine, "bank1",memory_region(space->machine, "user1")+Bank*0x1000000);
261   crystal_state *state = (crystal_state *)space->machine->driver_data;
262
263   state->Bank = (data >> 1) & 7;
264   if (state->Bank <= 2)
265      memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "user1") + state->Bank * 0x1000000);
236266   else
237      memory_set_bankptr(space->machine, "bank1",memory_region(space->machine, "user2"));
267      memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "user2"));
238268}
239269
240270static TIMER_CALLBACK( Timercb )
241271{
272   crystal_state *state = (crystal_state *)machine->driver_data;
242273   int which = (int)(FPTR)ptr;
243274   static const int num[] = { 0, 1, 9, 10 };
244275
245   if(!(Timerctrl[which]&2))
246      Timerctrl[which]&=~1;
276   if (!(state->Timerctrl[which] & 2))
277      state->Timerctrl[which] &= ~1;
278
247279   IntReq(machine, num[which]);
248280}
249281
250INLINE void Timer_w(const address_space *space, int which, UINT32 data, UINT32 mem_mask)
282INLINE void Timer_w( const address_space *space, int which, UINT32 data, UINT32 mem_mask )
251283{
252   if(((data^Timerctrl[which])&1) && (data&1))   //Timer activate
284   crystal_state *state = (crystal_state *)space->machine->driver_data;
285
286   if (((data ^ state->Timerctrl[which]) & 1) && (data & 1))   //Timer activate
253287   {
254      int PD=(data>>8)&0xff;
255      int TCV=memory_read_dword(space, 0x01801404+which*8);
288      int PD = (data >> 8) & 0xff;
289      int TCV = memory_read_dword(space, 0x01801404 + which * 8);
256290      attotime period = attotime_mul(ATTOTIME_IN_HZ(43000000), (PD + 1) * (TCV + 1));
257291
258      if(Timerctrl[which]&2)
259         timer_adjust_periodic(Timer[which],period,0,period);
292      if (state->Timerctrl[which] & 2)
293         timer_adjust_periodic(state->Timer[which], period, 0, period);
260294      else
261         timer_adjust_oneshot(Timer[which],period,0);
295         timer_adjust_oneshot(state->Timer[which], period, 0);
262296   }
263   COMBINE_DATA(&Timerctrl[which]);
297   COMBINE_DATA(&state->Timerctrl[which]);
264298}
265299
266static WRITE32_HANDLER(Timer0_w)
300static WRITE32_HANDLER( Timer0_w )
267301{
268302   Timer_w(space, 0, data, mem_mask);
269303}
270304
271static READ32_HANDLER(Timer0_r)
305static READ32_HANDLER( Timer0_r )
272306{
273   return Timerctrl[0];
307   crystal_state *state = (crystal_state *)space->machine->driver_data;
308   return state->Timerctrl[0];
274309}
275310
276static WRITE32_HANDLER(Timer1_w)
311static WRITE32_HANDLER( Timer1_w )
277312{
278313   Timer_w(space, 1, data, mem_mask);
279314}
280315
281static READ32_HANDLER(Timer1_r)
316static READ32_HANDLER( Timer1_r )
282317{
283   return Timerctrl[1];
318   crystal_state *state = (crystal_state *)space->machine->driver_data;
319   return state->Timerctrl[1];
284320}
285321
286static WRITE32_HANDLER(Timer2_w)
322static WRITE32_HANDLER( Timer2_w )
287323{
288324   Timer_w(space, 2, data, mem_mask);
289325}
290326
291static READ32_HANDLER(Timer2_r)
327static READ32_HANDLER( Timer2_r )
292328{
293   return Timerctrl[2];
329   crystal_state *state = (crystal_state *)space->machine->driver_data;
330   return state->Timerctrl[2];
294331}
295332
296static WRITE32_HANDLER(Timer3_w)
333static WRITE32_HANDLER( Timer3_w )
297334{
298335   Timer_w(space, 3, data, mem_mask);
299336}
300337
301static READ32_HANDLER(Timer3_r)
338static READ32_HANDLER( Timer3_r )
302339{
303   return Timerctrl[3];
340   crystal_state *state = (crystal_state *)space->machine->driver_data;
341   return state->Timerctrl[3];
304342}
305343
306static READ32_HANDLER(FlashCmd_r)
344static READ32_HANDLER( FlashCmd_r )
307345{
308   if((FlashCmd&0xff)==0xff)
346   crystal_state *state = (crystal_state *)space->machine->driver_data;
347
348   if ((state->FlashCmd & 0xff) == 0xff)
309349   {
310      if(Bank<=2)
350      if (state->Bank <= 2)
311351      {
312         UINT32 *ptr=(UINT32*)(memory_region(space->machine, "user1")+Bank*0x1000000);
352         UINT32 *ptr = (UINT32*)(memory_region(space->machine, "user1") + state->Bank * 0x1000000);
313353         return ptr[0];
314354      }
315355      else
316356         return 0xffffffff;
317357   }
318   if((FlashCmd&0xff)==0x90)
358   if ((state->FlashCmd & 0xff) == 0x90)
319359   {
320      if(Bank<=2)
360      if (state->Bank <= 2)
321361            return 0x00180089;   //Intel 128MBit
322362      else
323363         return 0xffffffff;
r7972r7973
325365   return 0;
326366}
327367
328static WRITE32_HANDLER(FlashCmd_w)
368static WRITE32_HANDLER( FlashCmd_w )
329369{
330   FlashCmd=data;
370   crystal_state *state = (crystal_state *)space->machine->driver_data;
371   state->FlashCmd = data;
331372}
332373
333static READ32_HANDLER(PIO_r)
374static READ32_HANDLER( PIO_r )
334375{
335   return PIO;
376   crystal_state *state = (crystal_state *)space->machine->driver_data;
377   return state->PIO;
336378}
337379
338static WRITE32_HANDLER(PIO_w)
380static WRITE32_HANDLER( PIO_w )
339381{
340   running_device *ds1302 = devtag_get_device(space->machine, "rtc");
382   crystal_state *state = (crystal_state *)space->machine->driver_data;
341383   UINT32 RST = data & 0x01000000;
342384   UINT32 CLK = data & 0x02000000;
343385   UINT32 DAT = data & 0x10000000;
344386
345387   if (!RST)
346      ds1302->reset();
388      state->ds1302->reset();
347389
348   ds1302_dat_w(ds1302, 0, DAT ? 1 : 0);
349   ds1302_clk_w(ds1302, 0, CLK ? 1 : 0);
390   ds1302_dat_w(state->ds1302, 0, DAT ? 1 : 0);
391   ds1302_clk_w(state->ds1302, 0, CLK ? 1 : 0);
350392
351   if (ds1302_read(ds1302, 0))
393   if (ds1302_read(state->ds1302, 0))
352394      memory_write_dword(space, 0x01802008, memory_read_dword(space, 0x01802008) | 0x10000000);
353395   else
354396      memory_write_dword(space, 0x01802008, memory_read_dword(space, 0x01802008) & (~0x10000000));
355397
356   COMBINE_DATA(&PIO);
398   COMBINE_DATA(&state->PIO);
357399}
358400
359INLINE void DMA_w(const address_space *space, int which, UINT32 data, UINT32 mem_mask)
401INLINE void DMA_w( const address_space *space, int which, UINT32 data, UINT32 mem_mask )
360402{
361   if(((data^DMActrl[which])&(1<<10)) && (data&(1<<10)))   //DMAOn
403   crystal_state *state = (crystal_state *)space->machine->driver_data;
404
405   if (((data ^ state->DMActrl[which]) & (1 << 10)) && (data & (1 << 10)))   //DMAOn
362406   {
363      UINT32 CTR=data;
364      UINT32 SRC=memory_read_dword(space,0x01800804+which*0x10);
365      UINT32 DST=memory_read_dword(space,0x01800808+which*0x10);
366      UINT32 CNT=memory_read_dword(space,0x0180080C+which*0x10);
407      UINT32 CTR = data;
408      UINT32 SRC = memory_read_dword(space, 0x01800804 + which * 0x10);
409      UINT32 DST = memory_read_dword(space, 0x01800808 + which * 0x10);
410      UINT32 CNT = memory_read_dword(space, 0x0180080C + which * 0x10);
367411      int i;
368412
369      if(CTR&0x2)   //32 bits
413      if (CTR & 0x2)   //32 bits
370414      {
371         for(i=0;i<CNT;++i)
415         for (i = 0; i < CNT; ++i)
372416         {
373            UINT32 v=memory_read_dword(space,SRC+i*4);
374            memory_write_dword(space,DST+i*4,v);
417            UINT32 v = memory_read_dword(space, SRC + i * 4);
418            memory_write_dword(space, DST + i * 4, v);
375419         }
376420      }
377      else if(CTR&0x1)   //16 bits
421      else if (CTR & 0x1)   //16 bits
378422      {
379         for(i=0;i<CNT;++i)
423         for (i = 0; i < CNT; ++i)
380424         {
381            UINT16 v=memory_read_word(space,SRC+i*2);
382            memory_write_word(space,DST+i*2,v);
425            UINT16 v = memory_read_word(space, SRC + i * 2);
426            memory_write_word(space, DST + i * 2, v);
383427         }
384428      }
385429      else   //8 bits
386430      {
387         for(i=0;i<CNT;++i)
431         for (i = 0; i < CNT; ++i)
388432         {
389            UINT8 v=memory_read_byte(space,SRC+i);
390            memory_write_byte(space,DST+i,v);
433            UINT8 v = memory_read_byte(space, SRC + i);
434            memory_write_byte(space, DST + i, v);
391435         }
392436      }
393      data&=~(1<<10);
394      memory_write_dword(space,0x0180080C+which*0x10,0);
395      IntReq(space->machine, 7+which);
437      data &= ~(1 << 10);
438      memory_write_dword(space, 0x0180080C + which * 0x10, 0);
439      IntReq(space->machine, 7 + which);
396440   }
397   COMBINE_DATA(&DMActrl[which]);
441   COMBINE_DATA(&state->DMActrl[which]);
398442}
399443
400static READ32_HANDLER(DMA0_r)
444static READ32_HANDLER( DMA0_r )
401445{
402   return DMActrl[0];
446   crystal_state *state = (crystal_state *)space->machine->driver_data;
447   return state->DMActrl[0];
403448}
404449
405static WRITE32_HANDLER(DMA0_w)
450static WRITE32_HANDLER( DMA0_w )
406451{
407452   DMA_w(space, 0, data, mem_mask);
408453}
409454
410static READ32_HANDLER(DMA1_r)
455static READ32_HANDLER( DMA1_r )
411456{
412   return DMActrl[1];
457   crystal_state *state = (crystal_state *)space->machine->driver_data;
458   return state->DMActrl[1];
413459}
414460
415static WRITE32_HANDLER(DMA1_w)
461static WRITE32_HANDLER( DMA1_w )
416462{
417463   DMA_w(space, 1, data, mem_mask);
418464}
r7972r7973
425471   AM_RANGE(0x01280000, 0x01280003) AM_WRITE(Banksw_w)
426472   AM_RANGE(0x01400000, 0x0140ffff) AM_RAM AM_BASE_SIZE_GENERIC(nvram)
427473
428   AM_RANGE(0x01801400, 0x01801403) AM_READ(Timer0_r) AM_WRITE(Timer0_w)
429   AM_RANGE(0x01801408, 0x0180140b) AM_READ(Timer1_r) AM_WRITE(Timer1_w)
430   AM_RANGE(0x01801410, 0x01801413) AM_READ(Timer2_r) AM_WRITE(Timer2_w)
431   AM_RANGE(0x01801418, 0x0180141b) AM_READ(Timer3_r) AM_WRITE(Timer3_w)
432   AM_RANGE(0x01802004, 0x01802007) AM_WRITE(PIO_w) AM_READ(PIO_r)
474   AM_RANGE(0x01801400, 0x01801403) AM_READWRITE(Timer0_r, Timer0_w)
475   AM_RANGE(0x01801408, 0x0180140b) AM_READWRITE(Timer1_r, Timer1_w)
476   AM_RANGE(0x01801410, 0x01801413) AM_READWRITE(Timer2_r, Timer2_w)
477   AM_RANGE(0x01801418, 0x0180141b) AM_READWRITE(Timer3_r, Timer3_w)
478   AM_RANGE(0x01802004, 0x01802007) AM_READWRITE(PIO_r, PIO_w)
433479
434   AM_RANGE(0x01800800, 0x01800803) AM_READ(DMA0_r) AM_WRITE(DMA0_w)
435   AM_RANGE(0x01800810, 0x01800813) AM_READ(DMA1_r) AM_WRITE(DMA1_w)
480   AM_RANGE(0x01800800, 0x01800803) AM_READWRITE(DMA0_r, DMA0_w)
481   AM_RANGE(0x01800810, 0x01800813) AM_READWRITE(DMA1_r, DMA1_w)
436482
437483   AM_RANGE(0x01800c04, 0x01800c07) AM_WRITE(IntAck_w)
438   AM_RANGE(0x01800000, 0x0180ffff) AM_RAM AM_BASE(&sysregs)
439   AM_RANGE(0x02000000, 0x027fffff) AM_RAM AM_BASE(&workram)
484   AM_RANGE(0x01800000, 0x0180ffff) AM_RAM AM_BASE_MEMBER(crystal_state, sysregs)
485   AM_RANGE(0x02000000, 0x027fffff) AM_RAM AM_BASE_MEMBER(crystal_state, workram)
440486
441   AM_RANGE(0x030000a4, 0x030000a7) AM_READ(FlipCount_r) AM_WRITE(FlipCount_w)
487   AM_RANGE(0x030000a4, 0x030000a7) AM_READWRITE(FlipCount_r, FlipCount_w)
442488
443   AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_BASE(&vidregs)
444   AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_BASE(&textureram)
445   AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_BASE(&frameram)
489   AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_BASE_MEMBER(crystal_state, vidregs)
490   AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_BASE_MEMBER(crystal_state, textureram)
491   AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_BASE_MEMBER(crystal_state, frameram)
446492   AM_RANGE(0x04800000, 0x04800fff) AM_DEVREADWRITE("vrender", vr0_snd_read, vr0_snd_write)
447493
448   AM_RANGE(0x05000000, 0x05000003) AM_READ(FlashCmd_r) AM_WRITE(FlashCmd_w)
494   AM_RANGE(0x05000000, 0x05000003) AM_READWRITE(FlashCmd_r, FlashCmd_w)
449495   AM_RANGE(0x05000000, 0x05ffffff) AM_ROMBANK("bank1")
450496
451   AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_BASE(&ResetPatch)
497   AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_BASE_MEMBER(crystal_state, ResetPatch)
452498
453499ADDRESS_MAP_END
454500
455static void PatchReset(void)
501static void PatchReset( running_machine *machine )
456502{
457503   //The test menu reset routine seems buggy
458504   //it reads the reset vector from 0x02000000 but it should be
r7972r7973
476522    JMP Loop1
477523*/
478524
525   crystal_state *state = (crystal_state *)machine->driver_data;
526
479527#if 1
480528   static const UINT32 Patch[] =
481529   {
r7972r7973
487535      0xdef4d4fa
488536   };
489537
490   memcpy(ResetPatch,Patch,sizeof(Patch));
538   memcpy(state->ResetPatch, Patch, sizeof(Patch));
491539#else
492540   static const UINT8 Patch[] =
493541   {
r7972r7973
496544      0x20,0x3A,0xD0,0xA1,0xFA,0xD4,0xF4,0xDE
497545   };
498546
499   memcpy(ResetPatch,Patch,sizeof(Patch));
547   memcpy(state->ResetPatch, Patch, sizeof(Patch));
500548#endif
501549}
502550
503static MACHINE_START(crystal)
551static STATE_POSTLOAD( crystal_banksw_postload )
504552{
553   crystal_state *state = (crystal_state *)machine->driver_data;
554
555   if (state->Bank <= 2)
556      memory_set_bankptr(machine, "bank1", memory_region(machine, "user1") + state->Bank * 0x1000000);
557   else
558      memory_set_bankptr(machine, "bank1", memory_region(machine, "user2"));
559}
560
561static MACHINE_START( crystal )
562{
563   crystal_state *state = (crystal_state *)machine->driver_data;
505564   int i;
506565
566   state->maincpu = devtag_get_device(machine, "maincpu");
567   state->ds1302 = devtag_get_device(machine, "rtc");
568   state->vr0video = devtag_get_device(machine, "vr0");
569
507570   cpu_set_irq_callback(devtag_get_device(machine, "maincpu"), icallback);
508571   for (i = 0; i < 4; i++)
509      Timer[i] = timer_alloc(machine, Timercb, (void*)(FPTR)i);
572      state->Timer[i] = timer_alloc(machine, Timercb, (void*)(FPTR)i);
510573
511   PatchReset();
574   PatchReset(machine);
575
576#ifdef IDLE_LOOP_SPEEDUP
577   state_save_register_global(machine, state->FlipCntRead);
578#endif
579
580   state_save_register_global(machine, state->Bank);
581   state_save_register_global(machine, state->FlipCount);
582   state_save_register_global(machine, state->IntHigh);
583   state_save_register_global_array(machine, state->Timerctrl);
584   state_save_register_global(machine, state->FlashCmd);
585   state_save_register_global(machine, state->PIO);
586   state_save_register_global_array(machine, state->DMActrl);
587   state_save_register_global(machine, state->OldPort4);
588   state_save_register_postload(machine, crystal_banksw_postload, NULL);
512589}
513590
514static MACHINE_RESET(crystal)
591static MACHINE_RESET( crystal )
515592{
593   crystal_state *state = (crystal_state *)machine->driver_data;
516594   int i;
517595
518   memset(sysregs, 0, 0x10000);
519   memset(vidregs, 0, 0x10000);
520   FlipCount = 0;
521   IntHigh = 0;
596   memset(state->sysregs, 0, 0x10000);
597   memset(state->vidregs, 0, 0x10000);
598   state->FlipCount = 0;
599   state->IntHigh = 0;
522600   cpu_set_irq_callback(devtag_get_device(machine, "maincpu"), icallback);
523   Bank = 0;
601   state->Bank = 0;
524602   memory_set_bankptr(machine, "bank1", memory_region(machine, "user1") + 0);
525   FlashCmd = 0xff;
526   OldPort4 = 0;
603   state->FlashCmd = 0xff;
604   state->OldPort4 = 0;
527605
528   DMActrl[0] = 0;
529   DMActrl[1] = 0;
606   state->DMActrl[0] = 0;
607   state->DMActrl[1] = 0;
530608
531609   for (i = 0; i < 4; i++)
532610   {
533      Timerctrl[i] = 0;
534      timer_adjust_oneshot(Timer[i], attotime_never, 0);
611      state->Timerctrl[i] = 0;
612      timer_adjust_oneshot(state->Timer[i], attotime_never, 0);
535613   }
536614
537   vr0_snd_set_areas(devtag_get_device(machine, "vrender"), textureram, frameram);
615   vr0_snd_set_areas(devtag_get_device(machine, "vrender"), state->textureram, state->frameram);
538616#ifdef IDLE_LOOP_SPEEDUP
539   FlipCntRead = 0;
617   state->FlipCntRead = 0;
540618#endif
541619
542   PatchReset();
620   PatchReset(machine);
543621}
544622
545static VIDEO_START(crystal)
623static UINT16 GetVidReg( const address_space *space, UINT16 reg )
546624{
547   vrender0_init(machine);
548}
549
550static UINT16 GetVidReg(const address_space *space, UINT16 reg)
551{
552625   return memory_read_word(space, 0x03000000 + reg);
553626}
554627
555static void SetVidReg(const address_space *space, UINT16 reg, UINT16 val)
628static void SetVidReg( const address_space *space, UINT16 reg, UINT16 val )
556629{
557630   memory_write_word(space, 0x03000000 + reg, val);
558631}
559632
560633
561static VIDEO_UPDATE(crystal)
634static VIDEO_UPDATE( crystal )
562635{
636   crystal_state *state = (crystal_state *)screen->machine->driver_data;
563637   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
564638   int DoFlip;
565639
566
567640   UINT32 B0 = 0x0;
568641   UINT32 B1 = (GetVidReg(space, 0x90) & 0x8000) ? 0x400000 : 0x100000;
569642   UINT16 *Front, *Back;
r7972r7973
573646   UINT16 head, tail;
574647   UINT32 width = video_screen_get_width(screen);
575648
576   if(GetVidReg(space, 0x8e) & 1)
649   if (GetVidReg(space, 0x8e) & 1)
577650   {
578      Front = (UINT16*) (frameram + B1 / 4);
579      Back  = (UINT16*) (frameram + B0 / 4);
651      Front = (UINT16*) (state->frameram + B1 / 4);
652      Back  = (UINT16*) (state->frameram + B0 / 4);
580653   }
581654   else
582655   {
583      Front = (UINT16*) (frameram + B0 / 4);
584      Back  = (UINT16*) (frameram + B1 / 4);
656      Front = (UINT16*) (state->frameram + B0 / 4);
657      Back  = (UINT16*) (state->frameram + B1 / 4);
585658   }
586659
587660   Visible  = (UINT16*) Front;
588   DrawDest = (UINT16 *) frameram;
661   DrawDest = (UINT16 *) state->frameram;
589662
590663
591   if(GetVidReg(space, 0x8c) & 0x80)
664   if (GetVidReg(space, 0x8c) & 0x80)
592665      DrawDest = Front;
593666   else
594667      DrawDest = Back;
r7972r7973
600673   DoFlip = 0;
601674   head = GetVidReg(space, 0x82);
602675   tail = GetVidReg(space, 0x80);
603   while((head & 0x7ff) != (tail & 0x7ff))
676   while ((head & 0x7ff) != (tail & 0x7ff))
604677   {
605      DoFlip = vrender0_ProcessPacket(space, 0x03800000 + head * 64, DrawDest, (UINT8*)textureram);
678      DoFlip = vrender0_ProcessPacket(state->vr0video, 0x03800000 + head * 64, DrawDest, (UINT8*)state->textureram);
606679      head++;
607680      head &= 0x7ff;
608      if(DoFlip)
681      if (DoFlip)
609682         break;
610683   }
611684
612   if(DoFlip)
685   if (DoFlip)
613686      SetVidReg(space, 0x8e, GetVidReg(space, 0x8e) ^ 1);
614687
615   srcline=(UINT16 *) Visible;
616   for(y = 0; y < 240; y++)
688   srcline = (UINT16 *) Visible;
689   for (y = 0; y < 240; y++)
617690      memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y * 512], width * 2);
618691
619692   return 0;
r7972r7973
621694
622695static VIDEO_EOF(crystal)
623696{
697   crystal_state *state = (crystal_state *)machine->driver_data;
624698   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
625699   UINT16 head, tail;
626700   int DoFlip = 0;
627701
628702   head = GetVidReg(space, 0x82);
629703   tail = GetVidReg(space, 0x80);
630   while((head & 0x7ff) != (tail & 0x7ff))
704   while ((head & 0x7ff) != (tail & 0x7ff))
631705   {
632706      UINT16 Packet0 = memory_read_word(space, 0x03800000 + head * 64);
633      if(Packet0 & 0x81)
707      if (Packet0 & 0x81)
634708         DoFlip = 1;
635709      head++;
636710      head &= 0x7ff;
637      if(DoFlip)
711      if (DoFlip)
638712         break;
639713   }
640714   SetVidReg(space, 0x82, head);
641   if(DoFlip)
715   if (DoFlip)
642716   {
643      if(FlipCount)
644         FlipCount--;
717      if (state->FlipCount)
718         state->FlipCount--;
645719
646720   }
647721}
r7972r7973
736810   0x04800000
737811};
738812
813static const vr0video_interface vr0video_config =
814{
815   "maincpu"
816};
739817
740818static MACHINE_DRIVER_START( crystal )
819
820   MDRV_DRIVER_DATA(crystal_state)
821
741822   MDRV_CPU_ADD("maincpu", SE3208, 43000000)
742823   MDRV_CPU_PROGRAM_MAP(crystal_mem)
743824   MDRV_CPU_VBLANK_INT("screen", crystal_interrupt)
r7972r7973
754835   MDRV_SCREEN_SIZE(320, 240)
755836   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
756837
757   MDRV_VIDEO_START(crystal)
758838   MDRV_VIDEO_UPDATE(crystal)
759839   MDRV_VIDEO_EOF(crystal)
760840
841   MDRV_VIDEO_VRENDER0_ADD("vr0", vr0video_config)
842
761843   MDRV_PALETTE_INIT(RRRRR_GGGGGG_BBBBB)
762844   MDRV_PALETTE_LENGTH(65536)
763845
r7972r7973
841923
842924static DRIVER_INIT(crysking)
843925{
844   UINT16 *Rom=(UINT16*) memory_region(machine, "user1");
926   UINT16 *Rom = (UINT16*) memory_region(machine, "user1");
845927
846928   //patch the data feed by the protection
847929
848   Rom[WORD_XOR_LE(0x7bb6/2)]=0xDF01;
849   Rom[WORD_XOR_LE(0x7bb8/2)]=0x9C00;
930   Rom[WORD_XOR_LE(0x7bb6/2)] = 0xDF01;
931   Rom[WORD_XOR_LE(0x7bb8/2)] = 0x9C00;
850932
851   Rom[WORD_XOR_LE(0x976a/2)]=0x901C;
852   Rom[WORD_XOR_LE(0x976c/2)]=0x9001;
933   Rom[WORD_XOR_LE(0x976a/2)] = 0x901C;
934   Rom[WORD_XOR_LE(0x976c/2)] = 0x9001;
853935
854   Rom[WORD_XOR_LE(0x8096/2)]=0x90FC;
855   Rom[WORD_XOR_LE(0x8098/2)]=0x9001;
936   Rom[WORD_XOR_LE(0x8096/2)] = 0x90FC;
937   Rom[WORD_XOR_LE(0x8098/2)] = 0x9001;
856938
857   Rom[WORD_XOR_LE(0x8a52/2)]=0x4000;   //NOP
858   Rom[WORD_XOR_LE(0x8a54/2)]=0x403c;   //NOP
939   Rom[WORD_XOR_LE(0x8a52/2)] = 0x4000;   //NOP
940   Rom[WORD_XOR_LE(0x8a54/2)] = 0x403c;   //NOP
859941}
860942
861943static DRIVER_INIT(evosocc)
862944{
863   UINT16 *Rom=(UINT16*) memory_region(machine, "user1");
864   Rom+=0x1000000*2/2;
945   UINT16 *Rom = (UINT16*) memory_region(machine, "user1");
946   Rom += 0x1000000 * 2 / 2;
865947
866   Rom[WORD_XOR_LE(0x97388E/2)]=0x90FC;   //PUSH R2..R7
867   Rom[WORD_XOR_LE(0x973890/2)]=0x9001;   //PUSH R0
948   Rom[WORD_XOR_LE(0x97388E/2)] = 0x90FC;   //PUSH R2..R7
949   Rom[WORD_XOR_LE(0x973890/2)] = 0x9001;   //PUSH R0
868950
869   Rom[WORD_XOR_LE(0x971058/2)]=0x907C;   //PUSH R2..R6
870   Rom[WORD_XOR_LE(0x971060/2)]=0x9001; //PUSH R0
951   Rom[WORD_XOR_LE(0x971058/2)] = 0x907C;   //PUSH R2..R6
952   Rom[WORD_XOR_LE(0x971060/2)] = 0x9001; //PUSH R0
871953
872   Rom[WORD_XOR_LE(0x978036/2)]=0x900C;   //PUSH R2-R3
873   Rom[WORD_XOR_LE(0x978038/2)]=0x8303;   //LD    (%SP,0xC),R3
954   Rom[WORD_XOR_LE(0x978036/2)] = 0x900C;   //PUSH R2-R3
955   Rom[WORD_XOR_LE(0x978038/2)] = 0x8303;   //LD    (%SP,0xC),R3
874956
875   Rom[WORD_XOR_LE(0x974ED0/2)]=0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
876   Rom[WORD_XOR_LE(0x974ED2/2)]=0x9001;   //PUSH R0
957   Rom[WORD_XOR_LE(0x974ED0/2)] = 0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
958   Rom[WORD_XOR_LE(0x974ED2/2)] = 0x9001;   //PUSH R0
877959}
878960
879961static DRIVER_INIT(topbladv)
880962{
881   UINT16 *Rom=(UINT16*) memory_region(machine, "user1");
963   UINT16 *Rom = (UINT16*) memory_region(machine, "user1");
882964
883   Rom[WORD_XOR_LE(0x12d7a/2)]=0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
884   Rom[WORD_XOR_LE(0x12d7c/2)]=0x9001;   //PUSH R0
965   Rom[WORD_XOR_LE(0x12d7a/2)] = 0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
966   Rom[WORD_XOR_LE(0x12d7c/2)] = 0x9001;   //PUSH R0
885967
886   Rom[WORD_XOR_LE(0x2fe18/2)]=0x9001;   //PUSH R0
887   Rom[WORD_XOR_LE(0x2fe1a/2)]=0x9200;   //PUSH SR
968   Rom[WORD_XOR_LE(0x2fe18/2)] = 0x9001;   //PUSH R0
969   Rom[WORD_XOR_LE(0x2fe1a/2)] = 0x9200;   //PUSH SR
888970
889   Rom[WORD_XOR_LE(0x18880/2)]=0x9001;   //PUSH R0
890   Rom[WORD_XOR_LE(0x18882/2)]=0x9200;   //PUSH SR
971   Rom[WORD_XOR_LE(0x18880/2)] = 0x9001;   //PUSH R0
972   Rom[WORD_XOR_LE(0x18882/2)] = 0x9200;   //PUSH SR
891973
892   Rom[WORD_XOR_LE(0xDACE/2)]=0x901C;   //PUSH R4-R3-R2
893   Rom[WORD_XOR_LE(0xDAD0/2)]=0x9001;   //PUSH R0
974   Rom[WORD_XOR_LE(0xDACE/2)] = 0x901C;   //PUSH R4-R3-R2
975   Rom[WORD_XOR_LE(0xDAD0/2)] = 0x9001;   //PUSH R0
894976
895977}
896978
897979static DRIVER_INIT(officeye)
898980{
899   UINT16 *Rom=(UINT16*) memory_region(machine, "user1");
981   UINT16 *Rom = (UINT16*) memory_region(machine, "user1");
900982
901   Rom[WORD_XOR_LE(0x9c9e/2)]=0x901C;   //PUSH R4-R3-R2
902   Rom[WORD_XOR_LE(0x9ca0/2)]=0x9001;   //PUSH R0
983   Rom[WORD_XOR_LE(0x9c9e/2)] = 0x901C;   //PUSH R4-R3-R2
984   Rom[WORD_XOR_LE(0x9ca0/2)] = 0x9001;   //PUSH R0
903985
904   Rom[WORD_XOR_LE(0x9EE4/2)]=0x907C;   //PUSH R6-R5-R4-R3-R2
905   Rom[WORD_XOR_LE(0x9EE6/2)]=0x9001;   //PUSH R0
986   Rom[WORD_XOR_LE(0x9EE4/2)] = 0x907C;   //PUSH R6-R5-R4-R3-R2
987   Rom[WORD_XOR_LE(0x9EE6/2)] = 0x9001;   //PUSH R0
906988
907   Rom[WORD_XOR_LE(0x4B2E0/2)]=0x9004;   //PUSH R2
908   Rom[WORD_XOR_LE(0x4B2E2/2)]=0x9001;   //PUSH R0
989   Rom[WORD_XOR_LE(0x4B2E0/2)] = 0x9004;   //PUSH R2
990   Rom[WORD_XOR_LE(0x4B2E2/2)] = 0x9001;   //PUSH R0
909991
910992/*
911    Rom[WORD_XOR_LE(0x18880/2)]=0x9001; //PUSH R0
912    Rom[WORD_XOR_LE(0x18882/2)]=0x9200; //PUSH SR
993    Rom[WORD_XOR_LE(0x18880/2)] = 0x9001; //PUSH R0
994    Rom[WORD_XOR_LE(0x18882/2)] = 0x9200; //PUSH SR
913995 */
914996}
915997
916998
917999
918GAME( 2001, crysbios,        0, crystal, crystal,        0, ROT0, "Brezzasoft", "Crystal System BIOS", GAME_IS_BIOS_ROOT )
919GAME( 2001, crysking, crysbios, crystal, crystal, crysking, ROT0, "Brezzasoft", "The Crystal of Kings", 0 )
920GAME( 2001, evosocc,  crysbios, crystal, crystal,  evosocc, ROT0, "Evoga", "Evolution Soccer", 0 )
921GAME( 2003, topbladv, crysbios, topbladv,crystal, topbladv, ROT0, "SonoKong / Expotato", "Top Blade V", GAME_NOT_WORKING ) // protection
922GAME( 2001, officeye,        0, crystal, crystal, officeye, ROT0, "Danbi", "Office Yeo In Cheon Ha (version 1.2)", GAME_NOT_WORKING ) // protection
1000GAME( 2001, crysbios,        0, crystal,  crystal,         0, ROT0, "Brezzasoft", "Crystal System BIOS", GAME_IS_BIOS_ROOT )
1001GAME( 2001, crysking, crysbios, crystal,  crystal,  crysking, ROT0, "Brezzasoft", "The Crystal of Kings", 0 )
1002GAME( 2001, evosocc,  crysbios, crystal,  crystal,  evosocc,  ROT0, "Evoga", "Evolution Soccer", 0 )
1003GAME( 2003, topbladv, crysbios, topbladv, crystal,  topbladv, ROT0, "SonoKong / Expotato", "Top Blade V", GAME_NOT_WORKING ) // protection
1004GAME( 2001, officeye,        0, crystal,  crystal,  officeye, ROT0, "Danbi", "Office Yeo In Cheon Ha (version 1.2)", GAME_NOT_WORKING ) // protection
src/mame/drivers/megadriv.c
r7972r7973
65746574
65756575
65766576
6577DRIVER_INIT( x32x )
6577DRIVER_INIT( _32x )
65786578{
65796579
65806580
src/mame/drivers/finalizr.c
r7972r7973
324324   ROM_LOAD( "523k03.13c",   0xc000, 0x4000, CRC(c48927c6) SHA1(9cf6b285034670370ba0246c33e1fe0a057457e7) )
325325
326326   ROM_REGION( 0x1000, "audiocpu", 0 )   /* 8039 */
327   ROM_LOAD( "d8749hd.bin",  0x0000, 0x0800, CRC(978dfc33) SHA1(13d24ce577b88bf6ec2e970d36dc67a7ec691c55) )   /* this comes from the bootleg, */
328                                             /* the original has a custom IC */
327   ROM_LOAD( "d8749hd.bin",  0x0000, 0x0800, BAD_DUMP CRC(978dfc33) SHA1(13d24ce577b88bf6ec2e970d36dc67a7ec691c55) )   /* this comes from the bootleg, the original has a custom IC */
329328
330329   ROM_REGION( 0x20000, "gfx1", 0 )
331330   ROM_LOAD16_BYTE( "523h04.5e",    0x00000, 0x4000, CRC(c056d710) SHA1(3fe0ab7ef3bce7298c2a073d0985c33f9dc40062) )
src/mame/drivers/segaorun.c
r7972r7973
969969INPUT_PORTS_END
970970
971971
972static INPUT_PORTS_START( toutrun ) /* This is used by the Outrun to Turbo Outrun conversion kit */
972// This is used by the Outrun to Turbo Outrun conversion kit
973// In service mode, all four settings for DSW-B 1&2 are valid
974// In game, uses motors only if DSW-B 1&2 are both OFF ("Moving")
975static INPUT_PORTS_START( toutrun )
973976   PORT_INCLUDE( outrun_generic )
974977
975978   PORT_MODIFY("SERVICE")
r7972r7973
992995INPUT_PORTS_END
993996
994997
995static INPUT_PORTS_START( toutrun1 ) /* This is for the Sitdown/Cockpit version, (used only for Dedicated Turbo Outrun cabs?) */
998// This is used by the deluxe cockpit version
999// In service mode, the only valid setting for DSW-B 1&2 is both OFF ("Moving")
1000// In game, uses motors regardless of DSW-B 1&2 setting
1001static INPUT_PORTS_START( toutrunm )
9961002   PORT_INCLUDE( toutrun )
9971003
9981004   PORT_MODIFY("DSW")
1005   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2")
1006   PORT_DIPSETTING(    0x03, "Moving" )
1007//  PORT_DIPSETTING(    0x02, DEF_STR( Unused ) )
1008//  PORT_DIPSETTING(    0x01, DEF_STR( Unused ) )
1009//  PORT_DIPSETTING(    0x00, DEF_STR( Unused ) )
1010INPUT_PORTS_END
1011
1012
1013// This is used by the sitdown/cockpit version
1014// In service mode, the only valid setting for DSW-B 1&2 is both ON ("Cockpit")
1015// In game, does not use motors regardless of DSW-B 1&2 setting
1016// In service mode, the only valid setting for DSW-B 4 is OFF
1017// In game, always uses Turbo Shifter button regardless of DSW-B 4 setting
1018static INPUT_PORTS_START( toutrunc )
1019   PORT_INCLUDE( toutrun )
1020
1021   PORT_MODIFY("DSW")
9991022   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2")
10001023//  PORT_DIPSETTING(    0x03, DEF_STR( Unused ) )
10011024//  PORT_DIPSETTING(    0x02, DEF_STR( Unused ) )
r7972r7973
10901113 *
10911114 *************************************/
10921115
1093static MACHINE_DRIVER_START( outrundx )
1116static MACHINE_DRIVER_START( outrun_base )
10941117
10951118   /* driver data */
10961119   MDRV_DRIVER_DATA(segas1x_state)
r7972r7973
11221145   MDRV_VIDEO_START(outrun)
11231146   MDRV_VIDEO_UPDATE(outrun)
11241147
1148
11251149   /* sound hardware */
11261150   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11271151
r7972r7973
11351159   MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
11361160MACHINE_DRIVER_END
11371161
1162static MACHINE_DRIVER_START( outrundx )
1163   MDRV_IMPORT_FROM(outrun_base)
1164   MDRV_SEGA16SP_ADD_OUTRUN("segaspr1")
1165MACHINE_DRIVER_END
11381166
11391167static MACHINE_DRIVER_START( outrun )
1140   MDRV_IMPORT_FROM(outrundx)
1168   MDRV_IMPORT_FROM(outrun_base)
11411169   MDRV_NVRAM_HANDLER(outrun)
1170
1171   MDRV_SEGA16SP_ADD_OUTRUN("segaspr1")
11421172MACHINE_DRIVER_END
11431173
11441174
11451175static MACHINE_DRIVER_START( shangon )
1146   MDRV_IMPORT_FROM(outrun)
1176   MDRV_IMPORT_FROM(outrun_base)
1177   MDRV_NVRAM_HANDLER(outrun)
11471178
11481179   MDRV_SCREEN_MODIFY("screen")
11491180   MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK_25MHz/4, 400, 0, 321, 262, 0, 224)
11501181
11511182   MDRV_VIDEO_START(shangon)
11521183   MDRV_VIDEO_UPDATE(shangon)
1184
1185   MDRV_SEGA16SP_ADD_16B("segaspr1")
11531186MACHINE_DRIVER_END
11541187
11551188
r7972r7973
15601593/**************************************************************************************************************************
15611594 **************************************************************************************************************************
15621595 **************************************************************************************************************************
1563    Turbo Outrun (White cockpit/sitdown Deluxe version)
1564    CPU: FD1094 (317-0109)
1596    Turbo Outrun (Out Run upgrade set)
1597    CPU: FD1094 (317-0118)
1598    GAME BD   834-6919-12
1599     CPU BD   837-6905-12
1600     VIDEO BD 837-6906-02
15651601*/
15661602ROM_START( toutrun )
15671603   ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
1568   ROM_LOAD16_BYTE( "epr-12289.133", 0x000000, 0x10000, CRC(812fd035) SHA1(7bea9ba611333dfb86cfc2e2be8cff5f700b6f71) )
1569   ROM_LOAD16_BYTE( "epr-12288.118", 0x000001, 0x10000, CRC(2f1151bb) SHA1(e91600d4f4e5d3d5a67cafb1ff34006f281434f1) )
1570   ROM_LOAD16_BYTE( "epr-12291.132", 0x020000, 0x10000, CRC(8ca284d2) SHA1(93f71ec554ab000294aaa4de9ece0eecfcfe3c46) )
1571   ROM_LOAD16_BYTE( "epr-12290.117", 0x020001, 0x10000, CRC(44dbf3cb) SHA1(ad867a66d97e9f5b9e14a8d05049581214a077bf) )
1604   ROM_LOAD16_BYTE( "epr-12513.133", 0x000000, 0x10000, CRC(ae8835a5) SHA1(09573964d4f42ac0f08be3682b73e3420df27c6d) )
1605   ROM_LOAD16_BYTE( "epr-12512.118", 0x000001, 0x10000, CRC(f90372ad) SHA1(b42dd8c580421b4d7ffacf8d3baa7b9fc9e392ef) )
1606   ROM_LOAD16_BYTE( "epr-12515.132", 0x020000, 0x10000, CRC(1f047df4) SHA1(c1c67847f1390e671c19f0b90c3cbfbc237d960b) )
1607   ROM_LOAD16_BYTE( "epr-12514.117", 0x020001, 0x10000, CRC(5539e9c3) SHA1(01046e3b836f66ba6d5c4be1611de48197aca67f) )
15721608   ROM_LOAD16_BYTE( "epr-12293.131", 0x040000, 0x10000, CRC(f4321eea) SHA1(64334acc82c14bb58b7d51719f34fd81cfb9fc6b) )
15731609   ROM_LOAD16_BYTE( "epr-12292.116", 0x040001, 0x10000, CRC(51d98af0) SHA1(6e7115706bfafb687faa23d55d4a8c8e498a4df2) )
15741610
15751611   ROM_REGION( 0x2000, "user1", 0 )   /* decryption key */
1576   ROM_LOAD( "317-0109.key", 0x0000, 0x2000, CRC(e12a6e78) SHA1(358325490fc93bb979e9a9a296ce639d331e8b52) )
1612   ROM_LOAD( "317-0118.key", 0x0000, 0x2000, CRC(083d7d56) SHA1(3153e44479986859f60a26fe9264ecea07e6e469) )
15771613
15781614   ROM_REGION( 0x60000, "sub", 0 ) /* second 68000 CPU */
15791615   ROM_LOAD16_BYTE( "opr-12295.76", 0x000000, 0x10000, CRC(d43a3a84) SHA1(362c98f62c205b6b40b7e8a4ba107745b547b984) )
r7972r7973
15871623   ROM_LOAD( "opr-12325.104", 0x20000, 0x10000, CRC(1405137a) SHA1(367db88d36852e35c5e839f692be5ea8c8e072d2) )
15881624
15891625   ROM_REGION32_LE( 0x100000, "gfx2", 0 ) /* sprites */
1590   ROM_LOAD32_BYTE( "opr-12307.9",  0x00000, 0x10000, CRC(437dcf09) SHA1(0022ee4d1c3698f77271e570cef98a8a1e5c5d6a) )
1591   ROM_LOAD32_BYTE( "opr-12308.10", 0x00001, 0x10000, CRC(0de70cc2) SHA1(c03f8f8cda72daf64af2878bf254840ac6dd17eb) )
1592   ROM_LOAD32_BYTE( "opr-12309.11", 0x00002, 0x10000, CRC(deb8c242) SHA1(c05d8ced4eafae52c4795fb1471cd66f5903d1aa) )
1593   ROM_LOAD32_BYTE( "opr-12310.12", 0x00003, 0x10000, CRC(45cf157e) SHA1(5d0be2a374a53ea1fe0ba2bf9b2173e96de1eb51) )
1594   ROM_LOAD32_BYTE( "opr-12311.13", 0x40000, 0x10000, CRC(ae2bd639) SHA1(64bb60ae7e3f87fbbce00106ba65c4e6fc1af0e4) )
1595   ROM_LOAD32_BYTE( "opr-12312.14", 0x40001, 0x10000, CRC(626000e7) SHA1(4a7f9e76dd76a3dc56b8257149bc94be3f4f2e87) )
1596   ROM_LOAD32_BYTE( "opr-12313.15", 0x40002, 0x10000, CRC(52870c37) SHA1(3a6836a46d94c0f9115800d206410252a1134c57) )
1597   ROM_LOAD32_BYTE( "opr-12314.16", 0x40003, 0x10000, CRC(40c461ea) SHA1(7bed8f24112dc3c827fd087138fcf2700092aa59) )
1598   ROM_LOAD32_BYTE( "opr-12315.17", 0x80000, 0x10000, CRC(3ff9a3a3) SHA1(0d90fe2669d03bd07a0d3b05934201778e28d54c) )
1599   ROM_LOAD32_BYTE( "opr-12316.18", 0x80001, 0x10000, CRC(8a1e6dc8) SHA1(32f09ec504c2b6772815bad7380a2f738f11746a) )
1600   ROM_LOAD32_BYTE( "opr-12317.19", 0x80002, 0x10000, CRC(77e382d4) SHA1(5b7912069a46043b7be989d82436add85497d318) )
1601   ROM_LOAD32_BYTE( "opr-12318.20", 0x80003, 0x10000, CRC(d1afdea9) SHA1(813eccc88d5046992be5b5a0618d32127d16e30b) )
1602   ROM_LOAD32_BYTE( "opr-12319.25", 0xc0000, 0x10000, CRC(df23baf9) SHA1(f9611391bb3b3b92203fa9f6dd461e3a6e863622) )
1603   ROM_LOAD32_BYTE( "opr-12320.22", 0xc0001, 0x10000, CRC(7931e446) SHA1(9f2161a689ebad61f6653942e23d9c2bc6170d4a) )
1604   ROM_LOAD32_BYTE( "opr-12321.23", 0xc0002, 0x10000, CRC(830bacd4) SHA1(5a4816969437ee1edca5845006c0b8e9ba365491) )
1605   ROM_LOAD32_BYTE( "opr-12322.24", 0xc0003, 0x10000, CRC(8b812492) SHA1(bf1f9e059c093c0991c7caf1b01c739ed54b8357) )
1626   /* Video BD 837-6906-2, Mask Roms twice the size as EPR/OPR counterparts */
1627   ROM_LOAD32_BYTE( "mpr-12336.9",   0x00000, 0x20000, CRC(dda465c7) SHA1(83acc12a387b004986f084f25964c15a9f88a41a) )
1628   ROM_LOAD32_BYTE( "mpr-12337.10",  0x00001, 0x20000, CRC(828233d1) SHA1(d73a200af4245d590e1fd3ac436723f99cc50452) )
1629   ROM_LOAD32_BYTE( "mpr-12338.11",  0x00002, 0x20000, CRC(46b4b5f4) SHA1(afeb2e5ac6792edafe7328993fe8dfcd4bce1924) )
1630   ROM_LOAD32_BYTE( "mpr-12339.12",  0x00003, 0x20000, CRC(0d7e3bab) SHA1(fdb603df55785ded593daf591ddd90f8f24e0d47) )
1631   ROM_LOAD32_BYTE( "mpr-12364.13",  0x80000, 0x20000, CRC(a4b83e65) SHA1(966d8c163cef0842abff54e1dba3f15248e73f68) )
1632   ROM_LOAD32_BYTE( "mpr-12365.14",  0x80001, 0x20000, CRC(4a80b2a9) SHA1(14b4fe71e102622a73c8dc0dbd0013cbbe6fcf9d) )
1633   ROM_LOAD32_BYTE( "mpr-12366.15",  0x80002, 0x20000, CRC(385cb3ab) SHA1(fec6d80d488bfe26524fa3a48b195a45a073e481) )
1634   ROM_LOAD32_BYTE( "mpr-12367.16",  0x80003, 0x20000, CRC(4930254a) SHA1(00f24be3bf02b143fa554f4d32e283bdac79af6a) )
16061635
16071636   ROM_REGION( 0x10000, "gfx3", 0 ) /* road gfx (2 identical roms, 1 for each road) */
16081637   ROM_LOAD( "epr-12299.47", 0x0000, 0x8000, CRC(fc9bc41b) SHA1(9af73e096253cf2c4f283f227530110a4b37fcee) ) /* Manual shows both as EPR-12298 */
r7972r7973
16211650ROM_END
16221651
16231652/**************************************************************************************************************************
1624    Turbo Outrun (Upright version??)
1653    Turbo Outrun (Upright version?? According to service mode dipswitch screen it's a Cockpit)
16251654    CPU: FD1094 (317-????)
16261655    GAME BD   834-6919
16271656     CPU BD   837-6905
16281657     VIDEO BD 837-6906
1658
1659    Must set Cabinet Type dipswitch (DSW-B 1&2 to both ON) to Cockpit
1660    Must set Turbo Switch dipswitch (DSW-B 4 to OFF) to Use Turbo Shifter
16291661*/
1630ROM_START( toutrun2 )
1662ROM_START( toutrun3 )
16311663   ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
16321664   ROM_LOAD16_BYTE( "epr-12410.133", 0x000000, 0x10000, CRC(aa74f3e9) SHA1(2daf6b17317542063c0a40beea5b45c797192591) )
16331665   ROM_LOAD16_BYTE( "epr-12409.118", 0x000001, 0x10000, CRC(c11c8ef7) SHA1(4c1c5100d7fd728642d58e4bf45fba48695841e3) )
r7972r7973
16941726    Must set Cabinet Type dipswitch (DSW-B 1&2 to both ON) to Cockpit
16951727    Must set Turbo Switch dipswitch (DSW-B 4 to OFF) to Use Turbo Shifter
16961728*/
1697ROM_START( toutrun1 )
1729ROM_START( toutrun2 )
16981730   ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
16991731   ROM_LOAD16_BYTE( "epr-12397.133", 0x000000, 0x10000, CRC(e4b57d7d) SHA1(62be55356c82b38ebebcc87a5458e23300019339) )
17001732   ROM_LOAD16_BYTE( "epr-12396.118", 0x000001, 0x10000, CRC(5e7115cb) SHA1(02c9ec91d9afb424e5045671ab0b5499181728c9) )
r7972r7973
17521784ROM_END
17531785
17541786/**************************************************************************************************************************
1755    Turbo Outrun (Out Run upgrade set)
1756    CPU: FD1094 (317-0118)
1757    GAME BD   834-6919-12
1758     CPU BD   837-6905-12
1759     VIDEO BD 837-6906-02
1787    Turbo Outrun (White cockpit/sitdown Deluxe version)
1788    CPU: FD1094 (317-0109)
17601789*/
1761ROM_START( toutrunu )
1790ROM_START( toutrun1 )
17621791   ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
1763   ROM_LOAD16_BYTE( "epr-12513.133", 0x000000, 0x10000, CRC(ae8835a5) SHA1(09573964d4f42ac0f08be3682b73e3420df27c6d) )
1764   ROM_LOAD16_BYTE( "epr-12512.118", 0x000001, 0x10000, CRC(f90372ad) SHA1(b42dd8c580421b4d7ffacf8d3baa7b9fc9e392ef) )
1765   ROM_LOAD16_BYTE( "epr-12515.132", 0x020000, 0x10000, CRC(1f047df4) SHA1(c1c67847f1390e671c19f0b90c3cbfbc237d960b) )
1766   ROM_LOAD16_BYTE( "epr-12514.117", 0x020001, 0x10000, CRC(5539e9c3) SHA1(01046e3b836f66ba6d5c4be1611de48197aca67f) )
1792   ROM_LOAD16_BYTE( "epr-12289.133", 0x000000, 0x10000, CRC(812fd035) SHA1(7bea9ba611333dfb86cfc2e2be8cff5f700b6f71) )
1793   ROM_LOAD16_BYTE( "epr-12288.118", 0x000001, 0x10000, CRC(2f1151bb) SHA1(e91600d4f4e5d3d5a67cafb1ff34006f281434f1) )
1794   ROM_LOAD16_BYTE( "epr-12291.132", 0x020000, 0x10000, CRC(8ca284d2) SHA1(93f71ec554ab000294aaa4de9ece0eecfcfe3c46) )
1795   ROM_LOAD16_BYTE( "epr-12290.117", 0x020001, 0x10000, CRC(44dbf3cb) SHA1(ad867a66d97e9f5b9e14a8d05049581214a077bf) )
17671796   ROM_LOAD16_BYTE( "epr-12293.131", 0x040000, 0x10000, CRC(f4321eea) SHA1(64334acc82c14bb58b7d51719f34fd81cfb9fc6b) )
17681797   ROM_LOAD16_BYTE( "epr-12292.116", 0x040001, 0x10000, CRC(51d98af0) SHA1(6e7115706bfafb687faa23d55d4a8c8e498a4df2) )
17691798
17701799   ROM_REGION( 0x2000, "user1", 0 )   /* decryption key */
1771   ROM_LOAD( "317-0118.key", 0x0000, 0x2000, CRC(083d7d56) SHA1(3153e44479986859f60a26fe9264ecea07e6e469) )
1800   ROM_LOAD( "317-0109.key", 0x0000, 0x2000, CRC(e12a6e78) SHA1(358325490fc93bb979e9a9a296ce639d331e8b52) )
17721801
17731802   ROM_REGION( 0x60000, "sub", 0 ) /* second 68000 CPU */
17741803   ROM_LOAD16_BYTE( "opr-12295.76", 0x000000, 0x10000, CRC(d43a3a84) SHA1(362c98f62c205b6b40b7e8a4ba107745b547b984) )
r7972r7973
17821811   ROM_LOAD( "opr-12325.104", 0x20000, 0x10000, CRC(1405137a) SHA1(367db88d36852e35c5e839f692be5ea8c8e072d2) )
17831812
17841813   ROM_REGION32_LE( 0x100000, "gfx2", 0 ) /* sprites */
1785   /* Video BD 837-6906-2, Mask Roms twice the size as EPR/OPR counterparts */
1786   ROM_LOAD32_BYTE( "mpr-12336.9",   0x00000, 0x20000, CRC(dda465c7) SHA1(83acc12a387b004986f084f25964c15a9f88a41a) )
1787   ROM_LOAD32_BYTE( "mpr-12337.10",  0x00001, 0x20000, CRC(828233d1) SHA1(d73a200af4245d590e1fd3ac436723f99cc50452) )
1788   ROM_LOAD32_BYTE( "mpr-12338.11",  0x00002, 0x20000, CRC(46b4b5f4) SHA1(afeb2e5ac6792edafe7328993fe8dfcd4bce1924) )
1789   ROM_LOAD32_BYTE( "mpr-12339.12",  0x00003, 0x20000, CRC(0d7e3bab) SHA1(fdb603df55785ded593daf591ddd90f8f24e0d47) )
1790   ROM_LOAD32_BYTE( "mpr-12364.13",  0x80000, 0x20000, CRC(a4b83e65) SHA1(966d8c163cef0842abff54e1dba3f15248e73f68) )
1791   ROM_LOAD32_BYTE( "mpr-12365.14",  0x80001, 0x20000, CRC(4a80b2a9) SHA1(14b4fe71e102622a73c8dc0dbd0013cbbe6fcf9d) )
1792   ROM_LOAD32_BYTE( "mpr-12366.15",  0x80002, 0x20000, CRC(385cb3ab) SHA1(fec6d80d488bfe26524fa3a48b195a45a073e481) )
1793   ROM_LOAD32_BYTE( "mpr-12367.16",  0x80003, 0x20000, CRC(4930254a) SHA1(00f24be3bf02b143fa554f4d32e283bdac79af6a) )
1814   ROM_LOAD32_BYTE( "opr-12307.9",  0x00000, 0x10000, CRC(437dcf09) SHA1(0022ee4d1c3698f77271e570cef98a8a1e5c5d6a) )
1815   ROM_LOAD32_BYTE( "opr-12308.10", 0x00001, 0x10000, CRC(0de70cc2) SHA1(c03f8f8cda72daf64af2878bf254840ac6dd17eb) )
1816   ROM_LOAD32_BYTE( "opr-12309.11", 0x00002, 0x10000, CRC(deb8c242) SHA1(c05d8ced4eafae52c4795fb1471cd66f5903d1aa) )
1817   ROM_LOAD32_BYTE( "opr-12310.12", 0x00003, 0x10000, CRC(45cf157e) SHA1(5d0be2a374a53ea1fe0ba2bf9b2173e96de1eb51) )
1818   ROM_LOAD32_BYTE( "opr-12311.13", 0x40000, 0x10000, CRC(ae2bd639) SHA1(64bb60ae7e3f87fbbce00106ba65c4e6fc1af0e4) )
1819   ROM_LOAD32_BYTE( "opr-12312.14", 0x40001, 0x10000, CRC(626000e7) SHA1(4a7f9e76dd76a3dc56b8257149bc94be3f4f2e87) )
1820   ROM_LOAD32_BYTE( "opr-12313.15", 0x40002, 0x10000, CRC(52870c37) SHA1(3a6836a46d94c0f9115800d206410252a1134c57) )
1821   ROM_LOAD32_BYTE( "opr-12314.16", 0x40003, 0x10000, CRC(40c461ea) SHA1(7bed8f24112dc3c827fd087138fcf2700092aa59) )
1822   ROM_LOAD32_BYTE( "opr-12315.17", 0x80000, 0x10000, CRC(3ff9a3a3) SHA1(0d90fe2669d03bd07a0d3b05934201778e28d54c) )
1823   ROM_LOAD32_BYTE( "opr-12316.18", 0x80001, 0x10000, CRC(8a1e6dc8) SHA1(32f09ec504c2b6772815bad7380a2f738f11746a) )
1824   ROM_LOAD32_BYTE( "opr-12317.19", 0x80002, 0x10000, CRC(77e382d4) SHA1(5b7912069a46043b7be989d82436add85497d318) )
1825   ROM_LOAD32_BYTE( "opr-12318.20", 0x80003, 0x10000, CRC(d1afdea9) SHA1(813eccc88d5046992be5b5a0618d32127d16e30b) )
1826   ROM_LOAD32_BYTE( "opr-12319.25", 0xc0000, 0x10000, CRC(df23baf9) SHA1(f9611391bb3b3b92203fa9f6dd461e3a6e863622) )
1827   ROM_LOAD32_BYTE( "opr-12320.22", 0xc0001, 0x10000, CRC(7931e446) SHA1(9f2161a689ebad61f6653942e23d9c2bc6170d4a) )
1828   ROM_LOAD32_BYTE( "opr-12321.23", 0xc0002, 0x10000, CRC(830bacd4) SHA1(5a4816969437ee1edca5845006c0b8e9ba365491) )
1829   ROM_LOAD32_BYTE( "opr-12322.24", 0xc0003, 0x10000, CRC(8b812492) SHA1(bf1f9e059c093c0991c7caf1b01c739ed54b8357) )
17941830
17951831   ROM_REGION( 0x10000, "gfx3", 0 ) /* road gfx (2 identical roms, 1 for each road) */
17961832   ROM_LOAD( "epr-12299.47", 0x0000, 0x8000, CRC(fc9bc41b) SHA1(9af73e096253cf2c4f283f227530110a4b37fcee) ) /* Manual shows both as EPR-12298 */
r7972r7973
22052241GAME( 1987, shangon2, shangon,  shangon,  shangon,  shangon3, ROT0, "Sega",    "Super Hang-On (mini ride-on, Rev A, FD1089B 317-0034)", 0 )
22062242GAME( 1987, shangon1, shangon,  shangon,  shangon,  shangon3, ROT0, "Sega",    "Super Hang-On (mini ride-on?, FD1089B 317-0034)", GAME_NOT_WORKING ) /* bad program rom */
22072243GAME( 1991, shangonle,shangon,  shangon,  shangon,  shangon,  ROT0, "Sega",    "Limited Edition Hang-On", 0 )
2208GAMEL(1989, toutrun,  0,        outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (cockpit, FD1094 317-0109)", 0, layout_outrun )
2209GAMEL(1989, toutrun2, toutrun,  outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (upright, FD1094 317-unknown)", 0, layout_outrun )
2210GAMEL(1989, toutrun1, toutrun,  outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (cockpit, FD1094 317-unknown)", GAME_NOT_WORKING, layout_outrun ) /* FD1094 CPU not decrypted */
2211GAMEL(1989, toutrunu, toutrun,  outrun,   toutrun,  outrun,   ROT0, "Sega",    "Turbo Out Run (Out Run upgrade, FD1094 317-0118)" , 0, layout_outrun )
2244GAMEL(1989, toutrun,  0,        outrun,   toutrun,  outrun,   ROT0, "Sega",    "Turbo Out Run (Out Run upgrade, FD1094 317-0118)" , 0, layout_outrun ) /* Cabinet determined by dipswitch settings */
2245GAMEL(1989, toutrun3, toutrun,  outrun,   toutrunc, outrun,   ROT0, "Sega",    "Turbo Out Run (upright, FD1094 317-unknown)", 0, layout_outrun )
2246GAMEL(1989, toutrun2, toutrun,  outrun,   toutrun,  outrun,   ROT0, "Sega",    "Turbo Out Run (cockpit, FD1094 317-unknown)", GAME_NOT_WORKING, layout_outrun ) /* FD1094 CPU not decrypted */
2247GAMEL(1989, toutrun1, toutrun,  outrun,   toutrunm, outrun,   ROT0, "Sega",    "Turbo Out Run (deluxe cockpit, FD1094 317-0109)", 0, layout_outrun )
src/mame/drivers/system16.c
r7972r7973
20902090   MDRV_CPU_MODIFY("maincpu")
20912091   MDRV_CPU_PROGRAM_MAP(shinobib_map)
20922092
2093   MDRV_SEGA16SP_ADD_SHINOBI_BOOTLEG("segaspr1")
2094
20932095   MDRV_VIDEO_START( s16a_bootleg_shinobi )
20942096   MDRV_VIDEO_UPDATE( s16a_bootleg )
20952097MACHINE_DRIVER_END
r7972r7973
21012103   MDRV_CPU_MODIFY("maincpu")
21022104   MDRV_CPU_PROGRAM_MAP(passshtb_map)
21032105
2106   MDRV_SEGA16SP_ADD_PASSINGSHOT_BOOTLEG("segaspr1")
2107
21042108   MDRV_VIDEO_START( s16a_bootleg_passsht )
21052109   MDRV_VIDEO_UPDATE( s16a_bootleg )
21062110MACHINE_DRIVER_END
r7972r7973
21132117   MDRV_CPU_MODIFY("maincpu")
21142118   MDRV_CPU_PROGRAM_MAP(passht4b_map)
21152119
2120   // wrong
2121   MDRV_SEGA16SP_ADD_PASSINGSHOT_BOOTLEG("segaspr1")
2122
21162123   MDRV_VIDEO_START( s16a_bootleg_passsht )
21172124   MDRV_VIDEO_UPDATE( s16a_bootleg_passht4b )
21182125MACHINE_DRIVER_END
r7972r7973
21242131   MDRV_CPU_MODIFY("maincpu")
21252132   MDRV_CPU_PROGRAM_MAP(wb3bbl_map)
21262133
2134   MDRV_SEGA16SP_ADD_WONDERBOY3_BOOTLEG("segaspr1")
2135
21272136   MDRV_VIDEO_START( s16a_bootleg_wb3bl )
21282137   MDRV_VIDEO_UPDATE( s16a_bootleg )
21292138MACHINE_DRIVER_END
r7972r7973
21392148   MDRV_CPU_PROGRAM_MAP(goldnaxeb1_map)
21402149   MDRV_CPU_VBLANK_INT("screen", sys16_interrupt)
21412150
2151
21422152   /* video hardware */
21432153   MDRV_SCREEN_ADD("screen", RASTER)
21442154   MDRV_SCREEN_REFRESH_RATE(60)
r7972r7973
21502160   MDRV_GFXDECODE(sys16)
21512161   MDRV_PALETTE_LENGTH(2048*SHADOW_COLORS_MULTIPLIER)
21522162
2163   MDRV_SEGA16SP_ADD_16B("segaspr1")
2164
21532165   MDRV_PALETTE_INIT( all_black )
21542166   MDRV_VIDEO_START(system16)
21552167   MDRV_VIDEO_UPDATE(system16)
r7972r7973
21962208   MDRV_SOUND_CONFIG(tturfbl_msm5205_interface)
21972209   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
21982210   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
2211
2212   MDRV_SEGA16SP_ADD_16B("segaspr1")
21992213MACHINE_DRIVER_END
22002214
22012215static MACHINE_DRIVER_START( dduxbl )
r7972r7973
22042218   MDRV_IMPORT_FROM(system16)
22052219   MDRV_CPU_MODIFY("maincpu")
22062220   MDRV_CPU_PROGRAM_MAP(dduxbl_map)
2221
2222   MDRV_SEGA16SP_ADD_16B("segaspr1")
22072223MACHINE_DRIVER_END
22082224
22092225static MACHINE_DRIVER_START( eswatbl )
r7972r7973
22122228   MDRV_IMPORT_FROM(system16_7759)
22132229   MDRV_CPU_MODIFY("maincpu")
22142230   MDRV_CPU_PROGRAM_MAP(eswatbl_map)
2231
2232   MDRV_SEGA16SP_ADD_16B("segaspr1")
22152233MACHINE_DRIVER_END
22162234
22172235static MACHINE_DRIVER_START( fpointbl )
r7972r7973
22232241
22242242   MDRV_CPU_MODIFY("soundcpu")
22252243   MDRV_CPU_PROGRAM_MAP(fpointbl_sound_map)
2244
2245   MDRV_SEGA16SP_ADD_16B("segaspr1")
22262246MACHINE_DRIVER_END
22272247
22282248static MACHINE_DRIVER_START( tetrisbl )
r7972r7973
22312251   MDRV_IMPORT_FROM(system16)
22322252   MDRV_CPU_MODIFY("maincpu")
22332253   MDRV_CPU_PROGRAM_MAP(tetrisbl_map)
2254
2255   MDRV_SEGA16SP_ADD_16B("segaspr1")
22342256MACHINE_DRIVER_END
22352257
22362258
r7972r7973
22402262   MDRV_IMPORT_FROM(system16)
22412263   MDRV_CPU_MODIFY("maincpu")
22422264   MDRV_CPU_PROGRAM_MAP(beautyb_map)
2265
2266   MDRV_SEGA16SP_ADD_16B("segaspr1")
22432267MACHINE_DRIVER_END
22442268
22452269
r7972r7973
22712295   MDRV_VIDEO_START(system18old)
22722296   MDRV_VIDEO_UPDATE(system18old)
22732297
2298   MDRV_SEGA16SP_ADD_16B("segaspr1")
2299
22742300   /* sound hardware */
22752301   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
22762302
r7972r7973
31953221{
31963222   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
31973223
3224   running_device* device = devtag_get_device(machine, "segaspr1");
3225   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
3226
3227   sega16sp->xoffs = 107;
3228
3229
31983230   state->bg1_trans = 0;
31993231   state->splittab_bg_x = 0;
32003232   state->splittab_bg_y = 0;
r7972r7973
32053237   state->back_yscroll = 0;
32063238   state->fore_yscroll = 0;
32073239   state->text_yscroll = 0;
3208   state->sprite_xoffs = 107;
32093240
3241
3242
32103243   state->sample_buffer = 0;
32113244   state->sample_select = 0;
32123245
r7972r7973
32223255static DRIVER_INIT( shinobl )
32233256{
32243257   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3258   running_device* device = devtag_get_device(machine, "segaspr1");
3259   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
32253260
32263261   DRIVER_INIT_CALL(common);
32273262
32283263   state->spritebank_type = 1;
3229   state->sprite_xoffs = 117;
3264   sega16sp->xoffs = 117;
32303265}
32313266
32323267static DRIVER_INIT( passsht )
32333268{
32343269   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3270   running_device* device = devtag_get_device(machine, "segaspr1");
3271   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
32353272
32363273   DRIVER_INIT_CALL(common);
32373274
32383275   state->spritebank_type = 1;
32393276   state->back_yscroll = 3;
3240   state->sprite_xoffs = 117;
3277   sega16sp->xoffs = 117;
32413278}
32423279
32433280static DRIVER_INIT( wb3bbl )
32443281{
32453282   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3283   running_device* device = devtag_get_device(machine, "segaspr1");
3284   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
32463285
3286
32473287   DRIVER_INIT_CALL(common);
32483288
32493289   state->spritebank_type = 1;
32503290   state->back_yscroll = 2;
32513291   state->fore_yscroll = 2;
3252   state->sprite_xoffs = 117;
3292   sega16sp->xoffs = 117;
32533293}
32543294
32553295
r7972r7973
32623302   UINT8 *KEY = memory_region(machine, "decryption");
32633303   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
32643304   UINT8 data[0x1000];
3305   running_device* device = devtag_get_device(machine, "segaspr1");
3306   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
32653307
32663308   // the decryption key is in a rom (part of an MSDOS executable...)
32673309   for (i = 0; i < 0x800; i++)
r7972r7973
32843326   DRIVER_INIT_CALL(common);
32853327
32863328   state->spritebank_type = 1;
3287   state->sprite_xoffs = 121;
3329   sega16sp->xoffs = 121;
32883330}
32893331
32903332
r7972r7973
33283370static DRIVER_INIT( goldnaxeb2 )
33293371{
33303372   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3373   running_device* device = devtag_get_device(machine, "segaspr1");
3374   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
33313375
33323376   DRIVER_INIT_CALL(common);
33333377
33343378   state->spritebank_type = 1;
3335   state->sprite_xoffs = 121;
3379   sega16sp->xoffs = 121;
33363380}
33373381
33383382static DRIVER_INIT( tturfbl )
r7972r7973
33463390
33473391static DRIVER_INIT( dduxbl )
33483392{
3349   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3393   running_device* device = devtag_get_device(machine, "segaspr1");
3394   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
33503395
33513396   DRIVER_INIT_CALL(common);
33523397
3353   state->sprite_xoffs = 112;
3398   sega16sp->xoffs = 112;
33543399}
33553400
33563401static DRIVER_INIT( eswatbl )
33573402{
33583403   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
3404   running_device* device = devtag_get_device(machine, "segaspr1");
3405   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
33593406
33603407   DRIVER_INIT_CALL(common);
33613408   //state->splittab_fg_x = &sys16_textram[0x0f80];
33623409
33633410   state->spritebank_type = 1;
3364   state->sprite_xoffs = 124;
3411   sega16sp->xoffs = 124;
33653412}
33663413
33673414static DRIVER_INIT( fpointbl )
r7972r7973
33783425/* Tetris-based */
33793426static DRIVER_INIT( beautyb )
33803427{
3381   segas1x_bootleg_state *state = (segas1x_bootleg_state *)machine->driver_data;
33823428   UINT16*rom = (UINT16*)memory_region( machine, "maincpu" );
33833429   int x;
3430   running_device* device = devtag_get_device(machine, "segaspr1");
3431   sega16sp_state *sega16sp = (sega16sp_state *)device->token;
33843432
33853433   for (x = 0; x < 0x8000; x++)
33863434   {
r7972r7973
33923440
33933441   DRIVER_INIT_CALL(common);
33943442
3395   state->sprite_xoffs = 112;
3443   sega16sp->xoffs = 112;
33963444}
33973445
33983446
src/mame/drivers/cps1.c
r7972r7973
67766776   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
67776777ROM_END
67786778
6779ROM_START( sf2thndr )
6780   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
6781   ROM_LOAD16_BYTE( "17_30.11e",     0x00000, 0x20000, CRC(d3cd6d18) SHA1(c7efe9e7a7dee29bfe40a571960145efa26ac22e) )
6782   ROM_LOAD16_BYTE( "17_37.11f",     0x00001, 0x20000, CRC(e892716e) SHA1(b3836b33bc026a0bccc5ed7cdecf8d2ba2b5607a) )
6783   ROM_LOAD16_BYTE( "sf2u_31b.12e",  0x40000, 0x20000, CRC(a673143d) SHA1(e565f0ec23d6deb543c72af5a83f070c07319477) )
6784   ROM_LOAD16_BYTE( "sf2u_38b.12f",  0x40001, 0x20000, CRC(4c2ccef7) SHA1(77b119c70c255622b023de25d9af3b3aac52ea47) )
6785   ROM_LOAD16_BYTE( "sf2u_28b.9e",   0x80000, 0x20000, CRC(4009955e) SHA1(7842dbef7650485639fbae49b9f4db7494d4f73d) )
6786   ROM_LOAD16_BYTE( "sf2u_35b.9f",   0x80001, 0x20000, CRC(8c1f3994) SHA1(5e1d334399d05a837c2d80f79eada543e83afaf7) )
6787   ROM_LOAD16_BYTE( "17_29.10e",     0xc0000, 0x20000, CRC(8830b54d) SHA1(fe5e958f69d52fa12c31c1a7ccf0dcfd340045cb) )
6788   ROM_LOAD16_BYTE( "17_36.10f",     0xc0001, 0x20000, CRC(3f13ada3) SHA1(412572f220f64e5b0ee2cad0a9204142ae2f7c90) )
6789
6790   ROM_REGION( 0x600000, "gfx", 0 )
6791   ROMX_LOAD( "sf2_06.bin", 0x000000, 0x80000, CRC(22c9cc8e) SHA1(b9194fb337b30502c1c9501cd6c64ae4035544d4) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx02.rom */
6792   ROMX_LOAD( "sf2_08.bin", 0x000002, 0x80000, CRC(57213be8) SHA1(3759b851ac0904ec79cbb67a2264d384b6f2f9f9) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx04.rom */
6793   ROMX_LOAD( "sf2_05.bin", 0x000004, 0x80000, CRC(ba529b4f) SHA1(520840d727161cf09ca784919fa37bc9b54cc3ce) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx01.rom */
6794   ROMX_LOAD( "sf2_07.bin", 0x000006, 0x80000, CRC(4b1b33a8) SHA1(2360cff890551f76775739e2d6563858bff80e41) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx03.rom */
6795   ROMX_LOAD( "sf2_15.bin", 0x200000, 0x80000, CRC(2c7e2229) SHA1(357c2275af9133fd0bd6fbb1fa9ad5e0b490b3a2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx11.rom */
6796   ROMX_LOAD( "sf2_17.bin", 0x200002, 0x80000, CRC(b5548f17) SHA1(baa92b91cf616bc9e2a8a66adc777ffbf962a51b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx13.rom */
6797   ROMX_LOAD( "sf2_14.bin", 0x200004, 0x80000, CRC(14b84312) SHA1(2eea16673e60ba7a10bd4d8f6c217bb2441a5b0e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx10.rom */
6798   ROMX_LOAD( "sf2_16.bin", 0x200006, 0x80000, CRC(5e9cd89a) SHA1(f787aab98668d4c2c54fc4ba677c0cb808e4f31e) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx12.rom */
6799   ROMX_LOAD( "sf2_25.bin", 0x400000, 0x80000, CRC(994bfa58) SHA1(5669b845f624b10e7be56bfc89b76592258ce48b) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx21.rom */
6800   ROMX_LOAD( "sf2_27.bin", 0x400002, 0x80000, CRC(3e66ad9d) SHA1(9af9df0826988872662753e9717c48d46f2974b0) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx23.rom */
6801   ROMX_LOAD( "sf2_24.bin", 0x400004, 0x80000, CRC(c1befaa8) SHA1(a6a7f4725e52678cbd8d557285c01cdccb2c2602) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx20.rom */
6802   ROMX_LOAD( "sf2_26.bin", 0x400006, 0x80000, CRC(0627c831) SHA1(f9a92d614e8877d648449de2612fc8b43c85e4c2) , ROM_GROUPWORD | ROM_SKIP(6) ) /* sf2gfx22.rom */
6803
6804   ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
6805   ROM_LOAD( "sf2_09.bin",    0x00000, 0x08000, CRC(a4823a1b) SHA1(7b6bf59dfd578bfbbdb64c27988796783442d659) )
6806   ROM_CONTINUE(              0x10000, 0x08000 )
6807
6808   ROM_REGION( 0x40000, "oki", 0 )   /* Samples */
6809   ROM_LOAD( "sf2_18.bin",    0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) )
6810   ROM_LOAD( "sf2_19.bin",    0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
6811
6812   ROM_REGION( 0x0200, "aboardplds", 0 )
6813   ROM_LOAD( "buf1",         0x0000, 0x0117, CRC(eb122de7) SHA1(b26b5bfe258e3e184f069719f9fd008d6b8f6b9b) )
6814   ROM_LOAD( "ioa1",         0x0000, 0x0117, CRC(59c7ee3b) SHA1(fbb887c5b4f5cb8df77cec710eaac2985bc482a6) )
6815   ROM_LOAD( "prg1",         0x0000, 0x0117, CRC(f1129744) SHA1(a5300f301c1a08a7da768f0773fa0fe3f683b237) )
6816   ROM_LOAD( "rom1",         0x0000, 0x0117, CRC(41dc73b9) SHA1(7d4c9f1693c821fbf84e32dd6ef62ddf14967845) )
6817   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
6818ROM_END
6819
67796820ROM_START( sf2rb )
67806821   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
67816822   ROM_LOAD16_WORD( "sf2d__23.rom",      0x000000, 0x80000, CRC(450532b0) SHA1(14d5ff44ce97247ef4c42147157856d16c5fb4b8) )
r7972r7973
89518992   DRIVER_INIT_CALL(cps1);
89528993}
89538994
8995static DRIVER_INIT( sf2thndr )
8996{
8997   /* This particular hack uses a modified B-board PAL which mirrors the CPS-B registers at an alternate address */
8998   memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w);
8999
9000   DRIVER_INIT_CALL(cps1);
9001}
9002
89549003static DRIVER_INIT( sf2hack )
89559004{
89569005   /* some SF2 hacks have some inputs wired to the LSB instead of MSB */
r7972r7973
91169165GAME( 1991, sf2ja,    sf2,      cps1_10MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II - The World Warrior (Japan 910214)", GAME_SUPPORTS_SAVE )
91179166GAME( 1991, sf2jc,    sf2,      cps1_10MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II - The World Warrior (Japan 910306)", GAME_SUPPORTS_SAVE )
91189167GAME( 1991, sf2qp1,   sf2,      cps1_10MHz, sf2,      cps1,     ROT0,   "bootleg","Street Fighter II - The World Warrior (Quicken Pt-I, bootleg)", GAME_SUPPORTS_SAVE )   // 910214
9168GAME( 1991, sf2thndr, sf2,      cps1_10MHz, sf2,      sf2thndr, ROT0,   "bootleg","Street Fighter II - The World Warrior (Thunder Edition)", GAME_SUPPORTS_SAVE )
91199169GAME( 1991, 3wonders, 0,        cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Three Wonders (World 910520)", GAME_SUPPORTS_SAVE )      // "ETC"
91209170GAME( 1991, 3wondersu,3wonders, cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Three Wonders (US 910520)", GAME_SUPPORTS_SAVE )
91219171GAME( 1991, wonder3,  3wonders, cps1_10MHz, 3wonders, cps1,     ROT0,   "Capcom", "Wonder 3 (Japan 910520)", GAME_SUPPORTS_SAVE )
src/mame/drivers/bbusters.c
r7972r7973
257257static WRITE8_HANDLER( sound_status_w )
258258{
259259   sound_status = data;
260
260261}
261262
262263static WRITE16_HANDLER( sound_cpu_w )
263264{
265
264266   if (ACCESSING_BITS_0_7)
265267   {
268
269
266270      soundlatch_w(space, 0, data&0xff);
267271      cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
268272   }
273
269274}
270275
271276/* Eprom is byte wide, top half of word _must_ be 0xff */
r7972r7973
293298
294299   cpu_set_input_line(space->cpu, 2, HOLD_LINE);
295300
301   gun_select = data & 0xff;
296302
297   gun_select = data & 0xff;
298303}
299304
305static WRITE16_HANDLER( two_gun_output_w )
306{
307   output_set_value("Player1_Gun_Recoil",(data & 0x01));
308   output_set_value("Player2_Gun_Recoil",(data & 0x02)>>1);
309
310
311}
312
313static WRITE16_HANDLER( three_gun_output_w )
314{
315   output_set_value("Player1_Gun_Recoil",(data & 0x01));
316   output_set_value("Player2_Gun_Recoil",(data & 0x02)>>1);
317   output_set_value("Player3_Gun_Recoil",(data & 0x04)>>2);
318
319
320}
321
300322static READ16_HANDLER( kludge_r )
301323{
302324   // might latch the gun value?
r7972r7973
343365   AM_RANGE(0x0e0018, 0x0e0019) AM_READ(sound_status_r)
344366   AM_RANGE(0x0e8000, 0x0e8001) AM_READWRITE(kludge_r, gun_select_w)
345367   AM_RANGE(0x0e8002, 0x0e8003) AM_READ(control_3_r)
346   AM_RANGE(0x0f0008, 0x0f0009) AM_WRITENOP
368   /* AM_RANGE(0x0f0008, 0x0f0009) AM_WRITENOP */
369   AM_RANGE(0x0f0008, 0x0f0009) AM_WRITE(three_gun_output_w)
347370   AM_RANGE(0x0f0018, 0x0f0019) AM_WRITE(sound_cpu_w)
348371   AM_RANGE(0x0f8000, 0x0f80ff) AM_READ(eprom_r) AM_WRITEONLY AM_BASE(&eprom_data) /* Eeprom */
349372ADDRESS_MAP_END
r7972r7973
364387   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("IN0")
365388   AM_RANGE(0x0e0002, 0x0e0003) AM_READ_PORT("DSW1")
366389   AM_RANGE(0x0e0004, 0x0e0007) AM_READ(mechatt_gun_r)
367   AM_RANGE(0x0e4002, 0x0e4003) AM_WRITENOP /* Gun force feedback? */
390   /* AM_RANGE(0x0e4002, 0x0e4003) AM_WRITENOP  Gun force feedback? */
391   AM_RANGE(0x0e4002, 0x0e4003) AM_WRITE(two_gun_output_w)
368392   AM_RANGE(0x0e8000, 0x0e8001) AM_READWRITE(sound_status_r, sound_cpu_w)
369393ADDRESS_MAP_END
370394
src/mame/drivers/shaolins.c
r7972r7973
233233MACHINE_DRIVER_END
234234
235235static MACHINE_DRIVER_START( shaolinb )
236    MDRV_IMPORT_FROM(shaolins)
236   MDRV_IMPORT_FROM(shaolins)
237237
238    MDRV_SOUND_REPLACE("sn1", SN76489, MASTER_CLOCK/12) /* only type verified on pcb */
238   MDRV_SOUND_REPLACE("sn1", SN76489, MASTER_CLOCK/12) /* only type verified on pcb */
239239   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
240240
241    MDRV_SOUND_REPLACE("sn2", SN76489, MASTER_CLOCK/6)  /* only type verified on pcb */
241   MDRV_SOUND_REPLACE("sn2", SN76489, MASTER_CLOCK/6)  /* only type verified on pcb */
242242   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
243243MACHINE_DRIVER_END
244244
r7972r7973
250250
251251ROM_START( kicker )
252252   ROM_REGION( 0x10000, "maincpu", 0 )
253   ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
254   ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
255   ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
253   ROM_LOAD( "477-l03.d9",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
254   ROM_LOAD( "477-l04.d10",  0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
255   ROM_LOAD( "477-l05.d11",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
256256
257257   ROM_REGION( 0x4000, "gfx1", 0 )
258   ROM_LOAD( "kikra10.bin",  0x0000, 0x2000, CRC(4d156afc) SHA1(29eb66e2ebcf2f1c1d5ece5413d1ebf54663f9cf) )
259   ROM_LOAD( "kikra11.bin",  0x2000, 0x2000, CRC(ff6ca5df) SHA1(dfcd445c8b233a0a4168eb249472e53784eda25d) )
258   ROM_LOAD( "477-k06.a10",  0x0000, 0x4000, CRC(63202dc4) SHA1(0ffb9cfe3737c2b4f842b57607550a656b013d66) )
259//  ROM_LOAD( "kikra10.a10",  0x0000, 0x2000, CRC(4d156afc) SHA1(29eb66e2ebcf2f1c1d5ece5413d1ebf54663f9cf) ) /* proper Konami rom labels unknown */
260//  ROM_LOAD( "kikra11.a11",  0x2000, 0x2000, CRC(ff6ca5df) SHA1(dfcd445c8b233a0a4168eb249472e53784eda25d) ) /* proper Konami rom labels unknown */
260261
261262   ROM_REGION( 0x8000, "gfx2", 0 )
262   ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
263   ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
263   ROM_LOAD( "477-k02.h15",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
264   ROM_LOAD( "477-k01.h14",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
264265
265266   ROM_REGION( 0x0500, "proms", 0 )
266   ROM_LOAD( "kicker.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
267   ROM_LOAD( "kicker.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
268   ROM_LOAD( "kicker.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
269   ROM_LOAD( "kicker.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
270   ROM_LOAD( "kicker.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
267   ROM_LOAD( "477j10.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
268   ROM_LOAD( "477j11.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
269   ROM_LOAD( "477j12.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
270   ROM_LOAD( "477j09.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
271   ROM_LOAD( "477j08.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
271272ROM_END
272273
273274ROM_START( shaolins )
274275   ROM_REGION( 0x10000, "maincpu", 0 )
275   ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
276   ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
277   ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
276   ROM_LOAD( "477-l03.d9",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
277   ROM_LOAD( "477-l04.d10",  0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
278   ROM_LOAD( "477-l05.d11",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
278279
279280   ROM_REGION( 0x4000, "gfx1", 0 )
280   ROM_LOAD( "shaolins.6",   0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) )
281   ROM_LOAD( "shaolins.7",   0x2000, 0x2000, CRC(5f53ae61) SHA1(ad29e2255855c503295c6b63eb4cd6700a1e3f0e) )
281   ROM_LOAD( "shaolins.a10", 0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) ) /* proper Konami rom labels unknown */
282   ROM_LOAD( "shaolins.a11", 0x2000, 0x2000, CRC(5f53ae61) SHA1(ad29e2255855c503295c6b63eb4cd6700a1e3f0e) ) /* proper Konami rom labels unknown */
282283
283284   ROM_REGION( 0x8000, "gfx2", 0 )
284   ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
285   ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
285   ROM_LOAD( "477-k02.h15",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
286   ROM_LOAD( "477-k01.h14",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
286287
287288   ROM_REGION( 0x0500, "proms", 0 )
288   ROM_LOAD( "kicker.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
289   ROM_LOAD( "kicker.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
290   ROM_LOAD( "kicker.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
291   ROM_LOAD( "kicker.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
292   ROM_LOAD( "kicker.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
289   ROM_LOAD( "477j10.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
290   ROM_LOAD( "477j11.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
291   ROM_LOAD( "477j12.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
292   ROM_LOAD( "477j09.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
293   ROM_LOAD( "477j08.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
293294ROM_END
294295
295296/*
src/mame/drivers/pachifev.c
r7972r7973
11/**********************************************************************************************************
22
3PACHI FEVER / SANKI DENSHI KOGYO
3PACHI FEVER / (c) 1983 SANKI DENSHI KOGYO
44
5
6GEN6480830 (TEXAS INSTRUMENTS)
7XTAL:12.000MHZ
8RY050012   (TEXAS INSTRUMENTS)
9XTAL:10.738MHZ
10
11SOUND   :MSM5205 & ?
12
13DIP SWITCH:8BIT x 3
14
155===========================================================================================================
166
177Many thanks to Olivier Galibert and Wilbert Pol for identify the CPU
188
9Driver by Tomasz Slanina
1910
20Tomasz Slanina 10.02.2010:
21---------------------------
22
23There's very little info about the game or hardware, so all the above (except for clocks and MSM ) is
24just a guess:
25
26- CPU (GEN6480830 ?) is TMS9995 or derivative ( decrementer + lvl3 interrupt, internal ram)
27- RY050012 could be a VDP ( probably TMS9928A )
28- SN76469A (or similar) used for music
11- CPU has scratched surface and custom marks "GEN480830   DBS 30102" plus TI logo.
12  There's "GENZUK 01" print on the PCB, near the chip.
13  It's  TMS9995 or derivative ( decrementer + lvl3 interrupt, internal ram)
14  XTAL:12.000MHZ
15- VDP has also custom label ( "RY 050012    DDU 30600" ) plus TI logo
16  Seems to be TMS9928A
17  XTAL:10.738MHZ
18- 2xY2404 ( SN76489A comaptible? ) for music and sfx
2919- MSM5205 - sample player (see below)
3020
3121- TODO:
3222  - what's the correct game title - Pachifever ? Fever 777 ?
33  - ic48.50 ROM redump (probably more adpcm samples + lookuptable .. mapped at $c000)
3423  - remaing DSW
3524  - unknown writes ($ffxx range)
3625  - controls : unused bits (is the BUTTON1 used _only_ for entering initials?)
r7972r7973
6251class pachifev_state
6352{
6453public:
65   static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, pachifev_state(machine)); }
54    static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, pachifev_state(machine)); }
6655
67   pachifev_state(running_machine &machine) { }
56    pachifev_state(running_machine &machine) { }
6857
6958 /* controls related */
7059
r7972r7973
8574        /*end of input read*/
8675        state->power=0;
8776        state->max_power=state->input_power;
88        if(--state->cnt <= 0) /* why to do it N times? no ide.. someone should fix it */
77        if(--state->cnt <= 0) /* why to do it N times? no idea.. someone should fix it */
8978        {
9079            state->cnt=0;
9180            state->input_power=0;
r7972r7973
10291}
10392
10493static ADDRESS_MAP_START( pachifev_map, ADDRESS_SPACE_PROGRAM, 8 )
105    AM_RANGE(0x0000, 0x9fff) AM_ROM
94    AM_RANGE(0x0000, 0xdfff) AM_ROM
10695
107    AM_RANGE(0xc000, 0xc0ff) AM_NOP /* game is expecting here some kind of lookup table (adpcm samples start?) */
108
10996    AM_RANGE(0xe000, 0xe7ff) AM_RAM
11097    AM_RANGE(0xf000, 0xf0fb) AM_NOP  /* internal ram */
11198    AM_RANGE(0xff00, 0xff00) AM_READ_PORT("IN0")
r7972r7973
115102    AM_RANGE(0xff08, 0xff08) AM_READ_PORT("DSW3")
116103    AM_RANGE(0xff10, 0xff10) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
117104    AM_RANGE(0xff12, 0xff12) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
118    AM_RANGE(0xff20, 0xff20) AM_WRITENOP /* unknown */
119    AM_RANGE(0xff30, 0xff30) AM_DEVWRITE("sn76", sn76496_w)
105    AM_RANGE(0xff20, 0xff20) AM_DEVWRITE("sn76_1", sn76496_w)
106    AM_RANGE(0xff30, 0xff30) AM_DEVWRITE("sn76_2", sn76496_w)
120107    AM_RANGE(0xff40, 0xff40) AM_WRITE(controls_w)
121108    AM_RANGE(0xff50, 0xff50) AM_WRITENOP /* unknown */
122109    AM_RANGE(0xfffa, 0xfffb) AM_NOP /* decrementer */
r7972r7973
129116
130117static INPUT_PORTS_START( pachifev )
131118    PORT_START("IN0")
132    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )  /* used on enter player initials in top 5 */
119    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )  /* used to enter player initials in top 5 */
133120    PORT_BIT( 0x4d, IP_ACTIVE_LOW, IPT_UNKNOWN )
134121    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
135122    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
r7972r7973
322309    /* sound hardware */
323310    MDRV_SPEAKER_STANDARD_MONO("mono")
324311#if USE_MSM
325    MDRV_SOUND_ADD("adpcm", MSM5205, 288000)  /* guess */
312    MDRV_SOUND_ADD("adpcm", MSM5205, XTAL_384kHz)  /* guess */
326313    MDRV_SOUND_CONFIG(msm5205_config)
327314    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
328315#endif
329    MDRV_SOUND_ADD("sn76", SN76489, XTAL_10_738635MHz/3) /* guess */
316    MDRV_SOUND_ADD("sn76_1", SN76489A, XTAL_10_738635MHz/3) /* guess */
330317    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
318    MDRV_SOUND_ADD("sn76_2", SN76489A, XTAL_10_738635MHz/3) /* guess */
319    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
331320MACHINE_DRIVER_END
332321
333322ROM_START( pachifev )
r7972r7973
337326    ROM_LOAD( "ic44.02",   0x04000, 0x2000, CRC(98b3841f) SHA1(0563139877bf01e1673767ee1798bbcf68adadea) )
338327    ROM_LOAD( "ic45.03",   0x06000, 0x2000, CRC(6b76e6fa) SHA1(5be10ab0b76e2061fc7e9c77649572955bee7661) )
339328    ROM_LOAD( "ic46.04",   0x08000, 0x2000, CRC(1c8c66d7) SHA1(3b9b05f35b20d798651c7d5fdb35e6af956615a1) )
329    /* empty ROM socket  - no data for 0xa000 - 0xbfff */
330   ROM_LOAD( "ic48.50",   0x0c000, 0x2000, CRC(4ff52b70) SHA1(a459b52712250d2ecdbe6aeb8c400806867e9857) )
340331
341332    ROM_REGION( 0x4000, "adpcm", 0 )
342333    ROM_LOAD( "ic66.10",   0x0000, 0x2000, CRC(217c573e) SHA1(6fb90865d1d81f5ea00fa7916d0ccb6756ef5ce5) )
343334
344    ROM_REGION( 0x2000, "user1", 0 )
345    ROM_LOAD( "ic48.50",   0x00000, 0x2000, BAD_DUMP CRC(1c8c66d7) SHA1(3b9b05f35b20d798651c7d5fdb35e6af956615a1) )
346335ROM_END
347336
348337GAME( 1983, pachifev,  0,       pachifev,  pachifev,  0, ROT270, "Sanki Denshi Kogyo", "Pachifever", GAME_IMPERFECT_SOUND )
349
src/mame/drivers/subsino.c
r7972r7973
166166  - Figured out and documented all the game outputs.
167167  - Created proper button-lamps layout.
168168
169  Now the game is in full-working state.
169170
171
172  2010-04-22
173  ----------
174
175  Treasure Bonus (Subsino)
176
177  - Reworked and cleaned-up the inputs.
178     Most buttons have more than one single function.
179  - Added DIP locations.
180  - Figured out the following DIP Switches:
181     Complete Coinage (1/2/5/10/20/25/50/100).
182     Remote Credits (1/2/5/10/20/25/50/100).
183     Minimum Bet (1/8/16/32).
184     Max Bet (16/32/64/80).
185     Demo Sounds (Off/On).
186     Game Limit (10000/20000/30000/60000).
187     Double-Up (No/Yes).
188     Win Rate (84/86/88/90/92/94/96%).
189     Double-Up Level (0/1/2/3/4/5/6/7).
190     Double-Up Game (Dancers / Panties Colors / Cards / Seven-Bingo).
191
192  - Fixed inverted functions and buggy inputs.
193  - Added lamps support.
194  - Created button-lamps layout.
195  - Remapped inputs to reflect the controls layout. This way is more
196     user-friendly since controls are straight with button-lamps.
197  - Added coin/keyin/keyout/payout counters.
198  - Removed the pulse limitation in the BET input. This allow it to work
199     as BET and STOP2 properly.
200  - Added technical notes.
201
202
170203***************************************************************************/
171204
172205#include "emu.h"
r7972r7973
182215#include "sharkpye.lh"
183216#include "smoto.lh"
184217#include "tisub.lh"
218#include "stisub.lh"
185219
186220
187221/***************************************************************************
r7972r7973
508542/***** COIN PULSE: *****
509543
510544
511  * Victor 5, Victor 21, Poker Carnival (crsbingo), Shark Party (English, Alpha license).
545  * Victor 5, Victor 21, Poker Carnival (crsbingo),
546    Shark Party (English, Alpha license), Treasure Bonus (Subsino).
512547
513548  7654 3210
514549  ---- ---x  Coin pulse.
r7972r7973
645680  -x-- ----  ???.
646681  x--- ----  HOLD4 & HOLD5.
647682
683
684  * Treasure Bonus (Subsino).
685
686  7654 3210
687  ---- ---x  SMALL / RED / STOP3.
688  ---- --x-  D-UP / INFO.
689  ---- -x--  START / STOP ALL.
690  ---- x---  BET / STOP2.
691  ---x ----  ???.
692  --x- ----  TAKE / STOP1.
693  -x-- ----  ???.
694  x--- ----  BIG / BLACK.
695
696
697  After seeing the button/lamps functions, I think that controls layout should be
698  arranged the following way:
699
700   ________    ________    ________    ________    ________       __________
701  |        |  |        |  |        |  |        |  |        |     |          |
702  |  D-UP  |  |  TAKE  |  |  BET   |  | SMALL  |  |  BIG   |     |  START   |
703  |  INFO  |  | STOP 1 |  | STOP 2 |  | STOP 3 |  |        |     | STOP ALL |
704  |________|  |________|  |________|  |________|  |________|     |__________|
705
706   Key 'Z'     Key 'X'     Key 'C'     Key 'V'     Key 'B'        Key 'N'
707
708  Mapped to the above keys to be more user-friendly.
709
648710*/
649711
650712   output_set_lamp_value(0, (data) & 1);      /* Lamp 0 */
r7972r7973
10411103   AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs
10421104ADDRESS_MAP_END
10431105
1106
10441107/***************************************************************************
10451108*                              Input Ports                                 *
10461109***************************************************************************/
r7972r7973
13981461   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
13991462INPUT_PORTS_END
14001463
1464
14011465static INPUT_PORTS_START( stisub )
14021466   PORT_START("SW1")
1403   PORT_DIPNAME( 0x01, 0x01, "SW1" )
1404   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1405   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1406   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1407   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1408   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1409   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1410   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1411   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1412   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1413   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1414   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1415   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1416   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1418   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1419   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1420   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1421   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1467   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:1,2,3")
1468   PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
1469   PORT_DIPSETTING(    0x05, DEF_STR( 1C_2C ) )
1470   PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
1471   PORT_DIPSETTING(    0x07, "1 Coin / 10 Credits" )
1472   PORT_DIPSETTING(    0x03, "1 Coin / 20 Credits" )
1473   PORT_DIPSETTING(    0x02, "1 Coin / 25 Credits" )
1474   PORT_DIPSETTING(    0x01, "1 Coin / 50 Credits" )
1475   PORT_DIPSETTING(    0x00, "1 Coin / 100 Credits" )
1476   PORT_DIPNAME( 0x38, 0x00, "Remote Credits" )      PORT_DIPLOCATION("SW1:4,5,6")
1477   PORT_DIPSETTING(    0x30, "1 Pulse / 1 Credits" )
1478   PORT_DIPSETTING(    0x28, "1 Pulse / 2 Credits" )
1479   PORT_DIPSETTING(    0x20, "1 Pulse / 5 Credits" )
1480   PORT_DIPSETTING(    0x38, "1 Pulse / 10 Credits" )
1481   PORT_DIPSETTING(    0x18, "1 Pulse / 20 Credits" )
1482   PORT_DIPSETTING(    0x10, "1 Pulse / 25 Credits" )
1483   PORT_DIPSETTING(    0x08, "1 Pulse / 50 Credits" )
1484   PORT_DIPSETTING(    0x00, "1 Pulse / 100 Credits" )
1485   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:7")
14221486   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
14231487   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1424   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1488   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:8")
14251489   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14261490   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14271491
14281492   PORT_START("SW2")
1429   PORT_DIPNAME( 0x01, 0x01, "SW2" )
1430   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1431   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1432   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1433   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1434   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1435   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1436   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1437   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1438   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1439   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1440   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1441   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1493   PORT_DIPNAME( 0x03, 0x03, "Minimum Bet" )         PORT_DIPLOCATION("SW2:1,2")
1494   PORT_DIPSETTING(    0x02, "1" )
1495   PORT_DIPSETTING(    0x03, "8" )
1496   PORT_DIPSETTING(    0x01, "16" )
1497   PORT_DIPSETTING(    0x00, "32" )
1498   PORT_DIPNAME( 0x0c, 0x0c, "Max Bet" )            PORT_DIPLOCATION("SW2:3,4")
1499   PORT_DIPSETTING(    0x04, "16" )
1500   PORT_DIPSETTING(    0x08, "32" )
1501   PORT_DIPSETTING(    0x0c, "64" )
1502   PORT_DIPSETTING(    0x00, "80" )
1503   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW2:5")
14421504   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
14431505   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1444   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1445   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1446   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1447   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1448   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1449   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1450   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1451   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1452   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1506   PORT_DIPNAME( 0x60, 0x60, "Game Limit" )         PORT_DIPLOCATION("SW2:6,7")
1507   PORT_DIPSETTING(    0x40, "10000" )
1508   PORT_DIPSETTING(    0x60, "20000" )
1509   PORT_DIPSETTING(    0x20, "30000" )
1510   PORT_DIPSETTING(    0x00, "60000" )
1511   PORT_DIPNAME( 0x80, 0x80, "Double Up" )            PORT_DIPLOCATION("SW2:8")
1512   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1513   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
14531514
1454   PORT_START("SW3")
1455   PORT_DIPNAME( 0x01, 0x01, "SW3" )
1456   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1457   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1458   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1459   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1460   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1461   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1462   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1463   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1464   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1515   PORT_START( "SW3" )
1516   PORT_DIPNAME( 0x07, 0x07, "Win Rate" )      PORT_DIPLOCATION("SW3:1,2,3")
1517   PORT_DIPSETTING(    0x00, "84%" )
1518   PORT_DIPSETTING(    0x01, "84%" )   // yes, again!
1519   PORT_DIPSETTING(    0x02, "86%" )
1520   PORT_DIPSETTING(    0x03, "88%" )
1521   PORT_DIPSETTING(    0x04, "90%" )
1522   PORT_DIPSETTING(    0x07, "92%" )
1523   PORT_DIPSETTING(    0x05, "94%" )
1524   PORT_DIPSETTING(    0x06, "96%" )
1525   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:4")
14651526   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
14661527   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1467   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1528   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:5")
14681529   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
14691530   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1470   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1531   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:6")
14711532   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
14721533   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1473   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1534   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:7")
14741535   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
14751536   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1476   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1537   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:8")
14771538   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14781539   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14791540
1480   PORT_START("SW4")
1481   PORT_DIPNAME( 0x01, 0x01, "SW4" )
1482   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1483   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1484   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1485   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1486   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1487   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1488   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1489   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1490   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1541   PORT_START( "SW4" )
1542   PORT_DIPNAME( 0x07, 0x07, "Double-Up Level" )      PORT_DIPLOCATION("SW4:1,2,3")
1543   PORT_DIPSETTING(    0x00, "0" )
1544   PORT_DIPSETTING(    0x01, "1" )
1545   PORT_DIPSETTING(    0x02, "2" )
1546   PORT_DIPSETTING(    0x03, "3" )
1547   PORT_DIPSETTING(    0x04, "4" )
1548   PORT_DIPSETTING(    0x05, "5" )
1549   PORT_DIPSETTING(    0x06, "6" )
1550   PORT_DIPSETTING(    0x07, "7" )
1551   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:4")
14911552   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
14921553   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1493   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1494   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1495   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1496   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1554   PORT_DIPNAME( 0x10, 0x10, "Double-Up Game" )      PORT_DIPLOCATION("SW4:5")
1555   PORT_DIPSETTING(    0x10, "Dancers / Panties Colors" )
1556   PORT_DIPSETTING(    0x00, "Cards / Seven-Bingo" )
1557   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:6")
14971558   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
14981559   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1499   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1560   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:7")
15001561   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
15011562   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1502   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1563   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:8")
15031564   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15041565   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15051566
1506/*
1507    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )    PORT_NAME("Hold 1")
1508    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )    PORT_NAME("Hold 2 / Big")
1509    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD3 )    PORT_NAME("Hold 3 / Small")
1510    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1511    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_BET )      PORT_IMPULSE(3)
1512    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1513*/
1514
15151567   PORT_START("INA")
1516   PORT_DIPNAME( 0x01, 0x01, "INA" )
1517   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1518   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1519   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1520   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1521   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1522   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1523   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1524   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1525   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )   PORT_NAME("Start")
1526   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_BET )      PORT_IMPULSE(3)
1527   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )   PORT_NAME("Double / Info")
1528   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1529   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1530   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1531   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1532   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1533   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1568   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1569   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1570   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1571   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START )         PORT_CODE(KEYCODE_N)   PORT_NAME("Start / Stop All")
1572   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_BET )      PORT_CODE(KEYCODE_C)   PORT_NAME("Bet / Stop 2")
1573   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )   PORT_CODE(KEYCODE_Z)   PORT_NAME("Double / Info")
1574   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1575   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15341576
15351577   PORT_START( "INB" )
15361578   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )         PORT_IMPULSE(3)   // coin
r7972r7973
15431585   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )   // key out
15441586
15451587   PORT_START("INC")
1546   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH )   PORT_NAME("Black")
1547   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1548   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1549   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1588   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_LOW )      PORT_CODE(KEYCODE_V)   PORT_NAME("Small / Black / Stop 3")
1589   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
15501590   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )      PORT_CODE(KEYCODE_R)   PORT_NAME("Reset")   // hard reset
1551   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_LOW )      PORT_NAME("Red")
1552   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1553   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1554   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1555   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1556   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1557   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1558   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )
1559   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1560   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1561   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1591   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH )   PORT_CODE(KEYCODE_B)   PORT_NAME("Big / Red")
1592   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1593   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1594   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )   PORT_CODE(KEYCODE_X)   PORT_NAME("Take / Stop 1")
1595   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15621596INPUT_PORTS_END
15631597
1598
15641599static INPUT_PORTS_START( crsbingo )
15651600
15661601   PORT_START( "SW1" )
r7972r7973
20832118   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
20842119INPUT_PORTS_END
20852120
2121
20862122/***************************************************************************
20872123*                             Graphics Layout                              *
20882124***************************************************************************/
r7972r7973
21622198   GFXDECODE_ENTRY( "reels", 0, layout_8x32x8, 0, 1 )
21632199GFXDECODE_END
21642200
2201
21652202/***************************************************************************
21662203*                             Machine Drivers                              *
21672204***************************************************************************/
r7972r7973
28962933   ROM_LOAD( "sti-alpha_9-ver1.1.u22", 0x60000, 0x20000, CRC(9710a223) SHA1(76ef6bd77ae33d91a9b6a9a615d07caee3356dfb) )
28972934ROM_END
28982935
2936
28992937/***************************************************************************
29002938*                        Driver Init / Decryption                          *
29012939***************************************************************************/
r7972r7973
30733111
30743112}
30753113
3114
30763115/***************************************************************************
30773116*                               Game Drivers                               *
30783117***************************************************************************/
30793118
30803119/*     YEAR  NAME      PARENT    MACHINE   INPUT     INIT      ROT    COMPANY            FULLNAME                               FLAGS   LAYOUT      */
30813120GAMEL( 1990, victor21, 0,        victor21, victor21, victor21, ROT0, "Subsino / Buffy", "Victor 21",                            0,      layout_victor21 )
3082GAMEL( 1991, victor5,  0,        victor5,  victor5,  victor5,  ROT0, "Subsino",         "G.E.A.",                               0,      layout_victor5 ) // PCB black-box was marked 'victor 5' - in-game says G.E.A with no manufacturer info?
3121GAMEL( 1991, victor5,  0,        victor5,  victor5,  victor5,  ROT0, "Subsino",         "G.E.A.",                               0,      layout_victor5 )   // PCB black-box was marked 'victor 5' - in-game says G.E.A with no manufacturer info?
30833122GAMEL( 1992, tisub,    0,        tisub,    tisub,    tisub,    ROT0, "Subsino",         "Treasure Island (Subsino, set 1)",     0,      layout_tisub )
30843123GAMEL( 1992, tisuba,   tisub,    tisub,    tisub,    tisuba,   ROT0, "Subsino",         "Treasure Island (Subsino, set 2)",     0,      layout_tisub )
30853124GAMEL( 1991, crsbingo, 0,        crsbingo, crsbingo, crsbingo, ROT0, "Subsino",         "Poker Carnival",                       0,      layout_crsbingo )
3086GAME(  1995, stisub,   0,        stisub,   stisub,   stisub,   ROT0, "Alpha",           "Treasure Bonus (Subsino)",           0 ) // board CPU module marked 'Super Treasure Island' (alt title?)
3087GAMEL( 1996, sharkpy,  0,        sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.3)",            0,      layout_sharkpy ) // missing POST messages?
3088GAMEL( 1996, sharkpya, sharkpy,  sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.6)",            0,      layout_sharkpy ) // missing POST messages?
3089GAMEL( 1995, sharkpye, sharkpy,  sharkpy,  sharkpye, sharkpye, ROT0, "Alpha",           "Shark Party (English, Alpha license)", 0,      layout_sharkpye ) // PCB black-box was marked 'victor 6'
3125GAMEL( 1995, stisub,   0,        stisub,   stisub,   stisub,   ROT0, "Alpha",           "Treasure Bonus (Subsino)",           0,      layout_stisub )      // board CPU module marked 'Super Treasure Island' (alt title?)
3126GAMEL( 1996, sharkpy,  0,        sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.3)",            0,      layout_sharkpy )   // missing POST messages?
3127GAMEL( 1996, sharkpya, sharkpy,  sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.6)",            0,      layout_sharkpy )   // missing POST messages?
3128GAMEL( 1995, sharkpye, sharkpy,  sharkpy,  sharkpye, sharkpye, ROT0, "Alpha",           "Shark Party (English, Alpha license)", 0,      layout_sharkpye )   // PCB black-box was marked 'victor 6'
30903129GAMEL( 1996, smoto20,  0,        srider,   smoto20,  smoto20,  ROT0, "Subsino",         "Super Rider (Italy, v2.0)",            0,      layout_smoto )
30913130GAMEL( 1996, smoto16,  smoto20,  srider,   smoto16,  smoto16,  ROT0, "Subsino",         "Super Moto (Italy, v1.6)",             0,      layout_smoto )
src/mame/drivers/rohga.c
r7972r7973
55    Rogha Armour Attack         (c) 1991 Data East Corporation
66    Wizard Fire                 (c) 1992 Data East Corporation
77    Nitro Ball/Gun Ball         (c) 1992 Data East Corporation
8    Schmeiser Robo              (c) 1993 Hot B
8    Schmeiser Robo              (c) 1993 Hot-B
99
1010    This hardware is capable of alpha-blending on sprites and playfields
1111
r7972r7973
15661566GAME( 1992, darkseal2, wizdfire, wizdfire, wizdfire, wizdfire, ROT0,   "Data East Corporation", "Dark Seal 2 (Japan v2.1)", GAME_SUPPORTS_SAVE )
15671567GAME( 1992, nitrobal,  0,        nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Nitro Ball (US)", GAME_SUPPORTS_SAVE )
15681568GAME( 1992, gunball,   nitrobal, nitrobal, nitrobal, nitrobal, ROT270, "Data East Corporation", "Gun Ball (Japan)", GAME_SUPPORTS_SAVE )
1569GAME( 1993, schmeisr,  0,        schmeisr, schmeisr, schmeisr, ROT0,   "Hot B",                 "Schmeiser Robo (Japan)", GAME_SUPPORTS_SAVE )
1569GAME( 1993, schmeisr,  0,        schmeisr, schmeisr, schmeisr, ROT0,   "Hot-B",                 "Schmeiser Robo (Japan)", GAME_SUPPORTS_SAVE )
src/mame/drivers/nemesis.c
r7972r7973
21672167   ROM_LOAD16_BYTE( "456-e05.12c",   0x00001, 0x8000, CRC(c9761c78) SHA1(bfd63517efa820a05a0d9a908dd0917cd0d01b77) )
21682168   ROM_LOAD16_BYTE( "456-e02.13a",   0x10000, 0x8000, CRC(f6169c4b) SHA1(047a204fbcf8c24eca2db7197d4297e5a28c2b42) )
21692169   ROM_LOAD16_BYTE( "456-e06.13c",   0x10001, 0x8000, CRC(af58c548) SHA1(a15725c14b6e7840c84ab2bd4cf3668bbaf35abf) )
2170   ROM_LOAD16_BYTE( "456-d03.14a",   0x20000, 0x8000, CRC(8cefb25f) SHA1(876b1974ca76ca89f8b8ea45b4ba9ec82d7c7228) ) /* Labeled "E03" but same as above set */
2171   ROM_LOAD16_BYTE( "456-d07.14c",   0x20001, 0x8000, CRC(d50b82cb) SHA1(71e9fbe51272788e2ef6f150c7bff59ac8c28f1d) ) /* Labeled "E07" but same as above set */
2170   ROM_LOAD16_BYTE( "456-e03.14a",   0x20000, 0x8000, CRC(8cefb25f) SHA1(876b1974ca76ca89f8b8ea45b4ba9ec82d7c7228) ) /* Labeled "E03" but same as above set */
2171   ROM_LOAD16_BYTE( "456-e07.14c",   0x20001, 0x8000, CRC(d50b82cb) SHA1(71e9fbe51272788e2ef6f150c7bff59ac8c28f1d) ) /* Labeled "E07" but same as above set */
21722172   ROM_LOAD16_BYTE( "456-e04.15a",   0x30000, 0x8000, CRC(322423d0) SHA1(6106b607132a09193353f339d06032a13b1e3de8) )
21732173   ROM_LOAD16_BYTE( "456-e08.15c",   0x30001, 0x8000, CRC(eb656266) SHA1(2f4abea282d30775f7a25747eb41bfd8d5299967) )
21742174
21752175   ROM_REGION( 0x10000, "audiocpu", 0 )    /* 64k for sound */
2176   ROM_LOAD(      "456-d09.9c",   0x00000, 0x4000, CRC(26bf9636) SHA1(009dcbf18ea6230fc75a72232bd4fc29ad28dbf0) )
2176   ROM_LOAD(      "456-b09.9c",   0x00000, 0x4000, CRC(26bf9636) SHA1(009dcbf18ea6230fc75a72232bd4fc29ad28dbf0) ) /* Labeled "B09" but same as above set */
21772177
21782178   ROM_REGION( 0x0200,  "k007232", 0 )      /* 2x 256 byte for 0005289 wavetable data */
21792179   ROM_LOAD(      "400-a01.fse",  0x00000, 0x0100, CRC(5827b1e8) SHA1(fa8cf5f868cfb08bce203baaebb6c4055ee2a000) )
src/mame/drivers/8080bw.c
r7972r7973
27202720
27212721ROM_START( polaris )
27222722   ROM_REGION( 0x10000, "maincpu", 0 )
2723   ROM_LOAD( "ps-01",        0x0000, 0x0800, CRC(c04ce5a9) SHA1(62cc9b3b682ebecfb7600393862c65e26ff5263f) )
2724   ROM_LOAD( "ps-09",        0x0800, 0x0800, CRC(9a5c8cb2) SHA1(7a8c5d74f8b431072d9476d3ef65a3fe1d639813) )
2725   ROM_LOAD( "ps-08",        0x1000, 0x0800, CRC(8680d7ea) SHA1(7fd4b8a415666c36842fed80d2798b48f8b29d0d) )
2726   ROM_LOAD( "ps-04",        0x1800, 0x0800, CRC(65694948) SHA1(de92a7f3e3ef732b573254baa60df60f8e068a5d) )
2727   ROM_LOAD( "ps-05",        0x4000, 0x0800, CRC(772e31f3) SHA1(fa0b866b6df1a9217e286ca880b3bb3fb0644bf3) )
2728   ROM_LOAD( "ps-10",        0x4800, 0x0800, CRC(3df77bac) SHA1(b3275c34b8d42df83df2c404c5b7d220aae651fa) )
2723   ROM_LOAD( "ps01-1.30",   0x0000, 0x0800, CRC(7d41007c) SHA1(168f002fe997aac6e4141292de826d389859bb04) )
2724   ROM_LOAD( "ps09.36",     0x0800, 0x0800, CRC(9a5c8cb2) SHA1(7a8c5d74f8b431072d9476d3ef65a3fe1d639813) )
2725   ROM_LOAD( "ps03-1.31",   0x1000, 0x0800, CRC(21f32415) SHA1(6ac9ae9b55e342729fe260147021ed3911a24dc2) )
2726   ROM_LOAD( "ps04.37",     0x1800, 0x0800, CRC(65694948) SHA1(de92a7f3e3ef732b573254baa60df60f8e068a5d) )
2727   ROM_LOAD( "ps05.32",     0x4000, 0x0800, CRC(772e31f3) SHA1(fa0b866b6df1a9217e286ca880b3bb3fb0644bf3) )
2728   ROM_LOAD( "ps10.38",     0x4800, 0x0800, CRC(3df77bac) SHA1(b3275c34b8d42df83df2c404c5b7d220aae651fa) )
2729   ROM_LOAD( "ps26",        0x5000, 0x0800, CRC(9d5c3d50) SHA1(a6acf9ca6e807625156cb1759269014d5830a44f) )
27292730
27302731   ROM_REGION( 0x0400, "proms", 0 )      /* background color map */
2731   ROM_LOAD( "ps07",         0x0000, 0x0400, CRC(164aa05d) SHA1(41c699ce45c76a60c71294f25d8df6c6e6c1280a) )
2732   ROM_LOAD( "ps08.1b", 0x0000, 0x0400, CRC(164aa05d) SHA1(41c699ce45c76a60c71294f25d8df6c6e6c1280a) ) /* NEC B406 or compatible BPROM (82S137) */
27322733
27332734   ROM_REGION( 0x0100, "user1", 0 )      /* cloud graphics */
2734   ROM_LOAD( "mb7052.2c",    0x0000, 0x0100, CRC(2953253b) SHA1(2fb851bc9652ca4e51d473b484ede6dab05f1b51) )
2735   ROM_LOAD( "ps07.2c", 0x0000, 0x0100, CRC(2953253b) SHA1(2fb851bc9652ca4e51d473b484ede6dab05f1b51) ) /* MB7052 or compatible BPROM (82S129) */
27352736ROM_END
27362737
27372738ROM_START( polarisa )
27382739   ROM_REGION( 0x10000, "maincpu", 0 )
2739   ROM_LOAD( "ps01-1",       0x0000, 0x0800, CRC(7d41007c) SHA1(168f002fe997aac6e4141292de826d389859bb04) )
2740   ROM_LOAD( "ps-09",        0x0800, 0x0800, CRC(9a5c8cb2) SHA1(7a8c5d74f8b431072d9476d3ef65a3fe1d639813) )
2741   ROM_LOAD( "ps03-1",       0x1000, 0x0800, CRC(21f32415) SHA1(6ac9ae9b55e342729fe260147021ed3911a24dc2) )
2742   ROM_LOAD( "ps-04",        0x1800, 0x0800, CRC(65694948) SHA1(de92a7f3e3ef732b573254baa60df60f8e068a5d) )
2743   ROM_LOAD( "ps-05",        0x4000, 0x0800, CRC(772e31f3) SHA1(fa0b866b6df1a9217e286ca880b3bb3fb0644bf3) )
2744   ROM_LOAD( "ps-10",        0x4800, 0x0800, CRC(3df77bac) SHA1(b3275c34b8d42df83df2c404c5b7d220aae651fa) )
2745   ROM_LOAD( "ps26",         0x5000, 0x0800, CRC(9d5c3d50) SHA1(a6acf9ca6e807625156cb1759269014d5830a44f) )
2740   ROM_LOAD( "ps01.30",     0x0000, 0x0800, CRC(c04ce5a9) SHA1(62cc9b3b682ebecfb7600393862c65e26ff5263f) )
2741   ROM_LOAD( "ps09.36",     0x0800, 0x0800, CRC(9a5c8cb2) SHA1(7a8c5d74f8b431072d9476d3ef65a3fe1d639813) )
2742   ROM_LOAD( "ps03.31",     0x1000, 0x0800, CRC(8680d7ea) SHA1(7fd4b8a415666c36842fed80d2798b48f8b29d0d) )
2743   ROM_LOAD( "ps04.37",     0x1800, 0x0800, CRC(65694948) SHA1(de92a7f3e3ef732b573254baa60df60f8e068a5d) )
2744   ROM_LOAD( "ps05.32",     0x4000, 0x0800, CRC(772e31f3) SHA1(fa0b866b6df1a9217e286ca880b3bb3fb0644bf3) )
2745   ROM_LOAD( "ps10.38",     0x4800, 0x0800, CRC(3df77bac) SHA1(b3275c34b8d42df83df2c404c5b7d220aae651fa) )
27462746
27472747   ROM_REGION( 0x0400, "proms", 0 )      /* background color map */
2748   ROM_LOAD( "ps07",         0x0000, 0x0400, CRC(164aa05d) SHA1(41c699ce45c76a60c71294f25d8df6c6e6c1280a) )
2748   ROM_LOAD( "ps08.1b", 0x0000, 0x0400, CRC(164aa05d) SHA1(41c699ce45c76a60c71294f25d8df6c6e6c1280a) ) /* NEC B406 or compatible BPROM (82S137) */
27492749
27502750   ROM_REGION( 0x0100, "user1", 0 )      /* cloud graphics */
2751   ROM_LOAD( "mb7052.2c",    0x0000, 0x0100, CRC(2953253b) SHA1(2fb851bc9652ca4e51d473b484ede6dab05f1b51) )
2751   ROM_LOAD( "ps07.2c", 0x0000, 0x0100, CRC(2953253b) SHA1(2fb851bc9652ca4e51d473b484ede6dab05f1b51) ) /* MB7052 or compatible BPROM (82S129) */
27522752ROM_END
27532753
2754ROM_START( polariso )
2755   ROM_REGION( 0x10000, "maincpu", 0 )
2756   ROM_LOAD( "ps01.30",     0x0000, 0x0800, CRC(c04ce5a9) SHA1(62cc9b3b682ebecfb7600393862c65e26ff5263f) )
2757   ROM_LOAD( "ps02.36",     0x0800, 0x0800, CRC(18648e4f) SHA1(9f672e108177d5d9bc004b41eec00dc4d19269ff) )
2758   ROM_LOAD( "ps03.31",     0x1000, 0x0800, CRC(8680d7ea) SHA1(7fd4b8a415666c36842fed80d2798b48f8b29d0d) )
2759   ROM_LOAD( "ps04.37",     0x1800, 0x0800, CRC(65694948) SHA1(de92a7f3e3ef732b573254baa60df60f8e068a5d) )
2760   ROM_LOAD( "ps05.32",     0x4000, 0x0800, CRC(772e31f3) SHA1(fa0b866b6df1a9217e286ca880b3bb3fb0644bf3) )
2761   ROM_LOAD( "ps06.38",     0x4800, 0x0800, CRC(f577cb72) SHA1(7a931b5ebaf0d6941191f21afb9ed670d0251e07) )
2762
2763   ROM_REGION( 0x0400, "proms", 0 )      /* background color map */
2764   ROM_LOAD( "ps08.1b", 0x0000, 0x0400, CRC(164aa05d) SHA1(41c699ce45c76a60c71294f25d8df6c6e6c1280a) ) /* NEC B406 or compatible BPROM (82S137) */
2765
2766   ROM_REGION( 0x0100, "user1", 0 )      /* cloud graphics */
2767   ROM_LOAD( "ps07.2c", 0x0000, 0x0100, CRC(2953253b) SHA1(2fb851bc9652ca4e51d473b484ede6dab05f1b51) ) /* MB7052 or compatible BPROM (82S129) */
2768ROM_END
2769
27542770ROM_START( ozmawars )
27552771   ROM_REGION( 0x10000, "maincpu", 0 )
27562772   ROM_LOAD( "mw01",         0x0000, 0x0800, CRC(31f4397d) SHA1(bba9765aadd608d19e2515a5edf8e0eceb70916a) )
r7972r7973
29412957GAME( 1979, sflush,   0,        sflush,   sflush,   0, ROT270, "Taito", "Straight Flush",GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL)
29422958GAME( 1980, lupin3,   0,        lupin3,   lupin3,   0, ROT270, "Taito", "Lupin III (set 1)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
29432959GAME( 1980, lupin3a,  lupin3,   lupin3a,  lupin3a,  0, ROT270, "Taito", "Lupin III (set 2)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
2944GAME( 1980, polaris,  0,        polaris,  polaris,  0, ROT270, "Taito", "Polaris (set 1)", GAME_SUPPORTS_SAVE )
2945GAME( 1980, polarisa, polaris,  polaris,  polaris,  0, ROT270, "Taito", "Polaris (set 2)", GAME_SUPPORTS_SAVE )
2960GAME( 1980, polaris,  0,        polaris,  polaris,  0, ROT270, "Taito", "Polaris (Latest version)", GAME_SUPPORTS_SAVE )
2961GAME( 1980, polarisa, polaris,  polaris,  polaris,  0, ROT270, "Taito", "Polaris (First revision)", GAME_SUPPORTS_SAVE )
2962GAME( 1980, polariso, polaris,  polaris,  polaris,  0, ROT270, "Taito", "Polaris (Original version)", GAME_SUPPORTS_SAVE )
29462963GAME( 1980, ballbomb, 0,        ballbomb, ballbomb, 0, ROT270, "Taito", "Balloon Bomber", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )   /* missing clouds */
29472964GAME( 1980, indianbt, 0,        indianbt, indianbt, 0, ROT270, "Taito", "Indian Battle", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
29482965GAME( 1980, steelwkr, 0,        steelwkr, steelwkr, 0, ROT0  , "Taito", "Steel Worker", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
r7972r7973
29582975GAMEL(19??, sinvemag, invaders, invaders, sinvemag, 0, ROT270, "bootleg", "Super Invaders (EMAG)", GAME_SUPPORTS_SAVE, layout_invaders )
29592976GAMEL(19??, tst_invd, invaders, invaders, sicv,     0, ROT0,   "Test ROM", "Space Invaders Test ROM", GAME_SUPPORTS_SAVE, layout_invaders )
29602977GAMEL(19??, alieninv, invaders, invaders, alieninv, 0, ROT270, "Margamatics", "Alien Invasion", GAME_SUPPORTS_SAVE, layout_invaders )
2961GAMEL(19??, alieninvp2,invaders, invaders, searthin, 0, ROT270, "bootleg", "Alien Invasion Part II", GAME_SUPPORTS_SAVE, layout_invaders )
2978GAMEL(19??, alieninvp2,invaders, invaders, searthin,0, ROT270, "bootleg", "Alien Invasion Part II", GAME_SUPPORTS_SAVE, layout_invaders )
29622979GAMEL(1978, spceking, invaders, invaders, sicv,     0, ROT270, "Leijac Corporation (Konami)","Space King", GAME_SUPPORTS_SAVE, layout_invaders )
29632980GAMEL(1978, spcewars, invaders, spcewars, spcewars, 0, ROT270, "Sanritsu", "Space War (Sanritsu)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_invaders )
29642981GAME (19??, astropal, 0,        astropal, astropal, 0, ROT0,   "Sidam?", "Astropal", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
src/mame/drivers/namcos2.c
r7972r7973
511511      output_set_value("bureau",      (data >> 2) & 1);
512512      output_set_value("refrigerator",(data >> 3) & 1);
513513      output_set_value("porch",       (data >> 4) & 1);
514      /* data&0x20 : player#1 (ZIP) force feedback
515         * data&0x40 : player#2 (ZAP) force feedback
516         */
514      /* gun recoils */
515      output_set_value("Player1_Gun_Recoil",(data & 0x20)>>5);
516      output_set_value("Player2_Gun_Recoil",(data & 0x40)>>6);
517
517518   }
518519   else
519520   {
r7972r7973
523524      output_set_value("bureau", 0);
524525      output_set_value("refrigerator", 0);
525526      output_set_value("porch", 0);
527      output_set_value("Player1_Gun_Recoil",0);
528      output_set_value("Player2_Gun_Recoil",0);
526529   }
527530}
528531
r7972r7973
542545         switch( offset )
543546         {
544547         case 0xc0/2: GollyGhostUpdateDiorama_c0(data); break;
545         case 0xc2/2: break; /* unknown; 0x00 or 0x01 - probably lights up guns */
548         case 0xc2/2:
549          /* unknown; 0x00 or 0x01 - probably lights up guns */
550         break;
546551         case 0xc4/2: GollyGhostUpdateLED_c4(data); break;
547552         case 0xc6/2: GollyGhostUpdateLED_c6(data); break;
548553         case 0xc8/2: GollyGhostUpdateLED_c8(data); break;
r7972r7973
551556            break;
552557         }
553558      }
559      /* Note:  Outputs for the other gun games pass through here as well, but I couldn't find the offsets. */
560      /* Steel Gunner 1 & 2 have 6 "damage lamps" (three on each side) as well as gun recoils. */
561
554562   }
555563}
556564
565
557566static READ8_HANDLER( namcos2_dpram_byte_r )
558567{
559568   return namcos2_dpram[offset];
src/mame/drivers/harddriv.c
r7972r7973
34983498
34993499   /* ----------------------- */
35003500
3501   /* None of this stuff was in the zip, is it meant to be the same as Race Drivin' Compact, Race' Drivin, or Hard Drivin? */
35023501   ROM_REGION( 0x2000, "asic65", 0 )   /* ASIC65 TMS32015 code */
35033502   ROM_LOAD( "136077-1027.30j", 0x00000, 0x02000, NO_DUMP )
35043503
3504   /* ADSP board */
35053505   ROM_REGION( 0x20000, "soundcpu", 0 )      /* 2*64k for audio 68000 code */
3506   ROM_LOAD16_BYTE( "136077-1032.70n", 0x000000, 0x008000, CRC(fbc903a6) SHA1(047240a5192918ced52d90b0555ba2e19a26329e) )
3507   ROM_LOAD16_BYTE( "136077-1033.45n", 0x000001, 0x008000, CRC(e032ca7c) SHA1(a80c980c8e58cf8cada72140e42a3cd1ea987b3d) )
3506   ROM_LOAD16_BYTE( "rdps1032.bin", 0x000000, 0x010000, CRC(33005f2a) SHA1(e4037a76f122b271a9675d9187ab847a11738640) )
3507   ROM_LOAD16_BYTE( "rdps1033.bin", 0x000001, 0x010000, CRC(4fc800ac) SHA1(dd8cfdb727d6a65274f4f871a589a36796ae1e57) )
35083508
3509
3509   /* DSK board */
35103510   ROM_REGION16_BE( 0x51000, "user3", 0 )   /* 256k for DSK ROMs + 64k for RAM + 4k for ZRAM */
3511   ROM_LOAD16_BYTE( "136078-1030.30e", 0x000000, 0x010000, CRC(d355a1c2) SHA1(6b0fb52dbecbe574959739f49c3c0fccdd5cebdb) )
3512   ROM_LOAD16_BYTE( "136078-1031.10e", 0x000001, 0x010000, CRC(18fd5f44) SHA1(1c3bd780b72cfa61bcbd82683da18b4ee8d03a6d) )
3511   ROM_LOAD16_BYTE( "rdpd1026.bin", 0x000000, 0x020000, CRC(16572618) SHA1(08d9f7f76e6e75d5233240d4deab96808825994b) )
3512   ROM_LOAD16_BYTE( "rdpd1025.bin", 0x000001, 0x020000, CRC(57b8a266) SHA1(257246d42841aa30220caeb91945e29978ee8fc0) )
35133513
3514   ROM_REGION( 0x50000, "serialroms", 0 )      /* 10*128k for audio serial ROMs */
3515   ROM_LOAD( "136052-1123.65a", 0x000000, 0x010000, CRC(a88411dc) SHA1(1fd53c7eadffa163d5423df2f8338757e58d5f2e) )
3516   ROM_LOAD( "136052-1124.55a", 0x010000, 0x010000, CRC(071a4309) SHA1(c623bd51d6a4a56503fbf138138854d6a30b11d6) )
3517   ROM_LOAD( "136052-3125.45a", 0x020000, 0x010000, CRC(856548ff) SHA1(e8a17b274185c5e4ecf5f9f1c211e18b3ef2456d) )
3518   ROM_LOAD( "136052-1126.30a", 0x030000, 0x010000, CRC(f46ef09c) SHA1(ba62f73ee3b33d8f26b430ffa468f8792dca23de) )
3519   ROM_LOAD( "136077-1017.45c", 0x040000, 0x010000, CRC(e93129a3) SHA1(1221b08c8efbfd8cf6bfbfd956545f10bef48663) )
3514   /* Audio ROMs - show up as bad in self-test but so do racedriv's */
3515   ROM_REGION( 0x50000, "serialroms", 0 )      /* 5*64k for audio serial ROMs */
3516   ROM_LOAD( "rdps1123.bin", 0x000000, 0x010000, CRC(a88411dc) SHA1(1fd53c7eadffa163d5423df2f8338757e58d5f2e) )
3517   ROM_LOAD( "rdps1124.bin", 0x010000, 0x010000, CRC(071a4309) SHA1(c623bd51d6a4a56503fbf138138854d6a30b11d6) )
3518   ROM_LOAD( "rdps3125.bin", 0x020000, 0x010000, CRC(856548ff) SHA1(e8a17b274185c5e4ecf5f9f1c211e18b3ef2456d) )
3519   ROM_LOAD( "rdps1126.bin", 0x030000, 0x010000, CRC(f46ef09c) SHA1(ba62f73ee3b33d8f26b430ffa468f8792dca23de) )
3520   ROM_LOAD( "rdps1017.bin", 0x040000, 0x010000, CRC(f46ef09c) SHA1(ba62f73ee3b33d8f26b430ffa468f8792dca23de) )
35203521ROM_END
35213522
35223523
src/mame/drivers/ksys573.c
r7972r7973
32263226   DISK_IMAGE_READONLY( "706jaa02", 0, SHA1(58bd06855988250028086cba6b3670372b9d96a0) )
32273227ROM_END
32283228
3229ROM_START( fmania )
3230   ROM_REGION32_LE( 0x080000, "user1", 0 )
3231   SYS573_BIOS_A
3232
3233   ROM_REGION( 0x0000224, "user2", 0 ) /* security cart eeprom */
3234   ROM_FILL( 0x000000, 0x000224, 0xff )
3235
3236   ROM_REGION( 0x1000000, "user3", 0 ) /* onboard flash */
3237   ROM_FILL( 0x0000000, 0x1000000, 0xff )
3238
3239   DISK_REGION( "cdrom0" )
3240   DISK_IMAGE_READONLY( "918xxb02", 0, SHA1(8ced8952fff3e70ce0621a491f0973af5a6ccd82) )
3241ROM_END
3242
32293243ROM_START( ddrextrm )
32303244   ROM_REGION32_LE( 0x080000, "user1", 0 )
32313245   SYS573_BIOS_A
r7972r7973
47314745GAME( 2000, ddr4mp,   sys573,   konami573, ddr,       ddrdigital, ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
47324746GAME( 2000, ddr4mps,  sys573,   konami573, ddrsolo,   ddrsolo,    ROT0, "Konami", "Dance Dance Revolution 4th Mix Plus Solo (G*A34 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
47334747GAME( 2000, dmx2m,    sys573,   konami573, dmx,       dmx,        ROT0, "Konami", "Dance Maniax 2nd Mix (G*A39 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
4748GAME( 2000, fmania,   sys573,   konami573, konami573, konami573,  ROT0, "Konami", "Fighting Mania (918 xx B02)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
47344749GAME( 2001, gtrfrk5m, sys573,   konami573, gtrfrks,   gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 5th Mix (G*A26 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
47354750GAME( 2001, ddr5m,    sys573,   konami573, ddr,       ddrdigital, ROT0, "Konami", "Dance Dance Revolution 5th Mix (G*A27 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
47364751GAME( 2001, dmx2majp, sys573,   konami573, dmx,       dmx,        ROT0, "Konami", "Dance Maniax 2nd Mix Append J-Paradise (G*A38 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */
src/mame/drivers/gunbustr.c
r7972r7973
147147    Standard value poked into MSW is 0x3c00
148148    (0x2000 and zero are written at startup)
149149
150    Three bits are written in test mode to test
151    lamps and motors:
150*/
151   if (data & 0x1000000)
152   {
153   output_set_value("Player1_Gun_Recoil",1);
154   }
155   else
156   {
157   output_set_value("Player1_Gun_Recoil",0);
158   }
152159
153    ......x. ........   Hit motor
154    .......x ........   Solenoid
155    ........ .....x..   Hit lamp
156*/
160   if (data & 0x10000)
161   {
162   output_set_value("Player2_Gun_Recoil",1);
163   }
164   else
165   {
166   output_set_value("Player2_Gun_Recoil",0);
167   }
168
169   if (data & 0x40000)
170   {
171   output_set_value("Hit_lamp",1);
172   }
173   else
174   {
175   output_set_value("Hit_lamp",0);
176   }
177
157178}
158179
159180
181
160182static READ32_HANDLER( gunbustr_gun_r )
161183{
162184   return ( input_port_read(space->machine, "LIGHT0_X") << 24) | (input_port_read(space->machine, "LIGHT0_Y") << 16) |
src/mame/drivers/taito_z.c
r7972r7973
918918      output_set_lamp_value(1, (data & 0x40) ? 1 : 0);
919919   }
920920
921   if (state->dblaxle_vibration) output_set_value("Wheel_Vibration", (data & 0x04)>>2);
921922   logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(space->cpu), data);
922923}
923924
r7972r7973
12951296   timer_set(space->machine, cpu_clocks_to_attotime(space->cpu, 10000), NULL, 0, taitoz_cpub_interrupt5);
12961297}
12971298
1299static WRITE16_HANDLER( spacegun_gun_output_w )
1300{
1301   output_set_value("Player1_Gun_Recoil",(data & 0x01));
1302   output_set_value("Player2_Gun_Recoil",(data & 0x02)>>1);
1303}
12981304
1305
12991306static READ16_HANDLER( dblaxle_steer_input_r )
13001307{
13011308   int steer = 0;
r7972r7973
13521359static WRITE16_HANDLER( chasehq_motor_w )
13531360{
13541361   /* Writes $e00000-25 and $e00200-219 */
1355
1362   switch (offset)
1363   {
1364   case 0x0:
1365   break;
1366   case 0x101:
1367   /* outputs will go here, but driver is still broken */
1368   break;
1369   }
13561370logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",cpu_get_pc(space->cpu),data,offset);
13571371
13581372}
13591373
1374
1375static WRITE16_HANDLER( nightstr_motor_w )
1376{
1377
1378   /* Despite the informative notes at the top, the high end of the word doesn't seem to output any useful data. */
1379   /* I've added this so someone else can finish it.  */
1380   switch (offset)
1381   {
1382   case 0:
1383      output_set_value("Motor_1_Direction",0);
1384      if (data & 1) output_set_value("Motor_1_Direction",1);
1385      if (data & 2) output_set_value("Motor_1_Direction",2);
1386      output_set_value("Motor_1_Speed",(data & 60)/4);
1387
1388      break;
1389
1390   case 4:
1391      output_set_value("Motor_2_Direction",0);
1392      if (data & 1) output_set_value("Motor_2_Direction",1);
1393      if (data & 2) output_set_value("Motor_2_Direction",2);
1394      output_set_value("Motor_2_Speed",(data & 60)/4);
1395
1396      break;
1397   case 8:
1398      output_set_value("Motor_3_Direction",0);
1399      if (data & 1) output_set_value("Motor_3_Direction",1);
1400      if (data & 2) output_set_value("Motor_3_Direction",2);
1401      output_set_value("Motor_3_Speed",(data & 60)/4);
1402
1403      break;
1404   default:
1405      output_set_value("motor_debug",data);
1406   }
1407
1408}
1409
1410
1411
1412
13601413static READ16_HANDLER( aquajack_unknown_r )
13611414{
13621415   return 0xff;
r7972r7973
15991652   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
16001653   AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
16011654   AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_SIZE_MEMBER(taitoz_state, spriteram, spriteram_size)
1602   AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP    /* Motor 1 (left) */
1603   AM_RANGE(0xe00008, 0xe00009) AM_WRITENOP    /* Motor 2 (center) */
1604   AM_RANGE(0xe00010, 0xe00011) AM_WRITENOP    /* Motor 3 (right) */
1655   AM_RANGE(0xe00000, 0xe00011) AM_WRITE(nightstr_motor_w)    /* Motor outputs */
16051656   AM_RANGE(0xe40000, 0xe40007) AM_READWRITE(nightstr_stick_r, bshark_stick_w)
16061657ADDRESS_MAP_END
16071658
r7972r7973
16561707   AM_RANGE(0xc0000c, 0xc0000d) AM_NOP   // interrupt controller?
16571708   AM_RANGE(0xc0000e, 0xc0000f) AM_NOP
16581709   AM_RANGE(0xc20000, 0xc20007) AM_WRITE(spacegun_pancontrol)  /* pan */
1659//  AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP    /* ??? */
1710   AM_RANGE(0xe00000, 0xe00001) AM_WRITE(spacegun_gun_output_w)    /* gun outputs */
16601711   AM_RANGE(0xf00000, 0xf00007) AM_READWRITE(spacegun_lightgun_r, spacegun_lightgun_w)
16611712ADDRESS_MAP_END
16621713
r7972r7973
48454896{
48464897   taitoz_state *state = (taitoz_state *)machine->driver_data;
48474898   state->chasehq_lamps = 0;
4899   state->dblaxle_vibration = 0;
48484900}
48494901
4902static DRIVER_INIT( dblaxle )
4903{
4904   taitoz_state *state = (taitoz_state *)machine->driver_data;
4905   state->chasehq_lamps = 0;
4906   state->dblaxle_vibration = 1;
4907}
4908
48504909static STATE_POSTLOAD( bshark_postload )
48514910{
48524911   parse_control(machine);
r7972r7973
48564915{
48574916   taitoz_state *state = (taitoz_state *)machine->driver_data;
48584917   state->chasehq_lamps = 0;
4918   state->dblaxle_vibration = 0;
48594919   state->eep_latch = 0;
48604920
48614921   state_save_register_postload(machine, bshark_postload, NULL);
r7972r7973
48664926{
48674927   taitoz_state *state = (taitoz_state *)machine->driver_data;
48684928   state->chasehq_lamps = 1;
4929   state->dblaxle_vibration = 0;
48694930}
48704931
48714932
r7972r7973
48904951GAME( 1990, aquajack,   0,        aquajack, aquajack, taitoz,   ROT0,               "Taito Corporation Japan",   "Aqua Jack (World)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
48914952GAME( 1990, aquajackj,  aquajack, aquajack, aquajckj, taitoz,   ROT0,               "Taito Corporation",         "Aqua Jack (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
48924953GAME( 1990, spacegun,   0,        spacegun, spacegun, bshark,   ORIENTATION_FLIP_X, "Taito Corporation Japan",   "Space Gun (World)", GAME_SUPPORTS_SAVE )
4893GAMEL(1991, dblaxle,    0,        dblaxle,  dblaxle,  taitoz,   ROT0,               "Taito America Corporation", "Double Axle (US)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE, layout_dblaxle )
4894GAME( 1991, pwheelsj,   dblaxle,  dblaxle,  pwheelsj, taitoz,   ROT0,               "Taito Corporation",         "Power Wheels (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
4895GAME( 1991, racingb,    0,        racingb,  dblaxle,  taitoz,   ROT0,               "Taito Corporation Japan",   "Racing Beat (World)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
4954GAMEL(1991, dblaxle,    0,        dblaxle,  dblaxle,  dblaxle,   ROT0,               "Taito America Corporation", "Double Axle (US)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE, layout_dblaxle )
4955GAME( 1991, pwheelsj,   dblaxle,  dblaxle,  pwheelsj, dblaxle,   ROT0,               "Taito Corporation",         "Power Wheels (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
4956GAME( 1991, racingb,    0,        racingb,  dblaxle,  dblaxle,   ROT0,               "Taito Corporation Japan",   "Racing Beat (World)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
src/mame/drivers/jollyjgr.c
r7972r7973
9595  The hardware is very similar to Galaxian but has some differencies, like the 3bpp bitmap addition
9696  To advance input tests, press Tilt button
9797
98TODO (Frog & Spiders):
99- Missing projectiles;
100- inputs needs to be done from scratch;
101
98102*/
99103
100104#include "emu.h"
r7972r7973
119123   tilemap_t  *bg_tilemap;
120124
121125   /* misc */
122   int      nmi_enable, flip_x, flip_y;
126   UINT8      nmi_enable, flip_x, flip_y, bitmap_disable, tilemap_bank;
123127};
124128
125129
r7972r7973
164168   state->flip_x = data & 1;
165169   state->flip_y = data & 2;
166170
171   // same for these two (used by Frog & Spiders)
172   state->bitmap_disable = data & 0x40;
173   state->tilemap_bank = data & 0x20;
174
167175   tilemap_set_flip(state->bg_tilemap, (state->flip_x ? TILEMAP_FLIPX : 0) | (state->flip_y ? TILEMAP_FLIPY : 0));
168176
169177   state->nmi_enable = data & 0x80;
r7972r7973
189197   AM_RANGE(0x8ff9, 0x8ff9) AM_READ_PORT("INPUTS")
190198   AM_RANGE(0x8ff8, 0x8ff8) AM_DEVWRITE("aysnd", ay8910_address_w)
191199   AM_RANGE(0x8ffa, 0x8ffa) AM_READ_PORT("SYSTEM") AM_DEVWRITE("aysnd", ay8910_data_w)
200   AM_RANGE(0x8ffc, 0x8ffc) AM_WRITE(jollyjgr_misc_w)
201   AM_RANGE(0x8ffd, 0x8ffd) AM_WRITE(jollyjgr_coin_lookout_w)
192202   AM_RANGE(0x8fff, 0x8fff) AM_READ_PORT("DSW2")
203   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_BASE_MEMBER(jollyjgr_state, videoram)
204   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_BASE_MEMBER(jollyjgr_state, colorram)
205   AM_RANGE(0x9840, 0x987f) AM_RAM AM_BASE_MEMBER(jollyjgr_state, spriteram)
206   AM_RANGE(0x9880, 0x9bff) AM_RAM
207   AM_RANGE(0xa000, 0xffff) AM_RAM AM_BASE_MEMBER(jollyjgr_state, bitmap)
208ADDRESS_MAP_END
209
210static ADDRESS_MAP_START( fspider_map, ADDRESS_SPACE_PROGRAM, 8 )
211   AM_RANGE(0x0000, 0x7fff) AM_ROM
212   AM_RANGE(0x8000, 0x87ff) AM_RAM
213   AM_RANGE(0x8ff8, 0x8ff8) AM_READ_PORT("DSW1")
214   AM_RANGE(0x8ff9, 0x8ff9) AM_READ_PORT("INPUTS")
215   AM_RANGE(0x8ff8, 0x8ff8) AM_DEVWRITE("aysnd", ay8910_address_w)
216   AM_RANGE(0x8ffa, 0x8ffa) AM_READ_PORT("SYSTEM") AM_DEVWRITE("aysnd", ay8910_data_w)
193217   AM_RANGE(0x8ffc, 0x8ffc) AM_WRITE(jollyjgr_misc_w)
194218   AM_RANGE(0x8ffd, 0x8ffd) AM_WRITE(jollyjgr_coin_lookout_w)
219   AM_RANGE(0x8fff, 0x8fff) AM_READ_PORT("DSW2")
195220   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_BASE_MEMBER(jollyjgr_state, videoram)
196221   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_BASE_MEMBER(jollyjgr_state, colorram)
197222   AM_RANGE(0x9840, 0x987f) AM_RAM AM_BASE_MEMBER(jollyjgr_state, spriteram)
r7972r7973
200225ADDRESS_MAP_END
201226
202227
228
203229/*************************************
204230 *
205231 *  Input ports
r7972r7973
208234
209235static INPUT_PORTS_START( jollyjgr )
210236   PORT_START("DSW1")
211   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Bonus_Life ) )
237   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:!1,!2")
212238   PORT_DIPSETTING(    0x03, "10000" )
213239   PORT_DIPSETTING(    0x02, "20000" )
214240   PORT_DIPSETTING(    0x01, "30000" )
215241   PORT_DIPSETTING(    0x00, "40000" )
216   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Free_Play ) )
242   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Free_Play ) )   PORT_DIPLOCATION("SW1:!3")
217243   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
218244   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
219   PORT_DIPNAME( 0x18, 0x10, "Timer" )
245   PORT_DIPNAME( 0x18, 0x10, "Timer" )         PORT_DIPLOCATION("SW1:!4,!5")
220246   PORT_DIPSETTING(    0x18, "2 min 20 sec" )
221247   PORT_DIPSETTING(    0x10, "2 min 40 sec" )
222248   PORT_DIPSETTING(    0x08, "3 min" )
223249   PORT_DIPSETTING(    0x00, "3 min 20 sec" )
224   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )
225   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Flip_Screen ) ) // it works only when Cabinet is set to Upright
250   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )         PORT_DIPLOCATION("SW1:!6")
251   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW1:!7") // it works only when Cabinet is set to Upright
226252   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
227253   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
228   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
254   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW1:!8")
229255   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
230256   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
231257
232258   PORT_START("DSW2")
233   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
259   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW2:!1,!2")
234260   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
235261   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
236262   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
237263   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
238   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
264   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!3,!4")
239265   PORT_DIPSETTING(    0x0c, "3" )
240266   PORT_DIPSETTING(    0x08, "4" )
241267   PORT_DIPSETTING(    0x04, "5" )
242268   PORT_DIPSETTING(    0x00, "6" )
243   PORT_DIPNAME( 0x10, 0x00, "Display Coinage" )
269   PORT_DIPNAME( 0x10, 0x00, "Display Coinage" )      PORT_DIPLOCATION("SW2:!5")
244270   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
245271   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
246   PORT_DIPNAME( 0x20, 0x00, "Display Year" )
272   PORT_DIPNAME( 0x20, 0x00, "Display Year" )      PORT_DIPLOCATION("SW2:!6")
247273   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
248274   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
249   PORT_DIPNAME( 0x40, 0x00, "No Hit" )
275   PORT_DIPNAME( 0x40, 0x00, "No Hit" )         PORT_DIPLOCATION("SW2:!7")
250276   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
251277   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
252   PORT_DIPNAME( 0x80, 0x00, "Number of Coin Switches" )
278   PORT_DIPNAME( 0x80, 0x00, "Number of Coin Switches" )   PORT_DIPLOCATION("SW2:!8")
253279   PORT_DIPSETTING(    0x80, "1" )
254280   PORT_DIPSETTING(    0x00, "2" )
255281
r7972r7973
274300   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_TILT )
275301INPUT_PORTS_END
276302
303static INPUT_PORTS_START( fspider )
304   PORT_START("DSW1")
305   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )      PORT_DIPLOCATION("SW1:!1,!2,!3,!4")
306   PORT_DIPSETTING(    0x00, DEF_STR( 9C_1C ) )
307   PORT_DIPSETTING(    0x01, DEF_STR( 8C_1C ) )
308   PORT_DIPSETTING(    0x02, DEF_STR( 7C_1C ) )
309   PORT_DIPSETTING(    0x03, DEF_STR( 6C_1C ) )
310   PORT_DIPSETTING(    0x04, DEF_STR( 5C_1C ) )
311   PORT_DIPSETTING(    0x05, DEF_STR( 4C_1C ) )
312   PORT_DIPSETTING(    0x06, DEF_STR( 3C_1C ) )
313   PORT_DIPSETTING(    0x07, DEF_STR( 2C_1C ) )
314   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
315   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
316   PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
317   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
318   PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
319   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
320   PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
321   PORT_DIPSETTING(    0x08, DEF_STR( 1C_8C ) )
322
323   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )      PORT_DIPLOCATION("SW1:!5,!6,!7,!8")
324   PORT_DIPSETTING(    0x00, DEF_STR( 9C_1C ) )
325   PORT_DIPSETTING(    0x10, DEF_STR( 8C_1C ) )
326   PORT_DIPSETTING(    0x20, DEF_STR( 7C_1C ) )
327   PORT_DIPSETTING(    0x30, DEF_STR( 6C_1C ) )
328   PORT_DIPSETTING(    0x40, DEF_STR( 5C_1C ) )
329   PORT_DIPSETTING(    0x50, DEF_STR( 4C_1C ) )
330   PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
331   PORT_DIPSETTING(    0x70, DEF_STR( 2C_1C ) )
332   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
333   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
334   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
335   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
336   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
337   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
338   PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
339   PORT_DIPSETTING(    0x80, DEF_STR( 1C_8C ) )
340
341   PORT_START("DSW2")
342   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!1,!2")
343   PORT_DIPSETTING(    0x00, "3" )
344   PORT_DIPSETTING(    0x01, "4" )
345   PORT_DIPSETTING(    0x02, "5" )
346   PORT_DIPSETTING(    0x03, "6" )
347   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW2:!3,!4")
348   PORT_DIPSETTING(    0x00, "10000" )
349   PORT_DIPSETTING(    0x04, "20000" )
350   PORT_DIPSETTING(    0x08, "30000" )
351   PORT_DIPSETTING(    0x0c, "40000" )
352   PORT_DIPNAME( 0x10, 0x10, "Display Coinage Settings" )   PORT_DIPLOCATION("SW2:!5")
353   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
354   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
355   PORT_DIPNAME( 0x20, 0x20, "Show only 1P Coinage" )   PORT_DIPLOCATION("SW2:!6")
356   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
357   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
358   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW2:!7")
359   PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
360   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
361   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Free_Play ) )   PORT_DIPLOCATION("SW2:!8")
362   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
363   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
364
365   PORT_START("INPUTS")
366   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY
367   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY
368   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_2WAY
369   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_2WAY
370   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
371   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
372   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_2WAY PORT_COCKTAIL
373   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_2WAY PORT_COCKTAIL
374
375   PORT_START("SYSTEM")
376   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 )
377   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
378   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
379   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
380   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
381   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
382   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
383   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_TILT )
384INPUT_PORTS_END
385
277386/*************************************
278387 *
279388 *  Video emulation
r7972r7973
318427{
319428   jollyjgr_state *state = (jollyjgr_state *)machine->driver_data;
320429   int color = state->colorram[((tile_index & 0x1f) << 1) | 1] & 7;
321   SET_TILE_INFO(0, state->videoram[tile_index], color, 0);
430   int region = (state->tilemap_bank & 0x20) ? 2 : 0;
431   SET_TILE_INFO(region, state->videoram[tile_index], color, 0);
322432}
323433
324434static VIDEO_START( jollyjgr )
r7972r7973
377487
378488   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
379489
380   draw_bitmap(screen->machine, bitmap);
490   if(!(state->bitmap_disable))
491      draw_bitmap(screen->machine, bitmap);
381492
382493   /* Sprites are the same as in Galaxian */
383494   for (offs = 0; offs < 0x40; offs += 4)
r7972r7973
445556static GFXDECODE_START( jollyjgr )
446557   GFXDECODE_ENTRY( "gfx1", 0, jollyjgr_charlayout,   0, 8 )
447558   GFXDECODE_ENTRY( "gfx2", 0, jollyjgr_spritelayout, 0, 8 )
559   GFXDECODE_ENTRY( "gfx3", 0, jollyjgr_charlayout,   0, 8 )
448560GFXDECODE_END
449561
450562
r7972r7973
515627   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45)
516628MACHINE_DRIVER_END
517629
630static MACHINE_DRIVER_START( fspider )
631   MDRV_IMPORT_FROM( jollyjgr )
632
633   MDRV_CPU_MODIFY("maincpu")
634   MDRV_CPU_PROGRAM_MAP(fspider_map)
635
636MACHINE_DRIVER_END
637
518638/*************************************
519639 *
520640 *  ROM definition(s)
r7972r7973
540660   ROM_LOAD( "kd11.5h",      0x0000, 0x0800, CRC(d686245c) SHA1(73567b15d9399e450121ad01ad2dcb91bedc1099) )
541661   ROM_LOAD( "kd12.7h",      0x0800, 0x0800, CRC(d69cbb4e) SHA1(f33cc161f93cae9cc314067fa2453838fa8ac3ba) )
542662
663   ROM_REGION( 0x2000, "gfx3", ROMREGION_ERASE00 )
664
543665   /* it's identical to kd14.8a, except for the first 32 bytes which are palette bytes */
544666   ROM_REGION( 0x1000, "proms", 0 )
545667   ROM_LOAD( "kd13.1f",      0x0000, 0x1000, CRC(4f4e4e13) SHA1(a8fe0e1fd354e6cc2cf65eab66882c3b98c82100) )
546668ROM_END
547669
670ROM_START( fspiderb )
671   ROM_REGION( 0x10000, "maincpu", 0 )
672   ROM_LOAD( "1.5l",   0x0000, 0x1000, CRC(3679cab1) SHA1(21c055a1e6e42dda7070452a5de9bce01fa256b1) )
673   ROM_LOAD( "2.8b",   0x7000, 0x1000, CRC(6e543acf) SHA1(45b66068654aabfe9745c8c893424a6d360a1748) )
674   ROM_LOAD( "3.8c",   0x6000, 0x1000, CRC(f74f83d9) SHA1(18fdd7ebf5096b022207de4504e254860428f469) )
675   ROM_LOAD( "4.8e",   0x5000, 0x1000, CRC(26add629) SHA1(96a2691f81ea7d0215d99c45f7f6dad4a4a6844e) )
676   ROM_LOAD( "5.8f",   0x4000, 0x1000, CRC(0457de7b) SHA1(e7a7765d971d328333e8784178762c6fe4e2d783) )
677   ROM_LOAD( "6.8h",   0x2000, 0x1000, CRC(329d4716) SHA1(898d0f3d053a8ac90c731f39c1d05769882cdcf6) )
678   ROM_LOAD( "7.8j",   0x3000, 0x1000, CRC(a7d8fc3c) SHA1(3b39155001d21e75f16196bf3c11b34fb6d5fa0b) )
679   ROM_RELOAD(         0x1000, 0x1000 )
680
681   ROM_REGION( 0x4000, "gfx_bank", 0 )
682   ROM_LOAD(  "8.1c",   0x0000, 0x1000, CRC(4e39abad) SHA1(225a2a08a7afe404e6b74789aab8c97a39a21214) )
683   ROM_LOAD(  "9.2c",   0x1000, 0x1000, CRC(04dd1604) SHA1(9e686b09e2fc59fa879fd62982adb1c681f3eb73) )
684   ROM_LOAD( "10.5h",   0x2000, 0x1000, CRC(d4bce323) SHA1(f49df8318aa9e8bd49fad1931480dfd483a0248a) )
685   ROM_LOAD( "11.7h",   0x3000, 0x1000, CRC(7ab56309) SHA1(b43f542a7359c3a4ccf6f116e3a84bd13af6876f) )
686
687   ROM_REGION( 0x1000, "gfx1", 0 )
688   ROM_COPY( "gfx_bank", 0x0000, 0x0000, 0x800)
689   ROM_COPY( "gfx_bank", 0x1000, 0x0800, 0x800)
690
691   ROM_REGION( 0x1000, "gfx2", 0 )
692   ROM_COPY( "gfx_bank", 0x2000, 0x0000, 0x800)
693   ROM_COPY( "gfx_bank", 0x3000, 0x0800, 0x800)
694
695   ROM_REGION( 0x1000, "gfx3", ROMREGION_ERASE00 )
696   ROM_COPY( "gfx_bank", 0x0800, 0x0400, 0x400)
697   ROM_COPY( "gfx_bank", 0x1800, 0x0c00, 0x400)
698//  ROM_COPY( "gfx_bank", 0x2800, 0x1000, 0x800)
699//  ROM_COPY( "gfx_bank", 0x3800, 0x1800, 0x800)
700
701   ROM_REGION( 0x1000, "proms", 0 )
702   ROM_LOAD( "82s123.1f", 0x0000, 0x0020, CRC(cda6001a) SHA1(e10fe848e8123e53bd2db8a14cfa2d8c6621d6aa) )
703ROM_END
704
705
706
548707/*************************************
549708 *
550709 *  Game driver(s)
551710 *
552711 *************************************/
553712
713GAME( 1981, fspiderb, 0, fspider, fspider, 0, ROT90,  "Taito Corporation", "Frog & Spiders (bootleg)", GAME_NOT_WORKING ) //comes from a Fawaz Group bootleg board
554714GAME( 1982, jollyjgr, 0, jollyjgr, jollyjgr, 0, ROT90, "Taito Corporation", "Jolly Jogger", GAME_SUPPORTS_SAVE )
src/mame/drivers/konamigx.c
r7972r7973
28872887   ROM_LOAD( "soccerssa.nv", 0x0000, 0x080, CRC(e3a3f3d5) SHA1(374cf5bbcc459c56ebbba5068406f6d767bcb608) )
28882888ROM_END
28892889
2890/* Vs. Net Soccer TODO:
2890/* Vs. Net Soccer TODO: Hook up ROM tests. */
28912891
2892 Redump sound ROM
2893 Hook up ROM tests.
2894
2895*/
2896
2897
28982892/* Vs. Net Soccer (ver EAD) */
28992893ROM_START( vsnetscr )
29002894   /* main program */
r7972r7973
29302924
29312925   /* sound data */
29322926   ROM_REGION( 0x400000, "shared", 0 )
2933   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, BAD_DUMP CRC(0917d7de) SHA1(f2447637b396a9c92553b2c1dbf4edecc55ccc24) ) // seems to have many bad sounds
2927   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, CRC(d70c59dd) SHA1(c33caca20611202fb489d9416083f41754b1d6e1) )
29342928ROM_END
29352929
29362930/* Vs. Net Soccer (ver EAB) */
r7972r7973
29682962
29692963   /* sound data */
29702964   ROM_REGION( 0x400000, "shared", 0 )
2971   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, BAD_DUMP CRC(0917d7de) SHA1(f2447637b396a9c92553b2c1dbf4edecc55ccc24) ) // seems to have many bad sounds
2965   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, CRC(d70c59dd) SHA1(c33caca20611202fb489d9416083f41754b1d6e1) )
29722966ROM_END
29732967
29742968/* Vs. Net Soccer (ver UAB) */
r7972r7973
30063000
30073001   /* sound data */
30083002   ROM_REGION( 0x400000, "shared", 0 )
3009   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, BAD_DUMP CRC(0917d7de) SHA1(f2447637b396a9c92553b2c1dbf4edecc55ccc24) ) // seems to have many bad sounds
3003   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, CRC(d70c59dd) SHA1(c33caca20611202fb489d9416083f41754b1d6e1) )
30103004ROM_END
30113005
30123006
r7972r7973
31703164
31713165   /* sound data */
31723166   ROM_REGION( 0x400000, "shared", 0 )
3173   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, BAD_DUMP CRC(0917d7de) SHA1(f2447637b396a9c92553b2c1dbf4edecc55ccc24) ) // seems to have many bad sounds
3167   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, CRC(d70c59dd) SHA1(c33caca20611202fb489d9416083f41754b1d6e1) )
31743168ROM_END
31753169
31763170/* Vs. Net Soccer (ver AAA) */
r7972r7973
32083202
32093203   /* sound data */
32103204   ROM_REGION( 0x400000, "shared", 0 )
3211   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, BAD_DUMP CRC(0917d7de) SHA1(f2447637b396a9c92553b2c1dbf4edecc55ccc24) ) // seems to have many bad sounds
3205   ROM_LOAD( "627a23.7r", 0x000000, 0x400000, CRC(d70c59dd) SHA1(c33caca20611202fb489d9416083f41754b1d6e1) )
32123206ROM_END
32133207
32143208/* Lethal Enforcers II */
src/mame/drivers/wldarrow.c
r7972r7973
441441   ROM_LOAD( "tms2516.k3", 0x2800, 0x0800, CRC(30904dc8) SHA1(c82276aa0eb8f48d136ad8c15dd309c9b880c294) )
442442ROM_END
443443
444ROM_START( mdrawpkra )
445   ROM_REGION( 0x10000, "maincpu", 0 )
446   ROM_LOAD( "meyco.k8", 0x0000, 0x0800, CRC(b4f6994d) SHA1(46fb2784b7b333f6755522fd27741a2fc4a4bc99) )
447   ROM_LOAD( "meyco.k7", 0x0800, 0x0800, CRC(8830365d) SHA1(044bc92880b78fa2a6ed5e133b484ac7d34c455a) )
448   ROM_LOAD( "meyco.k6", 0x1000, 0x0800, CRC(e1d5d38d) SHA1(523029185e2edc0351fa128d6494a5002cb2d7e7) )
449   ROM_LOAD( "meyco.k5", 0x1800, 0x0800, CRC(27c8dbcc) SHA1(996732b16c46460400957b3ed7bc36f537258dd7) )
450   ROM_LOAD( "meyco.k4", 0x2000, 0x0800, CRC(e3f18769) SHA1(7c98ca3f8b423200eb51ebe432591a98394ef952) )
451   ROM_LOAD( "meyco.k3", 0x2800, 0x0800, CRC(72aee07f) SHA1(a6d6086f3a6181d5111d05ae779c3f7b363c7f14) )
452ROM_END
444453
445454
446455/*************************************
r7972r7973
459468}
460469
461470
462GAME( 1982, wldarrow,  0, wldarrow, wldarrow, wldarrow, ROT0, "Meyco Games", "Wild Arrow (Standard V4.8)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
463GAME( 198?, mdrawpkr,  0, wldarrow, mdrawpkr, wldarrow, ROT0, "Meyco Games", "Draw Poker Joker's Wild", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
471GAME( 1982, wldarrow,  0,        wldarrow, wldarrow, wldarrow, ROT0, "Meyco Games", "Wild Arrow (Standard V4.8)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
472GAME( 198?, mdrawpkr,  0,        wldarrow, mdrawpkr, wldarrow, ROT0, "Meyco Games", "Draw Poker Joker's Wild (Standard)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
473GAME( 198?, mdrawpkra, mdrawpkr, wldarrow, mdrawpkr, wldarrow, ROT0, "Meyco Games", "Draw Poker Joker's Wild (02-11)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
src/mame/drivers/segas16b.c
r7972r7973
33123312   MDRV_VIDEO_START(system16b)
33133313   MDRV_VIDEO_UPDATE(system16b)
33143314
3315   MDRV_SEGA16SP_ADD_16B("segaspr1")
3316
33153317   /* sound hardware */
33163318   MDRV_SPEAKER_STANDARD_MONO("mono")
33173319
src/mame/drivers/nmk16.c
r7972r7973
71407140GAME( 1993, tdragon2a,tdragon2, tdragon2, tdragon2, 0,        ROT270, "NMK",                          "Thunder Dragon 2 (1st Oct. 1993)", GAME_NO_COCKTAIL )
71417141GAME( 1993, bigbang,  tdragon2, tdragon2, tdragon2, 0,        ROT270, "NMK",                          "Big Bang (9th Nov. 1993)", GAME_NO_COCKTAIL )
71427142
7143GAME( 1994, raphero,  0,        raphero,  raphero,  0,        ROT270, "Media Trading Corp",           "Rapid Hero", GAME_IMPERFECT_SOUND ) // 23rd July 1993 in test mode, (c)1994 on title screen
7143GAME( 1994, raphero,  0,        raphero,  raphero,  0,        ROT270, "NMK / Media Shoji",            "Rapid Hero", GAME_IMPERFECT_SOUND ) // 23rd July 1993 in test mode, (c)1994 on title screen
71447144
71457145/* both sets of both these games show a date of 9th Mar 1992 in the test mode, they look like different revisions so I doubt this is accurate */
71467146GAME( 1992, sabotenb, 0,        bjtwin,   sabotenb, nmk,      ROT0,   "NMK / Tecmo",                  "Saboten Bombers (set 1)", GAME_NO_COCKTAIL )
src/tools/unidasm.c
r7972r7973
345345   free(memory);
346346}
347347
348
349348void CLIB_DECL logerror(const char *format, ...)
350349{
351350   /* silent logerrors are allowed in disassemblers */
src/tools/chdcd.c
r7972r7973
124124{
125125   FILE *infile;
126126   int i, numtracks;
127   int chdpos=0;
127   //int chdpos=0;
128128
129129   infile = fopen(tocfname, "rt");
130130
r7972r7973
212212      hunks = (outtoc->tracks[trknum].frames+CD_FRAMES_PER_HUNK - 1) / CD_FRAMES_PER_HUNK;
213213      outtoc->tracks[trknum].extraframes = hunks * CD_FRAMES_PER_HUNK - outtoc->tracks[trknum].frames;
214214
215      chdpos+=outtoc->tracks[trknum].frames+outtoc->tracks[trknum].extraframes;
215      //chdpos+=outtoc->tracks[trknum].frames+outtoc->tracks[trknum].extraframes;
216216
217217   }
218218   /*
src/tools/srcclean.c
r7972r7973
6767
6868int main(int argc, char *argv[])
6969{
70   int removed_tabs = 0, removed_spaces = 0, fixed_mac_style = 0, fixed_nix_style = 0;
70   int removed_tabs = 0, removed_spaces = 0, fixed_mac_style = 0, fixed_nix_style = 0, added_newline = 0;
7171   int src = 0, dst = 0, in_c_comment = FALSE, in_cpp_comment = FALSE, in_c_string = FALSE;
7272   int hichars = 0;
7373   int is_c_file;
r7972r7973
232232      return 1;
233233   }
234234
235   if (is_c_file && modified[dst - 1] != 0x0a)
236   {
237      modified[dst++] = 0x0d;
238      modified[dst++] = 0x0a;
239      added_newline = 1;
240   }
241
235242   /* if the result == original, skip it */
236243   if (dst != bytes || memcmp(original, modified, bytes))
237244   {
238245      /* explain what we did */
239246      printf("Cleaned up %s:", argv[1]);
247      if (added_newline) printf(" added newline at end of file");
240248      if (removed_spaces) printf(" removed %d space(s)", removed_spaces);
241249      if (removed_tabs) printf(" removed %d tab(s)", removed_tabs);
242250      if (hichars) printf(" fixed %d high-ASCII char(s)", hichars);
src/osd/sdl/strconv.h
r7972r7973
1010#ifndef __SDLSTRCONV__
1111#define __SDLSTRCONV__
1212
13#include "osdcomm.h"
13#include "osdcore.h"
1414
1515
1616
src/osd/sdl/main.c
r7972r7973
1717#include <stdlib.h>
1818
1919// MAMEOS headers
20#include "osdcore.h"
2120#include "strconv.h"
2221
2322extern int utf8_main(int argc, char *argv[]);
src/osd/windows/winmain.c
r7972r7973
10211021   HANDLE currentThread;
10221022   BOOL result;
10231023
1024   assert_always(
1025
10261024   // parse the map file, if present
10271025   parse_map_file();
10281026
src/emu/debug/express.c
r7972r7973
19761976   char *newstring;
19771977   UINT32 hash_index;
19781978   int strindex;
1979   int all_digits, i;
1979   //int all_digits, i;
19801980
19811981//  assert_always(entry->table == table, "Mismatched symbol tables");
19821982
19831983   /* we cannot add numeric symbols */
1984   all_digits = TRUE;
1985   for (i = 0; name[i]; i++)
1986   {
1987      if (!isdigit((UINT8)name[i]))
1988      {
1989         all_digits = FALSE;
1990         break;
1991      }
1992   }
1993//  assert_always(!all_digits, "All-digit symbols are not allowed");
1984   /*
1985    all_digits = TRUE;
1986    for (i = 0; name[i]; i++)
1987    {
1988        if (!isdigit((UINT8)name[i]))
1989        {
1990            all_digits = FALSE;
1991            break;
1992        }
1993    }
1994    assert_always(!all_digits, "All-digit symbols are not allowed");
1995    */
19941996
19951997   /* see if we already have an entry and just overwrite it if we do */
19961998   oldentry = (symbol_entry *)symtable_find(table, name);
src/emu/cpu/pic16c62x/16c62xdsm.c
r7972r7973
166166   int cnt = 1;
167167   int code;
168168   int bit;
169   char *buffertmp;
169   //char *buffertmp;
170170   const char *cp;            /* character pointer in OpFormats */
171171   UINT32 flags = 0;
172172
r7972r7973
195195      sprintf(buffer,"???? dw %04Xh",code);
196196      return cnt;
197197   }
198   buffertmp = buffer;
198   //buffertmp = buffer;
199199   if (Op[op].extcode)      /* Actually, theres no double length opcodes */
200200   {
201201      bit = 29;
src/emu/cpu/m37710/m7700ds.c
r7972r7973
375375   signed char varS;
376376   int length = 1;
377377   unsigned int address;
378   unsigned int start;
378   //unsigned int start;
379379   UINT32 flags = 0;
380380
381381   pb <<= 16;
382382   address = pc | pb;
383   start = address;
383   //start = address;
384384
385385   instruction = read_8(oprom,0);
386386
src/emu/cpu/sharc/sharcdma.c
r7972r7973
141141   UINT32 src, dst;
142142   UINT32 src_count, dst_count;
143143   UINT32 src_modifier, dst_modifier;
144   int chen, tran, dtype, pmode, mswf, master, ishake, intio, ext, flsh;
144   int chen, tran, dtype, pmode, /*mswf, master,*/ ishake, intio/*, ext, flsh*/;
145145
146146   chen = (cpustate->dma[channel].control >> 1) & 0x1;
147147   tran = (cpustate->dma[channel].control >> 2) & 0x1;
148148   dtype = (cpustate->dma[channel].control >> 5) & 0x1;
149149   pmode = (cpustate->dma[channel].control >> 6) & 0x3;
150   mswf = (cpustate->dma[channel].control >> 8) & 0x1;
151   master = (cpustate->dma[channel].control >> 9) & 0x1;
150   //mswf = (cpustate->dma[channel].control >> 8) & 0x1;
151   //master = (cpustate->dma[channel].control >> 9) & 0x1;
152152   ishake = (cpustate->dma[channel].control >> 10) & 0x1;
153153   intio = (cpustate->dma[channel].control >> 11) & 0x1;
154   ext = (cpustate->dma[channel].control >> 12) & 0x1;
155   flsh = (cpustate->dma[channel].control >> 13) & 0x1;
154   //ext = (cpustate->dma[channel].control >> 12) & 0x1;
155   //flsh = (cpustate->dma[channel].control >> 13) & 0x1;
156156
157157   if (ishake)
158158      fatalerror("SHARC: dma_exec: handshake not supported");
src/emu/cpu/avr8/avr8.c
r7972r7973
194194    cpustate->io = device->space(AS_IO);
195195
196196    WRITE_IO_8(cpustate, AVR8_IO_SREG, 0);
197
198   state_save_register_device_item(device, 0, cpustate->pc);
197199}
198200
199201static CPU_EXIT( avr8 )
src/emu/cpu/dsp32/dsp32.c
r7972r7973
311311    INITIALIZATION AND SHUTDOWN
312312***************************************************************************/
313313
314static void dsp32_register_save( running_device *device )
315{
316   dsp32_state *cpustate = get_safe_token(device);
317
318   state_save_register_device_item_array(device, 0, cpustate->r);
319   state_save_register_device_item(device, 0, cpustate->pin);
320   state_save_register_device_item(device, 0, cpustate->pout);
321   state_save_register_device_item(device, 0, cpustate->ivtp);
322   state_save_register_device_item(device, 0, cpustate->nzcflags);
323   state_save_register_device_item(device, 0, cpustate->vflags);
324   state_save_register_device_item(device, 0, cpustate->pin);
325   state_save_register_device_item(device, 0, cpustate->pin);
326   state_save_register_device_item_array(device, 0, cpustate->a);
327   state_save_register_device_item(device, 0, cpustate->NZflags);
328   state_save_register_device_item(device, 0, cpustate->VUflags);
329   state_save_register_device_item_array(device, 0, cpustate->abuf);
330   state_save_register_device_item_array(device, 0, cpustate->abufreg);
331   state_save_register_device_item_array(device, 0, cpustate->abufVUflags);
332   state_save_register_device_item_array(device, 0, cpustate->abufNZflags);
333   state_save_register_device_item_array(device, 0, cpustate->abufcycle);
334   state_save_register_device_item(device, 0, cpustate->abuf_index);
335   state_save_register_device_item_array(device, 0, cpustate->mbufaddr);
336   state_save_register_device_item_array(device, 0, cpustate->mbufdata);
337   state_save_register_device_item(device, 0, cpustate->par);
338   state_save_register_device_item(device, 0, cpustate->pare);
339   state_save_register_device_item(device, 0, cpustate->pdr);
340   state_save_register_device_item(device, 0, cpustate->pdr2);
341   state_save_register_device_item(device, 0, cpustate->pir);
342   state_save_register_device_item(device, 0, cpustate->pcr);
343   state_save_register_device_item(device, 0, cpustate->emr);
344   state_save_register_device_item(device, 0, cpustate->esr);
345   state_save_register_device_item(device, 0, cpustate->pcw);
346   state_save_register_device_item(device, 0, cpustate->piop);
347   state_save_register_device_item(device, 0, cpustate->ibuf);
348   state_save_register_device_item(device, 0, cpustate->isr);
349   state_save_register_device_item(device, 0, cpustate->obuf);
350   state_save_register_device_item(device, 0, cpustate->osr);
351   state_save_register_device_item(device, 0, cpustate->lastpins);
352   state_save_register_device_item(device, 0, cpustate->ppc);
353}
354
314355static CPU_INIT( dsp32c )
315356{
316357   const dsp32_config *configdata = (const dsp32_config *)device->baseconfig().static_config;
r7972r7973
322363
323364   cpustate->device = device;
324365   cpustate->program = device->space(AS_PROGRAM);
366
367   dsp32_register_save(device);
325368}
326369
327370
src/emu/cpu/lr35902/lr35902d.c
r7972r7973
205205CPU_DISASSEMBLE( lr35902 )
206206{
207207   const lr35902dasm *d;
208   const char *symbol, *src;
208   const char /* *symbol,*/ *src;
209209   char *dst;
210210   INT8 offset = 0;
211211   UINT8 op, op1;
r7972r7973
213213   int pos = 0;
214214
215215   dst = buffer;
216   symbol = NULL;
216   //symbol = NULL;
217217
218218   op = oprom[pos++];
219219   op1 = 0; /* keep GCC happy */
src/emu/cpu/tms32010/32010dsm.c
r7972r7973
231231   int cnt = 1;
232232   int code;
233233   int bit;
234   char *buffertmp;
234   //char *buffertmp;
235235   const char *cp;            /* character pointer in OpFormats */
236236
237237   if (!OpInizialized) InitDasm32010();
r7972r7973
255255      sprintf(buffer, "dw   %04Xh *(invalid op)", code);
256256      return cnt | DASMFLAG_SUPPORTED;
257257   }
258   buffertmp = buffer;
258   //buffertmp = buffer;
259259   if (Op[op].extcode)
260260   {
261261      bit = 31;
src/emu/cpu/apexc/apexc.c
r7972r7973
805805   cpustate->device = device;
806806   cpustate->program = device->space(AS_PROGRAM);
807807   cpustate->io = device->space(AS_IO);
808
809   state_save_register_device_item(device, 0, cpustate->a);
810   state_save_register_device_item(device, 0, cpustate->r);
811   state_save_register_device_item(device, 0, cpustate->cr);
812   state_save_register_device_item(device, 0, cpustate->ml);
813   state_save_register_device_item(device, 0, cpustate->working_store);
814   state_save_register_device_item(device, 0, cpustate->current_word);
815   state_save_register_device_item(device, 0, cpustate->running);
816   state_save_register_device_item(device, 0, cpustate->pc);
808817}
809818
810819static CPU_RESET( apexc )
src/emu/cpu/tms7000/7000dasm.c
r7972r7973
361361
362362CPU_DISASSEMBLE( tms7000 )
363363{
364   int opcode, i, size = 1;
364   int opcode, i/*, size = 1*/;
365365   int pos = 0;
366366   char tmpbuf[32];
367367
r7972r7973
395395               case UI8:
396396                  a = (UINT8)opram[pos++];
397397                  buffer += sprintf(buffer, of[j].opstr[k], (unsigned int)a);
398                  size += 1;
398                  //size += 1;
399399                  break;
400400               case I8:
401401                  b = (INT8)opram[pos++];
402402                  buffer += sprintf (buffer, of[j].opstr[k], (INT8)b);
403                  size += 1;
403                  //size += 1;
404404                  break;
405405               case UI16:
406406                  c = (UINT16)opram[pos++];
407407                  c <<= 8;
408408                  c += opram[pos++];
409409                  buffer += sprintf (buffer, of[j].opstr[k], (unsigned int)c);
410                  size += 2;
410                  //size += 2;
411411                  break;
412412               case I16:
413413                  d = (INT16)opram[pos++];
414414                  d <<= 8;
415415                  d += opram[pos++];
416416                  buffer += sprintf (buffer, of[j].opstr[k], (signed int)d);
417                  size += 2;
417                  //size += 2;
418418                  break;
419419               case PCREL:
420420                  b = (INT8)opram[pos++];
421421                  sprintf(tmpbuf, "$%04X", pc+2+k+b);
422422                  buffer += sprintf (buffer, of[j].opstr[k], tmpbuf);
423                  size += 1;
423                  //size += 1;
424424                  break;
425425               case PCABS:
426426                  c = (UINT16)opram[pos++];
r7972r7973
428428                  c += opram[pos++];
429429                  sprintf(tmpbuf, "$%04X", c);
430430                  buffer += sprintf (buffer, of[j].opstr[k], tmpbuf);
431                  size += 2;
431                  //size += 2;
432432                  break;
433433               case TRAP:
434434                  vector = 0xffff - ((0xff - opcode) * 2);
src/emu/cpu/f8/f8.c
r7972r7973
19041904   cpustate->device = device;
19051905   cpustate->program = device->space(AS_PROGRAM);
19061906   cpustate->iospace = device->space(AS_IO);
1907
1908   state_save_register_device_item(device, 0, cpustate->pc0);
1909   state_save_register_device_item(device, 0, cpustate->pc1);
1910   state_save_register_device_item(device, 0, cpustate->dc0);
1911   state_save_register_device_item(device, 0, cpustate->dc1);
1912   state_save_register_device_item(device, 0, cpustate->a);
1913   state_save_register_device_item(device, 0, cpustate->w);
1914   state_save_register_device_item(device, 0, cpustate->is);
1915   state_save_register_device_item(device, 0, cpustate->dbus);
1916   state_save_register_device_item(device, 0, cpustate->io);
1917   state_save_register_device_item(device, 0, cpustate->irq_vector);
1918   state_save_register_device_item(device, 0, cpustate->irq_request);
1919   state_save_register_device_item_array(device, 0, cpustate->r);
19071920}
19081921
19091922static CPU_SET_INFO( f8 )
src/emu/cpu/asap/asap.c
r7972r7973
448448   asap->irq_callback = irqcallback;
449449   asap->device = device;
450450   asap->program = device->space(AS_PROGRAM);
451
452
453   state_save_register_device_item(device, 0, asap->pc);
454   state_save_register_device_item(device, 0, asap->pflag);
455   state_save_register_device_item(device, 0, asap->iflag);
456   state_save_register_device_item(device, 0, asap->cflag);
457   state_save_register_device_item(device, 0, asap->vflag);
458   state_save_register_device_item(device, 0, asap->znflag);
459   state_save_register_device_item(device, 0, asap->op);
460   state_save_register_device_item(device, 0, asap->ppc);
461   state_save_register_device_item(device, 0, asap->nextpc);
462   state_save_register_device_item(device, 0, asap->irq_state);
451463}
452464
453465static CPU_RESET( asap )
src/emu/cpu/i960/i960dis.c
r7972r7973
158158static char *i960_disassemble(disassemble_t *diss)
159159{
160160   unsigned char op,op2;
161   unsigned char mode, modeh, model;
161   unsigned char /*mode,*/ modeh, model;
162162   unsigned char dst,abase,reg2;
163163   unsigned short opc;
164164   unsigned long iCode;
r7972r7973
171171
172172   model = (unsigned char) (iCode >> 10) &0x3;
173173   modeh = (unsigned char) (iCode >> 12) &0x3;
174   mode = (unsigned char) (iCode >> 10) &0x7;
174   //mode = (unsigned char) (iCode >> 10) &0x7;
175175   dst = (unsigned char) (iCode >> 19) &0x1f;
176176   abase = (unsigned char) (iCode>>14)&0x1f;
177177   reg2 = (unsigned char) (iCode)&0x1f;
src/emu/cpu/tms32025/32025dsm.c
r7972r7973
394394   int cnt = 1;
395395   int code;
396396   int bit;
397   char *buffertmp;
397   //char *buffertmp;
398398   const char *cp;            /* character pointer in OpFormats */
399399
400400   if (!OpInizialized) InitDasm32025();
r7972r7973
418418      sprintf(buffer,"???? dw %04Xh",code);
419419      return cnt | DASMFLAG_SUPPORTED;
420420   }
421   buffertmp = buffer;
421   //buffertmp = buffer;
422422   if (Op[op].extcode)
423423   {
424424      bit = 31;
src/emu/cpu/pic16c5x/16c5xdsm.c
r7972r7973
155155   int cnt = 1;
156156   int code;
157157   int bit;
158   char *buffertmp;
158   //char *buffertmp;
159159   const char *cp;            /* character pointer in OpFormats */
160160   UINT32 flags = 0;
161161
r7972r7973
184184      sprintf(buffer,"???? dw %04Xh",code);
185185      return cnt;
186186   }
187   buffertmp = buffer;
187   //buffertmp = buffer;
188188   if (Op[op].extcode)      /* Actually, theres no double length opcodes */
189189   {
190190      bit = 27;
src/emu/cpu/cp1610/cp1610.c
r7972r7973
33963396   cpustate->irq_callback = irqcallback;
33973397   cpustate->device = device;
33983398   cpustate->program = device->space(AS_PROGRAM);
3399
3400   state_save_register_device_item_array(device, 0, cpustate->r);
3401   state_save_register_device_item(device, 0, cpustate->flags);
3402   state_save_register_device_item(device, 0, cpustate->intr_enabled);
3403   state_save_register_device_item(device, 0, cpustate->intr_vector);
3404   state_save_register_device_item(device, 0, cpustate->reset_state);
3405   state_save_register_device_item(device, 0, cpustate->intr_state);
3406   state_save_register_device_item(device, 0, cpustate->intrm_state);
3407   state_save_register_device_item(device, 0, cpustate->reset_pending);
3408   state_save_register_device_item(device, 0, cpustate->intr_pending);
3409   state_save_register_device_item(device, 0, cpustate->intrm_pending);
3410   state_save_register_device_item(device, 0, cpustate->mask_interrupts);
33993411}
34003412
34013413static void cp1610_set_irq_line(cp1610_state *cpustate, UINT32 irqline, int state)
src/emu/uimenu.c
r7972r7973
31233123      crosshair_user_settings settings;
31243124      crosshair_item_data *data = (crosshair_item_data *)event->itemref;
31253125      int changed = FALSE;
3126      int set_def = FALSE;
3126      //int set_def = FALSE;
31273127      int newval = data->cur;
31283128
31293129      /* retreive the user settings */
r7972r7973
31343134         /* if selected, reset to default value */
31353135         case IPT_UI_SELECT:
31363136            newval = data->defvalue;
3137            set_def = TRUE;
3137            //set_def = TRUE;
31383138            break;
31393139
31403140         /* left decrements */
src/emu/memory.c
r7972r7973
980980      /* ensure future updates to land here as well until we get back into a bank */
981981      spacerw->direct.byteend = 0;
982982      spacerw->direct.bytestart = 1;
983      if (!spacerw->debugger_access)
984         logerror("Device '%s': warning - attempt to direct-map address %s in %s space\n", space->cpu->tag(), core_i64_hex_format(overrideaddress, space->addrchars), space->name);
985983      return FALSE;
986984   }
987985
src/emu/inptport.c
r7972r7973
973973
974974time_t input_port_init(running_machine *machine, const input_port_token *tokens)
975975{
976   input_port_private *portdata;
976   //input_port_private *portdata;
977977   char errorbuf[1024];
978978   time_t basetime;
979979
980980   /* allocate memory for our data structure */
981981   machine->input_port_data = auto_alloc_clear(machine, input_port_private);
982   portdata = machine->input_port_data;
982   //portdata = machine->input_port_data;
983983
984984   /* add an exit callback and a frame callback */
985985   add_exit_callback(machine, input_port_exit);
src/emu/machine/am53cf96.c
r7972r7973
9292
9393WRITE32_HANDLER( am53cf96_w )
9494{
95   int reg, val, dma;
95   int reg, val/*, dma*/;
9696
9797   reg = offset * 2;
9898   val = data;
r7972r7973
133133   // command
134134   if (reg == REG_COMMAND)
135135   {
136      dma = (val & 0x80) ? 1 : 0;
136      //dma = (val & 0x80) ? 1 : 0;
137137      fptr = 0;
138138      switch (val & 0x7f)
139139      {
src/emu/machine/mc146818.c
r7972r7973
113113
114114static TIMER_CALLBACK( mc146818_timer )
115115{
116   int year, month;
116   int year/*, month*/;
117117
118118   if (BCD_MODE)
119119   {
r7972r7973
132132               mc146818->data[4]=0;
133133               WEEK_DAY=bcd_adjust(WEEK_DAY+1)%7;
134134               DAY=bcd_adjust(DAY+1);
135               month=bcd_2_dec(MONTH);
135               //month=bcd_2_dec(MONTH);
136136               year=bcd_2_dec(YEAR);
137137               if (mc146818->type!=MC146818_IGNORE_CENTURY) year+=bcd_2_dec(CENTURY)*100;
138138               else year+=2000; // save for julian_days_in_month calculation
src/emu/cpuexec.c
r7972r7973
19131913#ifdef UNUSED_FUNCTION
19141914static int get_register_string_max_width(running_device *device, void *baseptr, const cpu_state_entry *entry)
19151915{
1916   int leadzero = 0, width = 0, percent = 0, explicitsign = 0, reset;
1916   int /*leadzero = 0,*/ width = 0, percent = 0, explicitsign = 0, reset;
19171917   int totalwidth = 0;
19181918   const char *fptr;
19191919
r7972r7973
19271927   {
19281928      /* reset any accumulated state */
19291929      if (reset)
1930         leadzero = width = percent = explicitsign = reset = 0;
1930         /*leadzero =*/ width = percent = explicitsign = reset = 0;
19311931
19321932      /* if we're not within a format, then anything other than a % outputs directly */
19331933      if (!percent && *fptr != '%')
r7972r7973
19521952
19531953         /* 0 means insert leading 0s, unless it follows another width digit */
19541954         case '0':
1955            if (width == 0)
1956               leadzero = TRUE;
1955            if (width == 0) {
1956               //leadzero = TRUE;
1957            }
19571958            else
19581959               width *= 10;
19591960            break;
src/emu/sound/sp0256.c
r7972r7973
11061106   sp0256_state *sp = (sp0256_state *)param;
11071107   stream_sample_t *output = outputs[0];
11081108   int output_index = 0;
1109   int length, did_samp, old_idx;
1109   int length, did_samp/*, old_idx*/;
11101110
11111111   while( output_index < samples )
11121112   {
r7972r7973
11371137      /*  repeat count holds up and we have room in our scratch buffer.   */
11381138      /* ---------------------------------------------------------------- */
11391139      did_samp = 0;
1140      old_idx  = sp->sc_head;
1140      //old_idx  = sp->sc_head;
11411141      if (length > 0) do
11421142      {
11431143         int do_samp;
src/emu/sound/tms5110r.c
r7972r7973
4040#define SUBTYPE_TMS5200         8
4141#define SUBTYPE_TMS5220         16
4242#define SUBTYPE_TMS5220C      32
43#define SUBTYPE_PAT4335277      64
4344
4445/* coefficient defines */
4546#define MAX_K               10
4647#define MAX_SCALE_BITS         6
4748#define MAX_SCALE            (1<<MAX_SCALE_BITS)
4849#define COEFF_ENERGY_SENTINEL   (511)
49#define MAX_CHIRP_SIZE         51
50#define MAX_CHIRP_SIZE         52
5051
5152struct tms5100_coeffs
5253{
r7972r7973
5859   unsigned short   energytable[MAX_SCALE];
5960   unsigned short   pitchtable[MAX_SCALE];
6061   int            ktable[MAX_K][MAX_SCALE];
61   INT8         chirptable[MAX_CHIRP_SIZE];
62   INT16         chirptable[MAX_CHIRP_SIZE];
6263   INT8         interp_coeff[8];
6364};
6465
r7972r7973
120121       37, 43,   34, 33,  15, -1, -8,-18,
121122     -19,-17,   -9,-10,  -6,  0,  3,  2,
122123       1,  0,    0,  0,   0,  0,  0,  0,
123       0,  0,    0 },
124       0,  0,    0,  0 },
124125   /* interpolation coefficients */
125126   { 3, 3, 3, 2, 2, 2, 1, 0 }
126127};
r7972r7973
184185      },
185186   },
186187   /* Chirp table */
187   { 0,43,-44,51,-77,18,37,20,
188   2,-30,-58,3,96,91,5,15,
189   38,-4,-90,-91,-42,-35,-35,-3,
190   37,43,35,34,15,-1,-8,-17,
191   -19,-17,-9,-9,-6,1,4,3,
192   1,0,0,0,0,0,0,0,
193   0,0,0
194   },
188   {   0, 43,  -44, 51,-77, 18, 37, 20,
189       2,-30,  -58,  3, 96, 91,  5, 15,
190      38, -4,  -90,-91,-42,-35,-35, -3,
191      37, 43,   35, 34, 15, -1, -8,-17,
192     -19,-17,   -9, -9, -6,  1,  4,  3,
193       1,  0,    0,  0,  0,  0,  0,  0,
194       0,  0,    0,  0 },
195195   /* interpolation coefficients */
196196   { 3, 3, 3, 2, 2, 2, 1, 0 }
197197};
198198
199/* The following TMS5110A LPC coefficients were read from an actual chip by Jarek Burczynski using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still came from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
199/* The following TMS5110A LPC coefficients were directly read from an actual TMS5110A chip by Jarek Burczynski using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
200200*/
201201static const struct tms5100_coeffs tms5110a_coeff =
202202{
r7972r7973
251251   {   0,  42, -44, 50, -78, 18, 37, 20,
252252       2, -31, -59,  2,  95, 90,  5, 15,
253253      38, -4,  -91,-91, -42,-35,-36, -4,
254       37, 43,   34, 33,  15, -1, -8,-18,
254      37, 43,   34, 33,  15, -1, -8,-18,
255255     -19,-17,   -9,-10,  -6,  0,  3,  2,
256256       1,  0,    0,  0,   0,  0,  0,  0,
257       0,  0,    0 },
257       0,  0,    0,  0 },
258258   /* interpolation coefficients */
259259   { 3, 3, 3, 2, 2, 2, 1, 0 }
260260};
261261
262/* The following TMS5200/TMC0285 coefficients come from US Patent 4,335,277 and 4,581,757. However, the K10 row of coefficients are entirely missing from both of those patents.
263***These values have not yet been verified against a real TMS5200 or TMC0285***
262/* The following coefficients come from US Patent 4,335,277 and 4,581,757. However, the K10 row of coefficients are entirely missing from both of those patents.
263The K values don't match the values read from an actual TMS5200 chip, but might match the CD2501 or some other undiscovered chip?
264264*/
265265   // k* is followed by d if done transcription, c if checked for derivative aberrations
266static const struct tms5100_coeffs tms5200_coeff =
266static const struct tms5100_coeffs pat4335277_coeff =
267267{
268268   /* subtype */
269   SUBTYPE_TMS5200,
269   SUBTYPE_PAT4335277,
270270   10,
271271   4,
272272   6,
r7972r7973
313313      { -195, -117,  -32,   54,  137,  213,  279,  335 },
314314      /* K9dc  */
315315      { -122,  -55,   15,   83, 149,  210,  264,  311  },
316      /* K10  - this was entirely missing from the patent, and I've simply copied the TMS5220 one, which is wrong */
316      /* K10  - this was entirely missing from the patent, and I've simply copied the real TMS5220 one, which is wrong */
317317      { -205, -132,  -59,   14,  87,  160,  234,  307  },
318318   },
319319   /* Chirp table */
320320   {   0,  42, -44, 50, -78, 18, 37, 20,
321321       2, -31, -59,  2,  95, 90,  5, 15,
322322      38, -4,  -91,-91, -42,-35,-36, -4,
323       37, 43,   34, 33,  15, -1, -8,-18,
323      37, 43,   34, 33,  15, -1, -8,-18,
324324     -19,-17,   -9,-10,  -6,  0,  3,  2,
325325       1,  0,    0,  0,   0,  0,  0,  0,
326       0,  0,    0 },
326       0,  0,    0,  0 },
327327   /* interpolation coefficients */
328328   { 3, 3, 3, 2, 2, 2, 1, 0 }
329329};
330330
331/* The following TMS5220 coefficients come from the datasheet, and its addendum, with the exception of the energy table. The energy table is copied from the TMS5110a dump and the TMS5200 patent (which are both the same for energy), as the datasheet lists it in RMS notation which doesn't help us since I(Lord Nightmare) can't figure out the proper formula TI used for converting energy to RMS (the obvious 'take all the values in the chirp ROM, multiply them by 1/2/3/4/etc, square each one, sum them up, divide by 51, which is # of ROM entries in chirp ROM, and take the square root of the result', doesn't QUITE work. It almost does, if you add 16 to the result, for the first 4 entries, but beyond that the entries become farther and farther offset).
331/* The following TMS5200/TMC0285 coefficients were directly read from an actual TMS5200 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
332Note that the K coefficients are VERY different from the coefficients given in the US 4,335,277 patent, which may have been for some sort of prototype or otherwise intentionally scrambled. The energy and pitch tables, however, are identical to the patent.
333Also note, that the K coefficients are ALMOST identical to the coefficients from the CD2802, above. */
334static const struct tms5100_coeffs tms5200_coeff =
335{
336   /* subtype */
337   SUBTYPE_TMS5200,
338   10,
339   4,
340   6,
341   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
342   /* E */
343   { 0,   1,   2,   3,   4,   6,   8,  11,
344    16,  23,  33,  47,  63,  85, 114,  0 },
345   /* P */
346   { 0,  14,  15,  16,  17,  18,  19,  20,
347    21,  22,  23,  24,  25,  26,  27,  28,
348    29,  30,  31,  32,  34,  36,  38,  40,
349    41,  43,  45,  48,  49,  51,  54,  55,
350    57,  60,  62,  64,  68,  72,  74,  76,
351    81,  85,  87,  90,  96,  99, 103, 107,
352   112, 117, 122, 127, 133, 139, 145, 151,
353   157, 164, 171, 178, 186, 194, 202, 211 },
354   {
355      /* K1 */
356      { -501, -498, -495, -490, -485, -478, -469, -459,
357        -446, -431, -412, -389, -362, -331, -295, -253,
358        -207, -156, -102,  -45,   13,   70,  126,  179,
359         228,  272,  311,  345,  374,  399,  420,  437 },
360      /* K2 */
361      { -376, -357, -335, -312, -286, -258, -227, -195,
362        -161, -124,  -87,  -49,  -10,   29,   68,  106,
363         143,  178,  212,  243,  272,  299,  324,  346,
364         366,  384,  400,  414,  427,  438,  448,  506 },
365      /* K3 */
366      { -407, -381, -349, -311, -268, -218, -162, -102,
367         -39,   25,   89,  149,  206,  257,  302,  341 },
368      /* K4 */
369      { -290, -252, -209, -163, -114,  -62,   -9,   44,
370          97,  147,  194,  238,  278,  313,  344,  371 },
371      /* K5 */
372      { -318, -283, -245, -202, -156, -107,  -56,   -3,
373          49,  101,  150,  196,  239,  278,  313,  344 },
374      /* K6 */
375      { -193, -152, -109,  -65,  -20,   26,   71,  115,
376         158,  198,  235,  270,  301,  330,  355,  377 },
377      /* K7 */
378      { -254, -218, -180, -140,  -97,  -53,   -8,   36,
379          81,  124,  165,  204,  240,  274,  304,  332 },
380      /* K8 */
381      { -205, -112,  -10,   92,  187,  269,  336,  387 },
382      /* K9 */
383      { -249, -183, -110,  -32,   48,  126,  198,  261 },
384      /* K10 */
385      { -190, -133,  -73,  -10,   53,  115,  173,  227 },
386   },
387   /* Chirp table */
388   {   0,  42, -44, 50, -78, 18, 37, 20,
389       2, -31, -59,  2,  95, 90,  5, 15,
390      38, -4,  -91,-91, -42,-35,-36, -4,
391      37, 43,   34, 33,  15, -1, -8,-18,
392     -19,-17,   -9,-10,  -6,  0,  3,  2,
393       1,  0,    0,  0,   0,  0,  0,  0,
394       0,  0,    0,  0 },
395   /* interpolation coefficients */
396   { 3, 3, 3, 2, 2, 2, 1, 0 }
397};
398
399/* The following TMS5220 coefficients were directly read from an actual TMS5220 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
400Note: The coefficients match those from the datasheet, and its addendum, with the exception of the energy table. The energy table on the datasheet (and in the QV5220.COD from qboxpro) lists it in RMS notation which doesn't help us since I(Lord Nightmare) can't figure out the proper formula TI used for converting energy to RMS (the obvious 'take all the values in the chirp ROM, multiply them by 1/2/3/4/etc, square each one, sum them up, divide by 51, which is # of ROM entries in chirp ROM, and take the square root of the result', doesn't QUITE work. It almost does, if you add 16 to the result, for the first 4 entries, but beyond that the entries become farther and farther offset).
332401Note that all the LPC K* values match the TMS5110a table exactly.
333***These values have not yet been verified against a real TMS5220***
334402*/
335403static const struct tms5100_coeffs tms5220_coeff =
336404{
r7972r7973
341409   6,
342410   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
343411   /* E   */
344   { 0,   1,   2,   3,   4,   6,   8,   11,
345    16,  23,  33,  47,  63,  85,  114, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
412   { 0,   1,   2,   3,   4,   6,   8,  11,
413    16,  23,  33,  47,  63,  85, 114,  0 },
346414   /* P   */
347415   { 0,  15,  16,  17,  18,  19,  20,  21,
348416    22,  23,  24,  25,  26,  27,  28,  29,
r7972r7973
365433         422,  435,  445,  455,  463,  470,  476,  506 },
366434      /* K3  */
367435      { -441, -387, -333, -279, -225, -171, -117,  -63,
368          -9,   45,   98,  152,  206,  260,  314,  368 },
436          -9,   45,   98,  152,  206,  260,  314,  368 },
369437      /* K4  */
370438      { -328, -273, -217, -161, -106,  -50,    5,   61,
371439         116,  172,  228,  283,  339,  394,  450,  506  },
r7972r7973
374442          43,   90,  136,  182,  229,  275,  322,  368  },
375443      /* K6  */
376444      { -256, -212, -168, -123,  -79,  -35,   10,   54,
377          98,  143,  187,  232,  276,  320,  365,  409 },
445          98,  143,  187,  232,  276,  320,  365,  409 },
378446      /* K7  */
379447      { -308, -260, -212, -164, -117,  -69,  -21,   27,
380448          75,  122,  170,  218,  266,  314,  361,  409  },
381449      /* K8  */
382450      { -256, -161,  -66,   29,  124,  219,  314,  409  },
383451      /* K9  */
384      { -256, -176,  -96,  -15,  65,  146,  226,  307  },
452      { -256, -176,  -96,  -15,  65,  146,  226,  307  },
385453      /* K10 */
386      { -205, -132,  -59,   14,  87,  160,  234,  307  },
454      { -205, -132,  -59,   14,  87,  160,  234,  307  },
387455   },
388456   /* Chirp table */
389457   {   0,  42, -44, 50, -78, 18, 37, 20,
390458       2, -31, -59,  2,  95, 90,  5, 15,
391      38,  -4, -91,-91, -42,-35,-36, -4,
392       37,  43,  34, 33,  15, -1, -8,-18,
393     -19,- 17,  -9,-10,  -6,  0,  3,  2,
394       1,   0,   0,  0,   0,  0,  0,  0,
395       0,   0,   0 },
459      38, -4,  -91,-91, -42,-35,-36, -4,
460      37, 43,   34, 33,  15, -1, -8,-18,
461     -19,-17,   -9,-10,  -6,  0,  3,  2,
462       1,  0,    0,  0,   0,  0,  0,  0,
463       0,  0,    0,  0 },
396464   /* interpolation coefficients */
397465   { 3, 3, 3, 2, 2, 2, 1, 0 }
398466};
399467
400468/* The following TMS5220C coefficients come from the tables in QBOXPRO, a program written at least in part by George "Larry" Brantingham of Quadravox, formerly of Texas Instruments, who had laid out the silicon for the TMS5100/TMC0280/CD2801. It is the same as the TMS5220 but has a change in the energy table (is this actually correct? or is this one correct for both 5220s? or is this the wrong table and the TMS5220 one correct for both?)
401Note: the energy table in QBOXPRO is also in RMS and was not used; however the energy values are offset by -1 compared to the 5220, which has been done here. the '152' is an educated guess.
402Note: the pitch table is the same as TMS5220 but with +1 applied to each value, and the first and second values the same, as shown in QV5220.COD.
469Note: the energy table in QV5220.COD is also in RMS and was not used (it also may well be incorrect; the values in QV5220.COD have an offset by one index which looks wrong), instead the table from the 5200/5220 is used here.
403470Note: the Kx tables are taken directly from QV5220.COD but with /64 added to each value as the values are stored ranging from -32768 to 32767 in QBOXPRO instead of -512 to 511 as on the real chip.
404471***These values have not yet been verified against a real TMS5220C, see below as for why***
405472This has not yet been verified against a real TMS5220C, and doing so will require decapping one as the TMS5220C, unlike the TMS5220, has a nonfunctional PROMOUT pin. This makes reading the internal LPC tables out electronically (via PROMOUT) impossible.
r7972r7973
413480   6,
414481   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
415482   /* E   */
416   { 0,   2,   3,   4,   6,   8,   11,   16, // first value is really 1, but must be 0 for zero energy frames to work properly
417    23,  33,  47,  63,  85,  114, 152, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
483   { 0,   1,   2,   3,   4,   6,   8,  11,
484    16,  23,  33,  47,  63,  85, 114,  0 },
418485   //{ 0x0d,  0x16,  0x20,  0x2d,  0x40,  0x5b,  0x81,  0xb6,
419   // 0x101, 0x16c, 0x202, 0x2d6, 0x402, 0x5a9, 0x7ff, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
486   // 0x101, 0x16c, 0x202, 0x2d6, 0x402, 0x5a9, 0x7ff, 0 }, /* values from 5220_10.bin code for the tms50c10 */
420487   /* P   */
421488   { 0,  16,  17,  18,  19,  20,  21,  22, // first value is 16 in QV5220.COD but must be 0 for unvoiced speech to work properly
422489    23,  24,  25,  26,  27,  28,  29,  30,
r7972r7973
463530   {   0,  42, -44, 50, -78, 18, 37, 20,
464531       2, -31, -59,  2,  95, 90,  5, 15,
465532      38, -4,  -91,-91, -42,-35,-36, -4,
466       37, 43,   34, 33,  15, -1, -8,-18,
533      37, 43,   34, 33,  15, -1, -8,-18,
467534     -19,-17,   -9,-10,  -6,  0,  3,  2,
468535       1,  0,    0,  0,   0,  0,  0,  0,
469       0,  0,    0 },
536       0,  0,    0,  0 },
470537   /* interpolation coefficients */
471538   { 3, 3, 3, 2, 2, 2, 1, 0 }
472};
No newline at end of file
539};
src/emu/sound/aica.c
r7972r7973
66    - No FM mode
77    - A third sample format (ADPCM) has been added
88    - Some minor other tweeks (no EGHOLD, slighly more capable DSP)
9
10    init:
11
129*/
1310
1411#include "emu.h"
r7972r7973
8380               14800.0,12700.0,11100.0,8900.0,7400.0,6300.0,5500.0,4400.0,3700.0,3200.0,2800.0,2200.0,1800.0,1600.0,1400.0,1100.0,
8481               920.0,790.0,690.0,550.0,460.0,390.0,340.0,270.0,230.0,200.0,170.0,140.0,110.0,98.0,85.0,68.0,57.0,49.0,43.0,34.0,
8582               28.0,25.0,22.0,18.0,14.0,12.0,11.0,8.5,7.1,6.1,5.4,4.3,3.6,3.1};
86static UINT32 FNS_Table[0x400];
8783static INT32 EG_TABLE[0x400];
8884
8985typedef enum {ATTACK,DECAY1,DECAY2,RELEASE} _STATE;
r7972r7973
125121   int curstep;
126122   int cur_lpquant, cur_lpsample, cur_lpstep;
127123   UINT8 *adbase, *adlpbase;
128   UINT8 mslc;         // monitored?
124   UINT8 lpend;
129125};
130126
131127
r7972r7973
346342
347343static void Compute_EG(aica_state *AICA,struct _SLOT *slot)
348344{
349   int octave=OCT(slot);
345   int octave=(OCT(slot)^8)-8;
350346   int rate;
351   if(octave&8) octave=octave-16;
352347   if(KRS(slot)!=0xf)
353348      rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
354349   else
r7972r7973
372367         slot->EG.volume+=slot->EG.AR;
373368         if(slot->EG.volume>=(0x3ff<<EG_SHIFT))
374369         {
375            if (!LPSLNK(slot))
370            if (!LPSLNK(slot) && slot->EG.D1R)
376371            {
377372               slot->EG.state=DECAY1;
378               if(slot->EG.D1R>=(1024<<EG_SHIFT)) //Skip DECAY1, go directly to DECAY2
373               if(slot->EG.D1R>=(1024<<EG_SHIFT) && slot->EG.D2R) //Skip DECAY1, go directly to DECAY2
379374                  slot->EG.state=DECAY2;
380375            }
381376            slot->EG.volume=0x3ff<<EG_SHIFT;
r7972r7973
414409
415410static UINT32 AICA_Step(struct _SLOT *slot)
416411{
417   int octave=OCT(slot);
418   UINT32 Fn;
419
420   Fn=(FNS_Table[FNS(slot)]);   //24.8
421   if(octave&8)
422      Fn>>=(16-octave);
423   else
412   int octave=(OCT(slot)^8)-8+SHIFT-10;
413   UINT32 Fn=FNS(slot) + (0x400);
414   if (octave >= 0)
424415      Fn<<=octave;
425
426   return Fn/(44100);
416   else
417      Fn>>=-octave;
418   return Fn;
427419}
428420
429421
r7972r7973
474466
475467   if (PCMS(slot) >= 2)
476468   {
477      UINT8 *base;
478      UINT32 curstep, steps_to_go;
479
480469      slot->curstep = 0;
481470      slot->adbase = (unsigned char *) (AICA->AICARAM+((SA(slot))&0x7fffff));
482471      InitADPCM(&(slot->cur_sample), &(slot->cur_quant));
483472      InitADPCM(&(slot->cur_lpsample), &(slot->cur_lpquant));
484473
485      // walk to the ADPCM state at LSA
486      curstep = 0;
487      base = slot->adbase;
488      steps_to_go = LSA(slot);
489
490      while (curstep < steps_to_go)
474      // on real hardware this creates undefined behavior.
475      if (LSA(slot) > LEA(slot))
491476      {
492         int shift1, delta1;
493         shift1 = 4*((curstep&1));
494         delta1 = (*base>>shift1)&0xf;
495         DecodeADPCM(&(slot->cur_lpsample),delta1,&(slot->cur_lpquant));
496         curstep++;
497         if (!(curstep & 1))
498         {
499            base++;
500         }
477         slot->udata.data[0xc/2] = 0xffff;
501478      }
502
503      slot->cur_lpstep = curstep;
504      slot->adlpbase = base;
505479   }
506480}
507481
r7972r7973
514488   else
515489   {
516490      slot->active=0;
491      slot->lpend = 1;
517492   }
518493   slot->udata.data[0]&=~0x4000;
519494}
r7972r7973
551526
552527   for(i=0;i<0x400;++i)
553528   {
554      float fcent=(double) 1200.0*log_base_2((double)(((double) 1024.0+(double)i)/(double)1024.0));
555      fcent=(double) 44100.0*pow(2.0,fcent/1200.0);
556      FNS_Table[i]=(float) (1<<SHIFT) *fcent;
557   }
558
559   for(i=0;i<0x400;++i)
560   {
561529      float envDB=((float)(3*(i-0x3ff)))/32.0;
562530      float scale=(float)(1<<SHIFT);
563531      EG_TABLE[i]=(INT32)(pow(10.0,envDB/20.0)*scale);
r7972r7973
642610      AICA->Slots[i].active=0;
643611      AICA->Slots[i].base=NULL;
644612      AICA->Slots[i].EG.state=RELEASE;
645      AICA->Slots[i].mslc=0;
613      AICA->Slots[i].lpend=1;
646614   }
647615
648616   AICALFO_Init(device->machine);
r7972r7973
673641               {
674642                  if(KEYONB(s2) && s2->EG.state==RELEASE/*&& !s2->active*/)
675643                  {
676                     if(s2->mslc) AICA->udata.data[0x10] &= 0x7FFF; // reset LP at KEY_ON
644                     s2->lpend = 0;
677645                     AICA_StartSlot(AICA, s2);
678646                     #if 0
679647                     printf("StartSlot[%02X]:   SSCTL %01X SA %06X LSA %04X LEA %04X PCMS %01X LPCTL %01X\n",sl,SSCTL(s2),SA(s2),LSA(s2),LEA(s2),PCMS(s2),LPCTL(s2));
r7972r7973
868836      case 0x10:   // LP check
869837      case 0x11:
870838         {
871            //int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f;   // which slot are we monitoring?
839            int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f;   // which slot are we monitoring?
840            if (!(AFSEL(AICA)))
841            {
842               struct _SLOT *slot=AICA->Slots + MSLC;
843               UINT16 LP;
844               UINT16 SGC;
845               int EG;
846
847               LP = slot->lpend ? 0x8000 : 0x0000;
848               slot->lpend = 0;
849               SGC = (slot->EG.state << 13) & 0x6000;
850               EG = slot->active ? slot->EG.volume : 0;
851               EG >>= (EG_SHIFT - 13);
852               EG = 0x1FFF - EG;
853               if (EG < 0) EG = 0;
854
855               AICA->udata.data[0x10/2] = (EG & 0x1FF8) | SGC | LP;
856            }
872857         }
873858         break;
874859
r7972r7973
965950      {
966951         AICA_UpdateRegR(AICA, addr&0xff);
967952         v= *((unsigned short *) (AICA->udata.datab+((addr&0xff))));
968         if((addr&0xfe)==0x10) AICA->udata.data[0x10/2] &= 0x7FFF;   // reset LP on read
953         if((addr&0xfffe)==0x2810) AICA->udata.data[0x10/2] &= 0x7FFF;   // reset LP on read
969954      }
970955      else if (addr == 0x2d00)
971956      {
r7972r7973
10921077         // seek to the interpolation sample
10931078         while (curstep < steps_to_go)
10941079         {
1095            int shift1, delta1;
1096            shift1 = 4*((curstep&1));
1097            delta1 = (*base>>shift1)&0xf;
1080            int shift1 = 4 & (curstep << 2);
1081            unsigned char delta1 = (*base>>shift1)&0xf;
10981082            DecodeADPCM(&(slot->cur_sample),delta1,&(slot->cur_quant));
1099            curstep++;
1100            if (!(curstep & 1))
1101            {
1083            if (!(++curstep & 1))
11021084               base++;
1103            }
11041085            if (curstep == addr1)
11051086               cur_sample = slot->cur_sample;
1087            if (curstep == LSA(slot))
1088            {
1089               slot->cur_lpsample = slot->cur_sample;
1090               slot->cur_lpquant = slot->cur_quant;
1091            }
11061092         }
11071093         nxt_sample = slot->cur_sample;
11081094
r7972r7973
11281114
11291115   if(addr1>=LSA(slot))
11301116   {
1131      if(LPSLNK(slot) && slot->EG.state==ATTACK)
1117      if(LPSLNK(slot) && slot->EG.state==ATTACK && slot->EG.D1R)
11321118         slot->EG.state = DECAY1;
11331119   }
11341120
r7972r7973
11401126      case 0:   //no loop
11411127         if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=LEA(slot))
11421128         {
1143         //slot->active=0;
1144         if(slot->mslc) AICA->udata.data[8] |= 0x8000;
1145         AICA_StopSlot(slot,0);
1129            AICA_StopSlot(slot,0);
11461130         }
11471131         break;
11481132      case 1: //normal loop
11491133         if(*addr[addr_select]>=LEA(slot))
11501134         {
1151            if(slot->mslc) AICA->udata.data[8] |= 0x8000;
1135            slot->lpend = 1;
11521136            rem_addr = *slot_addr[addr_select] - (LEA(slot)<<SHIFT);
11531137            *slot_addr[addr_select]=(LSA(slot)<<SHIFT) + rem_addr;
11541138
r7972r7973
11811165   else
11821166      sample=(sample*EG_TABLE[EG_Update(slot)>>(SHIFT-10)])>>SHIFT;
11831167
1184   if(slot->mslc)
1185   {
1186      AICA->udata.data[0x14/2] = addr1;
1187      if (!(AFSEL(AICA)))
1188      {
1189         UINT16 res;
1190
1191         AICA->udata.data[0x10/2] |= slot->EG.state<<13;
1192
1193         res = 0x3FF - (slot->EG.volume>>EG_SHIFT);
1194
1195         res *= 959;
1196         res /= 1024;
1197
1198         if (res > 959) res = 959;
1199
1200         AICA->udata.data[0x10/2] = res;
1201      }
1202   }
1203
12041168   return sample;
12051169}
12061170
r7972r7973
12221186      for(sl=0;sl<64;++sl)
12231187      {
12241188         struct _SLOT *slot=AICA->Slots+sl;
1225         slot->mslc = (MSLC(AICA)==sl);
12261189         RBUFDST=AICA->RINGBUF+AICA->BUFPTR;
12271190         if(AICA->Slots[sl].active)
12281191         {
r7972r7973
12981261   }
12991262}
13001263
1301#ifdef UNUSED_FUNCTION
13021264static DEVICE_STOP( aica )
13031265{
13041266}
1305#endif
13061267
13071268void aica_set_ram_base(running_device *device, void *base, int size)
13081269{
r7972r7973
13641325
13651326      /* --- the following bits of info are returned as pointers to data or functions --- */
13661327      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME( aica );   break;
1328      case DEVINFO_FCT_STOP:                  info->start = DEVICE_STOP_NAME( aica );   break;
13671329
13681330      /* --- the following bits of info are returned as NULL-terminated strings --- */
13691331      case DEVINFO_STR_NAME:                  strcpy(info->s, "AICA");               break;
src/emu/sound/ymf271.c
r7972r7973
12251225   int slotnum;
12261226   int slot_group;
12271227   int sync_mode, sync_reg;
1228   YMF271Slot *slot;
1228   //YMF271Slot *slot;
12291229
12301230   slotnum = 12*grp;
12311231   slotnum += fm_tab[adr & 0xf];
1232   slot = &chip->slots[slotnum];
1232   //slot = &chip->slots[slotnum];
12331233   slot_group = fm_tab[adr & 0xf];
12341234
12351235   reg = (adr >> 4) & 0xf;
src/emu/sound/cdda.c
r7972r7973
5353
5454static DEVICE_START( cdda )
5555{
56   const struct CDDAinterface *intf;
56   //const struct CDDAinterface *intf;
5757   cdda_info *info = get_safe_token(device);
5858
5959   /* allocate an audio cache */
6060   info->audio_cache = auto_alloc_array( device->machine, UINT8, CD_MAX_SECTOR_DATA * MAX_SECTORS );
6161
62   intf = (const struct CDDAinterface *)device->baseconfig().static_config;
62   //intf = (const struct CDDAinterface *)device->baseconfig().static_config;
6363
6464   info->stream = stream_create(device, 0, 2, 44100, info, cdda_update);
6565
src/emu/sound/scsp.c
r7972r7973
2323    * December 16, 2007 (kingshriek) Many EG bug fixes, implemented effects mixer,
2424                             implemented FM.
2525    * January 5, 2008   (kingshriek+RB) Working, good-sounding FM, removed obsolete non-USEDSP code.
26    * April 22, 2009   ("PluginNinja") Improved slot monitor, misc cleanups
2627*/
2728
2829#include "emu.h"
r7972r7973
108109               14800.0,12700.0,11100.0,8900.0,7400.0,6300.0,5500.0,4400.0,3700.0,3200.0,2800.0,2200.0,1800.0,1600.0,1400.0,1100.0,
109110               920.0,790.0,690.0,550.0,460.0,390.0,340.0,270.0,230.0,200.0,170.0,140.0,110.0,98.0,85.0,68.0,57.0,49.0,43.0,34.0,
110111               28.0,25.0,22.0,18.0,14.0,12.0,11.0,8.5,7.1,6.1,5.4,4.3,3.6,3.1};
111static UINT32 FNS_Table[0x400];
112112static INT32 EG_TABLE[0x400];
113113
114114typedef enum {ATTACK,DECAY1,DECAY2,RELEASE} _STATE;
r7972r7973
389389
390390static void Compute_EG(struct _SCSP *SCSP,struct _SLOT *slot)
391391{
392   int octave=OCT(slot);
392   int octave=(OCT(slot)^8)-8;
393393   int rate;
394   if(octave&8) octave=octave-16;
395394   if(KRS(slot)!=0xf)
396395      rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
397396   else
r7972r7973
460459
461460static UINT32 SCSP_Step(struct _SLOT *slot)
462461{
463   int octave=OCT(slot);
464   UINT64 Fn;
465
466   Fn=(FNS_Table[FNS(slot)]);   //24.8
467   if(octave&8)
468      Fn>>=(16-octave);
462   int octave=(OCT(slot)^8)-8+SHIFT-10;
463   UINT32 Fn=FNS(slot)+(1 << 10);
464   if (octave >= 0)
465   {
466      Fn<<=octave;
467   }
469468   else
470      Fn<<=octave;
469   {
470      Fn>>=-octave;
471   }
471472
472   return Fn/(44100);
473   return Fn;
473474}
474475
475476
r7972r7973
496497   slot->EG.volume=0x17F<<EG_SHIFT;
497498   slot->Prev=0;
498499   slot->Backwards=0;
500
499501   Compute_LFO(slot);
500502
501503//  printf("StartSlot[%p]: SA %x PCM8B %x LPCTL %x ALFOS %x STWINH %x TL %x EFSDL %x\n", slot, SA(slot), PCM8B(slot), LPCTL(slot), ALFOS(slot), STWINH(slot), TL(slot), EFSDL(slot));
r7972r7973
522524
523525   memset(SCSP,0,sizeof(*SCSP));
524526
527   SCSPDSP_Init(&SCSP->DSP);
528
525529   SCSP->device = device;
526530   SCSP->IrqTimA = SCSP->IrqTimBC = SCSP->IrqMidi = 0;
527531   SCSP->MidiR=SCSP->MidiW=0;
r7972r7973
552556
553557   for(i=0;i<0x400;++i)
554558   {
555      //float fcent=(double) 1200.0*log_base_2((1024.0+(double)i)/1024.0);
556      //fcent=(double) 44100.0*pow(2.0,fcent/1200.0);
557      float fcent=44100.0f*(1024.0f+(float)i)/1024.0f;
558      FNS_Table[i]=(float) (1<<SHIFT) *fcent;
559   }
560
561   for(i=0;i<0x400;++i)
562   {
563559      float envDB=((float)(3*(i-0x3ff)))/32.0f;
564560      float scale=(float)(1<<SHIFT);
565561      EG_TABLE[i]=(INT32)(pow(10.0,envDB/20.0)*scale);
r7972r7973
643639      SCSP->Slots[i].slot=i;
644640      SCSP->Slots[i].active=0;
645641      SCSP->Slots[i].base=NULL;
642      SCSP->Slots[i].EG.state=RELEASE;
646643   }
647644
648645   LFO_Init(device->machine);
r7972r7973
856853      case 8:
857854      case 9:
858855         {
859            unsigned char slot=SCSP->udata.data[0x8/2]>>11;
860            unsigned int CA=SCSP->Slots[slot&0x1f].cur_addr>>(SHIFT+12);
861            SCSP->udata.data[0x8/2]&=~(0x780);
862            SCSP->udata.data[0x8/2]|=CA<<7;
856            // MSLC     |  CA   |SGC|EG
857            // f e d c b a 9 8 7 6 5 4 3 2 1 0
858            unsigned char MSLC=(SCSP->udata.data[0x8/2]>>11)&0x1f;
859            struct _SLOT *slot=SCSP->Slots + MSLC;
860            unsigned int SGC = (slot->EG.state) & 3;
861            unsigned int CA = (slot->cur_addr>>(SHIFT+12)) & 0xf;
862            unsigned int EG = (0x1f - (slot->EG.volume>>(EG_SHIFT+5))) & 0x1f;
863            SCSP->udata.data[0x8/2] =  (MSLC << 11) | (CA << 7) | (SGC << 5) | EG;
863864         }
864865         break;
865866
r7972r7973
905906      else if(addr<0x800)
906907         *((unsigned short *) (SCSP->DSP.MADRS+(addr-0x780)/2))=val;
907908      else if(addr<0xC00)
909      {
908910         *((unsigned short *) (SCSP->DSP.MPRO+(addr-0x800)/2))=val;
909911
910      if(addr==0xBF0)
911      {
912         SCSPDSP_Start(&SCSP->DSP);
912         if(addr==0xBF0)
913         {
914            SCSPDSP_Start(&SCSP->DSP);
915             }
913916      }
914917   }
915918}
r7972r7973
10691072      }
10701073   }
10711074
1072   if(ALFOS(slot)!=0)
1075   if(!SDIR(slot))
10731076   {
1074      sample=sample*ALFO_Step(&(slot->ALFO));
1075      sample>>=SHIFT;
1077      if(ALFOS(slot)!=0)
1078      {
1079         sample=sample*ALFO_Step(&(slot->ALFO));
1080         sample>>=SHIFT;
1081      }
1082
1083      if(slot->EG.state==ATTACK)
1084         sample=(sample*EG_Update(slot))>>SHIFT;
1085      else
1086         sample=(sample*EG_TABLE[EG_Update(slot)>>(SHIFT-10)])>>SHIFT;
10761087   }
10771088
1078   if(slot->EG.state==ATTACK)
1079      sample=(sample*EG_Update(slot))>>SHIFT;
1080   else
1081      sample=(sample*EG_TABLE[EG_Update(slot)>>(SHIFT-10)])>>SHIFT;
1082
10831089   if(!STWINH(slot))
10841090   {
1085      unsigned short Enc=((TL(slot))<<0x0)|(0x7<<0xd);
1086      *RBUFDST=(sample*SCSP->LPANTABLE[Enc])>>(SHIFT+1);
1091      if(!SDIR(slot))
1092      {
1093         unsigned short Enc=((TL(slot))<<0x0)|(0x7<<0xd);
1094         *RBUFDST=(sample*SCSP->LPANTABLE[Enc])>>(SHIFT+1);
1095      }
1096      else
1097      {
1098         unsigned short Enc=(0<<0x0)|(0x7<<0xd);
1099         *RBUFDST=(sample*SCSP->LPANTABLE[Enc])>>(SHIFT+1);
1100      }
10871101   }
10881102
10891103   return sample;
r7972r7973
11181132
11191133            sample=SCSP_UpdateSlot(SCSP, slot);
11201134
1121#ifdef USEDSP
11221135            Enc=((TL(slot))<<0x0)|((IMXL(slot))<<0xd);
11231136            SCSPDSP_SetSample(&SCSP->DSP,(sample*SCSP->LPANTABLE[Enc])>>(SHIFT-2),ISEL(slot),IMXL(slot));
1124#endif
11251137            Enc=((TL(slot))<<0x0)|((DIPAN(slot))<<0x8)|((DISDL(slot))<<0xd);
11261138            {
11271139               smpl+=(sample*SCSP->LPANTABLE[Enc])>>SHIFT;
src/emu/sound/s14001a.c
r7972r7973
552552static STREAM_UPDATE( s14001a_pcm_update )
553553{
554554   INT32 mix[48000];
555   INT32 *mixp;
555   //INT32 *mixp;
556556   S14001AChip *chip = (S14001AChip *)param;
557557   int i;
558558
559559   memset(mix, 0, sizeof(mix));
560560
561   mixp = &mix[0];
561   //mixp = &mix[0];
562562   for (i = 0; i < samples; i++)
563563   {
564564      s14001a_clock(chip);
src/emu/sound/okim6376.c
r7972r7973
386386   if (info->command != -1)
387387   {
388388      int temp = data >> 4, i, start;
389      unsigned char *base, *base_end;
389      unsigned char *base/*, *base_end*/;
390390
391391
392392      /* FIX: Check if it's possible to start multiple voices at the same time */
r7972r7973
405405
406406            /* determine the start position, max address space is 16Mbit */
407407            base = &info->region_base[info->command * 4];
408            base_end = &info->region_base[(MAX_WORDS+1) * 4];
408            //base_end = &info->region_base[(MAX_WORDS+1) * 4];
409409            start = ((base[0] << 16) + (base[1] << 8) + base[2]) & 0x1fffff;
410410
411411            if (start == 0)
src/emu/sound/vrender0.c
r7972r7973
108108   const vr0_interface *intf;
109109   vr0_state *VR0 = get_safe_token(device);
110110
111   intf=(const vr0_interface *)device->baseconfig().static_config;
111   intf = (const vr0_interface *)device->baseconfig().static_config;
112112
113113   memcpy(&(VR0->Intf),intf,sizeof(vr0_interface));
114114   memset(VR0->SOUNDREGS,0,sizeof(VR0->SOUNDREGS));
115115
116116   VR0->stream = stream_create(device, 0, 2, 44100, VR0, VR0_Update);
117
118   state_save_register_device_item_array(device, 0, VR0->SOUNDREGS);
117119}
118120
119121WRITE32_DEVICE_HANDLER(vr0_snd_write)
src/emu/sound/tms5220.c
r7972r7973
1414     Preliminary MASSIVE merge of tms5110 and tms5220 cores by Lord Nightmare
1515     Lattice Filter, Multiplier, and clipping redone by Lord Nightmare
1616     TMS5220C multi-rate feature added by Lord Nightmare
17     Massive rewrite and reorganization by Lord Nightmare
1718
1819     Much information regarding these lpc encoding comes from US patent 4,209,844
1920     US patent 4,331,836 describes the complete 51xx chip
r7972r7973
4243TI's naming has D7 as LSB and D0 as MSB and is in uppercase
4344
4445TODO:
45    Implement a ready callback for pc interfaces
46    * Implement a ready callback for pc interfaces
4647    - this will be quite a challenge since for it to be really accurate
4748      the whole emulation has to run in sync (lots of timers) with the
4849      cpu cores.
49    If a command is still executing, /READY will be kept high until the command has
50    finished if the next command is written.
51    tomcat has a 5220 which is not hooked up at all
50    * If a command is still executing, /READY will be kept high until the command has
51      finished if the next command is written.
52    * tomcat has a 5220 which is not hooked up at all
53    * documentation is inconsistent in the patents about what data is returned for chirp rom addresses (base 0) 41 to 51; the patent says the 'rom returns zeroes for locations beyond 40', but at the same time the rom stores the complement of the actual chirp rom value, so are locations beyond 40 = 0x00(0) or = 0xFF(-1)? The latter seems more likely to me, and that is how it is currently implemented. (LN).
54    * Is the TS=0 forcing energy to 0 for next frame in the interpolator actually correct?
5255
56Pedantic detail from observation of real chip:
57The 5200 and 5220 chips outputs the following coefficients over PROMOUT while
58'idle' and not speaking, in this order:
59e[0 or f] p[0] k1[0] k2[0] k3[0] k4[0] k5[f] k6[f] k7[f] k8[7] k9[7] k10[7]
60
61Driver specific notes:
62
63    Looping has the tms5220 hookep up directly to the cpu. However currently the
64    tms9900 cpu core does not support a ready line.
65
66    Victory's initial audio selftest is pretty brutal to the FIFO: it sends a
67    sequence of bytes to the FIFO and checks the status bits after each one; if
68    even one bit is in the wrong state (i.e. speech starts one byte too early or
69    late), the test fails!
70    The sample in Victory 'Shields up!' after you activate shields, the 'up' part
71    of the sample is missing the STOP frame at the end of it; this causes the
72    speech core to run out of bits to parse from the FIFO, cutting the sample off
73    by one frame. This appears to be an original game code bug.
74
5375Progress list for drivers using old vs new interface:
5476starwars: uses new interface (couriersud)
55gauntlet: uses new interface (couriersud
77gauntlet: uses new interface (couriersud)
5678atarisy1: uses new interface (Lord Nightmare)
5779atarisy2: uses new interface (Lord Nightmare)
5880atarijsa: uses new interface (Lord Nightmare)
5981firefox: uses new interface (couriersud)
6082mhavoc: uses old interface, and is in the machine file instead of the driver.
61monymony(zaccaria.c): uses new interface (couriersud)
83monymony/jackrabt(zaccaria.c): uses new interface (couriersud)
6284victory(audio/exidy.c): uses new interface (couriersud)
6385looping: uses old interface
6486portraits: uses *NO* interface; the i/o cpu hasn't been hooked to anything!
6587dotron and midwayfb(mcr.c): uses old interface
6688
67Notes:
68    Looping has the tms5220 hookep up directly to the cpu. However currently the
69    tms9900 cpu core does not support a ready line.
70
7189    Email from Lord Nightmare having a lot more detail follows:
7290
7391    Yes, there is at least two more differences:
r7972r7973
175193   between current and target to the current each frame */
176194#undef OVERRIDE_INTERPOLATION
177195
178/* defines how many times to leftshift the chirp rom before feeding to the lattice filter. default is 0 */
179#define CHIRPROM_LEFTSHIFT 0
180
181196/* *****debugging defines***** */
182197#undef VERBOSE
183// above is general, somewhat obsolete
198// above is general, somewhat obsolete, catch all for debugs which don't fit elsewhere
199#undef DEBUG_DUMP_INPUT_DATA
200// above dumps the data input to the tms52xx to stdout, useful for making logged data dumps for real hardware tests
184201#undef DEBUG_FIFO
185202// above debugs fifo stuff: writes, reads and flag updates
186#undef DEBUG_FRAME_DUMP
187// above dumps the contents of each decoded speech frame as hex
188#undef DEBUG_FRAME_INFO
189// above dumps information about each decoded speech frame
203#undef DEBUG_PARSE_FRAME_DUMP
204// above dumps each frame to stderr: be sure to select one of the options below if you define it!
205#undef DEBUG_PARSE_FRAME_DUMP_BIN
206// dumps each speech frame as binary
207#undef DEBUG_PARSE_FRAME_DUMP_HEX
208// dumps each speech frame as hex
190209#undef DEBUG_FRAME_ERRORS
191210// above dumps info if a frame ran out of data
192211#undef DEBUG_COMMAND_DUMP
r7972r7973
195214// above spams the errorlog with i/o ready messages whenever the ready or irq pin is read
196215#undef DEBUG_GENERATION
197216// above dumps some debug information related to the sample generation loop, i.e. when ramp frames happen
217#undef DEBUG_GENERATION_VERBOSE
218// above dumps MUCH MORE debug information related to the sample generation loop, namely the k, pitch and energy values for EVERY SINGLE SAMPLE.
219#undef DEBUG_CLIP_WRAP
220// above dumps info to stderr whenever the clip/wrap hardware is (or would be) clipping the signal.
198221#undef DEBUG_IO_READY
199222// above debugs the io ready callback
200223#undef DEBUG_RS_WS
r7972r7973
234257
235258
236259   /* these contain global status bits */
237   /*
238        R Nabet : speak_external is only set when a speak external command is going on.
239        speaking_now is set whenever a speak or speak external command is going on.
240        Note that we really need to do anything in tms5220_process and play samples only when
241        speaking_now is true.  Else, we can play nothing as well, which is a
242        speed-up...
243    */
244   UINT8 speaking_now;      /* Speak or Speak External command in progress */
245   UINT8 speak_external;   /* Speak External command in progress, writes go to FIFO. */
246   UINT8 talk_status;      /* TS status bit is 1, i.e. speak or speak external is in progress and we have not encountered a stop frame yet; talk_status differs from speaking_now in that speaking_now is set as soon as a speak or speak external command is started; talk_status does NOT go active until after 8 bytes are written to the fifo on a speak external command, otherwise the two are the same. TS is cleared when a STOP command has just been processed in the speech stream, and a new command is about to be processed. */
260   UINT8 speaking_now;      /* True only if actual speech is being generated right now. Is set when a speak vsm command happens OR when speak external happens and buffer low becomes nontrue; Is cleared when speech halts after the last stop frame or the last frame after talk status is otherwise cleared.*/
261   UINT8 speak_external;   /* DDIS is 1, i.e. Speak External command in progress, writes go to FIFO. */
262   UINT8 talk_status;      /* TS status bit is 1 i.e. speak or speak external is in progress and we have not encountered a stop frame yet; talk_status differs from speaking_now in that speaking_now is set as soon as a speak or speak external command is started; talk_status does NOT go active until after 8 bytes are written to the fifo on a speak external command, otherwise the two are the same. TS is cleared by 3 things: 1. when a STOP command has just been processed as a new frame in the speech stream; 2. if the fifo runs out in speak external mode; 3. on power-up/during a reset command; When it gets cleared, speak_external is also cleared, an interrupt is generated, and speaking_now will be cleared when the next frame starts. */
247263   UINT8 buffer_low;      /* FIFO has less than 8 bytes in it */
248264   UINT8 buffer_empty;      /* FIFO is empty*/
249265   UINT8 irq_pin;         /* state of the IRQ pin (output) */
250266
251267   /* these contain data describing the current and previous voice frames */
252#define OLD_FRAME_STOP_FLAG (tms->old_frame_energy == COEFF_ENERGY_SENTINEL) // 1 if this was a stop (E = 0xF) frame
253#define OLD_FRAME_SILENCE_FLAG (tms->old_frame_energy == 0) // 1 if this was a silence (E=0) frame
254#define OLD_FRAME_UNVOICED_FLAG (tms->old_frame_pitch == 0) // 1 if unvoiced, 0 if voiced
255   UINT16 old_frame_energy;
256   UINT16 old_frame_pitch;
257   INT32 old_frame_k[10];
268#define OLD_FRAME_SILENCE_FLAG (tms->old_frame_energy_idx == 0) // 1 if E=0, 0 otherwise.
269#define OLD_FRAME_UNVOICED_FLAG (tms->old_frame_pitch_idx == 0) // 1 if P=0 (unvoiced), 0 if voiced
270   UINT8 old_frame_energy_idx;
271   UINT8 old_frame_pitch_idx;
272   UINT8 old_frame_k_idx[10];
258273
259#define NEW_FRAME_STOP_FLAG (tms->new_frame_energy == COEFF_ENERGY_SENTINEL)  // ditto as above
260#define NEW_FRAME_SILENCE_FLAG (tms->new_frame_energy == 0) // ditto as above
261#define NEW_FRAME_UNVOICED_FLAG (tms->new_frame_pitch == 0) // ditto as above
262   UINT16 new_frame_energy;
263   UINT16 new_frame_pitch;
264   INT32 new_frame_k[10];
274#define NEW_FRAME_STOP_FLAG (tms->new_frame_energy_idx == 0xF) // 1 if this is a stop (Energy = 0xF) frame
275#define NEW_FRAME_SILENCE_FLAG (tms->new_frame_energy_idx == 0) // ditto as above
276#define NEW_FRAME_UNVOICED_FLAG (tms->new_frame_pitch_idx == 0) // ditto as above
277   UINT8 new_frame_energy_idx;
278   UINT8 new_frame_pitch_idx;
279   UINT8 new_frame_k_idx[10];
265280
266281
267282   /* these are all used to contain the current state of the sound generation */
268283   UINT16 current_energy;
269284   UINT16 current_pitch;
270   INT32 current_k[10];
285   INT16 current_k[10];
271286
272287   UINT16 target_energy;
273288   UINT16 target_pitch;
274   INT32 target_k[10];
289   INT16 target_k[10];
275290
276291   UINT16 previous_energy;         /* needed for lattice filter to match patent */
277292
278293   //UINT8 interp_period; /* TODO: the current interpolation period, counts 1,2,3,4,5,6,7,0 for divide by 8,8,8,4,4,4,2,1 */
279294   UINT8 interp_count;      /* number of samples within each sub-interpolation period, ranges from 0-24 */
295   //UINT8 spkslow_delay;  /* delay counter for interp count, only used on tms51xx */
280296   UINT8 sample_count;      /* number of samples within the ENTIRE interpolation period, ranges from 0-199 */
281297   UINT8 tms5220c_rate; /* only relevant for tms5220C's multi frame rate feature; is the actual 4 bit value written on a 0x2* or 0x0* command */
282298   UINT16 pitch_count;      /* pitch counter; provides chirp rom address */
r7972r7973
358374         break;
359375      case TMS5220_IS_5200:
360376         tms->coeff = &tms5200_coeff;
377         //tms->coeff = &pat4335277_coeff;
361378         break;
362379      case TMS5220_IS_5220:
363380         tms->coeff = &tms5220_coeff;
r7972r7973
385402   state_save_register_device_item(tms->device, 0, tms->buffer_empty);
386403   state_save_register_device_item(tms->device, 0, tms->irq_pin);
387404
388   state_save_register_device_item(tms->device, 0, tms->old_frame_energy);
389   state_save_register_device_item(tms->device, 0, tms->old_frame_pitch);
390   state_save_register_device_item_array(tms->device, 0, tms->old_frame_k);
405   state_save_register_device_item(tms->device, 0, tms->old_frame_energy_idx);
406   state_save_register_device_item(tms->device, 0, tms->old_frame_pitch_idx);
407   state_save_register_device_item_array(tms->device, 0, tms->old_frame_k_idx);
391408
392   state_save_register_device_item(tms->device, 0, tms->new_frame_energy);
393   state_save_register_device_item(tms->device, 0, tms->new_frame_pitch);
394   state_save_register_device_item_array(tms->device, 0, tms->new_frame_k);
409   state_save_register_device_item(tms->device, 0, tms->new_frame_energy_idx);
410   state_save_register_device_item(tms->device, 0, tms->new_frame_pitch_idx);
411   state_save_register_device_item_array(tms->device, 0, tms->new_frame_k_idx);
395412
396413   state_save_register_device_item(tms->device, 0, tms->current_energy);
397414   state_save_register_device_item(tms->device, 0, tms->current_pitch);
r7972r7973
425442
426443/**********************************************************************************************
427444
445      printbits helper function: takes a long int input and prints the resulting bits to stderr
446
447 **********************************************************************************************/
448
449#ifdef DEBUG_PARSE_FRAME_DUMP_BIN
450static void printbits(long data, int num)
451{
452   int i;
453   for (i=(num-1); i>=0; i--)
454      fprintf(stderr,"%0ld", (data>>i)&1);
455}
456#endif
457#ifdef DEBUG_PARSE_FRAME_DUMP_HEX
458static void printbits(long data, int num)
459{
460   switch((num-1)&0xFC)
461   {
462      case 0:
463         fprintf(stderr,"%0lx", data);
464         break;
465      case 4:
466         fprintf(stderr,"%02lx", data);
467         break;
468      case 8:
469         fprintf(stderr,"%03lx", data);
470         break;
471      case 12:
472         fprintf(stderr,"%04lx", data);
473         break;
474      default:
475         fprintf(stderr,"%04lx", data);
476         break;
477   }
478}
479#endif
480
481/**********************************************************************************************
482
428483     tms5220_data_write -- handle a write to the TMS5220
429484
430485***********************************************************************************************/
431486
432487static void tms5220_data_write(tms5220_state *tms, int data)
433488{
489#ifdef DEBUG_DUMP_INPUT_DATA
490   fprintf(stdout, "%c",data);
491#endif
434492   if (tms->speak_external) // If we're in speak external mode
435493   {
436494      /* add this byte to the FIFO */
r7972r7973
439497         tms->fifo[tms->fifo_tail] = data;
440498         tms->fifo_tail = (tms->fifo_tail + 1) % FIFO_SIZE;
441499         tms->fifo_count++;
442
443         /* if we were speaking, then we're no longer empty */
444         if (tms->speak_external)
445            tms->buffer_empty = 0;
446500#ifdef DEBUG_FIFO
447501         logerror("data_write: Added byte to FIFO (current count=%2d)\n", tms->fifo_count);
502#endif
503         update_status_and_ints(tms);
504         if ((tms->talk_status == 0) && (tms->buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero...
505         {
506         int i;
507#ifdef DEBUG_FIFO
508         logerror("data_write triggered talk status to go active!\n");
509#endif
510            /* ...then we now have enough bytes to start talking; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */
511            tms->new_frame_energy_idx = 0;
512            tms->new_frame_pitch_idx = 0;
513            for (i = 0; i < tms->coeff->num_k; i++)
514               tms->new_frame_k_idx[i] = 0;
515            tms->talk_status = tms->speaking_now = 1;
516         }
448517      }
449518      else
450519      {
451
452         logerror("data_write: Ran out of room in the FIFO!\n");
520#ifdef DEBUG_FIFO
521         logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
453522         // at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it.
454523#endif
455524      }
456525
457      update_status_and_ints(tms);
526
458527   }
459528   else //(! tms->speak_external)
460529      /* R Nabet : we parse commands at once.  It is necessary for such commands as read. */
r7972r7973
500569    mode, it is immediately unset here. */
501570   if ((tms->speak_external == 1) && (tms->buffer_empty == 1))
502571   {
503      /* generate an interrupt if necessary; if /TS was active and is now inactive, set int. */
504        if (tms->talk_status == 1)
505            set_interrupt_state(tms, 1);
506      tms->talk_status = 0;
572      /* generate an interrupt: /TS was active, and is now inactive. */
573      if (tms->talk_status == 1)
574      {
575         tms->talk_status = tms->speak_external = 0;
576         set_interrupt_state(tms, 1);
577      }
507578   }
508579   /* Note that TS being unset will also generate an interrupt when a STOP
509580    frame is encountered; this is handled in the sample generator code and not here */
r7972r7973
672743static void tms5220_process(tms5220_state *tms, INT16 *buffer, unsigned int size)
673744{
674745    int buf_count=0;
675    int i, interp_period, bitout;
746    int i, interp_period, bitout, zpar;
676747
677748//tryagain:
678749
r7972r7973
682753
683754    /* if speak external is set, but talk status is not (yet) set,
684755    wait for buffer low to clear */
685   if (!tms->talk_status && tms->speak_external)
686    {
687        if (tms->buffer_low == 1)
756   if (!tms->talk_status && tms->speak_external && (tms->buffer_low == 1))
688757           goto empty;
689758
690      /* we now have enough bytes; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */
691      tms->new_frame_energy = 0;
692      tms->new_frame_pitch = 0;
693      for (i = 0; i < tms->coeff->num_k; i++)
694         tms->new_frame_k[i] = 0;
695
696        tms->talk_status = 1;
697   }
698
699759    /* loop until the buffer is full or we've stopped speaking */
700   while ((size > 0) && tms->talk_status)
760   while ((size > 0) && tms->speaking_now)
701761    {
702762
703763        /* if we're ready for a new frame */
704764        if ((tms->interp_count == 0) && (tms->sample_count == 0))
705765        {
766         /* appropriately override the initial sample count */
767         tms->sample_count = reload_table[tms->tms5220c_rate&0x3];
706768
707769         /* remember previous frame energy, pitch, and coefficients */
708         tms->old_frame_energy = tms->new_frame_energy;
709         tms->old_frame_pitch = tms->new_frame_pitch;
770         tms->old_frame_energy_idx = tms->new_frame_energy_idx;
771         tms->old_frame_pitch_idx = tms->new_frame_pitch_idx;
710772         for (i = 0; i < tms->coeff->num_k; i++)
711            tms->old_frame_k[i] = tms->new_frame_k[i];
773            tms->old_frame_k_idx[i] = tms->new_frame_k_idx[i];
712774
713         /* if the old frame was a stop frame, exit and do not process any more frames */
714         if (OLD_FRAME_STOP_FLAG)
775         /* if the talk status was clear last frame, halt speech now. */
776         if (tms->talk_status == 0)
715777         {
716778#ifdef DEBUG_GENERATION
717            logerror("tms5220_process: processing frame: stop frame\n");
779            fprintf(stderr,"tms5220_process: processing frame: talk status = 0 caused by stop frame or buffer empty, halting speech.\n");
718780#endif
719            tms->speaking_now = tms->talk_status = tms->speak_external = 0;
720            set_interrupt_state(tms, 1); // TS went inactive, so int is raised
721            tms->sample_count = reload_table[tms->tms5220c_rate&0x3];
722            update_status_and_ints(tms);
781            tms->speaking_now = 0; // finally halt speech
723782            goto empty;
724783         }
725784
726785
727786         /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */
728787         parse_frame(tms);
788#ifdef DEBUG_PARSE_FRAME_DUMP
789         fprintf(stderr,"\n");
790#endif
729791
792         /* if the new frame is a stop frame, set an interrupt and set talk status to 0 */
793         if (NEW_FRAME_STOP_FLAG == 1)
794            {
795               tms->talk_status = tms->speak_external = 0;
796               set_interrupt_state(tms, 1);
797               update_status_and_ints(tms);
798            }
730799
731         /* Set old frame targets as starting point of new frame */
732         tms->current_energy = tms->old_frame_energy;
733         tms->current_pitch = tms->old_frame_pitch;
734         for (i = 0; i < tms->coeff->num_k; i++)
735            tms->current_k[i] = tms->old_frame_k[i];
736
737
738800         /* in all cases where interpolation would be inhibited, set the target
739801               value equal to the current value.
740802               Interpolation inhibit cases:
741803               * Old frame was voiced, new is unvoiced
742               * Old frame was silence/zero energy, new is unvoiced
804               * Old frame was silence/zero energy, new has nonzero energy
743805               * Old frame was unvoiced, new is voiced
744               * New frame is a silence/zero energy frame - ? not sure
745               * New frame is a stop frame - ? not sure
746806            */
747         if ( ((NEW_FRAME_SILENCE_FLAG == 0) && (NEW_FRAME_STOP_FLAG == 0))
748         && ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
749            || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 1))
750            || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) )
751            )
807         if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
808            || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0))
809            || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) )
752810         {
753811#ifdef DEBUG_GENERATION
754            logerror("processing frame: interpolation inhibited\n");
755            logerror("*** current Energy = %d\n",tms->current_energy);
756            logerror("*** next frame Energy = %d\n",tms->new_frame_energy);
812            fprintf(stderr,"processing frame: interpolation inhibited\n");
813            fprintf(stderr,"*** current Energy = %d\n",tms->current_energy);
814            fprintf(stderr,"*** next frame Energy = %d(index: %x)\n",tms->coeff->energytable[tms->new_frame_energy_idx],tms->new_frame_energy_idx);
757815#endif
758816            tms->target_energy = tms->current_energy;
759817            tms->target_pitch = tms->current_pitch;
760818            for (i = 0; i < tms->coeff->num_k; i++)
761819               tms->target_k[i] = tms->current_k[i];
762820         }
763         /* in cases where the new frame is a STOP or SILENCE frame,
764               ramp the energy down to 0, leaving everything else alone. */
765         else if ((NEW_FRAME_SILENCE_FLAG == 1) || (NEW_FRAME_STOP_FLAG == 1))
821         else // normal frame, normal interpolation
766822         {
767823#ifdef DEBUG_GENERATION
768            logerror("processing frame: ramp-down (energy = 0 or STOP)\n";
824            fprintf(stderr,"processing frame: Normal\n");
825            fprintf(stderr,"*** current Energy = %d\n",tms->current_energy);
826            fprintf(stderr,"*** new (target) Energy = %d(index: %x)\n",tms->coeff->energytable[tms->new_frame_energy_idx],tms->new_frame_energy_idx);
769827#endif
770            tms->target_energy = 0;
771            tms->target_pitch = tms->current_pitch;
772            for (i = 0; i < tms->coeff->num_k; i++)
773               tms->target_k[i] = tms->current_k[i];
828
829            tms->target_energy = tms->coeff->energytable[tms->new_frame_energy_idx];
830            tms->target_pitch = tms->coeff->pitchtable[tms->new_frame_pitch_idx];
831            zpar = NEW_FRAME_UNVOICED_FLAG; // find out if parameters k5-k10 should be zeroed
832            for (i = 0; i < 4; i++)
833               tms->target_k[i] = tms->coeff->ktable[i][tms->new_frame_k_idx[i]];
834            for (i = 4; i < tms->coeff->num_k; i++)
835                  tms->target_k[i] = (tms->coeff->ktable[i][tms->new_frame_k_idx[i]] * (1-zpar));
774836         }
775         else // normal frame, normal interpolation
837
838         /* if TS is now 0, ramp the energy down to 0. Is this really correct to hardware? */
839         if ( (tms->talk_status == 0))
776840         {
777841#ifdef DEBUG_GENERATION
778            logerror("processing frame: Normal\n");
779            logerror("*** current Energy = %d\n",tms->current_energy);
780            logerror("*** new (target) Energy = %d\n",tms->new_frame_energy);
842            fprintf(stderr,"Talk status is 0, forcing target energy to 0\n");
781843#endif
782
783            tms->target_energy = tms->new_frame_energy;
784            tms->target_pitch = tms->new_frame_pitch;
785            for (i = 0; i < tms->coeff->num_k; i++)
786               tms->target_k[i] = tms->new_frame_k[i];
844            tms->target_energy = 0;
787845         }
788846      }
789847      else // Not a new frame, just interpolate the existing frame.
r7972r7973
793851#else
794852         interp_period = tms->sample_count / 25;
795853#endif
854#define PC_COUNT_LOAD 0
855      zpar = OLD_FRAME_UNVOICED_FLAG;
796856      switch(tms->interp_count)
797857         {
798858            /*         PC=X  X cycle, rendering change (change for next cycle which chip is actually doing) */
r7972r7973
801861            case 1: /* PC=0, B cycle, nothing happens (update energy) */
802862            break;
803863            case 2: /* PC=1, A cycle, update energy (calc pitch) */
864            if (interp_period == PC_COUNT_LOAD)
865               tms->current_energy = tms->coeff->energytable[tms->old_frame_energy_idx];
804866            tms->current_energy += ((tms->target_energy - tms->current_energy) >> tms->coeff->interp_coeff[interp_period]);
805867            break;
806868            case 3: /* PC=1, B cycle, nothing happens (update pitch) */
807869            break;
808870            case 4: /* PC=2, A cycle, update pitch (calc K1) */
871            if (interp_period == PC_COUNT_LOAD)
872               tms->current_pitch = tms->coeff->pitchtable[tms->old_frame_pitch_idx];
809873            tms->current_pitch += ((tms->target_pitch - tms->current_pitch) >> tms->coeff->interp_coeff[interp_period]);
810874            break;
811875            case 5: /* PC=2, B cycle, nothing happens (update K1) */
812876            break;
813877            case 6: /* PC=3, A cycle, update K1 (calc K2) */
878            if (interp_period == PC_COUNT_LOAD)
879               tms->current_k[0] = tms->coeff->ktable[0][tms->old_frame_k_idx[0]];
814880            tms->current_k[0] += ((tms->target_k[0] - tms->current_k[0]) >> tms->coeff->interp_coeff[interp_period]);
815881            break;
816882            case 7: /* PC=3, B cycle, nothing happens (update K2) */
817883            break;
818884            case 8: /* PC=4, A cycle, update K2 (calc K3) */
885            if (interp_period == PC_COUNT_LOAD)
886               tms->current_k[1] = tms->coeff->ktable[1][tms->old_frame_k_idx[1]];
819887            tms->current_k[1] += ((tms->target_k[1] - tms->current_k[1]) >> tms->coeff->interp_coeff[interp_period]);
820888            break;
821889            case 9: /* PC=4, B cycle, nothing happens (update K3) */
822890            break;
823891            case 10: /* PC=5, A cycle, update K3 (calc K4) */
892            if (interp_period == PC_COUNT_LOAD)
893               tms->current_k[2] = tms->coeff->ktable[2][tms->old_frame_k_idx[2]];
824894            tms->current_k[2] += ((tms->target_k[2] - tms->current_k[2]) >> tms->coeff->interp_coeff[interp_period]);
825895            break;
826896            case 11: /* PC=5, B cycle, nothing happens (update K4) */
827897            break;
828898            case 12: /* PC=6, A cycle, update K4 (calc K5) */
899            if (interp_period == PC_COUNT_LOAD)
900               tms->current_k[3] = tms->coeff->ktable[3][tms->old_frame_k_idx[3]];
829901            tms->current_k[3] += ((tms->target_k[3] - tms->current_k[3]) >> tms->coeff->interp_coeff[interp_period]);
830902            break;
831903            case 13: /* PC=6, B cycle, nothing happens (update K5) */
832904            break;
833905            case 14: /* PC=7, A cycle, update K5 (calc K6) */
906            if (interp_period == PC_COUNT_LOAD)
907               tms->current_k[4] = (tms->coeff->ktable[4][tms->old_frame_k_idx[4]] * (1-zpar));
834908            tms->current_k[4] += ((tms->target_k[4] - tms->current_k[4]) >> tms->coeff->interp_coeff[interp_period]);
835909            break;
836910            case 15: /* PC=7, B cycle, nothing happens (update K6) */
837911            break;
838912            case 16: /* PC=8, A cycle, update K6 (calc K7) */
913            if (interp_period == PC_COUNT_LOAD)
914               tms->current_k[5] = (tms->coeff->ktable[5][tms->old_frame_k_idx[5]] * (1-zpar));
839915            tms->current_k[5] += ((tms->target_k[5] - tms->current_k[5]) >> tms->coeff->interp_coeff[interp_period]);
840916            break;
841917            case 17: /* PC=8, B cycle, nothing happens (update K7) */
842918            break;
843919            case 18: /* PC=9, A cycle, update K7 (calc K8) */
920            if (interp_period == PC_COUNT_LOAD)
921               tms->current_k[6] = (tms->coeff->ktable[6][tms->old_frame_k_idx[6]] * (1-zpar));
844922            tms->current_k[6] += ((tms->target_k[6] - tms->current_k[6]) >> tms->coeff->interp_coeff[interp_period]);
845923            break;
846924            case 19: /* PC=9, B cycle, nothing happens (update K8) */
847925            break;
848926            case 20: /* PC=10, A cycle, update K8 (calc K9) */
927            if (interp_period == PC_COUNT_LOAD)
928               tms->current_k[7] = (tms->coeff->ktable[7][tms->old_frame_k_idx[7]] * (1-zpar));
849929            tms->current_k[7] += ((tms->target_k[7] - tms->current_k[7]) >> tms->coeff->interp_coeff[interp_period]);
850930            break;
851931            case 21: /* PC=10, B cycle, nothing happens (update K9) */
852932            break;
853933            case 22: /* PC=11, A cycle, update K9 (calc K10) */
934            if (interp_period == PC_COUNT_LOAD)
935               tms->current_k[8] = (tms->coeff->ktable[8][tms->old_frame_k_idx[8]] * (1-zpar));
854936            tms->current_k[8] += ((tms->target_k[8] - tms->current_k[8]) >> tms->coeff->interp_coeff[interp_period]);
855937            break;
856938            case 23: /* PC=11, B cycle, nothing happens (update K10) */
857939            break;
858940            case 24: /* PC=12, A cycle, update K10 (do nothing) */
941            if (interp_period == PC_COUNT_LOAD)
942               tms->current_k[9] = (tms->coeff->ktable[9][tms->old_frame_k_idx[9]] * (1-zpar));
859943            tms->current_k[9] += ((tms->target_k[9] - tms->current_k[9]) >> tms->coeff->interp_coeff[interp_period]);
860944            break;
861945         }
r7972r7973
865949      if (OLD_FRAME_UNVOICED_FLAG == 1)
866950      {
867951         /* generate unvoiced samples here */
952#ifdef NORMALMODE
868953         if (tms->RNG & 1)
869            tms->excitation_data = -0x40; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so +-64 */
954            tms->excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/
870955         else
871956            tms->excitation_data = 0x40;
957#else
958         if (tms->RNG & 1)
959            tms->excitation_data = ~0x7F;
960         else
961            tms->excitation_data = 0x80;
962#endif
872963        }
873964        else
874965        {
875966            /* generate voiced samples here */
876967            /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp
877968             * function has a chirp/peak and then a long chain of zeroes.
878             * The last entry of the chirp rom is at address 0b110011 (50d), the 51st sample,
969             * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample,
879970             * and if the address reaches that point the ADDRESS incrementer is
880             * disabled, forcing all samples beyond 50d to be == 50d
881             * (address 50d holds zeroes)
971             * disabled, forcing all samples beyond 51d to be == 51d
972             * (address 51d holds zeroes, which may or may not be inverted to -1)
882973             */
883974#ifdef NORMALMODE
884          if (tms->pitch_count > 50)
885              tms->excitation_data = tms->coeff->chirptable[50]<<CHIRPROM_LEFTSHIFT;
886          else /*tms->pitch_count <= 50*/
887              tms->excitation_data = tms->coeff->chirptable[tms->pitch_count]<<CHIRPROM_LEFTSHIFT;
975          if (tms->pitch_count >= 51)
976              tms->excitation_data = tms->coeff->chirptable[51];
977          else /*tms->pitch_count < 51*/
978              tms->excitation_data = tms->coeff->chirptable[tms->pitch_count];
888979#else
889          tms->excitation_data = tms->pitch_count - 64;
980          if (tms->pitch_count >= 51)
981              tms->excitation_data = tms->coeff->chirptable[51]^0xFF;
982          else /*tms->pitch_count < 51*/
983              tms->excitation_data = tms->coeff->chirptable[tms->pitch_count]^0xFF;
890984#endif
891985        }
892986
r7972r7973
900994            tms->RNG >>= 1;
901995            tms->RNG |= bitout << 12;
902996   }
903
997#ifdef DEBUG_GENERATION_VERBOSE
998      fprintf(stderr,"X:%04d; E:%04d; P:%04d; Pc:%04d ",tms->excitation_data, tms->current_energy, tms->current_pitch, tms->pitch_count);
999      for (i=0; i<10; i++)
1000         fprintf(stderr,"K%d:%04d ", i+1, tms->current_k[i]);
1001      fprintf(stderr,"\n");
1002#endif
9041003      buffer[buf_count] = clip_and_wrap(lattice_filter(tms)); /* execute lattice filter and clipping/wrapping */
9051004
9061005        //if (tms->digital_select == 0) /* if digital is NOT selected... */
r7972r7973
9101009
9111010        size--;
9121011        tms->sample_count = (tms->sample_count + 1) % 200;
913#ifdef NORMALMODE
914        if (tms->current_pitch != 0)
915            tms->pitch_count = (tms->pitch_count + 1) % tms->current_pitch;
916        else
917            tms->pitch_count = 51; // blank spot in the chirp rom
918#else
919          tms->pitch_count = (tms->pitch_count + 1) % 128;
920#endif
1012        tms->pitch_count++;
1013        if (tms->pitch_count >= tms->current_pitch) tms->pitch_count = 0;
9211014
9221015        tms->interp_count = (tms->interp_count + 1) % 25;
9231016        buf_count++;
r7972r7973
9291022    {
9301023      tms->sample_count = (tms->sample_count + 1) % 200;
9311024      tms->interp_count = (tms->interp_count + 1) % 25;
932      buffer[buf_count] = 0x00;   /* should be (-1 << 8) ??? (cf note in data sheet, p 10, table 4) */
1025      buffer[buf_count] = -1<<4;   /* should be (-1 << 8) ??? (cf note in data sheet, p 10, table 4) */
9331026        buf_count++;
9341027        size--;
9351028    }
r7972r7973
9551048       00 0bcd efgh xxxx -> 0b0bcdefgh
9561049       0x xxxx xxxx xxxx -> 0b01111111
9571050       */
1051#ifdef DEBUG_CLIP_WRAP
1052   if ((cliptemp > 2047) || (cliptemp < -2048)) fprintf(stderr,"clipping cliptemp to range; was %d\n", cliptemp);
1053#endif
9581054#ifdef DO_CLIP_AND_WRAP
9591055   if (cliptemp > 2047) cliptemp = 2047;
9601056   else if (cliptemp < -2048) cliptemp = -2048;
1057   //cliptemp &= 0xFFF0;
9611058   /* at this point the analog output is tapped*/
9621059   return cliptemp << 4;
9631060#else
r7972r7973
9711068     ti_matrix_multiply -- does the proper multiply and shift as the TI chips do.
9721069     a is the k coefficient and is clamped to 10 bits (9 bits plus a sign)
9731070     b is the running result and is clamped to 14 bits.
974     output is 14 bits, but note the result LSB bit is always 1.
1071     output is 14 bits, but note the result LSB bit is always 1. (or is it?)
9751072
9761073**********************************************************************************************/
9771074static INT16 matrix_multiply(INT16 a, INT16 b)
r7972r7973
9811078   while (a<-512) { a+=1024; }
9821079   while (b>16383) { b-=32768; }
9831080   while (b<-16384) { b+=32768; }
1081#ifdef NORMALMODE
9841082   result = ((a*b)>>9)|1;
1083#else
1084   result = (a*b)>>9;
1085#endif
9851086#ifdef VERBOSE
9861087   if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x", a, b);
9871088   if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x", a, b);
r7972r7973
10071108      Kn = tms->current_k[n-1]
10081109      bn = tms->x[n-1]
10091110    */
1010      tms->u[10] = matrix_multiply(tms->current_energy, (tms->excitation_data*64));  //Y(11)
1111      tms->u[10] = matrix_multiply(tms->previous_energy, (tms->excitation_data*64));  //Y(11)
10111112      //tms->u[10] = matrix_multiply((tms->excitation_data*64), tms->current_energy); // wrong but sounds better
10121113        tms->u[9] = tms->u[10] - matrix_multiply(tms->current_k[9], tms->x[9]);
10131114        tms->u[8] = tms->u[9] - matrix_multiply(tms->current_k[8], tms->x[8]);
r7972r7973
11101211         {
11111212            //SPKEXT going active activates SPKEE which clears the fifo
11121213            tms->fifo_head = tms->fifo_tail = tms->fifo_count = tms->fifo_bits_taken = 0;
1113            tms->speaking_now = tms->speak_external = 1;
1214            tms->speak_external = 1;
11141215            tms->RDB_flag = FALSE;
11151216         }
11161217         break;
r7972r7973
11381239
11391240static void parse_frame(tms5220_state *tms)
11401241{
1141   int bits, indx, i, rep_flag;
1142#ifdef DEBUG_FRAME_DUMP
1143   int ene;
1144#endif
1242   int indx, i, rep_flag;
11451243
1146   // todo: we actually don't care how many bits are left in the fifo here; the frame subpart will be processed normally, and any bits extracted 'past the end' of the fifo will be read as zeroes; the fifo being emptied will set the /BE latch which will halt speech exactly as if a stop frame had been encountered (instead of whatever partial frame was read); the same exact circuitry is used for both on the real chip, see us patent 4335277 sheet 16, gates 232a (decode stop frame) and 232b (decode /BE plus DDIS (decode disable) which is active during speak external).
1147   if (tms->speak_external)
1148   {
1149      /* count the total number of bits available */
1150      bits = ((tms->fifo_count)*8)-tms->fifo_bits_taken;
1151   }
1152   else
1153   {
1154      /* we're talking out of a vsm rom, hence we have an effectively infinite number of bits which are pullable. extract_bits will toggle M0 for us and grab what bits are needed */
1155      bits = 131072; // == arbitrary large number
1156   }
1244   // We actually don't care how many bits are left in the fifo here; the frame subpart will be processed normally, and any bits extracted 'past the end' of the fifo will be read as zeroes; the fifo being emptied will set the /BE latch which will halt speech exactly as if a stop frame had been encountered (instead of whatever partial frame was read); the same exact circuitry is used for both on the real chip, see us patent 4335277 sheet 16, gates 232a (decode stop frame) and 232b (decode /BE plus DDIS (decode disable) which is active during speak external).
1245
11571246   /* if the chip is a tms5220C, and the rate mode is set to that each frame (0x04 bit set)
11581247    has a 2 bit rate preceeding it, grab two bits here and store them as the rate; */
11591248   if ((tms->variant == SUBTYPE_TMS5220C) && (tms->tms5220c_rate & 0x04))
11601249   {
1161      bits -= 2;
1162      if (bits < 0) goto ranout;
11631250      indx = extract_bits(tms, 2);
1251#ifdef DEBUG_PARSE_FRAME_DUMP
1252      printbits(indx,2);
1253      fprintf(stderr," ");
1254#endif
11641255      tms->sample_count = reload_table[indx];
11651256   }
11661257   else // non-5220C and 5220C in fixed rate mode
11671258   tms->sample_count = reload_table[tms->tms5220c_rate&0x3];
11681259
1260   update_status_and_ints(tms);
1261   if (!tms->talk_status) goto ranout;
1262
11691263   /* attempt to extract the energy index */
1170   bits -= tms->coeff->energy_bits;
1171   if (bits < 0) goto ranout;
1172   indx = extract_bits(tms,tms->coeff->energy_bits);
1173   tms->new_frame_energy = tms->coeff->energytable[indx];
1174#ifdef DEBUG_FRAME_DUMP
1175   ene = indx;
1264   tms->new_frame_energy_idx = extract_bits(tms,tms->coeff->energy_bits);
1265#ifdef DEBUG_PARSE_FRAME_DUMP
1266   printbits(tms->new_frame_energy_idx,tms->coeff->energy_bits);
1267   fprintf(stderr," ");
11761268#endif
1177
1269   update_status_and_ints(tms);
1270   if (!tms->talk_status) goto ranout;
11781271   /* if the energy index is 0 or 15, we're done */
1179
1180   if ((indx == 0) || (indx == 15))
1181   {
1182#ifdef DEBUG_FRAME_INFO
1183      logerror("  (4-bit energy=%d frame)\n",tms->new_frame_energy);
1184#endif
1272   if ((tms->new_frame_energy_idx == 0) || (tms->new_frame_energy_idx == 15))
11851273      return;
1186   }
11871274
1275
11881276   /* attempt to extract the repeat flag */
1189   bits -= 1;
1190   if (bits < 0) goto ranout;
11911277   rep_flag = extract_bits(tms,1);
1278#ifdef DEBUG_PARSE_FRAME_DUMP
1279   printbits(rep_flag, 1);
1280   fprintf(stderr," ");
1281#endif
11921282
11931283   /* attempt to extract the pitch */
1194   bits -= tms->coeff->pitch_bits;
1195   if (bits < 0) goto ranout;
1196   indx = extract_bits(tms,tms->coeff->pitch_bits);
1197   tms->new_frame_pitch = tms->coeff->pitchtable[indx];
1198
1284   tms->new_frame_pitch_idx = extract_bits(tms,tms->coeff->pitch_bits);
1285#ifdef DEBUG_PARSE_FRAME_DUMP
1286   printbits(tms->new_frame_pitch_idx,tms->coeff->pitch_bits);
1287   fprintf(stderr," ");
1288#endif
1289   update_status_and_ints(tms);
1290   if (!tms->talk_status) goto ranout;
11991291   /* if this is a repeat frame, just copy the k's */
12001292   if (rep_flag)
1293      return;
1294
1295   /* extract first 4 K coefficients */
1296   for (i = 0; i < 4; i++)
12011297   {
1202   //actually, we do nothing because the k's were already loaded (on parsing the previous frame)
1203
1204#ifdef DEBUG_FRAME_INFO
1205      logerror("  (10-bit energy=%d pitch=%d rep=%d frame)\n", tms->new_frame_energy, tms->new_frame_pitch, rep_flag);
1298      tms->new_frame_k_idx[i] = extract_bits(tms,tms->coeff->kbits[i]);
1299#ifdef DEBUG_PARSE_FRAME_DUMP
1300      printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
1301      fprintf(stderr," ");
12061302#endif
1207      return;
1303      update_status_and_ints(tms);
1304      if (!tms->talk_status) goto ranout;
12081305   }
12091306
1210
1211   /* if the pitch index was zero, we need 4 k's */
1212   if (indx == 0)
1307   /* if the pitch index was zero, we only need 4 K's... */
1308   if (tms->new_frame_pitch_idx == 0)
12131309   {
1214      /* attempt to extract 4 K's */
1215      bits -= 18;
1216      if (bits < 0) goto ranout;
1217      for (i = 0; i < 4; i++)
1218         tms->new_frame_k[i] = tms->coeff->ktable[i][extract_bits(tms,tms->coeff->kbits[i])];
1219
1220   /* and clear the rest of the new_frame_k[] */
1221      for (i = 4; i < tms->coeff->num_k; i++)
1222         tms->new_frame_k[i] = 0;
1223#ifdef DEBUG_FRAME_INFO
1224      logerror("  (29-bit energy=%d pitch=%d rep=%d 4K frame)\n", tms->new_frame_energy, tms->new_frame_pitch, rep_flag);
1225#endif
1310      /* and the rest of the coefficients are zeroed, but that's done in the generator code */
12261311      return;
12271312   }
12281313
1229   /* else we need 10 K's */
1230   bits -= 39;
1231   if (bits < 0) goto ranout;
1232#ifdef DEBUG_FRAME_DUMP
1233   logerror("FrameDump %02d ", ene);
1234   for (i = 0; i < tms->coeff->num_k; i++)
1314   /* If we got here, we need the remaining 6 K's */
1315   for (i = 4; i < tms->coeff->num_k; i++)
12351316   {
1236      int x;
1237      x = extract_bits(tms, tms->coeff->kbits[i]);
1238      tms->new_frame_k[i] = tms->coeff->ktable[i][x];
1239      logerror("%02d ", x);
1317      tms->new_frame_k_idx[i] = extract_bits(tms, tms->coeff->kbits[i]);
1318#ifdef DEBUG_PARSE_FRAME_DUMP
1319      printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
1320      fprintf(stderr," ");
1321#endif
1322      update_status_and_ints(tms);
1323      if (!tms->talk_status) goto ranout;
12401324   }
1241   logerror("\n");
1242#else
1243   for (i = 0; i < tms->coeff->num_k; i++)
1244   {
1245      int x;
1246      x = extract_bits(tms, tms->coeff->kbits[i]);
1247      tms->new_frame_k[i] = tms->coeff->ktable[i][x];
1248   }
1249#endif
1250#ifdef DEBUG_FRAME_INFO
1251   logerror("  (50-bit energy=%d pitch=%d rep=%d 10K frame))\n", tms->new_frame_energy, tms->new_frame_pitch, rep_flag);
1325#ifdef VERBOSE
12521326   if (tms->speak_external)
12531327      logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", bits);
12541328   else
r7972r7973
12601334#ifdef DEBUG_FRAME_ERRORS
12611335    logerror("Ran out of bits on a parse!\n");
12621336#endif
1263    /* this is an error condition; mark the buffer empty and turn off speaking */
1264    tms->buffer_empty = 1;
1265   tms->talk_status = tms->speak_external = tms->speaking_now = 0;
1266    tms->fifo_count = tms->fifo_head = tms->fifo_tail = 0;
1267
1268   tms->RDB_flag = FALSE;
1269
1270    /* generate an interrupt since TS went low */
1271    set_interrupt_state(tms, 1);
1272    return;
1273
1337   return;
12741338}
12751339
12761340/**********************************************************************************************
r7972r7973
13761440   tms->RDB_flag = FALSE;
13771441
13781442   /* initialize the energy/pitch/k states */
1379   tms->old_frame_energy = tms->new_frame_energy = tms->current_energy = tms->target_energy = 0;
1380   tms->old_frame_pitch = tms->new_frame_pitch = tms->current_pitch = tms->target_pitch = 0;
1381   memset(tms->old_frame_k, 0, sizeof(tms->old_frame_k));
1382   memset(tms->new_frame_k, 0, sizeof(tms->new_frame_k));
1443   tms->old_frame_energy_idx = tms->new_frame_energy_idx = tms->current_energy = tms->target_energy = 0;
1444   tms->old_frame_pitch_idx = tms->new_frame_pitch_idx = tms->current_pitch = tms->target_pitch = 0;
1445   memset(tms->old_frame_k_idx, 0, sizeof(tms->old_frame_k_idx));
1446   memset(tms->new_frame_k_idx, 0, sizeof(tms->new_frame_k_idx));
13831447   memset(tms->current_k, 0, sizeof(tms->current_k));
13841448   memset(tms->target_k, 0, sizeof(tms->target_k));
13851449
r7972r7973
14771541         logerror("Schedule write ready\n");
14781542#endif
14791543         //tms->io_ready = 1;
1480         ///* 100 nsec from data sheet */
1481         //timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
1544         /* 100 nsec from data sheet, through 3 asynchronous gates on patent */
1545         //timer_set(tms->device->machine, ATTOTIME_IN_HZ(device->clock), tms, 0, io_ready_cb); // /READY goes inactive immediately, within one clock... for that matter, what do we even need a timer for then?
14821546         tms->io_ready = 0;
1483         /* 25 usec in datasheet, but zaccaria won't work */
1484         timer_set(tms->device->machine, ATTOTIME_IN_USEC(100), tms, 1, io_ready_cb);
1547         /* 25 usec (16 clocks) in datasheet, but zaccaria games glitch or fail to talk if that value is used. The zaccaria glitching may be buggy game code or may be a bug with the MAME 6821 PIA code which interfaces with the tms5200, particularly its handling of updates of the CA1 and CA2 lines? */
1548         //timer_set(tms->device->machine, ATTOTIME_IN_USEC(100), tms, 1, io_ready_cb);
1549         timer_set(tms->device->machine, ATTOTIME_IN_HZ(device->clock/16), tms, 1, io_ready_cb); // this should take around 10-16 (closer to ~11?) cycles to complete
14851550      }
14861551   }
14871552}
r7972r7973
15251590      {
15261591         ///* high to low - schedule ready cycle*/
15271592         //tms->io_ready = 1;
1528         //timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
1593         /* 100 nsec from data sheet, through 3 asynchronous gates on patent */
1594         //timer_set(tms->device->machine, ATTOTIME_IN_HZ(device->clock), tms, 0, io_ready_cb); // /READY goes inactive immediately, within one clock... for that matter, what do we even need a timer for then?
15291595         tms->io_ready = 0;
1530         timer_set(tms->device->machine, ATTOTIME_IN_USEC(25), tms, 1, io_ready_cb);
1596         timer_set(tms->device->machine, ATTOTIME_IN_HZ(device->clock/16), tms, 1, io_ready_cb); // this should take around 10-16 (closer to ~15) cycles to complete
15311597      }
15321598   }
15331599}
src/emu/cheat.c
r7972r7973
622622      }
623623      else
624624      {
625         parameter_item *item = NULL, *prev = NULL;
625         parameter_item *item = NULL/*, *prev = NULL*/;
626626
627         for (item = cheat->parameter->itemlist; item != NULL; prev = item, item = item->next)
627         for (item = cheat->parameter->itemlist; item != NULL; /*prev = item, */item = item->next)
628628            if (item->value == cheat->parameter->value)
629629               break;
630630         if (state != NULL)
src/emu/drivers/xtal.h
r7972r7973
142142   XTAL_27_2109MHz      = 27210900,      /* LA Girl */
143143   XTAL_28MHz        = 28000000,
144144   XTAL_28_37516MHz   = 28375160,      /* Amiga PAL systems */
145   XTAL_28_48MHz        = 28480000,      /* Chromatics CGC-7900 */
145   XTAL_28_48MHz      = 28480000,      /* Chromatics CGC-7900 */
146146   XTAL_28_63636MHz   = 28636360,      /* Later Leland games and Atari GT, Amiga NTSC , Raiden2 h/w */
147147   XTAL_30MHz        = 30000000,      /* Impera Magic Card */
148148   XTAL_30_4761MHz    = 30476100,      /* Taito JC */
src/lib/util/cdrom.c
r7972r7973
250250   }
251251   else
252252   {
253      /* return 2048 bytes of mode 1 data from a 2352 byte mode 1 or 2 raw sector */
254      if ((datatype == CD_TRACK_MODE1) && ((tracktype == CD_TRACK_MODE1_RAW) || (tracktype == CD_TRACK_MODE2_RAW)))
253      /* return 2048 bytes of mode 1 data from a 2352 byte mode 1 raw sector */
254      if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE1_RAW))
255255      {
256256         memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 16], 2048);
257257         return 1;
258258      }
259259
260      /* return 2048 bytes of mode 1 data from a mode2 form1 sector */
261      if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE2_FORM1))
260      /* return 2048 bytes of mode 1 data from a mode2 form1 or raw sector */
261      if ((datatype == CD_TRACK_MODE1) && ((tracktype == CD_TRACK_MODE2_FORM1)||(tracktype == CD_TRACK_MODE2_RAW)))
262262      {
263263         memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 24], 2048);
264264         return 1;
src/lib/util/aviio.c
r7972r7973
13491349
13501350static avi_error extract_movie_info(avi_file *file)
13511351{
1352   avi_stream *audiostream;
1352   //avi_stream *audiostream;
13531353   avi_stream *stream;
13541354
13551355   /* get the video stream */
r7972r7973
13801380   }
13811381
13821382   /* now make sure all other audio streams are valid */
1383   audiostream = stream;
1383   //audiostream = stream;
13841384   while (1)
13851385   {
13861386      /* get the stream info */
src/mess/drivers/genesis.c
r7972r7973
437437
438438static DRIVER_INIT( mess_32x )
439439{
440   DRIVER_INIT_CALL(x32x);
440   DRIVER_INIT_CALL(_32x);
441441   DRIVER_INIT_CALL(mess_md_common);
442442}
443443
docs/messnew.txt
r7972r7973
8181
8282Source Changes:
8383----------------
84- The core is based on MAME 0.137u3.  This incorporates all features of the
84- The core is based on MAME 0.137u4.  This incorporates all features of the
8585  update to this core.  [MAME team]
8686
8787- [AMSTRAD CPC Family] Updated Hashes to GoodCPC V3.1415 [Cowering]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team