Previous 15994 Revisions Next

r1282 Thursday 15th November, 2007 at 18:35:57 UTC by Nathan Woods
Updated to MAME 0.120u4 core
[docs]messnew.txt
[src/emu]eigccppc.h eigccx86.h eminline.h emu.mak inptport.c inptport.h uimenu.c
[src/emu/cpu/i8051]i8051.c
[src/emu/cpu/tms32031]32031ops.c tms32031.c
[src/emu/debug]debugvw.c
[src/emu/sound]scsp.c
[src/emu/video]poly.c poly.h resnet.c resnet.h rgbgen.h rgbsse.h rgbutil.h rgbvmx.h* vooddefs.h voodoo.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]seibu.c snes.c
[src/mame/drivers]1942.c 1945kiii.c 2mindril.c ace.c acefruit.c acommand.c adp.c afega.c airbustr.c aladbl.c aleck64.c aliens.c alpha68k.c ampoker.c amspdwy.c arcadia.c armedf.c asuka.c backfire.c bagman.c battlane.c battlnts.c bbusters.c berzerk.c bestleag.c bfcobra.c bigevglf.c bishjan.c blmbycar.c blockade.c blockhl.c bnstars.c bombjack.c brkthru.c bwidow.c bwing.c cabal.c calorie.c capbowl.c cardline.c carrera.c cave.c cbasebal.c cbuster.c cchasm.c champbas.c changela.c cherrym.c cherrym2.c chinagat.c chinsan.c chqflag.c cidelsa.c cinemat.c cischeat.c citycon.c cliffhgr.c clshroad.c cntsteer.c coinmstr.c comebaby.c contra.c coolridr.c cosmic.c couple.c cowrace.c cps1.c cps2.c cps3.c crbaloon.c crospang.c crshrace.c crystal.c cshooter.c cultures.c cvs.c cybertnk.c dacholer.c dambustr.c darius.c darkhors.c dblewing.c ddayjlc.c ddealer.c ddenlovr.c ddz.c dec8.c deco156.c destroyr.c dgpix.c discoboy.c djboy.c dkong.c dlair.c dmndrby.c dominob.c dragrace.c dreamwld.c drtomy.c dunhuang.c dwarfd.c dynadice.c dynax.c egghunt.c eolith16.c epos.c ertictac.c esd16.c esh.c ettrivia.c exctsccr.c exidy.c exidy440.c expro02.c exterm.c fastlane.c fcrash.c filetto.c finalizr.c findout.c flyball.c fortecar.c freekick.c funworld.c funybubl.c gaelco.c gaelco2.c galaxia.c galaxian.c galivan.c galpani2.c galpani3.c galpanic.c gbusters.c ghosteo.c ginganin.c gladiatr.c go2000.c goindol.c goldstar.c good.c gottlieb.c gpworld.c gradius3.c grchamp.c groundfx.c gstream.c gsword.c gticlub.c gunpey.c hal21.c hanaroku.c harddriv.c hitme.c hng64.c homedata.c homerun.c hornet.c hotblock.c hshavoc.c hyprduel.c igs_180.c igs_blit.c igs_m027.c igs_m68.c ikki.c imolagp.c intrscti.c iqblock.c irobot.c istellar.c jackpool.c jalmah.c jchan.c jollyjgr.c jongkyo.c kaneko16.c kickgoal.c kingpin.c kinst.c koikoi.c konamigx.c konamim2.c ladybug.c laserbas.c laserbat.c lazercmd.c limenko.c littlerb.c lkage.c lockon.c looping.c lsasquad.c ltcasino.c lucky8.c lwings.c m62.c m72.c magic10.c magicfly.c mainevt.c mainsnk.c malzak.c marinedt.c mario.c markham.c mastboy.c matmania.c maxaflex.c mazerbla.c mcr.c megadriv.c megaplay.c megasys1.c megatech.c megazone.c meijinsn.c merit.c meritm.c metro.c mexico86.c midas.c midvunit.c miniboy7.c mirage.c mirax.c missb2.c missile.c mjkjidai.c mjsiyoub.c mlanding.c mnight.c mogura.c momoko.c mouser.c mpatrol.c mpu4.c mpu4drvr.c* mquake.c mrdo.c ms32.c munchmo.c murogem.c mw8080bw.c mwarr.c namcona1.c namcos10.c namcos11.c namcos12.c namcos2.c namcos21.c namcos22.c namcos23.c naughtyb.c nemesis.c ninjakd2.c ninjaw.c nmg5.c nmk16.c nwk-tr.c nycaptor.c ohmygod.c olibochu.c omegrace.c onetwo.c orbit.c pacman.c pandoras.c pangofun.c panicr.c paradise.c pasha2.c peplus.c pgm.c pingpong.c pipedrm.c pipeline.c pkscram.c pktgaldx.c pmpoker.c pntnpuzl.c pokechmp.c polepos.c popeye.c powerbal.c powerins.c ppmast93.c progolf.c psikyo.c psychic5.c pturn.c puckpkmn.c punchout.c pushman.c quasar.c quizo.c rabbit.c raiden2.c rbmk.c rcasino.c rcorsair.c redalert.c renegade.c rmhaihai.c rocnrope.c rpunch.c rungun.c sandscrp.c sangho.c sbasketb.c sbowling.c segac2.c segae.c segag80v.c segald.c segas16a.c segas18.c segas32.c segaxbd.c segaybd.c seibuspi.c senjyo.c seta.c seta2.c sfkick.c sg1000a.c shadfrce.c shanghai.c shougi.c silkroad.c simpl156.c skyarmy.c skyfox.c skylncr.c slapfght.c sliver.c smstrv.c snowbros.c sonson.c spaceg.c splash.c srmp5.c ssf2md.c ssfindo.c ssingles.c sslam.c ssozumo.c ssrj.c ssv.c starfire.c starwars.c statriv2.c steaser.c stepstag.c stlforce.c strnskil.c stv.c stvinit.c suna16.c suna8.c supdrapo.c superdq.c superqix.c suprgolf.c suprloco.c suprnova.c system1.c taito_f2.c taito_f3.c taito_x.c talbot.c tankbatt.c tankbust.c tarzan.c tattack.c taxidrvr.c tcl.c tecmo.c tecmosys.c terracre.c tetrisp2.c tetriunk.c thayers.c thedeep.c thepit.c thoop2.c thunderj.c thunderx.c tiamc1.c tigeroad.c tmaster.c tmnt.c tnzs.c toaplan1.c toaplan2.c toki.c topshoot.c topspeed.c toypop.c travrusa.c triplhnt.c trvmadns.c ttchamp.c tubep.c tugboat.c tumbleb.c tunhunt.c turbosub.c twins.c undrfire.c unico.c upscope.c vamphalf.c vball.c vegaeo.c vendetta.c vigilant.c viper.c vmetal.c vroulet.c wallc.c warpwarp.c warriorb.c wecleman.c wgp.c wheelfir.c wilytowr.c wink.c witch.c wwfwfest.c xain.c xexex.c xxmissio.c xyonix.c yamato.c yumefuda.c yunsun16.c yunsung8.c zerozone.c zn.c zr107.c
[src/mame/includes]tubep.h
[src/mame/layout]ampoker.lay* pepp0158.lay* sigmapkr.lay*
[src/mame/machine]decocass.c exctsccr.c neoboot.c sbrkout.c slapfght.c stactics.c stfight.c stvprot.c
[src/mame/video]ampoker.c* battlera.c combatsc.c dec8.c dooyong.c dynax.c equites.c flstory.c gaelco3d.c gradius3.c gstriker.c gticlub.c ladyfrog.c legionna.c m3raster.c marvins.c midvunit.c midzeus.c model2.c model2rd.c model3.c msisaac.c namcos22.c nbmj8688.c psychic5.c seibuspi.c skyfox.c slapshot.c stvvdp1.c taitojc.c tubep.c tutankhm.c vball.c welltris.c
[src/osd/windows]input.c verinfo.c

src/mame/audio/snes.c
r1281r1282
11881188 *       I/O for DSP       *
11891189 ***************************/
11901190
1191READ8_HANDLER( snes_dsp_io_r )
1191static READ8_HANDLER( snes_dsp_io_r )
11921192{
11931193   stream_update(channel);
11941194
r1281r1282
12021202   return DSPregs[offset & 0x7f];
12031203}
12041204
1205WRITE8_HANDLER( snes_dsp_io_w )
1205static WRITE8_HANDLER( snes_dsp_io_w )
12061206{
12071207   stream_update(channel);
12081208
src/mame/audio/seibu.c
r1281r1282
407407   sub2main[offset] = data;
408408}
409409
410WRITE8_HANDLER( seibu_pending_w )
410static WRITE8_HANDLER( seibu_pending_w )
411411{
412412   /* just a guess */
413413   main2sub_pending = 0;
src/mame/machine/stactics.c
r1281r1282
1111extern int stactics_shot_standby;
1212extern int stactics_shot_arrive;
1313
14#ifdef UNUSED_FUNCTION
1415READ8_HANDLER( stactics_port_0_r )
1516{
1617    if (*stactics_motor_on & 0x01)
r1281r1282
2627        return (input_port_0_r(0)|0x80);
2728    }
2829}
30#endif
2931
3032READ8_HANDLER( stactics_port_2_r )
3133{
src/mame/machine/stvprot.c
r1281r1282
290290   memory_install_write32_handler(0, ADDRESS_SPACE_PROGRAM, 0x04fffff0, 0x04ffffff, 0, 0, a_bus_ctrl_w);
291291}
292292
293READ32_HANDLER(astrass_prot_r)
293static READ32_HANDLER(astrass_prot_r)
294294{
295295   if ( offset == 3 && ctrl_index != -1 )
296296   {
r1281r1282
309309   return a_bus[offset];
310310}
311311
312WRITE32_HANDLER(astrass_prot_w)
312static WRITE32_HANDLER(astrass_prot_w)
313313{
314314   COMBINE_DATA(&a_bus[0 + offset]);
315315   if ( offset == 3 )
r1281r1282
335335static UINT16 decathlt_prottable1[24];
336336static UINT16 decathlt_prottable2[128];
337337
338READ32_HANDLER( decathlt_prot_r )
338static READ32_HANDLER( decathlt_prot_r )
339339{
340340   UINT32 *ROM = (UINT32 *)memory_region(REGION_USER1);
341341
r1281r1282
356356   return decathlt_protregs[offset];
357357}
358358
359WRITE32_HANDLER( decathlt_prot_w )
359static WRITE32_HANDLER( decathlt_prot_w )
360360{
361361   decathlt_protregs[offset] = (data&~mem_mask)|(decathlt_protregs[offset]&mem_mask);
362362//  decathlt_protregs[0] = 0x0c00000/4;
src/mame/machine/slapfght.c
r1281r1282
147147      cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE);
148148}
149149
150#ifdef UNUSED_FUNCTION
150151WRITE8_HANDLER( getstar_port_04_w )
151152{
152153//  cpu_halt(0,0);
153154}
155#endif
154156
155157
156158/* Tiger Heli MCU */
src/mame/machine/decocass.c
r1281r1282
907907 *
908908 ***************************************************************************/
909909
910READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r )
910static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r )
911911{
912912   static UINT8 latch1;
913913   UINT8 data;
r1281r1282
988988 *  - Tornado
989989 *
990990 ***************************************************************************/
991READ8_HANDLER( decocass_type2_r )
991static READ8_HANDLER( decocass_type2_r )
992992{
993993   UINT8 data;
994994
r1281r1282
10171017   return data;
10181018}
10191019
1020WRITE8_HANDLER( decocass_type2_w )
1020static WRITE8_HANDLER( decocass_type2_w )
10211021{
10221022   if (1 == type2_xx_latch)
10231023   {
r1281r1282
10681068 *  - Peter Pepper's Ice Cream Factory
10691069 *
10701070 ***************************************************************************/
1071READ8_HANDLER( decocass_type3_r )
1071static READ8_HANDLER( decocass_type3_r )
10721072{
10731073   UINT8 data, save;
10741074
r1281r1282
12551255   return data;
12561256}
12571257
1258WRITE8_HANDLER( decocass_type3_w )
1258static WRITE8_HANDLER( decocass_type3_w )
12591259{
12601260   if (1 == (offset & 1))
12611261   {
r1281r1282
12941294 *
12951295 ***************************************************************************/
12961296
1297READ8_HANDLER( decocass_type4_r )
1297static READ8_HANDLER( decocass_type4_r )
12981298{
12991299   UINT8 data;
13001300
r1281r1282
13391339   return data;
13401340}
13411341
1342WRITE8_HANDLER( decocass_type4_w )
1342static WRITE8_HANDLER( decocass_type4_w )
13431343{
13441344   if (1 == (offset & 1))
13451345   {
r1281r1282
13771377 *
13781378 ***************************************************************************/
13791379
1380READ8_HANDLER( decocass_type5_r )
1380static READ8_HANDLER( decocass_type5_r )
13811381{
13821382   UINT8 data;
13831383
r1281r1282
14191419   return data;
14201420}
14211421
1422WRITE8_HANDLER( decocass_type5_w )
1422static WRITE8_HANDLER( decocass_type5_w )
14231423{
14241424   if (1 == (offset & 1))
14251425   {
r1281r1282
14531453 *
14541454 ***************************************************************************/
14551455
1456READ8_HANDLER( decocass_nodong_r )
1456static READ8_HANDLER( decocass_nodong_r )
14571457{
14581458   UINT8 data;
14591459
src/mame/machine/neoboot.c
r1281r1282
143143   neogeo_set_main_cpu_bank_address(bank);
144144}
145145
146READ16_HANDLER( kof10th_RAMB_r )
146static READ16_HANDLER( kof10th_RAMB_r )
147147{
148148   return kof10thExtraRAMB[offset];
149149}
150150
151WRITE16_HANDLER( kof10th_custom_w )
151static WRITE16_HANDLER( kof10th_custom_w )
152152{
153153   if (!kof10thExtraRAMB[0xFFE]) { // Write to RAM bank A
154154      UINT16 *prom = (UINT16*)memory_region( NEOGEO_REGION_MAIN_CPU_CARTRIDGE );
r1281r1282
845845/* kof2003 bootleg init info */
846846static UINT16 kof2003_tbl[4096];
847847
848READ16_HANDLER( kof2003_r)
848static READ16_HANDLER( kof2003_r)
849849{
850850   return kof2003_tbl[offset];
851851}
852852
853WRITE16_HANDLER( kof2003_w )
853static WRITE16_HANDLER( kof2003_w )
854854{
855855   data = COMBINE_DATA(&kof2003_tbl[offset]);
856856   if (offset == 0x1ff0/2 || offset == 0x1ff2/2) {
r1281r1282
868868   }
869869}
870870
871WRITE16_HANDLER( kof2003p_w )
871static WRITE16_HANDLER( kof2003p_w )
872872{
873873   data = COMBINE_DATA(&kof2003_tbl[offset]);
874874   if (offset == 0x1ff0/2 || offset == 0x1ff2/2) {
src/mame/machine/stfight.c
r1281r1282
1212#include "sound/msm5205.h"
1313
1414// this prototype will move to the driver
15WRITE8_HANDLER( stfight_bank_w );
15static WRITE8_HANDLER( stfight_bank_w );
1616
1717
1818/*
r1281r1282
8787
8888// It's entirely possible that this bank is never switched out
8989// - in fact I don't even know how/where it's switched in!
90WRITE8_HANDLER( stfight_bank_w )
90static WRITE8_HANDLER( stfight_bank_w )
9191{
9292   UINT8   *ROM2 = memory_region(REGION_CPU1) + 0x10000;
9393
src/mame/machine/sbrkout.c
r1281r1282
5454    else return 0x00;
5555}
5656
57#ifdef UNUSED_FUNCTION
5758WRITE8_HANDLER( sbrkout_irq_w )
5859{
5960        /* generate irq */
6061        cpunum_set_input_line(0,M6502_IRQ_LINE,HOLD_LINE);
6162}
63#endif
6264
6365
6466/***************************************************************************
src/mame/machine/exctsccr.c
r1281r1282
2020
2121#include "driver.h"
2222
23#define MCU_HACK 0
2324
2425#define MCU_KEY_TABLE_SIZE 16
2526
2627/* These are global */
2728UINT8 *exctsccr_mcu_ram;
29
30#if MCU_HACK
31
2832WRITE8_HANDLER( exctsccr_mcu_w );
2933WRITE8_HANDLER( exctsccr_mcu_control_w );
3034
r1281r1282
333337      memcpy( &exctsccr_mcu_ram[0x007f], exctscc2_mcu_table8, MCU_KEY_TABLE_SIZE*2 );
334338   }
335339}
340
341#endif
src/mame/mamedriv.c
r1281r1282
16211621   DRIVER( kikikai )   /* A85 (c) 1986 Taito Corporation */
16221622   DRIVER( knightb )   /* bootleg */
16231623   DRIVER( kicknrun )   /* A87 (c) 1986 Taito Corporation */
1624   DRIVER( kicknruu )   /* A87 (c) 1986 Taito Corporation */
16241625   DRIVER( mexico86 )   /* bootleg (Micro Research) */
16251626   DRIVER( darius )   /* A96 (c) 1986 Taito Corporation Japan (World) */
16261627   DRIVER( dariusj )   /* A96 (c) 1986 Taito Corporation (Japan) */
r1281r1282
36213622   DRIVER( darkedge )   /* (c) 1992 */
36223623   DRIVER( darkedgj )   /* (c) 1992 (Japan) */
36233624   DRIVER( slipstrm )   /* (c) 1995 Capcom */
3625   DRIVER( slipstrh )   /* (c) 1995 Capcom */
36243626
36253627   /* Sega Multi System 32 games */
36263628   DRIVER( orunners )   /* (c) 1992 (World) */
r1281r1282
73767378   DRIVER( sltblgp1 )   /* 1996 */
73777379   DRIVER( gldncrwn )   /* 1997 */
73787380
7381   /* MPU4 Diagnostic ROMs */
7382   DRIVER( mpu4utst )
7383   DRIVER( mpu4tst2 )
7384   DRIVER( mpu4met0 )
7385
73797386   /* MPU4 Non-Video SWPs */
73807387   DRIVER( connect4 )   /* Dolbeck Systems */
73817388
r1281r1282
73907397   DRIVER( skiltrek )   /* 1992 */
73917398   DRIVER( mating )   /* 199? */
73927399   DRIVER( matinga )   /* 199? */
7400   DRIVER( vgpoker )   /* 199? */
73937401
73947402   /* ADP games */
73957403   DRIVER( backgamn )   /* (c) 1990 */
r1281r1282
77387746   DRIVER( cmv801 )   /* (c) 198? Corsica */
77397747   DRIVER( cm2v841 )   /* (c) 198? Dyna Electronics */
77407748   DRIVER( cm2841a )   /* (c) 198? Dyna Electronics */
7741   DRIVER( ampoker2 )   /* (c) 198? Novomatic */
7742   DRIVER( ampokr2a )   /* (c) 198? Novomatic */
7743   DRIVER( ampokr2b )   /* (c) 198? Novomatic */
7744   DRIVER( ampokr2c )   /* (c) 198? Novomatic */
7749   DRIVER( ampoker2 )   /* (c) 1990 Novomatic */
7750   DRIVER( ampkr2b1 )   /* 1990 bootleg */
7751   DRIVER( ampkr2b2 )   /* 1990 bootleg */
7752   DRIVER( ampkr2b3 )   /* 1994 bootleg */
7753   DRIVER( pkrdewin )   /* 1990 bootleg */
7754   DRIVER( ampkr95 )   /* 1995 bootleg */
7755   DRIVER( sigmapkr )   /* (c) 1995 Sigma */
7756   DRIVER( sigma2k )   /* (c) 2000 Sigma */
77457757   DRIVER( lucky8 )   /* (c) 1989 Falcon */
77467758   DRIVER( sidewndr )   /* (c) 1981? ACE */
77477759   DRIVER( spellbnd )   /* (c) 1981? ACE */
r1281r1282
78317843   DRIVER( eshb )      /* (c) 1984 Funai / Gakken */
78327844   DRIVER( comebaby )   /* (c) 2000 ExPotato */
78337845   DRIVER( peplus )   /* (c) 1987 IGT - International Gaming Technology */
7834    DRIVER( pepp0188 )   /* (c) 1987 IGT - International Gaming Technology */
7835    DRIVER( peset038 )   /* (c) 1987 IGT - International Gaming Technology */
7846   DRIVER( pepp0158 )   /* (c) 1987 IGT - International Gaming Technology */
7847   DRIVER( pepp0188 )   /* (c) 1987 IGT - International Gaming Technology */
7848   DRIVER( peset038 )   /* (c) 1987 IGT - International Gaming Technology */
7849    DRIVER( pebe0014 )   /* (c) 1994 IGT - International Gaming Technology */
7850    DRIVER( peke1012 )   /* (c) 1994 IGT - International Gaming Technology */
7851    DRIVER( peps0615 )   /* (c) 1996 IGT - International Gaming Technology */
7852   DRIVER( peps0716 )   /* (c) 1996 IGT - International Gaming Technology */
7853    DRIVER( pexp0019 )   /* (c) 1995 IGT - International Gaming Technology */
7854    DRIVER( pexs0006 )   /* (c) 1997 IGT - International Gaming Technology */
78367855   DRIVER( mirage )   /* (c) 1994 Mitchell */
78377856   DRIVER( dominob )   /* (c) 1990 Wonwoo Systems */
78387857   DRIVER( jongkyo )   /* (c) 1985 Kiwako */
src/mame/includes/tubep.h
r1281r1282
11/*----------- defined in video/tubep.c -----------*/
22
3VIDEO_EOF( tubep );
3void tubep_vblank_end(void);
44PALETTE_INIT( tubep );
55VIDEO_UPDATE( tubep );
66PALETTE_INIT( rjammer );
src/mame/mame.mak
r1281r1282
11541154   $(DRIVERS)/stv.o $(DRIVERS)/stvinit.o $(MACHINE)/stvprot.o $(MACHINE)/stvcd.o \
11551155   $(DRIVERS)/suprloco.o $(VIDEO)/suprloco.o \
11561156   $(DRIVERS)/system1.o $(VIDEO)/system1.o \
1157   $(DRIVERS)/system16.o $(MACHINE)/system16.o $(AUDIO)/system16.o $(VIDEO)/system16.o $(VIDEO)/sys16spr.o \
1157   $(DRIVERS)/system16.o $(MACHINE)/system16.o $(VIDEO)/system16.o $(VIDEO)/sys16spr.o \
11581158   $(DRIVERS)/system18.o \
11591159   $(DRIVERS)/system24.o $(MACHINE)/system24.o $(VIDEO)/system24.o \
11601160   $(DRIVERS)/topshoot.o \
r1281r1282
14881488   $(DRIVERS)/adp.o \
14891489   $(DRIVERS)/afega.o $(VIDEO)/afega.o \
14901490   $(DRIVERS)/ambush.o $(VIDEO)/ambush.o \
1491   $(DRIVERS)/ampoker.o \
1491   $(DRIVERS)/ampoker.o $(VIDEO)/ampoker.o \
14921492   $(DRIVERS)/amspdwy.o $(VIDEO)/amspdwy.o \
14931493   $(DRIVERS)/artmagic.o $(VIDEO)/artmagic.o \
14941494   $(DRIVERS)/attckufo.o $(AUDIO)/attckufo.o $(VIDEO)/attckufo.o \
r1281r1282
16251625
16261626$(DRIVERS)/acefruit.o:   $(LAYOUT)/sidewndr.lh
16271627
1628$(DRIVERS)/ampoker.o:   $(LAYOUT)/ampoker.lh \
1629                  $(LAYOUT)/sigmapkr.lh \
1630
16281631$(DRIVERS)/astrocde.o:   $(LAYOUT)/tenpindx.lh
16291632
16301633$(DRIVERS)/atarifb.o:   $(LAYOUT)/atarifb.lh \
r1281r1282
16801683$(DRIVERS)/nbmj8688.o:   $(LAYOUT)/nbmj8688.lh
16811684
16821685$(DRIVERS)/peplus.o:   $(LAYOUT)/peplus.lh \
1686                  $(LAYOUT)/pepp0158.lh \
16831687                  $(LAYOUT)/pepp0188.lh \
16841688                  $(LAYOUT)/peset038.lh
16851689
r1281r1282
17111715#-------------------------------------------------
17121716
17131717$(DRIVERS)/neogeo.o:   $(MAMESRC)/drivers/neodrvr.c
1718$(DRIVERS)/mpu4.o:      $(MAMESRC)/drivers/mpu4drvr.c
src/mame/video/skyfox.c
r1281r1282
5353
5454***************************************************************************/
5555
56#ifdef UNUSED_FUNCTION
5657READ8_HANDLER( skyfox_vregs_r )   // for debug
5758{
5859   return vreg[offset];
5960}
61#endif
6062
6163WRITE8_HANDLER( skyfox_vregs_w )
6264{
src/mame/video/stvvdp1.c
r1281r1282
411411   return result;
412412}
413413
414#ifdef UNUSED_FUNCTION
414415WRITE32_HANDLER ( stv_vdp1_framebuffer1_w )
415416{
416417   //popmessage ("STV VDP1 Framebuffer 1 WRITE offset %08x data %08x",offset, data);
r1281r1282
421422   //popmessage ("STV VDP1 Framebuffer 1 READ offset %08x",offset);
422423   return 0xffff;
423424}
425#endif
424426
425427
426428/*
src/mame/video/seibuspi.c
r1281r1282
6868   }
6969}
7070
71#ifdef UNUSED_FUNCTION
7172READ32_HANDLER( spi_layer_enable_r )
7273{
7374   return layer_enable;
7475}
76#endif
7577
7678WRITE32_HANDLER( spi_layer_enable_w )
7779{
src/mame/video/dynax.c
r1281r1282
635635
636636
637637
638WRITE8_HANDLER( dynax_blit_scroll_w )
638static WRITE8_HANDLER( dynax_blit_scroll_w )
639639{
640640   switch( blit_src & 0xc00000 )
641641   {
r1281r1282
659659}
660660
661661// inverted scroll values
662WRITE8_HANDLER( tenkai_blit_scroll_w )
662static WRITE8_HANDLER( tenkai_blit_scroll_w )
663663{
664664   switch( blit_src & 0xc00000 )
665665   {
r1281r1282
682682   }
683683}
684684
685WRITE8_HANDLER( dynax_blit2_scroll_w )
685static WRITE8_HANDLER( dynax_blit2_scroll_w )
686686{
687687   switch( blit2_src & 0xc00000 )
688688   {
src/mame/video/midzeus.c
r1281r1282
77#include "driver.h"
88#include "eminline.h"
99#include "includes/midzeus.h"
10#include "video/polynew.h"
10#include "video/poly.h"
1111
1212
1313
r1281r1282
201201      palette_set_color_rgb(machine, i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0));
202202
203203   /* initialize polygon engine */
204   poly = poly_alloc(1000, sizeof(poly_extra_data), 0);
204   poly = poly_alloc(1000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
205205
206206   /* we need to cleanup on exit */
207207   add_exit_callback(machine, exit_handler);
r1281r1282
603603*/
604604
605605
606static void render_poly_4bit(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
606static void render_poly_4bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
607607{
608608   const poly_extra_data *extra = extradata;
609   float doozdx = poly->param[0].dpdx;
610   float duozdx = poly->param[1].dpdx;
611   float dvozdx = poly->param[2].dpdx;
609   float ooz = extent->param[0].start;
610   float uoz = extent->param[1].start;
611   float voz = extent->param[2].start;
612   float doozdx = extent->param[0].dpdx;
613   float duozdx = extent->param[1].dpdx;
614   float dvozdx = extent->param[2].dpdx;
612615   const UINT32 *texbase = extra->texbase;
613616   const UINT32 *palbase = extra->palbase;
614617   UINT16 transcolor = extra->transcolor;
615618   int texwidth = extra->texwidth;
616   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
617   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
618   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
619619   int x;
620620
621621   for (x = extent->startx; x < extent->stopx; x++)
r1281r1282
640640}
641641
642642
643static void render_poly_8bit(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
643static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
644644{
645645   const poly_extra_data *extra = extradata;
646   float doozdx = poly->param[0].dpdx;
647   float duozdx = poly->param[1].dpdx;
648   float dvozdx = poly->param[2].dpdx;
646   float ooz = extent->param[0].start;
647   float uoz = extent->param[1].start;
648   float voz = extent->param[2].start;
649   float doozdx = extent->param[0].dpdx;
650   float duozdx = extent->param[1].dpdx;
651   float dvozdx = extent->param[2].dpdx;
649652   const UINT32 *texbase = extra->texbase;
650653   const UINT32 *palbase = extra->palbase;
651654   UINT16 transcolor = extra->transcolor;
652655   int texwidth = extra->texwidth;
653   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
654   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
655   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
656656   int x;
657657
658658   for (x = extent->startx; x < extent->stopx; x++)
r1281r1282
757757
758758         if ((data[datanum] >> 24) == 0x25 || (data[datanum] >> 24) == 0x30 /* invasn */)
759759         {
760            poly_draw_tri_scanline callback;
760            poly_draw_scanline callback;
761761            poly_extra_data *extra;
762762            poly_vertex vert[4];
763763            int i;
r1281r1282
798798            extra->texwidth = 512 >> texwshift;
799799            extra->palbase = zeus_palbase;
800800            extra->alpha = zeus_blend;
801            poly_render_triangle(poly, NULL, &Machine->screen[0].visarea, callback, 3, &vert[0], &vert[1], &vert[2]);
801            poly_render_quad(poly, NULL, &Machine->screen[0].visarea, callback, 3, &vert[0], &vert[1], &vert[2], &vert[3]);
802802
803            /* skip empty if not a full quad */
804            if (vert[2].x != vert[3].x || vert[2].y != vert[3].y)
805            {
806               extra = poly_get_extra_data(poly);
807               extra->transcolor = 0x100;
808               extra->texbase = &waveram[val1 & 0x3fffff];
809               extra->texwidth = 512 >> texwshift;
810               extra->palbase = zeus_palbase;
811               extra->alpha = zeus_blend;
812               poly_render_triangle(poly, NULL, &Machine->screen[0].visarea, callback, 3, &vert[0], &vert[2], &vert[3]);
813            }
814
815803            poly_wait(poly, "Normal");
816804         }
817805         else if (data[datanum] == 0x0c018000)
src/mame/video/gticlub.c
r1281r1282
55#include "gticlub.h"
66
77
8typedef struct _poly_extra_data poly_extra_data;
9struct _poly_extra_data
10{
11   UINT32 color;
12   int texture_x, texture_y;
13   int texture_page;
14   int texture_palette;
15   int texture_mirror_x;
16   int texture_mirror_y;
17};
818
19
920// defined in drivers/nwk-tr.c
1021int K001604_vh_start(running_machine *machine, int chip);
1122void K001604_tile_update(running_machine *machine, int chip);
r1281r1282
1526extern UINT8 gticlub_led_reg0;
1627extern UINT8 gticlub_led_reg1;
1728
29static poly_manager *poly;
1830
1931
32
2033/*****************************************************************************/
2134/* Konami K001006 Custom 3D Texel Renderer chip (KS10081) */
2235
r1281r1282
140153static const int decode_x_zr107[8] = {  0, 16, 1, 17, 2, 18, 3, 19 };
141154static const int decode_y_zr107[16] = {  0, 8, 32, 40, 4, 12, 36, 44, 64, 72, 96, 104, 68, 76, 100, 108 };
142155
143typedef struct {
144   float x,y,z;
145   INT16 u,v;
146} VERTEX;
147
148156UINT32 K001005_status = 0;
149157mame_bitmap *K001005_bitmap[2];
150158mame_bitmap *K001005_zbuffer;
r1281r1282
385393         {
386394            K001005_swap_buffers();
387395            render_polygons();
396            poly_wait(poly, "render_polygons");
388397            K001005_3d_fifo_ptr = 0;
389398         }
390399         break;
r1281r1282
416425
417426}
418427
419static void draw_triangle(VERTEX v1, VERTEX v2, VERTEX v3, UINT32 color)
428static void draw_scanline(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
420429{
421   int x, y;
422   struct poly_vertex vert[3];
423   const struct poly_scanline_data *scans;
430   const poly_extra_data *extra = extradata;
431   mame_bitmap *destmap = dest;
432   float z = extent->param[0].start;
433   float dz = extent->param[0].dpdx;
434   UINT32 *fb = BITMAP_ADDR32(destmap, scanline, 0);
435   UINT32 *zb = BITMAP_ADDR32(K001005_zbuffer, scanline, 0);
436   UINT32 color = extra->color;
437   int x;
424438
425   rectangle cliprect;
426   cliprect.min_x = 0;
427   cliprect.min_y = 0;
428   cliprect.max_x = Machine->screen[0].width-1;
429   cliprect.max_y = Machine->screen[0].height-1;
430
431   vert[0].x = v1.x;   vert[0].y = v1.y;   vert[0].p[0] = (UINT32)(v1.z);
432   vert[1].x = v2.x;   vert[1].y = v2.y;   vert[1].p[0] = (UINT32)(v2.z);
433   vert[2].x = v3.x;   vert[2].y = v3.y;   vert[2].p[0] = (UINT32)(v3.z);
434
435   scans = setup_triangle_1(&vert[0], &vert[1], &vert[2], &cliprect);
436
437   if (scans)
439   for (x = extent->startx; x < extent->stopx; x++)
438440   {
439      INT64 dz;
440      dz = scans->dp[0];
441      UINT32 iz = (UINT32)z >> 16;
441442
442      for (y = scans->sy; y <= scans->ey; y++)
443      if (iz <= zb[x])
443444      {
444         int x1, x2;
445         INT64 z;
446         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
447         UINT32 *fb = BITMAP_ADDR32(K001005_bitmap[K001005_bitmap_page], y, 0);
448         UINT32 *zb = BITMAP_ADDR32(K001005_zbuffer, y, 0);
449
450         x1 = scan->sx;
451         x2 = scan->ex;
452
453         z = scans->scanline[y - scans->sy].p[0];
454
455         for (x = x1; x <= x2; x++)
445         if (color & 0xff000000)
456446         {
457            UINT32 iz = (UINT64)(z) >> 16;
458
459            if (iz <= zb[x])
460            {
461               if (color & 0xff000000)
462               {
463                  fb[x] = color;
464                  zb[x] = iz;
465               }
466            }
467
468            z += dz;
447            fb[x] = color;
448            zb[x] = iz;
469449         }
470450      }
451
452      z += dz;
471453   }
472454}
473455
474static int texture_x, texture_y;
475static int texture_page;
476static int texture_palette;
477static int texture_mirror_x;
478static int texture_mirror_y;
479
480#define ZBUFFER_SCALE      16777216.0
481#define ZDIVIDE_SHIFT      24
482
483static void draw_triangle_tex(VERTEX v1, VERTEX v2, VERTEX v3, UINT32 color)
456static void draw_scanline_tex(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
484457{
485   double z1, z2, z3;
486   double w1, w2, w3;
487   int x, y;
488   struct poly_vertex vert[3];
489   const struct poly_scanline_data *scans;
458   const poly_extra_data *extra = extradata;
459   mame_bitmap *destmap = dest;
460   UINT8 *texrom = memory_region(REGION_GFX1) + (extra->texture_page * 0x40000);
461   int pal_chip = (extra->texture_palette & 0x8) ? 1 : 0;
462   int palette_index = (extra->texture_palette & 0x7) * 256;
463   float z = extent->param[0].start;
464   float u = extent->param[1].start;
465   float v = extent->param[2].start;
466   float w = extent->param[3].start;
467   float dz = extent->param[0].dpdx;
468   float du = extent->param[1].dpdx;
469   float dv = extent->param[2].dpdx;
470   float dw = extent->param[3].dpdx;
471   int texture_mirror_x = extra->texture_mirror_x;
472   int texture_mirror_y = extra->texture_mirror_y;
473   int texture_x = extra->texture_x;
474   int texture_y = extra->texture_y;
475   int x;
490476
491   float maxz;
477   UINT32 *fb = BITMAP_ADDR32(destmap, scanline, 0);
478   UINT32 *zb = BITMAP_ADDR32(K001005_zbuffer, scanline, 0);
492479
493   UINT8 *texrom = memory_region(REGION_GFX1) + (texture_page * 0x40000);
494   int pal_chip = (texture_palette & 0x8) ? 1 : 0;
495   int palette_index = (texture_palette & 0x7) * 256;
496
497   rectangle cliprect;
498   cliprect.min_x = 0;
499   cliprect.min_y = 0;
500   cliprect.max_x = Machine->screen[0].width-1;
501   cliprect.max_y = Machine->screen[0].height-1;
502/*
503    vert[0].x    = v1.x;    vert[0].y    = v1.y;
504    vert[0].p[0] = v1.u;    vert[0].p[1] = v1.v;    vert[0].p[2] = (INT32)(v1.z);
505    vert[1].x    = v2.x;    vert[1].y    = v2.y;
506    vert[1].p[0] = v2.u;    vert[1].p[1] = v2.v;    vert[1].p[2] = (INT32)(v2.z);
507    vert[2].x    = v3.x;    vert[2].y    = v3.y;
508    vert[2].p[0] = v3.u;    vert[2].p[1] = v3.v;    vert[2].p[2] = (INT32)(v3.z);
509*/
510   maxz = 0.0;
511   maxz = MAX(maxz, v1.z);
512   maxz = MAX(maxz, v2.z);
513   maxz = MAX(maxz, v3.z);
514
515   z1 = (double)(v1.z) / maxz;
516   z2 = (double)(v2.z) / maxz;
517   z3 = (double)(v3.z) / maxz;
518
519   w1 = (1.0 / z1) * ZBUFFER_SCALE;
520   w2 = (1.0 / z2) * ZBUFFER_SCALE;
521   w3 = (1.0 / z3) * ZBUFFER_SCALE;
522   v1.u = (INT32)((INT64)(v1.u * w1) >> ZDIVIDE_SHIFT);
523   v1.v = (INT32)((INT64)(v1.v * w1) >> ZDIVIDE_SHIFT);
524   v2.u = (INT32)((INT64)(v2.u * w2) >> ZDIVIDE_SHIFT);
525   v2.v = (INT32)((INT64)(v2.v * w2) >> ZDIVIDE_SHIFT);
526   v3.u = (INT32)((INT64)(v3.u * w3) >> ZDIVIDE_SHIFT);
527   v3.v = (INT32)((INT64)(v3.v * w3) >> ZDIVIDE_SHIFT);
528
529   vert[0].x    = v1.x;   vert[0].y    = v1.y;
530   vert[0].p[0] = v1.u;   vert[0].p[1] = v1.v;   vert[0].p[2] = (UINT32)(w1);   vert[0].p[3] = (UINT32)(v1.z);
531   vert[1].x    = v2.x;   vert[1].y    = v2.y;
532   vert[1].p[0] = v2.u;   vert[1].p[1] = v2.v;   vert[1].p[2] = (UINT32)(w2);   vert[1].p[3] = (UINT32)(v2.z);
533   vert[2].x    = v3.x;   vert[2].y    = v3.y;
534   vert[2].p[0] = v3.u;   vert[2].p[1] = v3.v;   vert[2].p[2] = (UINT32)(w3);   vert[2].p[3] = (UINT32)(v3.z);
535
536
537   scans = setup_triangle_4(&vert[0], &vert[1], &vert[2], &cliprect);
538
539   if (scans)
480   for (x = extent->startx; x < extent->stopx; x++)
540481   {
541      INT64 du, dv, dz, dw;
542      du = scans->dp[0];
543      dv = scans->dp[1];
544      dw = scans->dp[2];
545      dz = scans->dp[3];
482      UINT32 iz = (UINT32)z >> 16;
483      //int iu = u >> 16;
484      //int iv = v >> 16;
546485
547      for (y = scans->sy; y <= scans->ey; y++)
486      if (iz < zb[x])
548487      {
549         int x1, x2;
550         INT64 u, v, z, w;
551         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
552         UINT32 *fb = BITMAP_ADDR32(K001005_bitmap[K001005_bitmap_page], y, 0);
553         UINT32 *zb = BITMAP_ADDR32(K001005_zbuffer, y, 0);
488         float oow = 1.0f / w;
489         UINT32 color;
490         int iu, iv;
491         int iiv, iiu, texel;
554492
555         x1 = scan->sx;
556         x2 = scan->ex;
493         iu = u * oow;
494         iv = v * oow;
557495
558         u = scans->scanline[y - scans->sy].p[0];
559         v = scans->scanline[y - scans->sy].p[1];
560         w = scans->scanline[y - scans->sy].p[2];
561         z = scans->scanline[y - scans->sy].p[3];
496         iiu = texture_x + tex_mirror_table[texture_mirror_x][(iu >> 4) & 0x7f];
497         iiv = texture_y + tex_mirror_table[texture_mirror_y][(iv >> 4) & 0x7f];
498         texel = texrom[((iiv & 0x1ff) * 512) + (iiu & 0x1ff)];
499         color = K001006_palette[pal_chip][palette_index + texel];
562500
563         for (x = x1; x <= x2; x++)
501         if (color & 0xff000000)
564502         {
565            UINT32 iz = (UINT64)(z) >> 16;
566            //int iu = u >> 16;
567            //int iv = v >> 16;
568
569            if (iz < zb[x])
570            {
571               UINT32 color;
572               int iu, iv;
573               int iiv, iiu, texel;
574
575               UINT32 iw = (UINT64)(w) >> 16;
576
577               if (iw)
578               {
579                  iu = (INT64)(u << 8) / (INT64)iw;
580                  iv = (INT64)(v << 8) / (INT64)iw;
581               }
582               else
583               {
584                  iu = 0;
585                  iv = 0;
586               }
587
588               iiu = texture_x + tex_mirror_table[texture_mirror_x][(iu >> 4) & 0x7f];
589               iiv = texture_y + tex_mirror_table[texture_mirror_y][(iv >> 4) & 0x7f];
590               texel = texrom[((iiv & 0x1ff) * 512) + (iiu & 0x1ff)];
591               color = K001006_palette[pal_chip][palette_index + texel];
592
593               if (color & 0xff000000)
594               {
595                  fb[x] = color;
596                  zb[x] = iz;
597               }
598            }
599
600            u += du;
601            v += dv;
602            z += dz;
603            w += dw;
503            fb[x] = color;
504            zb[x] = iz;
604505         }
605506      }
507
508      u += du;
509      v += dv;
510      z += dz;
511      w += dw;
606512   }
607513}
608514
609static VERTEX prev_v[4];
515static poly_vertex prev_v[4];
610516static int prev_poly_type;
611517
612518static void render_polygons(void)
r1281r1282
619525   {
620526      if (K001005_3d_fifo[i] == 0x80000003)
621527      {
622         VERTEX v[4];
528         poly_extra_data *extra = poly_get_extra_data(poly);
529         poly_vertex v[4];
623530         int r, g, b, a;
624531         UINT32 color;
625532         int index = i;
r1281r1282
638545
639546            v[j].x = ((float)(x) / 16.0f) + 256.0f;
640547            v[j].y = ((float)(-y) / 16.0f) + 192.0f;
548            v[j].p[0] = 0;   /* ??? */
641549         }
642550
643551         ++index;
r1281r1282
649557         color = (a << 24) | (r << 16) | (g << 8) | (b);
650558         ++index;
651559
652         draw_triangle(v[0], v[1], v[2], color);
653         draw_triangle(v[0], v[2], v[3], color);
560         extra->color = color;
561         poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[0], &v[1], &v[2]);
562         poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[0], &v[2], &v[3]);
563//          poly_render_polygon(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, 4, v);
654564
655565         i = index - 1;
656566      }
r1281r1282
668578         // 0x01: -------- -------- ----x-x- x-x-x-x-    Texture X / 8
669579         // 0x01: -------- -------- -----x-x -x-x-x-x    Texture Y / 8
670580
671
672         VERTEX v[4];
581         poly_extra_data *extra = poly_get_extra_data(poly);
582         poly_vertex v[4];
673583         int tx, ty;
674584         UINT32 color = 0;
675585         UINT32 header;
r1281r1282
717627
718628            v[j].x = ((float)(x) / 16.0f) + 256.0f;
719629            v[j].y = ((float)(-y) / 16.0f) + 192.0f;
720            v[j].z = *(float*)(&z);
721            v[j].u = u2;
722            v[j].v = v2;
630            v[j].p[0] = *(float*)(&z);
631            v[j].p[3] = 1.0f / v[j].p[0];
632            v[j].p[1] = u2 * v[j].p[3];
633            v[j].p[2] = v2 * v[j].p[3];
723634
724635            ++num_verts;
725636
r1281r1282
741652             ((header & 0x008) >> 2) |
742653             ((header & 0x002) >> 1);
743654
744         texture_x = tx * 8;
745         texture_y = ty * 8;
655         extra->texture_x = tx * 8;
656         extra->texture_y = ty * 8;
746657
747         texture_page = (header >> 12) & 0x1f;
748         texture_palette = (header >> 28) & 0xf;
658         extra->texture_page = (header >> 12) & 0x1f;
659         extra->texture_palette = (header >> 28) & 0xf;
749660
750         texture_mirror_x = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
751         texture_mirror_y = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
661         extra->texture_mirror_x = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
662         extra->texture_mirror_y = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
752663
664         extra->color = color;
665
753666         if (num_verts < 3)
754667         {
755            draw_triangle_tex(prev_v[2], v[0], v[1], color);
668            poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &prev_v[2], &v[0], &v[1]);
756669            if (prev_poly_type)
757            {
758               draw_triangle_tex(prev_v[2], prev_v[3], v[0], color);
759            }
670               poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &prev_v[2], &prev_v[3], &v[0]);
671//              if (prev_poly_type)
672//                  poly_render_quad(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &prev_v[2], &prev_v[3], &v[0], &v[1]);
673//              else
674//                  poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &prev_v[2], &v[0], &v[1]);
760675
761            memcpy(&prev_v[0], &prev_v[2], sizeof(VERTEX));
762            memcpy(&prev_v[1], &prev_v[3], sizeof(VERTEX));
763            memcpy(&prev_v[2], &v[0], sizeof(VERTEX));
764            memcpy(&prev_v[3], &v[1], sizeof(VERTEX));
676            memcpy(&prev_v[0], &prev_v[2], sizeof(poly_vertex));
677            memcpy(&prev_v[1], &prev_v[3], sizeof(poly_vertex));
678            memcpy(&prev_v[2], &v[0], sizeof(poly_vertex));
679            memcpy(&prev_v[3], &v[1], sizeof(poly_vertex));
765680         }
766681         else
767682         {
768            draw_triangle_tex(v[0], v[1], v[2], color);
683            poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &v[0], &v[1], &v[2]);
769684            if (num_verts > 3)
770            {
771               draw_triangle_tex(v[2], v[3], v[0], color);
772            }
685               poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &v[2], &v[3], &v[0]);
686//              poly_render_polygon(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, num_verts, v);
773687
774            memcpy(prev_v, v, sizeof(VERTEX) * 4);
688            memcpy(prev_v, v, sizeof(poly_vertex) * 4);
775689         }
776690
777691         prev_poly_type = poly_type;
778692
779693         while ((K001005_3d_fifo[index] & 0xffffff00) != 0x80000000 && index < K001005_3d_fifo_ptr)
780694         {
695            poly_extra_data *extra = poly_get_extra_data(poly);
781696            int new_verts = 0;
782697
783698            if (poly_type)
784699            {
785               memcpy(&v[0], &prev_v[2], sizeof(VERTEX));
786               memcpy(&v[1], &prev_v[3], sizeof(VERTEX));
700               memcpy(&v[0], &prev_v[2], sizeof(poly_vertex));
701               memcpy(&v[1], &prev_v[3], sizeof(poly_vertex));
787702            }
788703            else
789704            {
790               memcpy(&v[0], &prev_v[1], sizeof(VERTEX));
791               memcpy(&v[1], &prev_v[2], sizeof(VERTEX));
705               memcpy(&v[0], &prev_v[1], sizeof(poly_vertex));
706               memcpy(&v[1], &prev_v[2], sizeof(poly_vertex));
792707            }
793708
794709            for (j=2; j < 4; j++)
r1281r1282
827742
828743               v[j].x = ((float)(x) / 16.0f) + 256.0f;
829744               v[j].y = ((float)(-y) / 16.0f) + 192.0f;
830               v[j].z = *(float*)(&z);
831               v[j].u = u2;
832               v[j].v = v2;
745               v[j].p[0] = *(float*)(&z);
746               v[j].p[3] = 1.0f / v[j].p[0];
747               v[j].p[1] = u2 * v[j].p[3];
748               v[j].p[2] = v2 * v[j].p[3];
833749
834750               ++new_verts;
835751
r1281r1282
837753                  break;
838754            }
839755
840            draw_triangle_tex(v[0], v[1], v[2], color);
756            extra->texture_x = tx * 8;
757            extra->texture_y = ty * 8;
758
759            extra->texture_page = (header >> 12) & 0x1f;
760            extra->texture_palette = (header >> 28) & 0xf;
761
762            extra->texture_mirror_x = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
763            extra->texture_mirror_y = ((command & 0x10) ? 0x2 : 0) | ((header & 0x00400000) ? 0x1 : 0);
764
765            extra->color = color;
766
767            poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &v[0], &v[1], &v[2]);
841768            if (new_verts > 1)
842            {
843               draw_triangle_tex(v[2], v[3], v[0], color);
844            }
769               poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, &v[2], &v[3], &v[0]);
770//              poly_render_polygon(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline_tex, 4, new_verts + 2, v);
845771
846            memcpy(prev_v, v, sizeof(VERTEX) * 4);
772            memcpy(prev_v, v, sizeof(poly_vertex) * 4);
847773         };
848774
849775         i = index - 1;
r1281r1282
851777      else if (K001005_3d_fifo[i] == 0x80000006 || K001005_3d_fifo[i] == 0x80000026 ||
852778             K001005_3d_fifo[i] == 0x80000020 || K001005_3d_fifo[i] == 0x80000022)
853779      {
854         VERTEX v[4];
780         poly_extra_data *extra = poly_get_extra_data(poly);
781         poly_vertex v[4];
855782         int r, g, b, a;
856783         UINT32 color;
857784         int num_verts = 0;
r1281r1282
879806
880807            v[j].x = ((float)(x) / 16.0f) + 256.0f;
881808            v[j].y = ((float)(-y) / 16.0f) + 192.0f;
882            v[j].z = *(float*)(&z);
809            v[j].p[0] = *(float*)(&z);
883810
884811            ++num_verts;
885812
r1281r1282
894821         color = (a << 24) | (r << 16) | (g << 8) | (b);
895822         index++;
896823
897         draw_triangle(v[0], v[1], v[2], color);
824         extra->color = color;
825
826         poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[0], &v[1], &v[2]);
898827         if (num_verts > 3)
899         {
900            draw_triangle(v[2], v[3], v[0], color);
901         }
828            poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[2], &v[3], &v[0]);
829//          poly_render_polygon(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, num_verts, v);
902830
903         memcpy(prev_v, v, sizeof(VERTEX) * 4);
831         memcpy(prev_v, v, sizeof(poly_vertex) * 4);
904832
905833         while ((K001005_3d_fifo[index] & 0xffffff00) != 0x80000000 && index < K001005_3d_fifo_ptr)
906834         {
835            poly_extra_data *extra = poly_get_extra_data(poly);
907836            int new_verts = 0;
908837
909838            if (poly_type)
910839            {
911               memcpy(&v[0], &prev_v[2], sizeof(VERTEX));
912               memcpy(&v[1], &prev_v[3], sizeof(VERTEX));
840               memcpy(&v[0], &prev_v[2], sizeof(poly_vertex));
841               memcpy(&v[1], &prev_v[3], sizeof(poly_vertex));
913842            }
914843            else
915844            {
916               memcpy(&v[0], &prev_v[1], sizeof(VERTEX));
917               memcpy(&v[1], &prev_v[2], sizeof(VERTEX));
845               memcpy(&v[0], &prev_v[1], sizeof(poly_vertex));
846               memcpy(&v[1], &prev_v[2], sizeof(poly_vertex));
918847            }
919848
920849            for (j=2; j < 4; j++)
r1281r1282
936865
937866               v[j].x = ((float)(x) / 16.0f) + 256.0f;
938867               v[j].y = ((float)(-y) / 16.0f) + 192.0f;
939               v[j].z = *(float*)(&z);
868               v[j].p[0] = *(float*)(&z);
940869
941870               ++new_verts;
942871
r1281r1282
951880            color = (a << 24) | (r << 16) | (g << 8) | (b);
952881            index++;
953882
954            draw_triangle(v[0], v[1], v[2], color);
883            extra->color = color;
884
885            poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[0], &v[1], &v[2]);
955886            if (new_verts > 1)
956            {
957               draw_triangle(v[0], v[2], v[3], color);
958            }
887               poly_render_triangle(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, &v[0], &v[2], &v[3]);
888//              poly_render_polygon(poly, K001005_bitmap[K001005_bitmap_page], &Machine->screen[0].visarea, draw_scanline, 1, new_verts + 2, v);
959889
960            memcpy(prev_v, v, sizeof(VERTEX) * 4);
890            memcpy(prev_v, v, sizeof(poly_vertex) * 4);
961891         };
962892
963893         i = index - 1;
r1281r1282
1014944
1015945
1016946
947static void gticlub_exit(running_machine *machine)
948{
949   poly_free(poly);
950}
951
1017952VIDEO_START( gticlub )
1018953{
954   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
955   add_exit_callback(machine, gticlub_exit);
956
1019957   K001005_init();
1020958   K001604_vh_start(machine, 0);
1021959}
src/mame/video/marvins.c
r1281r1282
8989**
9090***************************************************************************/
9191
92#ifdef UNUSED_FUNCTION
9293WRITE8_HANDLER( marvins_spriteram_w )
9394{
9495   spriteram[offset] = data;
9596}
97#endif
9698
9799WRITE8_HANDLER( marvins_foreground_ram_w )
98100{
src/mame/video/gaelco3d.c
r1281r1282
1010#include "eminline.h"
1111#include "gaelco3d.h"
1212#include "video/rgbutil.h"
13#include "video/polynew.h"
13#include "video/poly.h"
1414
1515UINT8 *gaelco3d_texture;
1616UINT8 *gaelco3d_texmask;
r1281r1282
5353};
5454
5555
56static void render_noz_noperspective(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
57static void render_normal(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
58static void render_alphablend(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
56static void render_noz_noperspective(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
57static void render_normal(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
58static void render_alphablend(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
5959
6060
6161
r1281r1282
251251
252252
253253
254static void render_noz_noperspective(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
254static void render_noz_noperspective(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
255255{
256256   const poly_extra_data *extra = extradata;
257257   mame_bitmap *bitmap = destbase;
r1281r1282
292292}
293293
294294
295static void render_normal(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
295static void render_normal(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
296296{
297297   const poly_extra_data *extra = extradata;
298298   mame_bitmap *bitmap = destbase;
r1281r1282
344344}
345345
346346
347static void render_alphablend(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
347static void render_alphablend(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
348348{
349349   const poly_extra_data *extra = extradata;
350350   mame_bitmap *bitmap = destbase;
src/mame/video/gstriker.c
r1281r1282
524524/*** VIDEO UPDATE/START **********************************************/
525525
526526
527#ifdef UNUSED_FUNCTION
527528WRITE16_HANDLER( gsx_videoram3_w )
528529{
529530   // This memory appears to be empty in gstriker
530531   gs_videoram3[offset] = data;
531532}
533#endif
532534
533535
534536VIDEO_UPDATE(gstriker)
src/mame/video/flstory.c
r1281r1282
127127
128128}
129129
130#ifdef UNUSED_FUNCTION
130131READ8_HANDLER( flstory_scrlram_r )
131132{
132133   return flstory_scrlram[offset];
133134}
135#endif
134136
135137WRITE8_HANDLER( flstory_scrlram_w )
136138{
src/mame/video/model2.c
r1281r1282
8888#include "driver.h"
8989#include "video/segaic24.h"
9090#include "video/poly.h"
91#include "eminline.h"
9192
9293#define DEBUG 0
9394
r1281r1282
99100extern UINT32 *model2_textureram1;
100101extern UINT32 *model2_lumaram;
101102
103static poly_manager *poly;
102104
105#define pz      p[0]
106#define pu      p[1]
107#define pv      p[2]
108
109
103110/*******************************************
104111 *
105112 *  Basic Data Types
r1281r1282
108115
109116typedef struct
110117{
111   float x, y, z;
112   UINT16 u, v;
113} vertex;
114
115typedef struct
116{
117   vertex   normal;
118   float   distance;
118   poly_vertex   normal;
119   float      distance;
119120} plane;
120121
121122typedef struct
r1281r1282
129130typedef struct
130131{
131132   void *            next;
132   vertex            v[3];
133   poly_vertex         v[3];
133134   UINT16            z;
134135   UINT16            texheader[4];
135136   UINT8            luma;
r1281r1282
139140
140141typedef struct
141142{
142   vertex   v[4];
143   UINT16   z;
144   UINT16   texheader[4];
145   UINT8   luma;
143   poly_vertex         v[4];
144   UINT16            z;
145   UINT16            texheader[4];
146   UINT8            luma;
146147} quad;
147148
149typedef struct _poly_extra_data poly_extra_data;
150struct _poly_extra_data
151{
152   UINT32      lumabase;
153   UINT32      colorbase;
154   UINT32 *   texsheet;
155   UINT32      texwidth;
156   UINT32      texheight;
157   UINT32      texx, texy;
158   UINT8      texmirrorx;
159   UINT8      texmirrory;
160};
148161
162
149163/*******************************************
150164 *
151165 *  Generic 3D Math Functions
152166 *
153167 *******************************************/
154168
155static void transform_point( vertex *point, float *matrix )
169INLINE void transform_point( poly_vertex *point, float *matrix )
156170{
157   float tx = (point->x * matrix[0]) + (point->y * matrix[3]) + (point->z * matrix[6]) + (matrix[9]);
158   float ty = (point->x * matrix[1]) + (point->y * matrix[4]) + (point->z * matrix[7]) + (matrix[10]);
159   float tz = (point->x * matrix[2]) + (point->y * matrix[5]) + (point->z * matrix[8]) + (matrix[11]);
171   float tx = (point->x * matrix[0]) + (point->y * matrix[3]) + (point->pz * matrix[6]) + (matrix[9]);
172   float ty = (point->x * matrix[1]) + (point->y * matrix[4]) + (point->pz * matrix[7]) + (matrix[10]);
173   float tz = (point->x * matrix[2]) + (point->y * matrix[5]) + (point->pz * matrix[8]) + (matrix[11]);
160174
161175   point->x = tx;
162176   point->y = ty;
163   point->z = tz;
177   point->pz = tz;
164178}
165179
166static void transform_vector( vertex *vector, float *matrix )
180INLINE void transform_vector( poly_vertex *vector, float *matrix )
167181{
168   float tx = (vector->x * matrix[0]) + (vector->y * matrix[3]) + (vector->z * matrix[6]);
169   float ty = (vector->x * matrix[1]) + (vector->y * matrix[4]) + (vector->z * matrix[7]);
170   float tz = (vector->x * matrix[2]) + (vector->y * matrix[5]) + (vector->z * matrix[8]);
182   float tx = (vector->x * matrix[0]) + (vector->y * matrix[3]) + (vector->pz * matrix[6]);
183   float ty = (vector->x * matrix[1]) + (vector->y * matrix[4]) + (vector->pz * matrix[7]);
184   float tz = (vector->x * matrix[2]) + (vector->y * matrix[5]) + (vector->pz * matrix[8]);
171185
172186   vector->x = tx;
173187   vector->y = ty;
174   vector->z = tz;
188   vector->pz = tz;
175189}
176190
177static void normalize_vector( vertex *vector )
191INLINE void normalize_vector( poly_vertex *vector )
178192{
179   float n = sqrt( (vector->x * vector->x) + (vector->y * vector->y) + (vector->z * vector->z) );
193   float n = sqrt( (vector->x * vector->x) + (vector->y * vector->y) + (vector->pz * vector->pz) );
180194
181195   if ( n )
182196   {
183      vector->x /= n;
184      vector->y /= n;
185      vector->z /= n;
197      float oon = 1.0f / n;
198      vector->x *= oon;
199      vector->y *= oon;
200      vector->pz *= oon;
186201   }
187202}
188203
189static float dot_product( vertex *v1, vertex *v2 )
204INLINE float dot_product( poly_vertex *v1, poly_vertex *v2 )
190205{
191   return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z);
206   return (v1->x * v2->x) + (v1->y * v2->y) + (v1->pz * v2->pz);
192207}
193208
194static void vector_cross3( vertex *dst, vertex *v0, vertex *v1, vertex *v2 )
209INLINE void vector_cross3( poly_vertex *dst, poly_vertex *v0, poly_vertex *v1, poly_vertex *v2 )
195210{
196   vertex   p1, p2;
211   poly_vertex   p1, p2;
197212
198   p1.x = v1->x - v0->x;   p1.y = v1->y - v0->y;   p1.z = v1->z - v0->z;
199   p2.x = v2->x - v0->x;   p2.y = v2->y - v0->y;   p2.z = v2->z - v0->z;
213   p1.x = v1->x - v0->x;   p1.y = v1->y - v0->y;   p1.pz = v1->pz - v0->pz;
214   p2.x = v2->x - v0->x;   p2.y = v2->y - v0->y;   p2.pz = v2->pz - v0->pz;
200215
201   dst->x = (p1.y * p2.z) - (p1.z * p2.y);
202   dst->y = (p1.z * p2.x) - (p1.x * p2.z);
203   dst->z = (p1.x * p2.y) - (p1.y * p2.x);
216   dst->x = (p1.y * p2.pz) - (p1.pz * p2.y);
217   dst->y = (p1.pz * p2.x) - (p1.x * p2.pz);
218   dst->pz = (p1.x * p2.y) - (p1.y * p2.x);
204219}
205220
206221/* 1.8.23 float to 4.12 float converter, courtesy of Aaron Giles */
r1281r1282
236251   return 0xffff;
237252}
238253
239static INT32 clip_polygon(vertex *v, INT32 num_vertices, plane *cp, vertex *vout)
254static INT32 clip_polygon(poly_vertex *v, INT32 num_vertices, plane *cp, poly_vertex *vout)
240255{
241   vertex *cur, *out;
256   poly_vertex *cur, *out;
242257   float   curdot, nextdot, scale;
243258   INT32   i, curin, nextin, nextvert, outcount;
244259
r1281r1282
255270      nextvert = (i + 1) % num_vertices;
256271
257272      /* if the current point is inside the plane, add it */
258      if ( curin ) memcpy( &out[outcount++], cur, sizeof( vertex ) );
273      if ( curin ) memcpy( &out[outcount++], cur, sizeof( poly_vertex ) );
259274
260275      nextdot = dot_product( &v[nextvert], &cp->normal );
261276      nextin = (nextdot >= cp->distance) ? 1 : 0;
r1281r1282
267282
268283         out[outcount].x = cur->x + ((v[nextvert].x - cur->x) * scale);
269284         out[outcount].y = cur->y + ((v[nextvert].y - cur->y) * scale);
270         out[outcount].z = cur->z + ((v[nextvert].z - cur->z) * scale);
271         out[outcount].u = (UINT16)((float)cur->u + (((float)v[nextvert].u - (float)cur->u) * scale));
272         out[outcount].v = (UINT16)((float)cur->v + (((float)v[nextvert].v - (float)cur->v) * scale));
285         out[outcount].pz = cur->pz + ((v[nextvert].pz - cur->pz) * scale);
286         out[outcount].pu = (UINT16)((float)cur->pu + (((float)v[nextvert].pu - (float)cur->pu) * scale));
287         out[outcount].pv = (UINT16)((float)cur->pv + (((float)v[nextvert].pv - (float)cur->pv) * scale));
273288            outcount++;
274289        }
275290
r1281r1282
363378   /* extract P0(n-1) */
364379   object.v[1].x = u2f( raster.command_buffer[2] << 8 );
365380   object.v[1].y = u2f( raster.command_buffer[3] << 8 );
366   object.v[1].z = u2f( raster.command_buffer[4] << 8 );
381   object.v[1].pz = u2f( raster.command_buffer[4] << 8 );
367382
368383   /* extract P1(n-1) */
369384   object.v[0].x = u2f( raster.command_buffer[5] << 8 );
370385   object.v[0].y = u2f( raster.command_buffer[6] << 8 );
371   object.v[0].z = u2f( raster.command_buffer[7] << 8 );
386   object.v[0].pz = u2f( raster.command_buffer[7] << 8 );
372387
373388   /* extract P0(n) */
374389   object.v[2].x = u2f( raster.command_buffer[11] << 8 );
375390   object.v[2].y = u2f( raster.command_buffer[12] << 8 );
376   object.v[2].z = u2f( raster.command_buffer[13] << 8 );
391   object.v[2].pz = u2f( raster.command_buffer[13] << 8 );
377392
378393   /* extract P1(n) */
379394   object.v[3].x = u2f( raster.command_buffer[14] << 8 );
380395   object.v[3].y = u2f( raster.command_buffer[15] << 8 );
381   object.v[3].z = u2f( raster.command_buffer[16] << 8 );
396   object.v[3].pz = u2f( raster.command_buffer[16] << 8 );
382397
383398   /* always calculate the min z and max z value */
384   min_z = object.v[0].z;
385   if ( object.v[1].z < min_z ) min_z = object.v[1].z;
386   if ( object.v[2].z < min_z ) min_z = object.v[2].z;
387   if ( object.v[3].z < min_z ) min_z = object.v[3].z;
399   min_z = object.v[0].pz;
400   if ( object.v[1].pz < min_z ) min_z = object.v[1].pz;
401   if ( object.v[2].pz < min_z ) min_z = object.v[2].pz;
402   if ( object.v[3].pz < min_z ) min_z = object.v[3].pz;
388403
389   max_z = object.v[0].z;
390   if ( object.v[1].z > max_z ) max_z = object.v[1].z;
391   if ( object.v[2].z > max_z ) max_z = object.v[2].z;
392   if ( object.v[3].z > max_z ) max_z = object.v[3].z;
404   max_z = object.v[0].pz;
405   if ( object.v[1].pz > max_z ) max_z = object.v[1].pz;
406   if ( object.v[2].pz > max_z ) max_z = object.v[2].pz;
407   if ( object.v[3].pz > max_z ) max_z = object.v[3].pz;
393408
394409   /* read in the texture information */
395410
r1281r1282
399414   else
400415      tp = &raster.texture_rom[raster.command_buffer[0] & 0x7FFFFF];
401416
402   object.v[0].v = *tp++;
403   object.v[0].u = *tp++;
404   object.v[1].v = *tp++;
405   object.v[1].u = *tp++;
406   object.v[2].v = *tp++;
407   object.v[2].u = *tp++;
408   object.v[3].v = *tp++;
409   object.v[3].u = *tp++;
417   object.v[0].pv = *tp++;
418   object.v[0].pu = *tp++;
419   object.v[1].pv = *tp++;
420   object.v[1].pu = *tp++;
421   object.v[2].pv = *tp++;
422   object.v[2].pu = *tp++;
423   object.v[3].pv = *tp++;
424   object.v[3].pu = *tp++;
410425
411426   /* update the address */
412427   raster.command_buffer[0] += 8;
r1281r1282
478493
479494   if ( cull == 0 )
480495   {
481      INT32   clipped_verts;
482      vertex   verts[10];
483      plane   clip_plane;
496      INT32      clipped_verts;
497      poly_vertex   verts[10];
498      plane      clip_plane;
484499
485500      clip_plane.normal.x = 0;
486501      clip_plane.normal.y = 0;
487      clip_plane.normal.z = 1;
502      clip_plane.normal.pz = 1;
488503      clip_plane.distance = 0;
489504
490505      /* do near z clipping */
r1281r1282
536551            tri->center[0] = raster.center[raster.center_sel][0];
537552            tri->center[1] = raster.center[raster.center_sel][1];
538553
539            memcpy( &tri->v[0], &verts[0], sizeof( vertex ) );
540            memcpy( &tri->v[1], &verts[i-1], sizeof( vertex ) );
541            memcpy( &tri->v[2], &verts[i], sizeof( vertex ) );
554            memcpy( &tri->v[0], &verts[0], sizeof( poly_vertex ) );
555            memcpy( &tri->v[1], &verts[i-1], sizeof( poly_vertex ) );
556            memcpy( &tri->v[2], &verts[i], sizeof( poly_vertex ) );
542557
543558            /* add to our sorted list */
544559            tri->next = NULL;
r1281r1282
603618   /* extract P0(n-1) */
604619   object.v[1].x = u2f( raster.command_buffer[2] << 8 );
605620   object.v[1].y = u2f( raster.command_buffer[3] << 8 );
606   object.v[1].z = u2f( raster.command_buffer[4] << 8 );
621   object.v[1].pz = u2f( raster.command_buffer[4] << 8 );
607622
608623   /* extract P1(n-1) */
609624   object.v[0].x = u2f( raster.command_buffer[5] << 8 );
610625   object.v[0].y = u2f( raster.command_buffer[6] << 8 );
611   object.v[0].z = u2f( raster.command_buffer[7] << 8 );
626   object.v[0].pz = u2f( raster.command_buffer[7] << 8 );
612627
613628   /* extract P0(n) */
614629   object.v[2].x = u2f( raster.command_buffer[11] << 8 );
615630   object.v[2].y = u2f( raster.command_buffer[12] << 8 );
616   object.v[2].z = u2f( raster.command_buffer[13] << 8 );
631   object.v[2].pz = u2f( raster.command_buffer[13] << 8 );
617632
618633   /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */
619634   raster.command_buffer[14] = raster.command_buffer[11];
r1281r1282
621636   raster.command_buffer[16] = raster.command_buffer[13];
622637
623638   /* always calculate the min z and max z values */
624   min_z = object.v[0].z;
625   if ( object.v[1].z < min_z ) min_z = object.v[1].z;
626   if ( object.v[2].z < min_z ) min_z = object.v[2].z;
639   min_z = object.v[0].pz;
640   if ( object.v[1].pz < min_z ) min_z = object.v[1].pz;
641   if ( object.v[2].pz < min_z ) min_z = object.v[2].pz;
627642
628   max_z = object.v[0].z;
629   if ( object.v[1].z > max_z ) max_z = object.v[1].z;
630   if ( object.v[2].z > max_z ) max_z = object.v[2].z;
643   max_z = object.v[0].pz;
644   if ( object.v[1].pz > max_z ) max_z = object.v[1].pz;
645   if ( object.v[2].pz > max_z ) max_z = object.v[2].pz;
631646
632647   /* read in the texture information */
633648
r1281r1282
637652   else
638653      tp = &raster.texture_rom[raster.command_buffer[0] & 0x7FFFFF];
639654
640   object.v[0].v = *tp++;
641   object.v[0].u = *tp++;
642   object.v[1].v = *tp++;
643   object.v[1].u = *tp++;
644   object.v[2].v = *tp++;
645   object.v[2].u = *tp++;
655   object.v[0].pv = *tp++;
656   object.v[0].pu = *tp++;
657   object.v[1].pv = *tp++;
658   object.v[1].pu = *tp++;
659   object.v[2].pv = *tp++;
660   object.v[2].pu = *tp++;
646661
647662   /* update the address */
648663   raster.command_buffer[0] += 6;
r1281r1282
715730   /* if we're not culling, do z-clip and add to out triangle list */
716731   if ( cull == 0 )
717732   {
718      INT32   clipped_verts;
719      vertex   verts[10];
720      plane   clip_plane;
733      INT32      clipped_verts;
734      poly_vertex   verts[10];
735      plane      clip_plane;
721736
722737      clip_plane.normal.x = 0;
723738      clip_plane.normal.y = 0;
724      clip_plane.normal.z = 1;
739      clip_plane.normal.pz = 1;
725740      clip_plane.distance = 0;
726741
727742      /* do near z clipping */
r1281r1282
773788            tri->center[0] = raster.center[raster.center_sel][0];
774789            tri->center[1] = raster.center[raster.center_sel][1];
775790
776            memcpy( &tri->v[0], &verts[0], sizeof( vertex ) );
777            memcpy( &tri->v[1], &verts[i-1], sizeof( vertex ) );
778            memcpy( &tri->v[2], &verts[i], sizeof( vertex ) );
791            memcpy( &tri->v[0], &verts[0], sizeof( poly_vertex ) );
792            memcpy( &tri->v[1], &verts[i-1], sizeof( poly_vertex ) );
793            memcpy( &tri->v[2], &verts[i], sizeof( poly_vertex ) );
779794
780795            /* add to our sorted list */
781796            tri->next = NULL;
r1281r1282
907922
908923/***********************************************************************************************/
909924
910typedef void (*model2_3d_render_func)( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect );
911
912static model2_3d_render_func render_funcs[8] =
925static poly_draw_scanline render_funcs[8] =
913926{
914927   model2_3d_render_0,   /* checker = 0, textured = 0, translucent = 0 */
915928   model2_3d_render_1,   /* checker = 0, textured = 0, translucent = 1 */
r1281r1282
923936
924937static void model2_3d_render( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect )
925938{
939   poly_extra_data *extra = poly_get_extra_data(poly);
926940   UINT8      renderer;
927941   rectangle   vp;
928942
r1281r1282
940954   if ( vp.min_y < cliprect->min_y ) vp.min_y = cliprect->min_y;
941955   if ( vp.max_y > cliprect->max_y ) vp.max_y = cliprect->max_y;
942956
943   /* render */
944   (*render_funcs[renderer])( bitmap, tri, &vp );
957   extra->lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
958   extra->colorbase = (tri->texheader[3] >> 6) & 0x3FF;
959
960   if (renderer & 2)
961   {
962      extra->texwidth = 32 << ((tri->texheader[0] >> 0) & 0x7);
963      extra->texheight = 32 << ((tri->texheader[0] >> 3) & 0x7);
964      extra->texx = 32 * ((tri->texheader[2] >> 0) & 0x1f);
965      extra->texy = 32 * (((tri->texheader[2] >> 6) & 0x1f) + ( tri->texheader[2] & 0x20 ));
966      extra->texmirrorx = (tri->texheader[0] >> 9) & 1;
967      extra->texmirrory = (tri->texheader[0] >> 8) & 1;
968      extra->texsheet = (tri->texheader[2] & 0x1000) ? model2_textureram1 : model2_textureram0;
969
970      tri->v[0].pz = 1.0f / (1.0f + tri->v[0].pz);
971      tri->v[0].pu = tri->v[0].pu * tri->v[0].pz * (1.0f / 8.0f);
972      tri->v[0].pv = tri->v[0].pv * tri->v[0].pz * (1.0f / 8.0f);
973      tri->v[1].pz = 1.0f / (1.0f + tri->v[1].pz);
974      tri->v[1].pu = tri->v[1].pu * tri->v[1].pz * (1.0f / 8.0f);
975      tri->v[1].pv = tri->v[1].pv * tri->v[1].pz * (1.0f / 8.0f);
976      tri->v[2].pz = 1.0f / (1.0f + tri->v[2].pz);
977      tri->v[2].pu = tri->v[2].pu * tri->v[2].pz * (1.0f / 8.0f);
978      tri->v[2].pv = tri->v[2].pv * tri->v[2].pz * (1.0f / 8.0f);
979
980      poly_render_triangle(poly, bitmap, &vp, render_funcs[renderer], 3, &tri->v[0], &tri->v[1], &tri->v[2]);
981   }
982   else
983      poly_render_triangle(poly, bitmap, &vp, render_funcs[renderer], 0, &tri->v[0], &tri->v[1], &tri->v[2]);
945984}
946985
947986/*
r1281r1282
9711010   for( i = 0; i < 3; i++ )
9721011   {
9731012      /* project the vertices */
974      tri->v[i].x = -8 + tri->center[0] + (tri->v[i].x / (1.0+tri->v[i].z));
975      tri->v[i].y = ((384 - tri->center[1])+90) - (tri->v[i].y / (1.0+tri->v[i].z));
1013      tri->v[i].x = -8 + tri->center[0] + (tri->v[i].x / (1.0f+tri->v[i].pz));
1014      tri->v[i].y = ((384 - tri->center[1])+90) - (tri->v[i].y / (1.0f+tri->v[i].pz));
9761015   }
9771016}
9781017
r1281r1282
10111050         {
10121051
10131052            fprintf( f, "index: %d\n", i );
1014            fprintf( f, "v0.x = %f, v0.y = %f, v0.z = %f\n", raster.tri_list[i].v[0].x, raster.tri_list[i].v[0].y, raster.tri_list[i].v[0].z );
1015            fprintf( f, "v1.x = %f, v1.y = %f, v1.z = %f\n", raster.tri_list[i].v[1].x, raster.tri_list[i].v[1].y, raster.tri_list[i].v[1].z );
1016            fprintf( f, "v2.x = %f, v2.y = %f, v2.z = %f\n", raster.tri_list[i].v[2].x, raster.tri_list[i].v[2].y, raster.tri_list[i].v[2].z );
1053            fprintf( f, "v0.x = %f, v0.y = %f, v0.z = %f\n", raster.tri_list[i].v[0].x, raster.tri_list[i].v[0].y, raster.tri_list[i].v[0].pz );
1054            fprintf( f, "v1.x = %f, v1.y = %f, v1.z = %f\n", raster.tri_list[i].v[1].x, raster.tri_list[i].v[1].y, raster.tri_list[i].v[1].pz );
1055            fprintf( f, "v2.x = %f, v2.y = %f, v2.z = %f\n", raster.tri_list[i].v[2].x, raster.tri_list[i].v[2].y, raster.tri_list[i].v[2].pz );
10171056
1018            fprintf( f, "tri z: %04x\n", raster.tri_list[i].z );
1057            fprintf( f, "tri z: %04x\n", raster.tri_list[i].pz );
10191058            fprintf( f, "texheader - 0: %04x\n", raster.tri_list[i].texheader[0] );
10201059            fprintf( f, "texheader - 1: %04x\n", raster.tri_list[i].texheader[1] );
10211060            fprintf( f, "texheader - 2: %04x\n", raster.tri_list[i].texheader[2] );
r1281r1282
10571096         }
10581097      }
10591098   }
1099   poly_wait(poly, "End of frame");
10601100}
10611101
10621102/* 3D Rasterizer main data input port */
r1281r1282
12641304   UINT32 *         polygon_ram0;         /* Fast Polygon RAM pointer */
12651305   UINT32 *         polygon_ram1;         /* Slow Polygon RAM pointer */
12661306   float            matrix[12];            /* Current Transformation Matrix */
1267   vertex            focus;               /* Focus (x,y) */
1268   vertex            light;               /* Light Vector */
1307   poly_vertex         focus;               /* Focus (x,y) */
1308   poly_vertex         light;               /* Light Vector */
12691309   float            lod;               /* LOD */
12701310   float            coef_table[32];         /* Distane Coefficient table */
12711311   texture_parameter   texture_parameters[32];   /* Texture parameters */
r1281r1282
12971337/* Parse Polygons: Normals Present, No Specular case */
12981338static void geo_parse_np_ns( UINT32 *input, UINT32 count )
12991339{
1300   vertex   point, normal;
1340   poly_vertex   point, normal;
13011341   UINT32   attr, i;
13021342
13031343   /* read the 1st point */
13041344   point.x = u2f( *input++ );
13051345   point.y = u2f( *input++ );
1306   point.z = u2f( *input++ );
1346   point.pz = u2f( *input++ );
13071347
13081348   /* transform with the current matrix */
13091349   transform_point( &point, geo.matrix );
r1281r1282
13151355   /* push it to the 3d rasterizer */
13161356   model2_3d_push( f2u(point.x) >> 8 );
13171357   model2_3d_push( f2u(point.y) >> 8 );
1318   model2_3d_push( f2u(point.z) >> 8 );
1358   model2_3d_push( f2u(point.pz) >> 8 );
13191359
13201360   /* read the 2nd point */
13211361   point.x = u2f( *input++ );
13221362   point.y = u2f( *input++ );
1323   point.z = u2f( *input++ );
1363   point.pz = u2f( *input++ );
13241364
13251365   /* transform with the current matrix */
13261366   transform_point( &point, geo.matrix );
r1281r1282
13321372   /* push it to the 3d rasterizer */
13331373   model2_3d_push( f2u(point.x) >> 8 );
13341374   model2_3d_push( f2u(point.y) >> 8 );
1335   model2_3d_push( f2u(point.z) >> 8 );
1375   model2_3d_push( f2u(point.pz) >> 8 );
13361376
13371377   /* loop through the following links */
13381378   for( i = 0; i < count; i++ )
r1281r1282
13461386      /* read in the normal */
13471387      normal.x = u2f(*input++);
13481388      normal.y = u2f(*input++);
1349      normal.z = u2f(*input++);
1389      normal.pz = u2f(*input++);
13501390
13511391      /* transform with the current matrix */
13521392      transform_vector( &normal, geo.matrix );
r1281r1282
13611401         /* read in the next point */
13621402         point.x = u2f( *input++ );
13631403         point.y = u2f( *input++ );
1364         point.z = u2f( *input++ );
1404         point.pz = u2f( *input++ );
13651405
13661406         /* transform with the current matrix */
13671407         transform_point( &point, geo.matrix );
r1281r1282
14071447         model2_3d_push( f2u(distance) >> 8 );
14081448         model2_3d_push( f2u(point.x) >> 8 );
14091449         model2_3d_push( f2u(point.y) >> 8 );
1410         model2_3d_push( f2u(point.z) >> 8 );
1450         model2_3d_push( f2u(point.pz) >> 8 );
14111451
14121452         /* if it's a quad, push one more point */
14131453         if ( attr & 1 )
r1281r1282
14151455            /* read in the next point */
14161456            point.x = u2f( *input++ );
14171457            point.y = u2f( *input++ );
1418            point.z = u2f( *input++ );
1458            point.pz = u2f( *input++ );
14191459
14201460            /* transform with the current matrix */
14211461            transform_point( &point, geo.matrix );
r1281r1282
14271467            /* push to the 3d rasterizer */
14281468            model2_3d_push( f2u(point.x) >> 8 );
14291469            model2_3d_push( f2u(point.y) >> 8 );
1430            model2_3d_push( f2u(point.z) >> 8 );
1470            model2_3d_push( f2u(point.pz) >> 8 );
14311471         }
14321472         else /* triangle */
14331473         {
r1281r1282
14481488/* Parse Polygons: Normals Present, Specular case */
14491489static void geo_parse_np_s( UINT32 *input, UINT32 count )
14501490{
1451   vertex   point, normal;
1491   poly_vertex   point, normal;
14521492   UINT32   attr, i;
14531493
14541494   /* read the 1st point */
14551495   point.x = u2f( *input++ );
14561496   point.y = u2f( *input++ );
1457   point.z = u2f( *input++ );
1497   point.pz = u2f( *input++ );
14581498
14591499   /* transform with the current matrix */
14601500   transform_point( &point, geo.matrix );
r1281r1282
14661506   /* push it to the 3d rasterizer */
14671507   model2_3d_push( f2u(point.x) >> 8 );
14681508   model2_3d_push( f2u(point.y) >> 8 );
1469   model2_3d_push( f2u(point.z) >> 8 );
1509   model2_3d_push( f2u(point.pz) >> 8 );
14701510
14711511   /* read the 2nd point */
14721512   point.x = u2f( *input++ );
14731513   point.y = u2f( *input++ );
1474   point.z = u2f( *input++ );
1514   point.pz = u2f( *input++ );
14751515
14761516   /* transform with the current matrix */
14771517   transform_point( &point, geo.matrix );
r1281r1282
14831523   /* push it to the 3d rasterizer */
14841524   model2_3d_push( f2u(point.x) >> 8 );
14851525   model2_3d_push( f2u(point.y) >> 8 );
1486   model2_3d_push( f2u(point.z) >> 8 );
1526   model2_3d_push( f2u(point.pz) >> 8 );
14871527
14881528   /* loop through the following links */
14891529   for( i = 0; i < count; i++ )
r1281r1282
14971537      /* read in the normal */
14981538      normal.x = u2f(*input++);
14991539      normal.y = u2f(*input++);
1500      normal.z = u2f(*input++);
1540      normal.pz = u2f(*input++);
15011541
15021542      /* transform with the current matrix */
15031543      transform_vector( &normal, geo.matrix );
r1281r1282
15121552         /* read in the next point */
15131553         point.x = u2f( *input++ );
15141554         point.y = u2f( *input++ );
1515         point.z = u2f( *input++ );
1555         point.pz = u2f( *input++ );
15161556
15171557         /* transform with the current matrix */
15181558         transform_point( &point, geo.matrix );
r1281r1282
15381578         if ( (dotl * dotp) < 0 ) luminance = 0;
15391579         else luminance = fabs( dotl );
15401580
1541         specular = ((2*dotl) * normal.z) - geo.light.z;
1581         specular = ((2*dotl) * normal.pz) - geo.light.pz;
15421582         if ( specular < 0 )   specular = 0;
15431583         if ( texparam->specular_control == 0 ) specular = 0;
15441584         if ( (texparam->specular_control >> 1) != 0 ) specular *= specular;
r1281r1282
15671607         model2_3d_push( f2u(distance) >> 8 );
15681608         model2_3d_push( f2u(point.x) >> 8 );
15691609         model2_3d_push( f2u(point.y) >> 8 );
1570         model2_3d_push( f2u(point.z) >> 8 );
1610         model2_3d_push( f2u(point.pz) >> 8 );
15711611
15721612         /* if it's a quad, push one more point */
15731613         if ( attr & 1 )
r1281r1282
15751615            /* read in the next point */
15761616            point.x = u2f( *input++ );
15771617            point.y = u2f( *input++ );
1578            point.z = u2f( *input++ );
1618            point.pz = u2f( *input++ );
15791619
15801620            /* transform with the current matrix */
15811621            transform_point( &point, geo.matrix );
r1281r1282
15871627            /* push to the 3d rasterizer */
15881628            model2_3d_push( f2u(point.x) >> 8 );
15891629            model2_3d_push( f2u(point.y) >> 8 );
1590            model2_3d_push( f2u(point.z) >> 8 );
1630            model2_3d_push( f2u(point.pz) >> 8 );
15911631         }
15921632         else /* triangle */
15931633         {
r1281r1282
16081648/* Parse Polygons: No Normals, No Specular case */
16091649static void geo_parse_nn_ns( UINT32 *input, UINT32 count )
16101650{
1611   vertex   point, normal, p0, p1, p2, p3;
1651   poly_vertex   point, normal, p0, p1, p2, p3;
16121652   UINT32   attr, i;
16131653
16141654   /* read the 1st point */
16151655   point.x = u2f( *input++ );
16161656   point.y = u2f( *input++ );
1617   point.z = u2f( *input++ );
1657   point.pz = u2f( *input++ );
16181658
16191659   /* transform with the current matrix */
16201660   transform_point( &point, geo.matrix );
16211661
16221662   /* save for normal calculation */
1623   p0.x = point.x; p0.y = point.y; p0.z = point.z;
1663   p0.x = point.x; p0.y = point.y; p0.pz = point.pz;
16241664
16251665   /* apply focus */
16261666   point.x *= geo.focus.x;
r1281r1282
16291669   /* push it to the 3d rasterizer */
16301670   model2_3d_push( f2u(point.x) >> 8 );
16311671   model2_3d_push( f2u(point.y) >> 8 );
1632   model2_3d_push( f2u(point.z) >> 8 );
1672   model2_3d_push( f2u(point.pz) >> 8 );
16331673
16341674   /* read the 2nd point */
16351675   point.x = u2f( *input++ );
16361676   point.y = u2f( *input++ );
1637   point.z = u2f( *input++ );
1677   point.pz = u2f( *input++ );
16381678
16391679   /* transform with the current matrix */
16401680   transform_point( &point, geo.matrix );
16411681
16421682   /* save for normal calculation */
1643   p1.x = point.x; p1.y = point.y; p1.z = point.z;
1683   p1.x = point.x; p1.y = point.y; p1.pz = point.pz;
16441684
16451685   /* apply focus */
16461686   point.x *= geo.focus.x;
r1281r1282
16491689   /* push it to the 3d rasterizer */
16501690   model2_3d_push( f2u(point.x) >> 8 );
16511691   model2_3d_push( f2u(point.y) >> 8 );
1652   model2_3d_push( f2u(point.z) >> 8 );
1692   model2_3d_push( f2u(point.pz) >> 8 );
16531693
16541694   /* skip 4 */
16551695   input += 4;
r1281r1282
16731713         /* read in the next point */
16741714         point.x = u2f( *input++ );
16751715         point.y = u2f( *input++ );
1676         point.z = u2f( *input++ );
1716         point.pz = u2f( *input++ );
16771717
16781718         /* transform with the current matrix */
16791719         transform_point( &point, geo.matrix );
16801720
16811721         /* save for normal calculation */
1682         p2.x = point.x; p2.y = point.y; p2.z = point.z;
1722         p2.x = point.x; p2.y = point.y; p2.pz = point.pz;
16831723
16841724         /* compute the normal */
16851725         vector_cross3( &normal, &p0, &p1, &p2 );
r1281r1282
17281768         model2_3d_push( f2u(distance) >> 8 );
17291769         model2_3d_push( f2u(point.x) >> 8 );
17301770         model2_3d_push( f2u(point.y) >> 8 );
1731         model2_3d_push( f2u(point.z) >> 8 );
1771         model2_3d_push( f2u(point.pz) >> 8 );
17321772
17331773         /* if it's a quad, push one more point */
17341774         if ( attr & 1 )
r1281r1282
17361776            /* read in the next point */
17371777            point.x = u2f( *input++ );
17381778            point.y = u2f( *input++ );
1739            point.z = u2f( *input++ );
1779            point.pz = u2f( *input++ );
17401780
17411781            /* transform with the current matrix */
17421782            transform_point( &point, geo.matrix );
17431783
17441784            /* save for normal calculation */
1745            p3.x = point.x; p3.y = point.y; p3.z = point.z;
1785            p3.x = point.x; p3.y = point.y; p3.pz = point.pz;
17461786
17471787            /* apply focus */
17481788            point.x *= geo.focus.x;
r1281r1282
17511791            /* push to the 3d rasterizer */
17521792            model2_3d_push( f2u(point.x) >> 8 );
17531793            model2_3d_push( f2u(point.y) >> 8 );
1754            model2_3d_push( f2u(point.z) >> 8 );
1794            model2_3d_push( f2u(point.pz) >> 8 );
17551795         }
17561796         else
17571797         {
r1281r1282
17591799            input += 3;
17601800
17611801            /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */
1762            p3.x = p2.x; p3.y = p2.y; p3.z = p2.z;
1802            p3.x = p2.x; p3.y = p2.y; p3.pz = p2.pz;
17631803         }
17641804      }
17651805      else /* we're done */
r1281r1282
17741814         case 2:
17751815         {
17761816            /* reuse P0(n) and P1(n) */
1777            p0.x = p2.x; p0.y = p2.y; p0.z = p2.z;
1778            p1.x = p3.x; p1.y = p3.y; p1.z = p3.z;
1817            p0.x = p2.x; p0.y = p2.y; p0.pz = p2.pz;
1818            p1.x = p3.x; p1.y = p3.y; p1.pz = p3.pz;
17791819         }
17801820         break;
17811821
17821822         case 1:
17831823         {
17841824            /* reuse P0(n-1) and P0(n) */
1785            p1.x = p2.x; p1.y = p2.y; p1.z = p2.z;
1825            p1.x = p2.x; p1.y = p2.y; p1.pz = p2.pz;
17861826         }
17871827         break;
17881828
17891829         case 3:
17901830         {
17911831            /* reuse P1(n-1) and P1(n) */
1792            p0.x = p3.x; p0.y = p3.y; p0.z = p3.z;
1832            p0.x = p3.x; p0.y = p3.y; p0.pz = p3.pz;
17931833         }
17941834         break;
17951835      }
r1281r1282
18021842/* Parse Polygons: No Normals, Specular case */
18031843static void geo_parse_nn_s( UINT32 *input, UINT32 count )
18041844{
1805   vertex   point, normal, p0, p1, p2, p3;
1845   poly_vertex   point, normal, p0, p1, p2, p3;
18061846   UINT32   attr, i;
18071847
18081848   /* read the 1st point */
18091849   point.x = u2f( *input++ );
18101850   point.y = u2f( *input++ );
1811   point.z = u2f( *input++ );
1851   point.pz = u2f( *input++ );
18121852
18131853   /* transform with the current matrix */
18141854   transform_point( &point, geo.matrix );
18151855
18161856   /* save for normal calculation */
1817   p0.x = point.x; p0.y = point.y; p0.z = point.z;
1857   p0.x = point.x; p0.y = point.y; p0.pz = point.pz;
18181858
18191859   /* apply focus */
18201860   point.x *= geo.focus.x;
r1281r1282
18231863   /* push it to the 3d rasterizer */
18241864   model2_3d_push( f2u(point.x) >> 8 );
18251865   model2_3d_push( f2u(point.y) >> 8 );
1826   model2_3d_push( f2u(point.z) >> 8 );
1866   model2_3d_push( f2u(point.pz) >> 8 );
18271867
18281868   /* read the 2nd point */
18291869   point.x = u2f( *input++ );
18301870   point.y = u2f( *input++ );
1831   point.z = u2f( *input++ );
1871   point.pz = u2f( *input++ );
18321872
18331873   /* transform with the current matrix */
18341874   transform_point( &point, geo.matrix );
18351875
18361876   /* save for normal calculation */
1837   p1.x = point.x; p1.y = point.y; p1.z = point.z;
1877   p1.x = point.x; p1.y = point.y; p1.pz = point.pz;
18381878
18391879   /* apply focus */
18401880   point.x *= geo.focus.x;
r1281r1282
18431883   /* push it to the 3d rasterizer */
18441884   model2_3d_push( f2u(point.x) >> 8 );
18451885   model2_3d_push( f2u(point.y) >> 8 );
1846   model2_3d_push( f2u(point.z) >> 8 );
1886   model2_3d_push( f2u(point.pz) >> 8 );
18471887
18481888   /* skip 4 */
18491889   input += 4;
r1281r1282
18671907         /* read in the next point */
18681908         point.x = u2f( *input++ );
18691909         point.y = u2f( *input++ );
1870         point.z = u2f( *input++ );
1910         point.pz = u2f( *input++ );
18711911
18721912         /* transform with the current matrix */
18731913         transform_point( &point, geo.matrix );
18741914
18751915         /* save for normal calculation */
1876         p2.x = point.x; p2.y = point.y; p2.z = point.z;
1916         p2.x = point.x; p2.y = point.y; p2.pz = point.pz;
18771917
18781918         /* compute the normal */
18791919         vector_cross3( &normal, &p0, &p1, &p2 );
r1281r1282
19021942         if ( (dotl * dotp) < 0 ) luminance = 0;
19031943         else luminance = fabs( dotl );
19041944
1905         specular = ((2*dotl) * normal.z) - geo.light.z;
1945         specular = ((2*dotl) * normal.pz) - geo.light.pz;
19061946         if ( specular < 0 )   specular = 0;
19071947         if ( texparam->specular_control == 0 ) specular = 0;
19081948         if ( (texparam->specular_control >> 1) != 0 ) specular *= specular;
r1281r1282
19311971         model2_3d_push( f2u(distance) >> 8 );
19321972         model2_3d_push( f2u(point.x) >> 8 );
19331973         model2_3d_push( f2u(point.y) >> 8 );
1934         model2_3d_push( f2u(point.z) >> 8 );
1974         model2_3d_push( f2u(point.pz) >> 8 );
19351975
19361976         /* if it's a quad, push one more point */
19371977         if ( attr & 1 )
r1281r1282
19391979            /* read in the next point */
19401980            point.x = u2f( *input++ );
19411981            point.y = u2f( *input++ );
1942            point.z = u2f( *input++ );
1982            point.pz = u2f( *input++ );
19431983
19441984            /* transform with the current matrix */
19451985            transform_point( &point, geo.matrix );
19461986
19471987            /* save for normal calculation */
1948            p3.x = point.x; p3.y = point.y; p3.z = point.z;
1988            p3.x = point.x; p3.y = point.y; p3.pz = point.pz;
19491989
19501990            /* apply focus */
19511991            point.x *= geo.focus.x;
r1281r1282
19541994            /* push to the 3d rasterizer */
19551995            model2_3d_push( f2u(point.x) >> 8 );
19561996            model2_3d_push( f2u(point.y) >> 8 );
1957            model2_3d_push( f2u(point.z) >> 8 );
1997            model2_3d_push( f2u(point.pz) >> 8 );
19581998         }
19591999         else
19602000         {
r1281r1282
19622002            input += 3;
19632003
19642004            /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */
1965            p3.x = p2.x; p3.y = p2.y; p3.z = p2.z;
2005            p3.x = p2.x; p3.y = p2.y; p3.pz = p2.pz;
19662006         }
19672007      }
19682008      else /* we're done */
r1281r1282
19772017         case 2:
19782018         {
19792019            /* reuse P0(n) and P1(n) */
1980            p0.x = p2.x; p0.y = p2.y; p0.z = p2.z;
1981            p1.x = p3.x; p1.y = p3.y; p1.z = p3.z;
2020            p0.x = p2.x; p0.y = p2.y; p0.pz = p2.pz;
2021            p1.x = p3.x; p1.y = p3.y; p1.pz = p3.pz;
19822022         }
19832023         break;
19842024
19852025         case 1:
19862026         {
19872027            /* reuse P0(n-1) and P0(n) */
1988            p1.x = p2.x; p1.y = p2.y; p1.z = p2.z;
2028            p1.x = p2.x; p1.y = p2.y; p1.pz = p2.pz;
19892029         }
19902030         break;
19912031
19922032         case 3:
19932033         {
19942034            /* reuse P1(n-1) and P1(n) */
1995            p0.x = p3.x; p0.y = p3.y; p0.z = p3.z;
2035            p0.x = p3.x; p0.y = p3.y; p0.pz = p3.pz;
19962036         }
19972037         break;
19982038      }
r1281r1282
22982338   geo.light.y = u2f( *input++ );
22992339
23002340   /* read the z light value */
2301   geo.light.z = u2f( *input++ );
2341   geo.light.pz = u2f( *input++ );
23022342
23032343   return input;
23042344}
r1281r1282
26532693
26542694static void model2_exit(running_machine *machine)
26552695{
2696   poly_free(poly);
26562697   if ( sys24_bitmap != NULL )
26572698   {
26582699      bitmap_free( sys24_bitmap );
r1281r1282
26672708
26682709   sys24_tile_vh_start(machine, 0x3fff);
26692710   sys24_bitmap = bitmap_alloc(width, height+4, BITMAP_FORMAT_INDEXED16);
2711
2712   poly = poly_alloc(4000, sizeof(poly_extra_data), 0);
26702713   add_exit_callback(machine, model2_exit);
26712714
26722715   /* initialize the geometry engine */
src/mame/video/taitojc.c
r1281r1282
1010
1111//static int debug_tex_pal = 0;
1212
13static int tex_base_x;
14static int tex_base_y;
15static int tex_wrap_x;
16static int tex_wrap_y;
13typedef struct _poly_extra_data poly_extra_data;
14struct _poly_extra_data
15{
16   int tex_base_x;
17   int tex_base_y;
18   int tex_wrap_x;
19   int tex_wrap_y;
20};
1721
22
1823static int taitojc_gfx_index;
1924
2025static UINT8 *taitojc_dirty_map;
r1281r1282
2328static int taitojc_char_dirty = 1;
2429static tilemap *taitojc_tilemap;
2530
31static poly_manager *poly;
32
2633#define TAITOJC_NUM_TILES      0x80
2734
2835static const gfx_layout taitojc_char_layout =
r1281r1282
180187   }
181188}
182189
190static void taitojc_exit(running_machine *machine)
191{
192   poly_free(poly);
193}
194
183195VIDEO_START( taitojc )
184196{
197   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
198   add_exit_callback(machine, taitojc_exit);
199
185200    /* find first empty slot to decode gfx */
186201   for (taitojc_gfx_index = 0; taitojc_gfx_index < MAX_GFX_ELEMENTS; taitojc_gfx_index++)
187202      if (machine->gfx[taitojc_gfx_index] == 0)
r1281r1282
300315
301316
302317
303typedef struct
318static void render_solid_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
304319{
305   int x, y, z;
306   UINT32 color;
307   int u, v;
308} VERTEX;
320   mame_bitmap *destmap = dest;
321   float z = extent->param[0].start;
322   int color = extent->param[1].start;
323   float dz = extent->param[0].dpdx;
324   UINT16 *fb = BITMAP_ADDR16(destmap, scanline, 0);
325   UINT16 *zb = BITMAP_ADDR16(zbuffer, scanline, 0);
326   int x;
309327
310static void render_solid_tri(VERTEX *v1, VERTEX *v2, VERTEX *v3)
311{
312   UINT16 color;
313   int x, y;
314   struct poly_vertex vert[3];
315   const struct poly_scanline_data *scans;
316
317   rectangle cliprect;
318
319   cliprect.min_x = 0;
320   cliprect.min_y = 0;
321   cliprect.max_x = Machine->screen[0].width-1;
322   cliprect.max_y = Machine->screen[0].height-1;
323
324   vert[0].x = v1->x;   vert[0].y = v1->y;   vert[0].p[0] = v1->z;
325   vert[1].x = v2->x;   vert[1].y = v2->y;   vert[1].p[0] = v2->z;
326   vert[2].x = v3->x;   vert[2].y = v3->y;   vert[2].p[0] = v3->z;
327
328   color = v1->color;
329
330   scans = setup_triangle_1(&vert[0], &vert[1], &vert[2], &cliprect);
331
332   if (scans)
328   for (x = extent->startx; x < extent->stopx; x++)
333329   {
334      INT64 dz = scans->dp[0];
330      int iz = (int)z & 0xffff;
335331
336      for (y = scans->sy; y <= scans->ey; y++)
332      if (iz <= zb[x])
337333      {
338         int x1, x2;
339         INT64 z;
340         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
341         UINT16 *fb = BITMAP_ADDR16(framebuffer, y, 0);
342         UINT16 *zb = BITMAP_ADDR16(zbuffer, y, 0);
343
344         x1 = scan->sx;
345         x2 = scan->ex;
346
347         z = scans->scanline[y - scans->sy].p[0];
348
349         for (x = x1; x <= x2; x++)
350         {
351            int iz = (z >> 16) & 0xffff;
352
353            if (iz <= zb[x])
354            {
355               fb[x] = color;
356               zb[x] = iz;
357            }
358
359            z += dz;
360         }
334         fb[x] = color;
335         zb[x] = iz;
361336      }
337
338      z += dz;
362339   }
363340}
364341
365static void render_shade_tri(VERTEX *v1, VERTEX *v2, VERTEX *v3)
342static void render_shade_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
366343{
367   int x, y;
368   struct poly_vertex vert[3];
369   const struct poly_scanline_data *scans;
344   mame_bitmap *destmap = dest;
345   float z = extent->param[0].start;
346   float color = extent->param[1].start;
347   float dz = extent->param[0].dpdx;
348   float dcolor = extent->param[1].dpdx;
349   UINT16 *fb = BITMAP_ADDR16(destmap, scanline, 0);
350   UINT16 *zb = BITMAP_ADDR16(zbuffer, scanline, 0);
351   int x;
370352
371   rectangle cliprect;
372
373   cliprect.min_x = 0;
374   cliprect.min_y = 0;
375   cliprect.max_x = Machine->screen[0].width-1;
376   cliprect.max_y = Machine->screen[0].height-1;
377
378   vert[0].x = v1->x;   vert[0].y = v1->y;   vert[0].p[0] = v1->color;   vert[0].p[1] = v1->z;
379   vert[1].x = v2->x;   vert[1].y = v2->y;   vert[1].p[0] = v2->color;   vert[1].p[1] = v2->z;
380   vert[2].x = v3->x;   vert[2].y = v3->y;   vert[2].p[0] = v3->color;   vert[2].p[1] = v3->z;
381
382   scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &cliprect);
383
384   if (scans)
353   for (x = extent->startx; x < extent->stopx; x++)
385354   {
386      INT64 dcolor = scans->dp[0];
387      INT64 dz = scans->dp[1];
355      int ic = (int)color & 0xffff;
356      int iz = (int)z & 0xffff;
388357
389      for (y = scans->sy; y <= scans->ey; y++)
358      if (iz <= zb[x])
390359      {
391         int x1, x2;
392         INT64 color, z;
393         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
394         UINT16 *fb = BITMAP_ADDR16(framebuffer, y, 0);
395         UINT16 *zb = BITMAP_ADDR16(zbuffer, y, 0);
396
397         x1 = scan->sx;
398         x2 = scan->ex;
399
400         color = scans->scanline[y - scans->sy].p[0];
401         z = scans->scanline[y - scans->sy].p[1];
402
403         for (x = x1; x <= x2; x++)
404         {
405            int ic = (color >> 16) & 0xffff;
406            int iz = (z >> 16) & 0xffff;
407
408            if (iz <= zb[x])
409            {
410               fb[x] = ic;
411               zb[x] = iz;
412            }
413
414            color += dcolor;
415            z += dz;
416         }
360         fb[x] = ic;
361         zb[x] = iz;
417362      }
363
364      color += dcolor;
365      z += dz;
418366   }
419367}
420368
421static void render_texture_tri(VERTEX *v1, VERTEX *v2, VERTEX *v3)
369static void render_texture_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
422370{
423   int x, y;
424   struct poly_vertex vert[3];
425   const struct poly_scanline_data *scans;
371   const poly_extra_data *extra = extradata;
372   mame_bitmap *destmap = dest;
373   float z = extent->param[0].start;
374   float u = extent->param[1].start;
375   float v = extent->param[2].start;
376   float color = extent->param[3].start;
377   float dz = extent->param[0].dpdx;
378   float du = extent->param[1].dpdx;
379   float dv = extent->param[2].dpdx;
380   float dcolor = extent->param[3].dpdx;
381   UINT16 *fb = BITMAP_ADDR16(destmap, scanline, 0);
382   UINT16 *zb = BITMAP_ADDR16(zbuffer, scanline, 0);
383   int tex_wrap_x = extra->tex_wrap_x;
384   int tex_wrap_y = extra->tex_wrap_y;
385   int tex_base_x = extra->tex_base_x;
386   int tex_base_y = extra->tex_base_y;
387   int x;
426388
427   rectangle cliprect;
428
429   cliprect.min_x = 0;
430   cliprect.min_y = 0;
431   cliprect.max_x = Machine->screen[0].width-1;
432   cliprect.max_y = Machine->screen[0].height-1;
433
434   vert[0].x = v1->x;   vert[0].y = v1->y;
435   vert[0].p[0] = v1->u;
436   vert[0].p[1] = v1->v;
437   vert[0].p[2] = v1->color;
438   vert[0].p[3] = v1->z;
439
440   vert[1].x = v2->x;   vert[1].y = v2->y;
441   vert[1].p[0] = v2->u;
442   vert[1].p[1] = v2->v;
443   vert[1].p[2] = v2->color;
444   vert[1].p[3] = v2->z;
445
446   vert[2].x = v3->x;   vert[2].y = v3->y;
447   vert[2].p[0] = v3->u;
448   vert[2].p[1] = v3->v;
449   vert[2].p[2] = v3->color;
450   vert[2].p[3] = v3->z;
451
452   scans = setup_triangle_4(&vert[0], &vert[1], &vert[2], &cliprect);
453
454   if (scans)
389   for (x = extent->startx; x < extent->stopx; x++)
455390   {
456      INT64 du = scans->dp[0];
457      INT64 dv = scans->dp[1];
458      INT64 dcolor = scans->dp[2];
459      INT64 dz = scans->dp[3];
391      int iu, iv;
392      UINT8 texel;
393      int palette = ((int)color & 0x7f) << 8;
394      int iz = (int)z & 0xffff;
460395
461      for (y = scans->sy; y <= scans->ey; y++)
396      if (!tex_wrap_x)
462397      {
463         int x1, x2;
464         INT64 u, v, color, z;
465         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
466         UINT16 *fb = BITMAP_ADDR16(framebuffer, y, 0);
467         UINT16 *zb = BITMAP_ADDR16(zbuffer, y, 0);
398         iu = ((int)u >> 4) & 0x7ff;
399      }
400      else
401      {
402         iu = (tex_base_x + (((int)u >> 4) & 0x3f)) & 0x7ff;
403      }
468404
469         x1 = scan->sx;
470         x2 = scan->ex;
405      if (!tex_wrap_y)
406      {
407         iv = ((int)v >> 4) & 0x7ff;
408      }
409      else
410      {
411         iv = (tex_base_y + (((int)v >> 4) & 0x3f)) & 0x7ff;
412      }
471413
472         u = scans->scanline[y - scans->sy].p[0];
473         v = scans->scanline[y - scans->sy].p[1];
474         color = scans->scanline[y - scans->sy].p[2];
475         z = scans->scanline[y - scans->sy].p[3];
414      texel = taitojc_texture[(iv * 2048) + iu];
476415
477         for (x = x1; x <= x2; x++)
478         {
479            int iu, iv;
480            UINT8 texel;
481            int palette = ((color >> 16) & 0x7f) << 8;
482            int iz = (z >> 16) & 0xffff;
483
484            if (!tex_wrap_x)
485            {
486               iu = (u >> (16+4)) & 0x7ff;
487            }
488            else
489            {
490               iu = (tex_base_x + ((u >> (16+4)) & 0x3f)) & 0x7ff;
491            }
492
493            if (!tex_wrap_y)
494            {
495               iv = (v >> (16+4)) & 0x7ff;
496            }
497            else
498            {
499               iv = (tex_base_y + ((v >> (16+4)) & 0x3f)) & 0x7ff;
500            }
501
502            texel = taitojc_texture[(iv * 2048) + iu];
503
504            if (iz <= zb[x] && texel != 0)
505            {
506               fb[x] = palette | texel;
507               zb[x] = iz;
508            }
509
510            u += du;
511            v += dv;
512            color += dcolor;
513            z += dz;
514         }
416      if (iz <= zb[x] && texel != 0)
417      {
418         fb[x] = palette | texel;
419         zb[x] = iz;
515420      }
421
422      u += du;
423      v += dv;
424      color += dcolor;
425      z += dz;
516426   }
517427}
518428
519INLINE void render_solid_quad(VERTEX *v1, VERTEX *v2, VERTEX *v3, VERTEX *v4)
520{
521   render_solid_tri(v1, v2, v3);
522   render_solid_tri(v1, v3, v4);
523}
524
525INLINE void render_shade_quad(VERTEX *v1, VERTEX *v2, VERTEX *v3, VERTEX *v4)
526{
527   render_shade_tri(v1, v2, v3);
528   render_shade_tri(v1, v3, v4);
529}
530
531INLINE void render_texture_quad(VERTEX *v1, VERTEX *v2, VERTEX *v3, VERTEX *v4)
532{
533   render_texture_tri(v1, v2, v3);
534   render_texture_tri(v1, v3, v4);
535}
536
537429void taitojc_render_polygons(UINT16 *polygon_fifo, int length)
538430{
539   VERTEX vert[4];
431   poly_vertex vert[4];
540432   int i;
541433   int ptr;
542434
r1281r1282
570462            // 0x12: Vertex 3 X
571463            // 0x13: Vertex 3 Z
572464
465            poly_extra_data *extra = poly_get_extra_data(poly);
573466            UINT16 texbase;
574467
575468            /*
r1281r1282
583476
584477            texbase = polygon_fifo[ptr++];
585478
586            tex_base_x = ((texbase >> 0) & 0xff) << 4;
587            tex_base_y = ((texbase >> 8) & 0xff) << 4;
479            extra->tex_base_x = ((texbase >> 0) & 0xff) << 4;
480            extra->tex_base_y = ((texbase >> 8) & 0xff) << 4;
588481
589            tex_wrap_x = (cmd & 0xc0) ? 1 : 0;
590            tex_wrap_y = (cmd & 0x30) ? 1 : 0;
482            extra->tex_wrap_x = (cmd & 0xc0) ? 1 : 0;
483            extra->tex_wrap_y = (cmd & 0x30) ? 1 : 0;
591484
592485            for (i=0; i < 3; i++)
593486            {
594               vert[i].color = polygon_fifo[ptr++];   // palette
595               vert[i].v = (UINT16)(polygon_fifo[ptr++]);
596               vert[i].u = (UINT16)(polygon_fifo[ptr++]);
487               vert[i].p[3] = polygon_fifo[ptr++];   // palette
488               vert[i].p[2] = (UINT16)(polygon_fifo[ptr++]);
489               vert[i].p[1] = (UINT16)(polygon_fifo[ptr++]);
597490               vert[i].y =  (INT16)(polygon_fifo[ptr++]);
598491               vert[i].x =  (INT16)(polygon_fifo[ptr++]);
599               vert[i].z = (UINT16)(polygon_fifo[ptr++]);
492               vert[i].p[0] = (UINT16)(polygon_fifo[ptr++]);
600493            }
601494
602            if (vert[0].z < 0x8000 && vert[1].z < 0x8000 && vert[2].z < 0x8000)
495            if (vert[0].p[0] < 0x8000 && vert[1].p[0] < 0x8000 && vert[2].p[0] < 0x8000)
603496            {
604               render_texture_tri(&vert[0], &vert[1], &vert[2]);
497               poly_render_triangle(poly, framebuffer, &Machine->screen[0].visarea, render_texture_scan, 4, &vert[0], &vert[1], &vert[2]);
605498            }
606499            break;
607500         }
r1281r1282
636529
637530            for (i=0; i < 4; i++)
638531            {
639               vert[i].color = polygon_fifo[ptr++];
532               vert[i].p[1] = polygon_fifo[ptr++];
640533               vert[i].y =  (INT16)(polygon_fifo[ptr++]);
641534               vert[i].x =  (INT16)(polygon_fifo[ptr++]);
642               vert[i].z = (UINT16)(polygon_fifo[ptr++]);
535               vert[i].p[0] = (UINT16)(polygon_fifo[ptr++]);
643536            }
644537
645            if (vert[0].z < 0x8000 && vert[1].z < 0x8000 && vert[2].z < 0x8000 && vert[3].z < 0x8000)
538            if (vert[0].p[0] < 0x8000 && vert[1].p[0] < 0x8000 && vert[2].p[0] < 0x8000 && vert[3].p[0] < 0x8000)
646539            {
647               if (vert[0].color == vert[1].color &&
648                  vert[1].color == vert[2].color &&
649                  vert[2].color == vert[3].color)
540               if (vert[0].p[1] == vert[1].p[1] &&
541                  vert[1].p[1] == vert[2].p[1] &&
542                  vert[2].p[1] == vert[3].p[1])
650543               {
651544                  // optimization: all colours the same -> render solid
652                  render_solid_quad(&vert[0], &vert[1], &vert[2], &vert[3]);
545                  poly_render_quad(poly, framebuffer, &Machine->screen[0].visarea, render_solid_scan, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
653546               }
654547               else
655548               {
656                  render_shade_quad(&vert[0], &vert[1], &vert[2], &vert[3]);
549                  poly_render_quad(poly, framebuffer, &Machine->screen[0].visarea, render_shade_scan, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
657550               }
658551            }
659552            break;
r1281r1282
687580            // 0x18: Vertex 4 X
688581            // 0x19: Vertex 4 Z
689582
583            poly_extra_data *extra = poly_get_extra_data(poly);
690584            UINT16 texbase;
691585
692586            /*
r1281r1282
700594
701595            texbase = polygon_fifo[ptr++];
702596
703            tex_base_x = ((texbase >> 0) & 0xff) << 4;
704            tex_base_y = ((texbase >> 8) & 0xff) << 4;
597            extra->tex_base_x = ((texbase >> 0) & 0xff) << 4;
598            extra->tex_base_y = ((texbase >> 8) & 0xff) << 4;
705599
706            tex_wrap_x = (cmd & 0xc0) ? 1 : 0;
707            tex_wrap_y = (cmd & 0x30) ? 1 : 0;
600            extra->tex_wrap_x = (cmd & 0xc0) ? 1 : 0;
601            extra->tex_wrap_y = (cmd & 0x30) ? 1 : 0;
708602
709603            for (i=0; i < 4; i++)
710604            {
711               vert[i].color = polygon_fifo[ptr++];   // palette
712               vert[i].v = (UINT16)(polygon_fifo[ptr++]);
713               vert[i].u = (UINT16)(polygon_fifo[ptr++]);
605               vert[i].p[3] = polygon_fifo[ptr++];   // palette
606               vert[i].p[2] = (UINT16)(polygon_fifo[ptr++]);
607               vert[i].p[1] = (UINT16)(polygon_fifo[ptr++]);
714608               vert[i].y =  (INT16)(polygon_fifo[ptr++]);
715609               vert[i].x =  (INT16)(polygon_fifo[ptr++]);
716               vert[i].z = (UINT16)(polygon_fifo[ptr++]);
610               vert[i].p[0] = (UINT16)(polygon_fifo[ptr++]);
717611            }
718612
719            if (vert[0].z < 0x8000 && vert[1].z < 0x8000 && vert[2].z < 0x8000 && vert[3].z < 0x8000)
613            if (vert[0].p[0] < 0x8000 && vert[1].p[0] < 0x8000 && vert[2].p[0] < 0x8000 && vert[3].p[0] < 0x8000)
720614            {
721               render_texture_quad(&vert[0], &vert[1], &vert[2], &vert[3]);
615               poly_render_quad(poly, framebuffer, &Machine->screen[0].visarea, render_texture_scan, 4, &vert[0], &vert[1], &vert[2], &vert[3]);
722616            }
723617            break;
724618         }
r1281r1282
733627         }
734628      }
735629   };
630   poly_wait(poly, "Finished render");
736631}
737632
738633void taitojc_clear_frame(void)
src/mame/video/model3.c
r1281r1282
11#include "driver.h"
2#include "video/polynew.h"
2#include "video/poly.h"
33#include "video/rgbutil.h"
44#include "eminline.h"
55#include <math.h>
r1281r1282
10711071static void render_one(TRIANGLE *tri)
10721072{
10731073   poly_extra_data *extra = poly_get_extra_data(poly);
1074   poly_draw_tri_scanline callback = NULL;
1074   poly_draw_scanline callback = NULL;
10751075
10761076   tri->v[0].pz = 1.0f / tri->v[0].pz;
10771077   tri->v[1].pz = 1.0f / tri->v[1].pz;
src/mame/video/namcos22.c
r1281r1282
3737#include "eminline.h"
3838#include "video/rgbutil.h"
3939#include "namcos22.h"
40#include "video/polynew.h"
40#include "video/poly.h"
4141#include <math.h>
4242
4343// uncomment this line to render everything as quads
r1281r1282
267267};
268268
269269
270#ifdef RENDER_AS_QUADS
271static void renderscanline_uvi_full(void *dest, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
272#else
273static void renderscanline_uvi_full(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
274#endif
270static void renderscanline_uvi_full(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
275271{
276#ifdef RENDER_AS_QUADS
277272   float z = extent->param[0].start;
278273   float u = extent->param[1].start;
279274   float v = extent->param[2].start;
r1281r1282
282277   float du = extent->param[1].dpdx;
283278   float dv = extent->param[2].dpdx;
284279   float di = extent->param[3].dpdx;
285#else
286   float z = poly_param_tri_value(extent->startx, scanline, 0, poly); /* 1/z */
287   float u = poly_param_tri_value(extent->startx, scanline, 1, poly); /* u/z */
288   float v = poly_param_tri_value(extent->startx, scanline, 2, poly); /* v/z */
289   float i = poly_param_tri_value(extent->startx, scanline, 3, poly); /* i/z */
290   float dz = poly->param[0].dpdx;
291   float du = poly->param[1].dpdx;
292   float dv = poly->param[2].dpdx;
293   float di = poly->param[3].dpdx;
294#endif
295280   mame_bitmap *bitmap = dest;
296281   const poly_extra_data *extra = extradata;
297282   int bn = extra->bn * 0x1000;
r1281r1282
498483#endif
499484}
500485
501#ifdef RENDER_AS_QUADS
502static void renderscanline_sprite(void *destbase, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
503#else
504static void renderscanline_sprite(void *destbase, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
505#endif
486static void renderscanline_sprite(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
506487{
507#ifdef RENDER_AS_QUADS
508488   int x_index = extent->param[0].start * 65536.0f;
509489   int y_index = extent->param[1].start * 65536.0f;
510490   int dx = extent->param[0].dpdx * 65536.0f;
511#else
512   int x_index = poly_param_tri_value(extent->startx, scanline, 0, poly) * 65536.0f;
513   int y_index = poly_param_tri_value(extent->startx, scanline, 1, poly) * 65536.0f;
514   int dx = poly->param[0].dpdx * 65536.0f;
515#endif
516491   const poly_extra_data *extra = extradata;
517492   mame_bitmap *destmap = destbase;
518493   const pen_t *pal = &Machine->remapped_colortable[extra->color];
src/mame/video/welltris.c
r1281r1282
1616
1717
1818
19#ifdef UNUSED_FUNCTION
1920READ16_HANDLER( welltris_spriteram_r )
2021{
2122   return welltris_spriteram[offset];
2223}
24#endif
2325
2426WRITE16_HANDLER( welltris_spriteram_w )
2527{
src/mame/video/midvunit.c
r1281r1282
88#include "cpu/tms34010/tms34010.h"
99#include "cpu/adsp2100/adsp2100.h"
1010#include "audio/williams.h"
11#include "video/polynew.h"
11#include "video/poly.h"
1212#include "midvunit.h"
1313
1414
r1281r1282
8383 *
8484 *************************************/
8585
86static void render_flat(void *destbase, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
86static void render_flat(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
8787{
8888   const poly_extra_data *extra = extradata;
8989   UINT16 pixdata = extra->pixdata;
r1281r1282
115115 *
116116 *************************************/
117117
118static void render_tex(void *destbase, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
118static void render_tex(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
119119{
120120   const poly_extra_data *extra = extradata;
121121   UINT16 pixdata = extra->pixdata & 0xff00;
r1281r1282
153153}
154154
155155
156static void render_textrans(void *destbase, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
156static void render_textrans(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
157157{
158158   const poly_extra_data *extra = extradata;
159159   UINT16 pixdata = extra->pixdata & 0xff00;
r1281r1282
193193}
194194
195195
196static void render_textransmask(void *destbase, INT32 scanline, const quad_extent *extent, const void *extradata, int threadid)
196static void render_textransmask(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
197197{
198198   const poly_extra_data *extra = extradata;
199199   UINT16 pixdata = extra->pixdata;
r1281r1282
240240 *
241241 *************************************/
242242
243static void make_vertices_inclusive(poly_vertex *vert)
244{
245   UINT8 rmask = 0, bmask = 0, eqmask = 0;
246   int vnum;
247
248   /* build up a mask of right and bottom points */
249   /* note we assume clockwise orientation here */
250   for (vnum = 0; vnum < 4; vnum++)
251   {
252      poly_vertex *currv = &vert[vnum];
253      poly_vertex *nextv = &vert[(vnum + 1) & 3];
254
255      /* if this vertex equals the next one, tag it */
256      if (nextv->y == currv->y && nextv->x == currv->x)
257         eqmask |= 1 << vnum;
258
259      /* if the next vertex is down from us, we are a right coordinate */
260      if (nextv->y > currv->y || (nextv->y == currv->y && nextv->x < currv->x))
261         rmask |= 1 << vnum;
262
263      /* if the next vertex is left from us, we are a bottom coordinate */
264      if (nextv->x < currv->x || (nextv->x == currv->x && nextv->y < currv->y))
265         bmask |= 1 << vnum;
266   }
267
268   /* bail on the edge case */
269   if (eqmask == 0x0f)
270      return;
271
272   /* adjust the right/bottom points so that they get included */
273   for (vnum = 0; vnum < 4; vnum++)
274   {
275      poly_vertex *currv = &vert[vnum];
276      int effvnum = vnum;
277
278      /* if we're equal to the next vertex, use that instead */
279      while (eqmask & (1 << effvnum))
280         effvnum = (effvnum + 1) & 3;
281
282      /* adjust the points */
283      if (rmask & (1 << effvnum))
284         currv->x += 0.001f;
285      if (bmask & (1 << effvnum))
286         currv->y += 0.001f;
287   }
288}
289
290
243291static void process_dma_queue(running_machine *machine)
244292{
245293   poly_extra_data *extra = poly_get_extra_data(poly);
246294   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
247295   int textured = ((dma_data[0] & 0x300) == 0x100);
248   poly_draw_quad_scanline callback;
296   poly_draw_scanline callback;
249297   poly_vertex vert[4];
250298
251299   /* if we're rendering to the same page we're viewing, it has changed */
r1281r1282
253301      video_changed = TRUE;
254302
255303   /* fill in the vertex data */
256   vert[0].x = (float)(INT16)dma_data[2];
257   vert[0].y = (float)(INT16)dma_data[3];
258   vert[1].x = (float)(INT16)dma_data[4];
259   vert[1].y = (float)(INT16)dma_data[5];
260   vert[2].x = (float)(INT16)dma_data[6];
261   vert[2].y = (float)(INT16)dma_data[7];
262   vert[3].x = (float)(INT16)dma_data[8];
263   vert[3].y = (float)(INT16)dma_data[9];
304   vert[0].x = (float)(INT16)dma_data[2] + 0.5f;
305   vert[0].y = (float)(INT16)dma_data[3] + 0.5f;
306   vert[1].x = (float)(INT16)dma_data[4] + 0.5f;
307   vert[1].y = (float)(INT16)dma_data[5] + 0.5f;
308   vert[2].x = (float)(INT16)dma_data[6] + 0.5f;
309   vert[2].y = (float)(INT16)dma_data[7] + 0.5f;
310   vert[3].x = (float)(INT16)dma_data[8] + 0.5f;
311   vert[3].y = (float)(INT16)dma_data[9] + 0.5f;
264312
313   /* make the vertices inclusive of right/bottom points */
314   make_vertices_inclusive(vert);
315
265316   /* handle flat-shaded quads here */
266317   if (!textured)
267318      callback = render_flat;
r1281r1282
270321   else
271322   {
272323      /* if textured, add the texture info */
273      vert[0].p[0] = (float)(dma_data[10] & 0xff) * 65536.0f;
274      vert[0].p[1] = (float)(dma_data[10] >> 8) * 65536.0f;
275      vert[1].p[0] = (float)(dma_data[11] & 0xff) * 65536.0f;
276      vert[1].p[1] = (float)(dma_data[11] >> 8) * 65536.0f;
277      vert[2].p[0] = (float)(dma_data[12] & 0xff) * 65536.0f;
278      vert[2].p[1] = (float)(dma_data[12] >> 8) * 65536.0f;
279      vert[3].p[0] = (float)(dma_data[13] & 0xff) * 65536.0f;
280      vert[3].p[1] = (float)(dma_data[13] >> 8) * 65536.0f;
324      vert[0].p[0] = (float)(dma_data[10] & 0xff) * 65536.0f + 32768.0f;
325      vert[0].p[1] = (float)(dma_data[10] >> 8) * 65536.0f + 32768.0f;
326      vert[1].p[0] = (float)(dma_data[11] & 0xff) * 65536.0f + 32768.0f;
327      vert[1].p[1] = (float)(dma_data[11] >> 8) * 65536.0f + 32768.0f;
328      vert[2].p[0] = (float)(dma_data[12] & 0xff) * 65536.0f + 32768.0f;
329      vert[2].p[1] = (float)(dma_data[12] >> 8) * 65536.0f + 32768.0f;
330      vert[3].p[0] = (float)(dma_data[13] & 0xff) * 65536.0f + 32768.0f;
331      vert[3].p[1] = (float)(dma_data[13] >> 8) * 65536.0f + 32768.0f;
281332
282333      /* handle non-masked, non-transparent quads */
283334      if ((dma_data[0] & 0xc00) == 0x000)
src/mame/video/vball.c
r1281r1282
6060   tilemap_mark_tile_dirty(bg_tilemap,offset);
6161}
6262
63#ifdef UNUSED_FUNCTION
6364READ8_HANDLER( vb_attrib_r )
6465{
6566   return vb_attribram[offset];
6667}
68#endif
6769
6870WRITE8_HANDLER( vb_attrib_w )
6971{
src/mame/video/battlera.c
r1281r1282
9696
9797/******************************************************************************/
9898
99#ifdef UNUSED_FUNCTION
99100READ8_HANDLER( HuC6270_data_r )
100101{
101102   int result;
r1281r1282
112113
113114   return 0;
114115}
116#endif
115117
116118WRITE8_HANDLER( HuC6270_data_w )
117119{
src/mame/video/nbmj8688.c
r1281r1282
172172      mjsikaku_gfxflag2 |= 0x20;
173173}
174174
175WRITE8_HANDLER( mjsikaku_gfxflag3_w )
175static WRITE8_HANDLER( mjsikaku_gfxflag3_w )
176176{
177177   mjsikaku_gfxflag3 = (data & 0xe0);
178178}
src/mame/video/psychic5.c
r1281r1282
139139}
140140
141141
142WRITE8_HANDLER( psychic5_bg_videoram_w )
142static WRITE8_HANDLER( psychic5_bg_videoram_w )
143143{
144144   psychic5_bg_videoram[offset] = data;
145145   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
146146}
147147
148WRITE8_HANDLER( psychic5_fg_videoram_w )
148static WRITE8_HANDLER( psychic5_fg_videoram_w )
149149{
150150   psychic5_fg_videoram[offset] = data;
151151   tilemap_mark_tile_dirty(fg_tilemap, offset / 2);
src/mame/video/slapshot.c
r1281r1282
3232
3333/**********************************************************/
3434
35VIDEO_START( slapshot_core )
35static VIDEO_START( slapshot_core )
3636{
3737   int i;
3838
src/mame/video/ladyfrog.c
r1281r1282
99static int tilebank=0;
1010
1111static tilemap *bg_tilemap;
12static int palette_bank,gfxctrl;
12static int palette_bank;
13//static int gfxctrl;
1314
1415UINT8 *ladyfrog_scrlram;
1516
r1281r1282
7879}
7980
8081
82#ifdef UNUSED_FUNCTION
8183READ8_HANDLER( ladyfrog_gfxctrl_r )
8284{
8385      return    gfxctrl;
8486}
87#endif
8588
8689READ8_HANDLER( ladyfrog_scrlram_r )
8790{
src/mame/video/model2rd.c
r1281r1282
5454
5555#ifndef MODEL2_TEXTURED
5656/* non-textured render path */
57static void MODEL2_FUNC_NAME ( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect )
57static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
5858{
59   struct poly_vertex vert[3];
60   const struct poly_scanline_data *scans;
59   const poly_extra_data *extra = extradata;
60   mame_bitmap *destmap = dest;
61   UINT32 *p = BITMAP_ADDR32(destmap, scanline, 0);
6162
63   /* extract color information */
64   const UINT16 *colortable_r = (const UINT16 *)&model2_colorxlat[0x0000/4];
65   const UINT16 *colortable_g = (const UINT16 *)&model2_colorxlat[0x4000/4];
66   const UINT16 *colortable_b = (const UINT16 *)&model2_colorxlat[0x8000/4];
67   const UINT16 *lumaram = (const UINT16 *)model2_lumaram;
68   const UINT16 *palram = (const UINT16 *)paletteram32;
69   UINT32   lumabase = extra->lumabase;
70   UINT32   color = extra->colorbase;
71   UINT8   luma;
72   UINT32   tr, tg, tb;
73   int      x;
74
6275   /* if it's translucent, there's nothing to render */
6376#if defined( MODEL2_TRANSLUCENT)
6477   return;
6578#endif
6679
67   /* setup vertices to be scanned */
68   vert[0].x = (INT32)tri->v[0].x;   vert[0].y = (INT32)tri->v[0].y;
69   vert[1].x = (INT32)tri->v[1].x;   vert[1].y = (INT32)tri->v[1].y;
70   vert[2].x = (INT32)tri->v[2].x;   vert[2].y = (INT32)tri->v[2].y;
80   luma = lumaram[BYTE_XOR_LE(lumabase + (0xf << 3))] & 0x3F;
7181
72   /* get the scan parameters */
73   scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], cliprect);
82   color = palram[BYTE_XOR_LE(color + 0x1000)] & 0x7fff;
7483
75   /* see if we have something to render */
76   if ( scans )
77   {
78      /* extract color information */
79      const UINT16 *colortable_r = (const UINT16 *)&model2_colorxlat[0x0000/4];
80      const UINT16 *colortable_g = (const UINT16 *)&model2_colorxlat[0x4000/4];
81      const UINT16 *colortable_b = (const UINT16 *)&model2_colorxlat[0x8000/4];
82      const UINT16 *lumaram = (const UINT16 *)model2_lumaram;
83      const UINT16 *palram = (const UINT16 *)paletteram32;
84      UINT32   lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x07);
85      UINT32   color = (tri->texheader[3] >> 6) & 0x3FF;
86      UINT8   luma;
87      UINT32   tr, tg, tb;
88      int      x, y;
84   colortable_r += ((color >>  0) & 0x1f) << 8;
85   colortable_g += ((color >>  5) & 0x1f) << 8;
86   colortable_b += ((color >> 10) & 0x1f) << 8;
8987
90      luma = lumaram[BYTE_XOR_LE(lumabase + (0xf << 3))] & 0x3F;
88   /* we have the 6 bits of luma information along with 5 bits per color component */
89   /* now build and index into the master color lookup table and extract the raw RGB values */
9190
92      color = palram[BYTE_XOR_LE(color + 0x1000)] & 0x7fff;
91   tr = colortable_r[BYTE_XOR_LE(luma)] & 0xff;
92   tg = colortable_g[BYTE_XOR_LE(luma)] & 0xff;
93   tb = colortable_b[BYTE_XOR_LE(luma)] & 0xff;
9394
94      colortable_r += ((color >>  0) & 0x1f) << 8;
95      colortable_g += ((color >>  5) & 0x1f) << 8;
96      colortable_b += ((color >> 10) & 0x1f) << 8;
95   /* build the final color */
96   color = MAKE_RGB(tr, tg, tb);
9797
98      /* we have the 6 bits of luma information along with 5 bits per color component */
99      /* now build and index into the master color lookup table and extract the raw RGB values */
100
101      tr = colortable_r[BYTE_XOR_LE(luma)] & 0xff;
102      tg = colortable_g[BYTE_XOR_LE(luma)] & 0xff;
103      tb = colortable_b[BYTE_XOR_LE(luma)] & 0xff;
104
105      /* build the final color */
106      color = MAKE_RGB(tr, tg, tb);
107
108      /* go through our scan list and paint the lines */
109      for(y = scans->sy; y <= scans->ey; y++)
110      {
111         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
112         UINT32 *p = BITMAP_ADDR32(bitmap, y, 0);
113         int x1, x2;
114
115         x1 = scan->sx;
116         x2 = scan->ex;
117
118         for(x = x1; x <= x2; x++)
98   for(x = extent->startx; x < extent->stopx; x++)
11999#if defined(MODEL2_CHECKER)
120            if ((x^y) & 1) p[x] = color;
100      if ((x^scanline) & 1) p[x] = color;
121101#else
122            p[x] = color;
102      p[x] = color;
123103#endif
124      }
125   }
126104}
127105
128106#else
129107/* textured render path */
130static void MODEL2_FUNC_NAME ( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect )
108static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
131109{
132   struct poly_vertex vert[3];
133   const struct poly_scanline_data *scans;
134   UINT32   tex_width   = (tri->texheader[0] >> 0) & 0x7;
135   UINT32   tex_height   = (tri->texheader[0] >> 3) & 0x7;
136   int i;
110   const poly_extra_data *extra = extradata;
111   mame_bitmap *destmap = dest;
112   UINT32 *p = BITMAP_ADDR32(destmap, scanline, 0);
137113
138   tex_width = 32 << tex_width;      /* or 1 << (5 + tex_width) */
139   tex_height = 32 << tex_height;
114   UINT32   tex_width = extra->texwidth;
115   UINT32   tex_height = extra->texheight;
140116
141   for( i = 0; i < 3; i++ )
142   {
143      float ooz = 1.0 / (1.0 + tri->v[i].z);
117   /* extract color information */
118   const UINT16 *colortable_r = (const UINT16 *)&model2_colorxlat[0x0000/4];
119   const UINT16 *colortable_g = (const UINT16 *)&model2_colorxlat[0x4000/4];
120   const UINT16 *colortable_b = (const UINT16 *)&model2_colorxlat[0x8000/4];
121   const UINT16 *lumaram = (const UINT16 *)model2_lumaram;
122   const UINT16 *palram = (const UINT16 *)paletteram32;
123   UINT32   colorbase = extra->colorbase;
124   UINT32   lumabase = extra->lumabase;
125   UINT32   tex_x = extra->texx;
126   UINT32   tex_y = extra->texy;
127   UINT32   tex_x_mask, tex_y_mask;
128   UINT32   tex_mirr_x = extra->texmirrorx;
129   UINT32   tex_mirr_y = extra->texmirrory;
130   UINT32 *sheet = extra->texsheet;
131   float ooz = extent->param[0].start;
132   float uoz = extent->param[1].start;
133   float voz = extent->param[2].start;
134   float dooz = extent->param[0].dpdx;
135   float duoz = extent->param[1].dpdx;
136   float dvoz = extent->param[2].dpdx;
137   int      x;
144138
145      vert[i].x = (INT32)tri->v[i].x;
146      vert[i].y = (INT32)tri->v[i].y;
139   tex_x_mask   = tex_width - 1;
140   tex_y_mask   = tex_height - 1;
147141
148      /* p[0] = 1/z in 1.3.28 format */
149      vert[i].p[0] = (INT32)(ooz * (float)(1 << 28));
142   colorbase = palram[BYTE_XOR_LE(colorbase + 0x1000)] & 0x7fff;
150143
151      /* p[1] and p[2] are u/z and v/z in 1.12.19 */
152      vert[i].p[1] = ((INT64)tri->v[i].u * (INT64)vert[i].p[0]) >> 12;
153      vert[i].p[2] = ((INT64)tri->v[i].v * (INT64)vert[i].p[0]) >> 12;
154   }
144   colortable_r += ((colorbase >>  0) & 0x1f) << 8;
145   colortable_g += ((colorbase >>  5) & 0x1f) << 8;
146   colortable_b += ((colorbase >> 10) & 0x1f) << 8;
155147
156   /* get the scan parameters */
157   scans = setup_triangle_3(&vert[0], &vert[1], &vert[2], cliprect);
158
159   /* see if we have something to render */
160   if ( scans )
148   for(x = extent->startx; x < extent->stopx; x++, uoz += duoz, voz += dvoz, ooz += dooz)
161149   {
162      INT64 duoz, dvoz, dooz;
150      float z = recip_approx(ooz) * 256.0f;
151      INT32 u = uoz * z;
152      INT32 v = voz * z;
153      UINT32   tr, tg, tb;
154      UINT16   t;
155      UINT8 luma;
156      int u2;
157      int v2;
163158
164      /* extract color information */
165      const UINT16 *colortable_r = (const UINT16 *)&model2_colorxlat[0x0000/4];
166      const UINT16 *colortable_g = (const UINT16 *)&model2_colorxlat[0x4000/4];
167      const UINT16 *colortable_b = (const UINT16 *)&model2_colorxlat[0x8000/4];
168      const UINT16 *lumaram = (const UINT16 *)model2_lumaram;
169      const UINT16 *palram = (const UINT16 *)paletteram32;
170      UINT32   colorbase = (tri->texheader[3] >> 6) & 0x3FF;
171      UINT32   lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
172      UINT32   tex_x      = (tri->texheader[2] >> 0) & 0x1f;
173      UINT32   tex_y      = (tri->texheader[2] >> 6) & 0x1f;
174      UINT32   tex_x_mask, tex_y_mask;
175      UINT32   tex_mirr_x   = (tri->texheader[0] >> 9) & 1;
176      UINT32   tex_mirr_y   = (tri->texheader[0] >> 8) & 1;
177      UINT32 *sheet;
178      int      x, y;
179
180      if ( tri->texheader[2] & 0x20 )
181         tex_y += 0x20;
182
183      tex_x = 32 * tex_x;
184      tex_y = 32 * tex_y;
185      tex_x_mask   = tex_width - 1;
186      tex_y_mask   = tex_height - 1;
187
188      sheet = model2_textureram0;
189
190      if (tri->texheader[2] & 0x1000)
191         sheet = model2_textureram1;
192
193      colorbase = palram[BYTE_XOR_LE(colorbase + 0x1000)] & 0x7fff;
194
195      colortable_r += ((colorbase >>  0) & 0x1f) << 8;
196      colortable_g += ((colorbase >>  5) & 0x1f) << 8;
197      colortable_b += ((colorbase >> 10) & 0x1f) << 8;
198
199      dooz = scans->dp[0];
200      duoz = scans->dp[1];
201      dvoz = scans->dp[2];
202
203      for(y = scans->sy; y <= scans->ey; y++)
204      {
205         const struct poly_scanline *scan = &scans->scanline[y - scans->sy];
206         UINT32 *p = BITMAP_ADDR32(bitmap, y, 0);
207         INT64 uoz, voz, ooz;
208         int x1, x2;
209
210         x1 = scan->sx;
211         x2 = scan->ex;
212
213         ooz = scans->scanline[y - scans->sy].p[0];
214         uoz = scans->scanline[y - scans->sy].p[1];
215         voz = scans->scanline[y - scans->sy].p[2];
216
217         for(x = x1; x <= x2; x++, uoz += duoz, voz += dvoz, ooz += dooz)
218         {
219            /* ooz is in 1.3.44 format (1.3.28 plus an extra 0.0.16) */
220            /* uoz and voz are in 1.12.35 format (1.12.19 plus an extra 0.0.16) */
221            INT32 z = ((UINT64)1 << 60) / ooz;   /* 16.16 */
222            INT32 u = ((uoz >> 16) * z) >> 27;   /* 12.8 */
223            INT32 v = ((voz >> 16) * z) >> 27;   /* 12.8 */
224            UINT32   tr, tg, tb;
225            UINT16   t;
226            UINT8 luma;
227            int u2;
228            int v2;
229
230159#if defined(MODEL2_CHECKER)
231            if ( ((x^y) & 1) == 0 )
232               continue;
160      if ( ((x^scanline) & 1) == 0 )
161         continue;
233162#endif
234            u2 = (u >> 8) & tex_x_mask;
235            v2 = (v >> 8) & tex_y_mask;
163      u2 = (u >> 8) & tex_x_mask;
164      v2 = (v >> 8) & tex_y_mask;
236165
237            if ( tex_mirr_x )
238               u2 = ( tex_width - 1 ) - u2;
166      if ( tex_mirr_x )
167         u2 = ( tex_width - 1 ) - u2;
239168
240            if ( tex_mirr_y )
241               v2 = ( tex_height - 1 ) - v2;
169      if ( tex_mirr_y )
170         v2 = ( tex_height - 1 ) - v2;
242171
243            t = get_texel( tex_x, tex_y, u2, v2, sheet );
172      t = get_texel( tex_x, tex_y, u2, v2, sheet );
244173
245174#if defined(MODEL2_TRANSLUCENT)
246            if ( t == 0x0f )
247               continue;
175      if ( t == 0x0f )
176         continue;
248177#endif
249            luma = lumaram[BYTE_XOR_LE(lumabase + (t << 3))] & 0x3f;
178      luma = lumaram[BYTE_XOR_LE(lumabase + (t << 3))] & 0x3f;
250179
251            /* we have the 6 bits of luma information along with 5 bits per color component */
252            /* now build and index into the master color lookup table and extract the raw RGB values */
180      /* we have the 6 bits of luma information along with 5 bits per color component */
181      /* now build and index into the master color lookup table and extract the raw RGB values */
253182
254            tr = colortable_r[BYTE_XOR_LE(luma)] & 0xff;
255            tg = colortable_g[BYTE_XOR_LE(luma)] & 0xff;
256            tb = colortable_b[BYTE_XOR_LE(luma)] & 0xff;
183      tr = colortable_r[BYTE_XOR_LE(luma)] & 0xff;
184      tg = colortable_g[BYTE_XOR_LE(luma)] & 0xff;
185      tb = colortable_b[BYTE_XOR_LE(luma)] & 0xff;
257186
258            p[x] = MAKE_RGB(tr, tg, tb);
259         }
260      }
187      p[x] = MAKE_RGB(tr, tg, tb);
261188   }
262189}
263190
src/mame/video/legionna.c
r1281r1282
2929   mid_gfx_bank  = (data &0x8000) >> 3;//???
3030}
3131
32#ifdef UNUSED_FUNCTION
3233WRITE16_HANDLER( legionna_control_w )
3334{
34#if 0
3535   if (ACCESSING_LSB)
3636   {
3737      legionna_enable=data;
r1281r1282
5050      else
5151         tilemap_set_enable(background_layer,1);
5252   }
53}
5354#endif
54}
5555
5656WRITE16_HANDLER( legionna_background_w )
5757{
src/mame/video/ampoker.c
r0r1282
1/********************************************************************************
2
3
4    AMERICAN POKER 2 - VIDEO HARDWARE
5    ---------------------------------
6
7    Company:    Novomatic.
8    Year:       1990.
9
10    Original preliminary driver:   Curt Coder.
11    Rewrite and additional work:   Roberto Fresca, with a lot of help of Grull Osgo.
12
13
14    --- Supported Sets ---
15
16    Old name | New name | Relation | Description
17    --------------------------------------------
18    ampokr2b   ampoker2   parent     American Poker II.
19      ----     ampkr2b1   clone      American Poker II (bootleg, set 1).
20    ampokr2a   ampkr2b2   clone      American Poker II (bootleg, set 2).
21    ampoker2   ampkr2b3   clone      American Poker II (bootleg, set 3).
22    ampokr2c   pkrdewin   clone      Poker De Win.
23      ----     ampkr95    clone      American Poker 95.
24      ----     sigmapkr   parent     Sigma Poker.
25      ----     sigma2k    parent     Sigma Poker 2000.
26
27
28********************************************************************************/
29
30
31#include "driver.h"
32
33static tilemap *bg_tilemap;
34
35
36PALETTE_INIT( ampoker2 )
37{
38   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
39
40   int i;
41
42/*    - bits -
43      76543210
44      RRRGGGBB
45*/
46   for (i = 0; i < machine->drv->total_colors; i++)
47   {
48      int bit0, bit1, bit2, r, g, b;
49
50      /* blue component */
51      bit0 = 0;
52      bit1 = (*color_prom >> 0) & 0x01;
53      bit2 = (*color_prom >> 1) & 0x01;
54      b =  ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
55
56      /* green component */
57      bit0 = (*color_prom >> 2) & 0x01;
58      bit1 = (*color_prom >> 3) & 0x01;
59      bit2 = (*color_prom >> 4) & 0x01;
60      g =  ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
61
62      /* red component */
63      bit0 = (*color_prom >> 5) & 0x01;
64      bit1 = (*color_prom >> 6) & 0x01;
65      bit2 = (*color_prom >> 7) & 0x01;
66      r = ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
67
68      palette_set_color(machine, i, MAKE_RGB(r, g, b));
69
70      color_prom++;
71   }
72}
73
74WRITE8_HANDLER( ampoker2_videoram_w )
75{
76   videoram[offset] = data;
77   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
78}
79
80static TILE_GET_INFO( get_bg_tile_info )
81{
82   int offs = tile_index * 2;
83   int attr = videoram[offs + 1];
84   int code = videoram[offs];
85   int color = attr;
86   code=code+(256*(color & 0x03));   /* code = color.bit1 + color.bit0 + code */
87   color= color >> 1;            /* color = color - bit0 (bit1..bit7) */
88
89   SET_TILE_INFO(0, code, color, 0);
90}
91
92static TILE_GET_INFO( s2k_get_bg_tile_info )
93{
94   int offs = tile_index * 2;
95   int attr = videoram[offs + 1];
96   int code = videoram[offs];
97   int color = attr;
98   code=code+(256*(color & 0x0f));   /* the game use 2 extra bits */
99   color= color >> 1;
100
101   SET_TILE_INFO(0, code, color, 0);
102}
103
104VIDEO_START(ampoker2)
105{
106   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
107      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
108}
109
110VIDEO_START(sigma2k)
111{
112   bg_tilemap = tilemap_create(s2k_get_bg_tile_info, tilemap_scan_rows,
113      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
114}
115
116VIDEO_UPDATE(ampoker2)
117{
118   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
119   return 0;
120}
src/mame/video/msisaac.c
r1281r1282
1010UINT8 *msisaac_videoram;
1111UINT8 *msisaac_videoram2;
1212
13static int textbank1, bg2_textbank;
13//static int textbank1;
14static int bg2_textbank;
1415
1516static tilemap *background, *background2, *foreground;
1617
r1281r1282
106107}
107108
108109
110#ifdef UNUSED_FUNCTION
109111WRITE8_HANDLER( msisaac_textbank1_w )
110112{
111113   if( textbank1!=data )
r1281r1282
114116      tilemap_mark_all_tiles_dirty( foreground );
115117   }
116118}
119#endif
117120
118121WRITE8_HANDLER( msisaac_bg2_textbank_w )
119122{
src/mame/video/equites.c
r1281r1282
665665   dirtybuf[offset] = 1;
666666}
667667
668#ifdef UNUSED_FUNCTION
668669WRITE16_HANDLER(splndrbt_bgcolor_w)
669670{
670671   data >>= 8;
r1281r1282
675676      memset(dirtybuf, 1, 0x400);
676677   }
677678}
679#endif
678680
679681/******************************************************************************/
src/mame/video/gradius3.c
r1281r1282
111111   return (gfxdata[2*offset+1] << 8) | gfxdata[2*offset];
112112}
113113
114READ16_HANDLER( gradius3_gfxram_r )
115{
116   return gradius3_gfxram[offset];
117}
118
119114WRITE16_HANDLER( gradius3_gfxram_w )
120115{
121116   int oldword = gradius3_gfxram[offset];
src/mame/video/combatsc.c
r1281r1282
301301   }
302302}
303303
304WRITE8_HANDLER( combascb_sh_irqtrigger_w )
304static WRITE8_HANDLER( combascb_sh_irqtrigger_w )
305305{
306306   soundlatch_w(offset,data);
307307   cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff);
308308}
309309
310READ8_HANDLER( combascb_io_r )
310static READ8_HANDLER( combascb_io_r )
311311{
312312   return readinputport(offset);
313313}
314314
315WRITE8_HANDLER( combascb_priority_w )
315static WRITE8_HANDLER( combascb_priority_w )
316316{
317317   priority = data & 0x20;
318318}
src/mame/video/tubep.c
r1281r1282
4545
4646
4747
48
4948/***************************************************************************
5049
5150  Convert the color PROMs into a more useable format.
5251
53  Roller Jammer has two 32 bytes palette PROMs, connected to the RGB
54  output this way:
5552
56  bit 7 -- 220 ohm resistor  -- \
57        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- BLUE
58
59        -- 220 ohm resistor  -- \
60        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- GREEN
61        -- 1  kohm resistor  -- /
62
63        -- 220 ohm resistor  -- \
64        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- RED
65  bit 0 -- 1  kohm resistor  -- /
66
67***************************************************************************/
68PALETTE_INIT( rjammer )
69{
70   int i;
71   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
72   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
73
74   static const int resistors_rg[3] = { 1000, 470, 220 };
75   static const int resistors_b [2] = { 470, 220 };
76   double weights_rg[3];
77   double weights_b[2];
78
79   compute_resistor_weights(0,   255,   -1.0,
80         3,   resistors_rg,   weights_rg,   470,   0,
81         2,   resistors_b,   weights_b,   470,   0,
82         0,   0,   0,   0,   0   );
83
84   for (i = 0;i < machine->drv->total_colors;i++)
85   {
86      int bit0,bit1,bit2,r,g,b;
87
88      /* red component */
89      bit0 = (*color_prom >> 0) & 0x01;
90      bit1 = (*color_prom >> 1) & 0x01;
91      bit2 = (*color_prom >> 2) & 0x01;
92      r = combine_3_weights(weights_rg, bit0, bit1, bit2);
93      /* green component */
94      bit0 = (*color_prom >> 3) & 0x01;
95      bit1 = (*color_prom >> 4) & 0x01;
96      bit2 = (*color_prom >> 5) & 0x01;
97      g = combine_3_weights(weights_rg, bit0, bit1, bit2);
98      /* blue component */
99      bit0 = (*color_prom >> 6) & 0x01;
100      bit1 = (*color_prom >> 7) & 0x01;
101      b = combine_2_weights(weights_b, bit0, bit1);
102
103      palette_set_color(machine,i, MAKE_RGB(r,g,b));
104
105      color_prom++;
106   }
107
108
109   /* text: colors 0, 17-31 from PROM @16B */
110   for (i = 0; i < TOTAL_COLORS(0)/2; i++)
111   {
112      COLOR(0, 2*i + 0) = 0;      /* transparent "black" */
113      COLOR(0, 2*i + 1) = i+16;   /* /SOFF is on the A4 line */
114   }
115}
116
117
118
119/***************************************************************************
120
121  Convert the color PROMs into a more useable format.
122
123
12453  Tube Panic has two 32 bytes palette control PROMs.
12554
12655  First one is connected to the RGB output this way:
r1281r1282
437366         for (c=0; c<2*6; c++)   out += weights_b[c] * bits_b[c];
438367         b = (int)(out + 0.5);
439368
440         //logerror("Calculate [%x:%x] (active resistors:r=%i g=%i b=%i) = ", i, shade, active_r, active_g, active_b);
441         //logerror("r:%3i g:%3i b:%3i\n",r,g,b );
369         /*logerror("Calculate [%x:%x] (active resistors:r=%i g=%i b=%i) = ", i, shade, active_r, active_g, active_b);*/
370         /*logerror("r:%3i g:%3i b:%3i\n",r,g,b );*/
442371
443372         palette_set_color(machine,32+i*0x40+sh, MAKE_RGB(r,g,b));
444373      }
r1281r1282
475404   state_save_register_global(page);
476405}
477406
407
478408WRITE8_HANDLER( tubep_textram_w )
479409{
480410   tubep_textram[offset] = data;
481411}
482412
483413
484
485414WRITE8_HANDLER( tubep_background_romselect_w )
486415{
487416   background_romsel = data & 1;
r1281r1282
494423}
495424
496425
497
498426WRITE8_HANDLER( tubep_background_a000_w )
499427{
500428   ls175_b7 = ((data&0x0f)^0x0f) | 0xf0;
r1281r1282
650578   }
651579}
652580
653VIDEO_EOF( tubep )
581void tubep_vblank_end(void)
654582{
655   /* clear displayed frame */
583   DISP = DISP ^ 1;
584   /* logerror("EOF: DISP after this is=%i, and clearing it now.\n", DISP); */
585   /* clear the new frame (the one that was (just) displayed)*/
656586   memset(spritemap+DISP*256*256, 0x0f, 256*256);
657   DISP = DISP ^ 1;
658587}
659588
660589
661590VIDEO_UPDATE( tubep )
662591{
663592   int offs;
593   int DISP_ = DISP^1;
664594
665595   /* draw background ram */
666596   {
r1281r1282
669599      UINT32 h,v;
670600      UINT8 * romBxx = memory_region(REGION_USER1) + 0x2000*background_romsel;
671601
672      for (v = 2*8; v < 30*8; v++)   /* only for visible area */
602      /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect->min_y, cliprect->max_y+1); */
603
604      for (v = cliprect->min_y; v <= cliprect->max_y; v++)   /* only for current scanline */
673605      {
674606         UINT32 sp_data0=0,sp_data1=0,sp_data2=0;
675607         for (h = 0*8; h < 32*8; h++)
r1281r1282
707639
708640            sp_data2 = sp_data1;
709641            sp_data1 = sp_data0;
710            sp_data0 = spritemap[ h + v*256 +(DISP*256*256) ];
642            sp_data0 = spritemap[ h + v*256 +(DISP_*256*256) ];
711643            sel0 = 0;
712644            if (sp_data0 != 0x0f)
713645               sel0 = 1;
r1281r1282
743675      sy = (offs/2) / 32;
744676      //if (flipscreen[1]) sy = 31 - sy;
745677
746      drawgfx(bitmap,machine->gfx[0],
678      if ((cliprect->min_y&(~0x07)) == 8*sy)
679      {
680         drawgfx(bitmap,machine->gfx[0],
747681            tubep_textram[offs],
748682            ((tubep_textram[offs+1]) & 0x0f) | color_A4,
749683            0,0, /*flipscreen[0],flipscreen[1],*/
750684            8*sx,8*sy,
751            &machine->screen[0].visarea,TRANSPARENCY_PEN, machine->pens[0]);
685            cliprect, TRANSPARENCY_PEN, machine->pens[0]);
686      }
752687   }
753688
689
754690   return 0;
755691}
756692
757693
758694
759695
696/***************************************************************************
760697
698  Convert the color PROMs into a more useable format.
761699
700  Roller Jammer has two 32 bytes palette PROMs, connected to the RGB
701  output this way:
702
703  bit 7 -- 220 ohm resistor  -- \
704        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- BLUE
705
706        -- 220 ohm resistor  -- \
707        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- GREEN
708        -- 1  kohm resistor  -- /
709
710        -- 220 ohm resistor  -- \
711        -- 470 ohm resistor  -- | -- 470 ohm pulldown resistor -- RED
712  bit 0 -- 1  kohm resistor  -- /
713
714***************************************************************************/
715
716PALETTE_INIT( rjammer )
717{
718   int i;
719   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
720   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
721
722   static const int resistors_rg[3] = { 1000, 470, 220 };
723   static const int resistors_b [2] = { 470, 220 };
724   double weights_rg[3];
725   double weights_b[2];
726
727   compute_resistor_weights(0,   255,   -1.0,
728         3,   resistors_rg,   weights_rg,   470,   0,
729         2,   resistors_b,   weights_b,   470,   0,
730         0,   0,   0,   0,   0   );
731
732   for (i = 0;i < machine->drv->total_colors;i++)
733   {
734      int bit0,bit1,bit2,r,g,b;
735
736      /* red component */
737      bit0 = (*color_prom >> 0) & 0x01;
738      bit1 = (*color_prom >> 1) & 0x01;
739      bit2 = (*color_prom >> 2) & 0x01;
740      r = combine_3_weights(weights_rg, bit0, bit1, bit2);
741      /* green component */
742      bit0 = (*color_prom >> 3) & 0x01;
743      bit1 = (*color_prom >> 4) & 0x01;
744      bit2 = (*color_prom >> 5) & 0x01;
745      g = combine_3_weights(weights_rg, bit0, bit1, bit2);
746      /* blue component */
747      bit0 = (*color_prom >> 6) & 0x01;
748      bit1 = (*color_prom >> 7) & 0x01;
749      b = combine_2_weights(weights_b, bit0, bit1);
750
751      palette_set_color(machine,i, MAKE_RGB(r,g,b));
752
753      color_prom++;
754   }
755
756
757   /* text: colors 0, 17-31 from PROM @16B */
758   for (i = 0; i < TOTAL_COLORS(0)/2; i++)
759   {
760      COLOR(0, 2*i + 0) = 0;      /* transparent "black" */
761      COLOR(0, 2*i + 1) = i+16;   /* /SOFF is on the A4 line */
762   }
763}
764
765
762766WRITE8_HANDLER( rjammer_background_LS377_w )
763767{
764768   ls377_data = data & 0xff;
765769}
766770
767771
768
769772WRITE8_HANDLER( rjammer_background_page_w )
770773{
771774   page = (data & 1) * 0x200;
r1281r1282
775778VIDEO_UPDATE( rjammer )
776779{
777780   int offs;
781   int DISP_ = DISP^1;
778782
779783   /* draw background ram */
780784   {
r1281r1282
790794   /* especially read from ROM19C can be done once per 8 pixels*/
791795   /* and the data could be bitswapped beforehand */
792796
793      for (v = 2*8; v < 30*8; v++)   /* only for visible area */
797      for (v = cliprect->min_y; v <= cliprect->max_y; v++)   /* only for current scanline */
794798      {
795799         UINT32 sp_data0=0,sp_data1=0,sp_data2=0;
796800         UINT8 pal14h4_pin19;
r1281r1282
811815
812816            sp_data2 = sp_data1;
813817            sp_data1 = sp_data0;
814            sp_data0 = spritemap[ h + v*256 +(DISP*256*256) ];
818            sp_data0 = spritemap[ h + v*256 +(DISP_*256*256) ];
815819            sel0 = 0;
816820            if (sp_data0 != 0x0f)
817821               sel0 = 1;
r1281r1282
906910      sy = (offs/2) / 32;
907911      //if (flipscreen[1]) sy = 31 - sy;
908912
909      drawgfx(bitmap,machine->gfx[0],
913      if ((cliprect->min_y&(~0x07)) == 8*sy)
914      {
915         drawgfx(bitmap,machine->gfx[0],
910916            tubep_textram[offs],
911917            (tubep_textram[offs+1]) & 0x0f,
912918            0,0, /*flipscreen[0],flipscreen[1],*/
913919            8*sx,8*sy,
914            &machine->screen[0].visarea,TRANSPARENCY_PEN, machine->pens[0]);
920            cliprect, TRANSPARENCY_PEN, machine->pens[0]);
921      }
915922   }
916923
917924   return 0;
src/mame/video/dooyong.c
r1281r1282
7373   dooyong_scroll8_w(offset, data, bgscroll8, bg_tilemap);
7474}
7575
76WRITE8_HANDLER( dooyong_bg2scroll8_w )
76static WRITE8_HANDLER( dooyong_bg2scroll8_w )
7777{
7878   dooyong_scroll8_w(offset, data, bg2scroll8, bg2_tilemap);
7979}
src/mame/video/dec8.c
r1281r1282
4242
4343#include "driver.h"
4444
45static int scroll1[4],scroll2[4];
45//static int scroll1[4];
46static int scroll2[4];
4647static tilemap *dec8_pf0_tilemap,*dec8_pf1_tilemap,*dec8_fix_tilemap;
4748static int dec8_pf0_control[0x20],dec8_pf1_control[0x20];
4849static int gfx_mask,game_uses_priority;
r1281r1282
147148   tilemap_mark_tile_dirty( dec8_fix_tilemap,offset );
148149}
149150
151#ifdef UNUSED_FUNCTION
150152WRITE8_HANDLER( dec8_scroll1_w )
151153{
152154   scroll1[offset]=data;
153155}
156#endif
154157
155158WRITE8_HANDLER( dec8_scroll2_w )
156159{
src/mame/video/m3raster.c
r1281r1282
1static void draw_scanline_normal(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
1static void draw_scanline_normal(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
22{
33   const poly_extra_data *extra = extradata;
44   const cached_texture *texture = extra->texture;
55   mame_bitmap *destmap = dest;
66   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
77   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
8   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
9   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
10   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
11   float doozdx = poly->param[0].dpdx;
12   float duozdx = poly->param[1].dpdx;
13   float dvozdx = poly->param[2].dpdx;
8   float ooz = extent->param[0].start;
9   float uoz = extent->param[1].start;
10   float voz = extent->param[2].start;
11   float doozdx = extent->param[0].dpdx;
12   float duozdx = extent->param[1].dpdx;
13   float dvozdx = extent->param[2].dpdx;
1414   UINT32 polyi = extra->polygon_intensity;
1515   UINT32 umask = (((extra->texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1;
1616   UINT32 vmask = (((extra->texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1;
r1281r1282
4747   }
4848}
4949
50static void draw_scanline_trans(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
50static void draw_scanline_trans(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
5151{
5252   const poly_extra_data *extra = extradata;
5353   const cached_texture *texture = extra->texture;
5454   mame_bitmap *destmap = dest;
5555   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
5656   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
57   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
58   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
59   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
60   float doozdx = poly->param[0].dpdx;
61   float duozdx = poly->param[1].dpdx;
62   float dvozdx = poly->param[2].dpdx;
57   float ooz = extent->param[0].start;
58   float uoz = extent->param[1].start;
59   float voz = extent->param[2].start;
60   float doozdx = extent->param[0].dpdx;
61   float duozdx = extent->param[1].dpdx;
62   float dvozdx = extent->param[2].dpdx;
6363   UINT32 polyi = (extra->polygon_intensity * extra->polygon_transparency) >> 5;
6464   int desttrans = 32 - extra->polygon_transparency;
6565   UINT32 umask = (((extra->texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1;
r1281r1282
102102}
103103
104104
105static void draw_scanline_alpha(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
105static void draw_scanline_alpha(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
106106{
107107   const poly_extra_data *extra = extradata;
108108   const cached_texture *texture = extra->texture;
109109   mame_bitmap *destmap = dest;
110110   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
111111   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
112   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
113   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
114   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
115   float doozdx = poly->param[0].dpdx;
116   float duozdx = poly->param[1].dpdx;
117   float dvozdx = poly->param[2].dpdx;
112   float ooz = extent->param[0].start;
113   float uoz = extent->param[1].start;
114   float voz = extent->param[2].start;
115   float doozdx = extent->param[0].dpdx;
116   float duozdx = extent->param[1].dpdx;
117   float dvozdx = extent->param[2].dpdx;
118118   UINT32 polyi = (extra->polygon_intensity * extra->polygon_transparency) >> 5;
119119   int desttrans = 32 - extra->polygon_transparency;
120120   UINT32 umask = (((extra->texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1;
r1281r1282
160160}
161161
162162
163static void draw_scanline_alpha_test(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
163static void draw_scanline_alpha_test(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
164164{
165165   const poly_extra_data *extra = extradata;
166166   const cached_texture *texture = extra->texture;
167167   mame_bitmap *destmap = dest;
168168   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
169169   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
170   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
171   float uoz = poly_param_tri_value(extent->startx, scanline, 1, poly);
172   float voz = poly_param_tri_value(extent->startx, scanline, 2, poly);
173   float doozdx = poly->param[0].dpdx;
174   float duozdx = poly->param[1].dpdx;
175   float dvozdx = poly->param[2].dpdx;
170   float ooz = extent->param[0].start;
171   float uoz = extent->param[1].start;
172   float voz = extent->param[2].start;
173   float doozdx = extent->param[0].dpdx;
174   float duozdx = extent->param[1].dpdx;
175   float dvozdx = extent->param[2].dpdx;
176176   UINT32 polyi = (extra->polygon_intensity * extra->polygon_transparency) >> 5;
177177   int desttrans = 32 - extra->polygon_transparency;
178178   UINT32 umask = (((extra->texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1;
r1281r1282
220220   }
221221}
222222
223
224static void draw_scanline_color(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
223static void draw_scanline_color(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
225224{
226225   const poly_extra_data *extra = extradata;
227226   mame_bitmap *destmap = dest;
228227   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
229228   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
230   float ooz = poly_param_tri_value(extent->startx, scanline, 0, poly);
231   float doozdx = poly->param[0].dpdx;
229   float ooz = extent->param[0].start;
230   float doozdx = extent->param[0].dpdx;
232231   int fr = extra->color & 0x7c00;
233232   int fg = extra->color & 0x03e0;
234233   int fb = extra->color & 0x001f;
src/mame/video/tutankhm.c
r1281r1282
102102
103103    Depending on bit 0 of the source address either the source pixels will be copied to
104104    the destination address, or a zero will be written.
105
106    Only source pixels which aren't 0 are copied or cleared.
107
105108    This allows the game to quickly clear the sprites from the screen
106109
107110    TODO: Does bit 1 of the source address mean something?
r1281r1282
130133
131134         for (j = 0; j < 16; j++)
132135         {
133            UINT8 data = 0;    /* assume clear */
136            UINT8 data;
134137
135            if (copy)
138            if (src & 1)
139               data = gfx_rom[src >> 1] & 0x0f;
140            else
141               data = gfx_rom[src >> 1] >> 4;
142
143            src = src + 1;
144
145            /* if there is a source pixel either copy the pixel or clear the pixel depending on the copy flag */
146
147            if (data)
136148            {
137               if (src & 1)
138                  data = gfx_rom[src >> 1] & 0x0f;
149               if (copy==0)
150                  data = 0;
151
152               if (dest & 1)
153                  tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0x0f) | (data << 4);
139154               else
140                  data = gfx_rom[src >> 1] >> 4;
141
142               src = src + 1;
155                  tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0xf0) | data;
143156            }
144157
145            if (dest & 1)
146               tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0x0f) | (data << 4);
147            else
148               tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0xf0) | data;
149
150158            dest = dest + 1;
151159         }
152160
src/mame/layout/ampoker.lay
r0r1282
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="L0" defstate="1">
4      <rect>
5         <color red="1.0" green="1.0" blue="1.0" />
6      </rect>
7      <text string="DEAL/TAKE" state="1">
8         <color red="0.0" green="0.0" blue="0.0" />
9         <bounds x="0" y="0.1" width="1" height="0.8" />
10      </text>
11   </element>
12
13   <element name="L1" defstate="1">
14      <rect>
15         <color red="1.0" green="1.0" blue="1.0" />
16      </rect>
17      <text string="BET/RED" state="1">
18         <color red="0.0" green="0.0" blue="0.0" />
19         <bounds x="0" y="0.1" width="1" height="0.8" />
20      </text>
21   </element>
22
23   <element name="L2" defstate="1">
24      <rect>
25         <color red="1.0" green="1.0" blue="1.0" />
26      </rect>
27      <text string="BLACK" state="1">
28         <color red="0.0" green="0.0" blue="0.0" />
29         <bounds x="0" y="0.1" width="1" height="0.8" />
30      </text>
31   </element>
32
33   <element name="L3" defstate="1">
34      <rect>
35         <color red="1.0" green="0.0" blue="0.0" />
36      </rect>
37      <text string="HOLD1" state="1">
38         <color red="0.0" green="0.0" blue="0.0" />
39         <bounds x="0" y="0.1" width="1" height="0.8" />
40      </text>
41   </element>
42
43   <element name="L4" defstate="1">
44      <rect>
45         <color red="1.0" green="0.0" blue="0.0" />
46      </rect>
47      <text string="HOLD2" state="1">
48         <color red="0.0" green="0.0" blue="0.0" />
49         <bounds x="0" y="0.1" width="1" height="0.8" />
50      </text>
51   </element>
52
53   <element name="L5" defstate="1">
54      <rect>
55         <color red="1.0" green="0.0" blue="0.0" />
56      </rect>
57      <text string="HOLD3" state="1">
58         <color red="0.0" green="0.0" blue="0.0" />
59         <bounds x="0" y="0.1" width="1" height="0.8" />
60      </text>
61   </element>
62
63   <element name="L6" defstate="1">
64      <rect>
65         <color red="1.0" green="0.0" blue="0.0" />
66      </rect>
67      <text string="HOLD4" state="1">
68         <color red="0.0" green="0.0" blue="0.0" />
69         <bounds x="0" y="0.1" width="1" height="0.8" />
70      </text>
71   </element>
72
73   <element name="L7" defstate="1">
74      <rect>
75         <color red="1.0" green="0.0" blue="0.0" />
76      </rect>
77      <text string="HOLD5" state="1">
78         <color red="0.0" green="0.0" blue="0.0" />
79         <bounds x="0" y="0.1" width="1" height="0.8" />
80      </text>
81   </element>
82
83   <view name="Button Lamps">
84      <screen index="0">
85         <bounds left="0" top="0" right="4" bottom="3" />
86      </screen>
87      <bezel name="lamp0" element="L0">
88         <bounds x="0" y="3.13" width="0.40" height="0.24" />
89      </bezel>
90      <bezel name="lamp1" element="L1">
91         <bounds x="0.5" y="3.13" width="0.40" height="0.24" />
92      </bezel>
93      <bezel name="lamp2" element="L2">
94         <bounds x="1.0" y="3.13" width="0.40" height="0.24" />
95      </bezel>
96      <bezel name="lamp3" element="L3">
97         <bounds x="1.6" y="3.13" width="0.40" height="0.24" />
98      </bezel>
99      <bezel name="lamp4" element="L4">
100         <bounds x="2.1" y="3.13" width="0.40" height="0.24" />
101      </bezel>
102      <bezel name="lamp5" element="L5">
103         <bounds x="2.6" y="3.13" width="0.40" height="0.24" />
104      </bezel>
105      <bezel name="lamp6" element="L6">
106         <bounds x="3.1" y="3.13" width="0.40" height="0.24" />
107      </bezel>
108      <bezel name="lamp7" element="L7">
109         <bounds x="3.6" y="3.13" width="0.40" height="0.24" />
110      </bezel>
111   </view>
112</mamelayout>
src/mame/layout/sigmapkr.lay
r0r1282
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="L0" defstate="1">
4      <rect>
5         <color red="1.0" green="1.0" blue="1.0" />
6      </rect>
7      <text string="DEAL/TAKE" state="1">
8         <color red="0.0" green="0.0" blue="0.0" />
9         <bounds x="0" y="0.1" width="1" height="0.8" />
10      </text>
11   </element>
12
13   <element name="L1" defstate="1">
14      <rect>
15         <color red="1.0" green="1.0" blue="1.0" />
16      </rect>
17      <text string="BET" state="1">
18         <color red="0.0" green="0.0" blue="0.0" />
19         <bounds x="0" y="0.1" width="1" height="0.8" />
20      </text>
21   </element>
22
23   <element name="L2" defstate="1">
24      <rect>
25         <color red="1.0" green="1.0" blue="1.0" />
26      </rect>
27      <text string="DOUBLE" state="1">
28         <color red="0.0" green="0.0" blue="0.0" />
29         <bounds x="0" y="0.1" width="1" height="0.8" />
30      </text>
31   </element>
32
33   <element name="L3" defstate="1">
34      <rect>
35         <color red="1.0" green="0.0" blue="0.0" />
36      </rect>
37      <text string="HOLD1" state="1">
38         <color red="0.0" green="0.0" blue="0.0" />
39         <bounds x="0" y="0.1" width="1" height="0.8" />
40      </text>
41   </element>
42
43   <element name="L4" defstate="1">
44      <rect>
45         <color red="1.0" green="0.0" blue="0.0" />
46      </rect>
47      <text string="HOLD2" state="1">
48         <color red="0.0" green="0.0" blue="0.0" />
49         <bounds x="0" y="0.1" width="1" height="0.8" />
50      </text>
51   </element>
52
53   <element name="L5" defstate="1">
54      <rect>
55         <color red="1.0" green="0.0" blue="0.0" />
56      </rect>
57      <text string="HOLD3" state="1">
58         <color red="0.0" green="0.0" blue="0.0" />
59         <bounds x="0" y="0.1" width="1" height="0.8" />
60      </text>
61   </element>
62
63   <element name="L6" defstate="1">
64      <rect>
65         <color red="1.0" green="0.0" blue="0.0" />
66      </rect>
67      <text string="HOLD4" state="1">
68         <color red="0.0" green="0.0" blue="0.0" />
69         <bounds x="0" y="0.1" width="1" height="0.8" />
70      </text>
71   </element>
72
73   <element name="L7" defstate="1">
74      <rect>
75         <color red="1.0" green="0.0" blue="0.0" />
76      </rect>
77      <text string="HOLD5" state="1">
78         <color red="0.0" green="0.0" blue="0.0" />
79         <bounds x="0" y="0.1" width="1" height="0.8" />
80      </text>
81   </element>
82
83   <view name="Button Lamps">
84      <screen index="0">
85         <bounds left="0" top="0" right="4" bottom="3" />
86      </screen>
87      <bezel name="lamp0" element="L0">
88         <bounds x="0" y="3.13" width="0.40" height="0.24" />
89      </bezel>
90      <bezel name="lamp1" element="L1">
91         <bounds x="0.5" y="3.13" width="0.40" height="0.24" />
92      </bezel>
93      <bezel name="lamp2" element="L2">
94         <bounds x="1.0" y="3.13" width="0.40" height="0.24" />
95      </bezel>
96      <bezel name="lamp3" element="L3">
97         <bounds x="1.6" y="3.13" width="0.40" height="0.24" />
98      </bezel>
99      <bezel name="lamp4" element="L4">
100         <bounds x="2.1" y="3.13" width="0.40" height="0.24" />
101      </bezel>
102      <bezel name="lamp5" element="L5">
103         <bounds x="2.6" y="3.13" width="0.40" height="0.24" />
104      </bezel>
105      <bezel name="lamp6" element="L6">
106         <bounds x="3.1" y="3.13" width="0.40" height="0.24" />
107      </bezel>
108      <bezel name="lamp7" element="L7">
109         <bounds x="3.6" y="3.13" width="0.40" height="0.24" />
110      </bezel>
111   </view>
112</mamelayout>
src/mame/layout/pepp0158.lay
r0r1282
1<!-- peplus.lay -->
2
3<mamelayout version="2">
4   <element name="bezel">
5   </element>
6
7   <element name="hold" defstate="1">
8      <rect state="0">
9         <color red="0.5" green="0.5" blue="0.5" />
10      </rect>
11      <rect state="1">
12         <color red="1.0" green="1.0" blue="1.0" />
13      </rect>
14      <text string="HOLD">
15         <color red="0.0" green="0.0" blue="0.0" />
16         <bounds x="0" y="0.1" width="1" height="0.8" />
17      </text>
18   </element>
19
20   <element name="change" defstate="1">
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.5" green="0.0" blue="0.0" />
26      </rect>
27   </element>
28
29   <element name="dooropen" defstate="1">
30      <rect state="0">
31         <color red="0.5" green="0.5" blue="0.5" />
32      </rect>
33      <rect state="1">
34         <color red="1.0" green="1.0" blue="1.0" />
35      </rect>
36      <text string="DOOR OPEN">
37         <color red="0.0" green="0.0" blue="0.0" />
38         <bounds x="0" y="0.1" width="1" height="0.8" />
39      </text>
40   </element>
41
42   <element name="dealdraw" defstate="1">
43      <rect state="0">
44         <color red="0.5" green="0.5" blue="0.5" />
45      </rect>
46      <rect state="1">
47         <color red="1.0" green="1.0" blue="1.0" />
48      </rect>
49      <text string="DEAL DRAW">
50         <color red="0.0" green="0.0" blue="0.0" />
51         <bounds x="0" y="0.1" width="1" height="0.8" />
52      </text>
53   </element>
54
55   <element name="cashout" defstate="1">
56      <rect state="0">
57         <color red="0.5" green="0.5" blue="0.5" />
58      </rect>
59      <rect state="1">
60         <color red="1.0" green="1.0" blue="1.0" />
61      </rect>
62      <text string="CASHOUT">
63         <color red="0.0" green="0.0" blue="0.0" />
64         <bounds x="0" y="0.1" width="1" height="0.8" />
65      </text>
66   </element>
67
68   <element name="betcredits" defstate="1">
69      <rect state="0">
70         <color red="0.5" green="0.5" blue="0.5" />
71      </rect>
72      <rect state="1">
73         <color red="1.0" green="1.0" blue="1.0" />
74      </rect>
75      <text string="BET CREDITS">
76         <color red="0.0" green="0.0" blue="0.0" />
77         <bounds x="0" y="0.1" width="1" height="0.8" />
78      </text>
79   </element>
80
81   <view name="Bezel Lamps">
82      <screen index="0">
83         <bounds left="10" top="40" right="330" bottom="240" />
84      </screen>
85      <bezel element="bezel">
86         <bounds left="0" top="0" right="340" bottom="310" />
87      </bezel>
88      <bezel name="lamp3" element="hold">
89         <bounds x="50" y="250" width="40" height="20" />
90      </bezel>
91      <bezel name="lamp0" element="hold">
92         <bounds x="100" y="250" width="40" height="20" />
93      </bezel>
94      <bezel name="lamp0" element="hold">
95         <bounds x="150" y="250" width="40" height="20" />
96      </bezel>
97      <bezel name="lamp0" element="hold">
98         <bounds x="200" y="250" width="40" height="20" />
99      </bezel>
100      <bezel name="lamp7" element="hold">
101         <bounds x="250" y="250" width="40" height="20" />
102      </bezel>
103      <bezel name="lamp5" element="change">
104         <bounds x="310" y="10" width="20" height="20" />
105      </bezel>
106      <bezel name="lamp6" element="dooropen">
107         <bounds x="10" y="10" width="100" height="20" />
108      </bezel>
109      <bezel name="lamp1" element="dealdraw">
110         <bounds x="10" y="280" width="100" height="20" />
111      </bezel>
112      <bezel name="lamp2" element="cashout">
113         <bounds x="120" y="280" width="100" height="20" />
114      </bezel>
115      <bezel name="lamp4" element="betcredits">
116         <bounds x="230" y="280" width="100" height="20" />
117      </bezel>
118   </view>
119</mamelayout>
src/mame/drivers/bfcobra.c
r1281r1282
228228   UINT8   count_w;
229229} ramdac;
230230
231VIDEO_UPDATE( bfcobra )
231static VIDEO_UPDATE( bfcobra )
232232{
233233   int x, y;
234234   UINT8  *src;
r1281r1282
856856   fdc.phase = COMMAND;
857857}
858858
859READ8_HANDLER( fdctrl_r )
859static READ8_HANDLER( fdctrl_r )
860860{
861861   UINT8 val = 0;
862862
r1281r1282
865865   return val;
866866}
867867
868READ8_HANDLER( fddata_r )
868static READ8_HANDLER( fddata_r )
869869{
870870   #define   BPS      1024
871871   #define SPT      10
r1281r1282
937937   return val;
938938}
939939
940WRITE8_HANDLER( fdctrl_w )
940static WRITE8_HANDLER( fdctrl_w )
941941{
942942   switch (fdc.phase)
943943   {
r1281r1282
10531053   return 0;
10541054}
10551055
1056#ifdef UNUSED_FUNCTION
10561057WRITE8_HANDLER( fd_op_w )
10571058{
10581059}
r1281r1282
10601061WRITE8_HANDLER( fd_ctrl_w )
10611062{
10621063}
1064#endif
10631065
1064MACHINE_RESET( bfcobra )
1066static MACHINE_RESET( bfcobra )
10651067{
10661068   bank[0] = 1;
10671069   memset(&ramdac, 0, sizeof(ramdac));
src/mame/drivers/rcasino.c
r1281r1282
4040static tilemap *bg_tilemap;
4141static int pulse;
4242static int hopper;
43PALETTE_INIT( rcasino )
43static PALETTE_INIT( rcasino )
4444{
4545   int i;
4646
r1281r1282
7878   }
7979}
8080
81WRITE8_HANDLER( rcasino_videoram_w )
81static WRITE8_HANDLER( rcasino_videoram_w )
8282{
8383   videoram[offset] = data;
8484   tilemap_mark_tile_dirty(bg_tilemap, offset);
8585}
8686
87WRITE8_HANDLER( rcasino_colorram_w )
87static WRITE8_HANDLER( rcasino_colorram_w )
8888{
8989   colorram[offset] = data;
9090   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
100100   SET_TILE_INFO(bank, code, color, 0);
101101}
102102
103VIDEO_START(rcasino)
103static VIDEO_START(rcasino)
104104{
105105   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
106106      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
107107}
108108
109VIDEO_UPDATE(rcasino)
109static VIDEO_UPDATE(rcasino)
110110{
111111   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
112112   return 0;
src/mame/drivers/intrscti.c
r1281r1282
5959   GFXDECODE_ENTRY( REGION_GFX1, 0, tiles8x8_layout, 0, 16 )
6060GFXDECODE_END
6161
62VIDEO_START(intrscti)
62static VIDEO_START(intrscti)
6363{
6464}
6565
66VIDEO_UPDATE(intrscti)
66static VIDEO_UPDATE(intrscti)
6767{
6868   int y,x;
6969   int count;
r1281r1282
124124   ROM_LOAD( "b.5a", 0x2000, 0x1000, CRC(8951fb7e) SHA1(c423bf0536e3a09453814172e31b47f9c3c3324c) )
125125ROM_END
126126
127DRIVER_INIT( intrscti )
127static DRIVER_INIT( intrscti )
128128{
129129   UINT8 *cpu = memory_region( REGION_CPU1 );
130130   int i;
src/mame/drivers/nycaptor.c
r1281r1282
208208}
209209
210210
211READ8_HANDLER(nycaptor_sharedram_r)
211static READ8_HANDLER(nycaptor_sharedram_r)
212212{
213213   return nycaptor_sharedram[offset];
214214}
215215
216WRITE8_HANDLER(nycaptor_sharedram_w)
216static WRITE8_HANDLER(nycaptor_sharedram_w)
217217{
218218   nycaptor_sharedram[offset]=data;
219219}
src/mame/drivers/tunhunt.c
r1281r1282
7070
7171UINT8 tunhunt_control;
7272
73WRITE8_HANDLER( tunhunt_control_w )
73static WRITE8_HANDLER( tunhunt_control_w )
7474{
7575   /*
7676        0x01    coin counter#2  "right counter"
src/mame/drivers/pasha2.c
r1281r1282
331331   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START3 )
332332INPUT_PORTS_END
333333
334VIDEO_START( pasha2 )
334static VIDEO_START( pasha2 )
335335{
336336   bitmap0 = auto_malloc(0x40000);
337337   bitmap1 = auto_malloc(0x40000);
338338}
339339
340VIDEO_UPDATE( pasha2 )
340static VIDEO_UPDATE( pasha2 )
341341{
342342   int x,y,count;
343343   int color;
r1281r1282
454454   return wram[(0x95744/2)+offset];
455455}
456456
457DRIVER_INIT( pasha2 )
457static DRIVER_INIT( pasha2 )
458458{
459459   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x95744, 0x95747, 0, 0, pasha2_speedup_r );
460460
src/mame/drivers/rungun.c
r1281r1282
4545
4646VIDEO_START( rng );
4747VIDEO_UPDATE( rng );
48MACHINE_RESET( rng );
48static MACHINE_RESET( rng );
4949READ16_HANDLER( ttl_ram_r );
5050WRITE16_HANDLER( ttl_ram_w );
5151WRITE16_HANDLER( rng_936_videoram_w );
r1281r1282
642642{
643643}
644644
645MACHINE_RESET( rng )
645static MACHINE_RESET( rng )
646646{
647647   K054539_init_flags(0, K054539_REVERSE_STEREO);
648648
src/mame/drivers/crystal.c
r1281r1282
704704   return 0;
705705}
706706
707VIDEO_EOF(crystal)
707static VIDEO_EOF(crystal)
708708{
709709   UINT16 head,tail;
710710   int DoFlip=0;
r1281r1282
884884ROM_END
885885
886886
887DRIVER_INIT(crysking)
887static DRIVER_INIT(crysking)
888888{
889889   UINT16 *Rom=(UINT16*) memory_region(REGION_USER1);
890890
r1281r1282
903903   Rom[WORD_XOR_LE(0x8a54/2)]=0x403c;   //NOP
904904}
905905
906DRIVER_INIT(evosocc)
906static DRIVER_INIT(evosocc)
907907{
908908   UINT16 *Rom=(UINT16*) memory_region(REGION_USER1);
909909   Rom+=0x1000000*2/2;
src/mame/drivers/chinsan.c
r1281r1282
4646UINT8* chinsan_video;
4747UINT8 chinsan_port_select;
4848
49VIDEO_START(chinsan)
49static VIDEO_START(chinsan)
5050{
5151}
5252
53VIDEO_UPDATE(chinsan)
53static VIDEO_UPDATE(chinsan)
5454{
5555   int y,x, count;
5656   count = 0;
r1281r1282
102102   ym_port_w2
103103};
104104
105WRITE8_HANDLER( chinsan_port00_w )
105static WRITE8_HANDLER( chinsan_port00_w )
106106{
107107
108108   chinsan_port_select = data;
r1281r1282
119119
120120}
121121
122READ8_HANDLER( chinsan_input_port_0_r )
122static READ8_HANDLER( chinsan_input_port_0_r )
123123{
124124
125125   //return 0xff; // the inputs don't seem to work, so just return ff for now
r1281r1282
151151   return mame_rand(Machine);
152152}
153153
154READ8_HANDLER( chinsan_input_port_1_r )
154static READ8_HANDLER( chinsan_input_port_1_r )
155155{
156156   switch (chinsan_port_select)
157157   {
src/mame/drivers/skyfox.c
r1281r1282
413413
414414
415415/* Untangle the graphics: cut each 32x32x8 tile in 16 8x8x8 tiles */
416DRIVER_INIT( skyfox )
416static DRIVER_INIT( skyfox )
417417{
418418   UINT8 *RAM = memory_region(REGION_GFX1);
419419   UINT8 *end = RAM + memory_region_length(REGION_GFX1);
src/mame/drivers/cshooter.c
r1281r1282
130130         0);
131131}
132132
133WRITE8_HANDLER(cshooter_txram_w)
133static WRITE8_HANDLER(cshooter_txram_w)
134134{
135135   cshooter_txram[offset] = data;
136136   tilemap_mark_tile_dirty(cshooter_txtilemap,offset/2);
137137}
138138
139VIDEO_START(cshooter)
139static VIDEO_START(cshooter)
140140{
141141   cshooter_txtilemap = tilemap_create(get_cstx_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32, 32);
142142   tilemap_set_transparent_pen(cshooter_txtilemap, 3);
143143}
144144
145VIDEO_UPDATE(cshooter)
145static VIDEO_UPDATE(cshooter)
146146{
147147   fillbitmap(bitmap, 0/*get_black_pen(machine)*/, &machine->screen[0].visarea);
148148   tilemap_mark_all_tiles_dirty(cshooter_txtilemap);
r1281r1282
221221   cshooter_counter = 0;
222222}
223223
224READ8_HANDLER ( cshooter_coin_r )
224static READ8_HANDLER ( cshooter_coin_r )
225225{
226226   /* Even reads must return 0xff - Odd reads must return the contents of input port 5.
227227       Code at 0x5061 is executed once during P.O.S.T. where there is one read.
r1281r1282
230230   return ( (cshooter_counter++ & 1) ? 0xff : input_port_5_r(0) );
231231}
232232
233WRITE8_HANDLER ( cshooter_c500_w )
233static WRITE8_HANDLER ( cshooter_c500_w )
234234{
235235}
236236
237WRITE8_HANDLER ( cshooter_c700_w )
237static WRITE8_HANDLER ( cshooter_c700_w )
238238{
239239}
240240
r1281r1282
707707ROM_END
708708
709709
710DRIVER_INIT( cshooter )
710static DRIVER_INIT( cshooter )
711711{
712712   /* temp so it boots */
713713   UINT8 *rom = memory_region(REGION_CPU1);
r1281r1282
718718   memory_set_bankptr(1,&memory_region(REGION_USER1)[0]);
719719}
720720
721DRIVER_INIT( cshootre )
721static DRIVER_INIT( cshootre )
722722{
723723   int A;
724724   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/rocnrope.c
r1281r1282
2121
2222
2323/* Roc'n'Rope has the IRQ vectors in RAM. The rom contains $FFFF at this address! */
24WRITE8_HANDLER( rocnrope_interrupt_vector_w )
24static WRITE8_HANDLER( rocnrope_interrupt_vector_w )
2525{
2626   UINT8 *RAM = memory_region(REGION_CPU1);
2727
src/mame/drivers/coinmstr.c
r1281r1282
531531   SET_TILE_INFO(0,tile,color,0);
532532}
533533
534VIDEO_START( coinmstr )
534static VIDEO_START( coinmstr )
535535{
536536   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8, 46, 64);
537537}
538538
539VIDEO_UPDATE( coinmstr )
539static VIDEO_UPDATE( coinmstr )
540540{
541541   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
542542   return 0;
r1281r1282
799799   ROM_LOAD( "q20.bin",      0x98000, 0x8000, CRC(0845b450) SHA1(c373839ee1ad983e2df41cb22f625c14972372b0) )
800800ROM_END
801801
802DRIVER_INIT( coinmstr )
802static DRIVER_INIT( coinmstr )
803803{
804804   UINT8 *rom = memory_region(REGION_USER1);
805805   int length = memory_region_length(REGION_USER1);
src/mame/drivers/expro02.c
r1281r1282
219219INPUT_PORTS_END
220220
221221
222WRITE16_HANDLER( galsnew_paletteram_w )
222static WRITE16_HANDLER( galsnew_paletteram_w )
223223{
224224   data = COMBINE_DATA(&paletteram16[offset]);
225225   palette_set_color_rgb(Machine,offset,pal5bit(data >> 6),pal5bit(data >> 11),pal5bit(data >> 1));
r1281r1282
348348MACHINE_DRIVER_END
349349
350350/* the tile roms seem lineswapped.. but I don't know how to descramble them yet */
351DRIVER_INIT(galsnew)
351static DRIVER_INIT(galsnew)
352352{
353353   UINT8 *src    = memory_region       ( REGION_GFX3 );
354354   UINT8 *dst    = memory_region       ( REGION_GFX2 );
src/mame/drivers/mainsnk.c
r1281r1282
452452   ROM_LOAD( "main1.bin",    0x001000, 0x000800, CRC(deb895c4) SHA1(f1281dcb3471d9627565706ff09ba72f09dc62a4) )
453453ROM_END
454454
455DRIVER_INIT ( canvas )
455static DRIVER_INIT ( canvas )
456456{
457457   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc000, 0, 0, input_port_0_r );
458458}
src/mame/drivers/hitme.c
r1281r1282
3838}
3939
4040
41WRITE8_HANDLER( hitme_vidram_w )
41static WRITE8_HANDLER( hitme_vidram_w )
4242{
4343   /* mark this tile dirty */
4444   hitme_vidram[offset] = data;
src/mame/drivers/senjyo.c
r1281r1282
116116
117117static int int_delay_kludge;
118118
119MACHINE_RESET( senjyo )
119static MACHINE_RESET( senjyo )
120120{
121121   /* we must avoid generating interrupts for the first few frames otherwise */
122122   /* Senjyo locks up. There must be an interrupt enable port somewhere, */
src/mame/drivers/murogem.c
r1281r1282
162162GFXDECODE_END
163163
164164
165PALETTE_INIT(murogem)
165static PALETTE_INIT(murogem)
166166{}
167167
168VIDEO_START(murogem)
168static VIDEO_START(murogem)
169169{
170170}
171171
172VIDEO_UPDATE(murogem)
172static VIDEO_UPDATE(murogem)
173173{
174174   int xx,yy,count;
175175   count = 0x000;
src/mame/drivers/snowbros.c
r1281r1282
7272#include "video/kan_panb.h" // for bootlegs / non-original hw
7373
7474
75WRITE16_HANDLER( snowbros_flipscreen_w )
75static WRITE16_HANDLER( snowbros_flipscreen_w )
7676{
7777   if (ACCESSING_MSB)
7878      flip_screen_set(~data & 0x8000);
7979}
8080
8181
82VIDEO_UPDATE( snowbros )
82static VIDEO_UPDATE( snowbros )
8383{
8484   /* This clears & redraws the entire screen each pass */
8585   fillbitmap(bitmap,0xf0,&machine->screen[0].visarea);
r1281r1282
8888}
8989
9090
91VIDEO_START( snowbros )
91static VIDEO_START( snowbros )
9292{
9393   pandora_start(0,0,0);
9494}
9595
96VIDEO_EOF( snowbros )
96static VIDEO_EOF( snowbros )
9797{
9898   pandora_eof(machine);
9999}
r1281r1282
136136
137137/* Sound Routines */
138138
139READ16_HANDLER( snowbros_68000_sound_r )
139static READ16_HANDLER( snowbros_68000_sound_r )
140140{
141141   return soundlatch_r(offset);
142142}
r1281r1282
330330//  AM_RANGE(0xe010, 0xe010) AM_WRITE(OKIM6295_data_0_w)
331331ADDRESS_MAP_END
332332
333WRITE8_HANDLER( twinadv_oki_bank_w )
333static WRITE8_HANDLER( twinadv_oki_bank_w )
334334{
335335   int bank = (data &0x02)>>1;
336336
r1281r1282
403403
404404/* Same volume used for all samples at the Moment, could be right, we have no
405405   way of knowing .. */
406READ16_HANDLER( sb3_sound_r )
406static READ16_HANDLER( sb3_sound_r )
407407{
408408   return 0x0003;
409409}
r1281r1282
475475
476476}
477477
478WRITE16_HANDLER( sb3_sound_w )
478static WRITE16_HANDLER( sb3_sound_w )
479479{
480480   if (data == 0x00fe)
481481   {
r1281r1282
15341534};
15351535
15361536
1537MACHINE_RESET (semiprot)
1537static MACHINE_RESET (semiprot)
15381538{
15391539   UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1);
15401540   int i;
r1281r1282
15431543   hyperpac_ram[0xf000/2 + i] = PROTDATA[i];
15441544}
15451545
1546MACHINE_RESET (finalttr)
1546static MACHINE_RESET (finalttr)
15471547{
15481548   UINT16 *PROTDATA = (UINT16*)memory_region(REGION_USER1);
15491549   int i;
r1281r1282
23012301   ROM_LOAD( "9.1h",     0xc0000, 0x40000, CRC(2ebd316d) SHA1(2f1249ebd2a0bb0cc15259f7187201576a365fa6) )
23022302ROM_END
23032303
2304READ16_HANDLER ( moremorp_0a_read )
2304static READ16_HANDLER ( moremorp_0a_read )
23052305{
23062306   return 0x000a;
23072307}
r1281r1282
26762676   hyperpac_ram[0xe086/2] = 0x3210;
26772677}
26782678
2679READ16_HANDLER ( _4in1_02_read )
2679static READ16_HANDLER ( _4in1_02_read )
26802680{
26812681   return 0x0202;
26822682}
src/mame/drivers/segaxbd.c
r1281r1282
209209}
210210
211211
212MACHINE_RESET( xboard )
212static MACHINE_RESET( xboard )
213213{
214214   fd1094_machine_init();
215215   segaic16_tilemap_reset(0);
src/mame/drivers/sonson.c
r1281r1282
6060extern VIDEO_START( sonson );
6161extern VIDEO_UPDATE( sonson );
6262
63WRITE8_HANDLER( sonson_sh_irqtrigger_w )
63static WRITE8_HANDLER( sonson_sh_irqtrigger_w )
6464{
6565   static int last;
6666
src/mame/drivers/sslam.c
r1281r1282
317317   }
318318}
319319
320WRITE16_HANDLER( sslam_snd_w )
320static WRITE16_HANDLER( sslam_snd_w )
321321{
322322   if (ACCESSING_LSB)
323323   {
src/mame/drivers/simpl156.c
r1281r1282
135135INPUT_PORTS_END
136136
137137
138READ32_HANDLER( simpl156_inputs_read )
138static READ32_HANDLER( simpl156_inputs_read )
139139{
140140   int eep = EEPROM_read_bit();
141141   UINT32 returndata;
r1281r1282
146146   return returndata;
147147}
148148
149READ32_HANDLER( simpl156_palette_r )
149static READ32_HANDLER( simpl156_palette_r )
150150{
151151   return paletteram16[offset]^0xffff0000;
152152}
153153
154WRITE32_HANDLER( simpl156_palette_w )
154static WRITE32_HANDLER( simpl156_palette_w )
155155{
156156   UINT16 dat;
157157   int color;
r1281r1282
212212
213213/* we need to throw away bits for all ram accesses as the devices are connected as 16-bit */
214214
215READ32_HANDLER( simpl156_spriteram_r )
215static READ32_HANDLER( simpl156_spriteram_r )
216216{
217217   return spriteram32[offset]^0xffff0000;
218218}
219219
220WRITE32_HANDLER( simpl156_spriteram_w )
220static WRITE32_HANDLER( simpl156_spriteram_w )
221221{
222222   data &=0x0000ffff;
223223   mem_mask &=0x0000ffff;
r1281r1282
228228static UINT32*simpl156_mainram;
229229
230230
231READ32_HANDLER( simpl156_mainram_r )
231static READ32_HANDLER( simpl156_mainram_r )
232232{
233233   return simpl156_mainram[offset]^0xffff0000;
234234}
235235
236WRITE32_HANDLER( simpl156_mainram_w )
236static WRITE32_HANDLER( simpl156_mainram_w )
237237{
238238   data &=0x0000ffff;
239239   mem_mask &=0x0000ffff;
r1281r1282
241241   COMBINE_DATA(&simpl156_mainram[offset]);
242242}
243243
244READ32_HANDLER( simpl156_pf1_rowscroll_r )
244static READ32_HANDLER( simpl156_pf1_rowscroll_r )
245245{
246246   return deco16_pf1_rowscroll[offset]^0xffff0000;
247247}
248248
249WRITE32_HANDLER( simpl156_pf1_rowscroll_w )
249static WRITE32_HANDLER( simpl156_pf1_rowscroll_w )
250250{
251251   data &=0x0000ffff;
252252   mem_mask &=0x0000ffff;
r1281r1282
254254   COMBINE_DATA(&deco16_pf1_rowscroll[offset]);
255255}
256256
257READ32_HANDLER( simpl156_pf2_rowscroll_r )
257static READ32_HANDLER( simpl156_pf2_rowscroll_r )
258258{
259259   return deco16_pf2_rowscroll[offset]^0xffff0000;
260260}
261261
262WRITE32_HANDLER( simpl156_pf2_rowscroll_w )
262static WRITE32_HANDLER( simpl156_pf2_rowscroll_w )
263263{
264264   data &=0x0000ffff;
265265   mem_mask &=0x0000ffff;
r1281r1282
267267   COMBINE_DATA(&deco16_pf2_rowscroll[offset]);
268268}
269269
270READ32_HANDLER ( simpl156_pf12_control_r )
270static READ32_HANDLER ( simpl156_pf12_control_r )
271271{
272272   return deco16_pf12_control[offset]^0xffff0000;
273273}
274274
275WRITE32_HANDLER( simpl156_pf12_control_w )
275static WRITE32_HANDLER( simpl156_pf12_control_w )
276276{
277277   data &=0x0000ffff;
278278   mem_mask &=0x0000ffff;
r1281r1282
281281}
282282
283283
284READ32_HANDLER( simpl156_pf1_data_r )
284static READ32_HANDLER( simpl156_pf1_data_r )
285285{
286286   return deco16_pf1_data[offset]^0xffff0000;
287287}
288288
289WRITE32_HANDLER( simpl156_pf1_data_w )
289static WRITE32_HANDLER( simpl156_pf1_data_w )
290290{
291291   data &=0x0000ffff;
292292   mem_mask &=0x0000ffff;
r1281r1282
294294   deco16_pf1_data_w(offset,data,mem_mask);
295295}
296296
297READ32_HANDLER( simpl156_pf2_data_r )
297static READ32_HANDLER( simpl156_pf2_data_r )
298298{
299299   return deco16_pf2_data[offset]^0xffff0000;
300300}
301301
302302
303WRITE32_HANDLER( simpl156_pf2_data_w )
303static WRITE32_HANDLER( simpl156_pf2_data_w )
304304{
305305   data &=0x0000ffff;
306306   mem_mask &=0x0000ffff;
r1281r1282
455455
456456GFXDECODE_END
457457
458NVRAM_HANDLER( simpl156 )
458static NVRAM_HANDLER( simpl156 )
459459{
460460   if (read_or_write)
461461      EEPROM_save(file);
r1281r1282
549549MACHINE_DRIVER_END
550550
551551
552DRIVER_INIT(simpl156)
552static DRIVER_INIT(simpl156)
553553{
554554   UINT8 *rom = memory_region(REGION_SOUND2);
555555   int length = memory_region_length(REGION_SOUND2);
src/mame/drivers/cliffhgr.c
r1281r1282
104104   laserdisc_exit(discinfo);
105105}
106106
107VIDEO_UPDATE( cliff )
107static VIDEO_UPDATE( cliff )
108108{
109109   /* update the TMS9928A video */
110110   video_update_tms9928a( machine, screen, bitmap, cliprect );
src/mame/drivers/cntsteer.c
r1281r1282
3737static int flipscreen=0;
3838static int bg_bank = 0;
3939
40PALETTE_INIT( zerotrgt )
40static PALETTE_INIT( zerotrgt )
4141{
4242   int i;
4343   for (i = 0;i < machine->drv->total_colors;i++)
r1281r1282
7979   SET_TILE_INFO(0, code + ((attr & 0x0f) << 8), ((attr & 0x70) >> 4)+colo, 0);
8080}
8181
82VIDEO_START( zerotrgt )
82static VIDEO_START( zerotrgt )
8383{
8484   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,       TILEMAP_TYPE_PEN,     16,16,64,64);
8585   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows_flip_x,TILEMAP_TYPE_PEN, 8, 8,32,32);
r1281r1282
151151
152152static int scrolly = 0, scrollx = 0, scrolly_hi = 0, rotation_x = 0, rotation_y = 0, rotation_sign = 0;
153153
154VIDEO_UPDATE( zerotrgt )
154static VIDEO_UPDATE( zerotrgt )
155155{
156156static int rot2=0,zoom=0;
157157static int scroll=0;
r1281r1282
265265}
266266
267267
268WRITE8_HANDLER( cntsteer_foreground_w )
268static WRITE8_HANDLER( cntsteer_foreground_w )
269269{
270270   videoram[offset] = data;
271271   tilemap_mark_tile_dirty(fg_tilemap, offset & 0x3ff);
272272}
273273
274WRITE8_HANDLER( cntsteer_background_w )
274static WRITE8_HANDLER( cntsteer_background_w )
275275{
276276   videoram2[offset] = data;
277277   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
706706
707707/***************************************************************************/
708708
709MACHINE_RESET( zerotrgt )
709static MACHINE_RESET( zerotrgt )
710710{
711711   nmimask = 0;
712712}
r1281r1282
957957}
958958#endif
959959
960DRIVER_INIT( zerotrgt )
960static DRIVER_INIT( zerotrgt )
961961{
962962   zerotrgt_rearrange_gfx(0x02000, 0x10000);
963963}
src/mame/drivers/battlnts.c
r1281r1282
2727      cpunum_set_input_line(0, HD6309_IRQ_LINE, HOLD_LINE);
2828}
2929
30WRITE8_HANDLER( battlnts_sh_irqtrigger_w )
30static WRITE8_HANDLER( battlnts_sh_irqtrigger_w )
3131{
3232   cpunum_set_input_line_and_vector(1, 0, HOLD_LINE, 0xff);
3333}
src/mame/drivers/dblewing.c
r1281r1282
138138   return ((bank>>4) & 0x7) * 0x1000;
139139}
140140
141VIDEO_START(dblewing)
141static VIDEO_START(dblewing)
142142{
143143   deco16_1_video_init();
144144
r1281r1282
146146   deco16_set_tilemap_bank_callback(1,dblewing_bank_callback);
147147}
148148
149VIDEO_UPDATE(dblewing)
149static VIDEO_UPDATE(dblewing)
150150{
151151
152152   flip_screen_set( deco16_pf12_control[0]&0x80 );
r1281r1282
237237static UINT16 dblwings_28c_data;
238238
239239
240READ16_HANDLER ( dlbewing_prot_r )
240static READ16_HANDLER ( dlbewing_prot_r )
241241{
242242   if ((offset*2)==0x068) return 0;//dblwings_78a_data;
243243   if ((offset*2)==0x094) return dblwings_104_data; // p1 inputs select screen  OK
r1281r1282
274274   return 0;//mame_rand(Machine);
275275}
276276
277WRITE16_HANDLER( dblewing_prot_w )
277static WRITE16_HANDLER( dblewing_prot_w )
278278{
279279   if ((offset*2)==0x008) { dblwings_008_data = data; return; }
280280   if ((offset*2)==0x088) { dblwings_088_data = data; return; }
src/mame/drivers/galpani2.c
r1281r1282
3535***************************************************************************/
3636
3737static UINT16 eeprom_word;
38READ16_HANDLER(galpani2_eeprom_r)
38static READ16_HANDLER(galpani2_eeprom_r)
3939{
4040   return (eeprom_word & ~1) | (EEPROM_read_bit() & 1);
4141}
4242
43WRITE16_HANDLER(galpani2_eeprom_w)
43static WRITE16_HANDLER(galpani2_eeprom_w)
4444{
4545   COMBINE_DATA( &eeprom_word );
4646   if ( ACCESSING_LSB )
r1281r1282
183183
184184***************************************************************************/
185185
186WRITE16_HANDLER( galpani2_coin_lockout_w )
186static WRITE16_HANDLER( galpani2_coin_lockout_w )
187187{
188188   if (ACCESSING_MSB)
189189   {
r1281r1282
197197   }
198198}
199199
200WRITE16_HANDLER( galpani2_oki_0_bank_w )
200static WRITE16_HANDLER( galpani2_oki_0_bank_w )
201201{
202202   if (ACCESSING_LSB)
203203   {
r1281r1282
207207   }
208208}
209209
210WRITE16_HANDLER( galpani2_oki_1_bank_w )
210static WRITE16_HANDLER( galpani2_oki_1_bank_w )
211211{
212212   if (ACCESSING_LSB)
213213   {
r1281r1282
282282
283283static UINT16 *galpani2_rombank;
284284
285READ16_HANDLER( galpani2_bankedrom_r )
285static READ16_HANDLER( galpani2_bankedrom_r )
286286{
287287   UINT16 *ROM = (UINT16 *) memory_region( REGION_USER1 );
288288   size_t    len = memory_region_length( REGION_USER1 ) / 2;
src/mame/drivers/shougi.c
r1281r1282
156156
157157
158158
159VIDEO_UPDATE( shougi )
159static VIDEO_UPDATE( shougi )
160160{
161161int offs;
162162
src/mame/drivers/hornet.c
r1281r1282
391391   palette_set_color_rgb(machine, color, pal5bit(data >> 6), pal6bit(data >> 0), pal5bit(data >> 11));
392392}
393393
394READ32_HANDLER(K037122_sram_r)
394static READ32_HANDLER(K037122_sram_r)
395395{
396396   int chip = get_cgboard_id();
397397
398398   return K037122_tile_ram[chip][offset];
399399}
400400
401WRITE32_HANDLER(K037122_sram_w)
401static WRITE32_HANDLER(K037122_sram_w)
402402{
403403   int chip = get_cgboard_id();
404404
r1281r1282
437437}
438438
439439
440READ32_HANDLER(K037122_char_r)
440static READ32_HANDLER(K037122_char_r)
441441{
442442   int chip = get_cgboard_id();
443443
r1281r1282
449449   return K037122_char_ram[chip][addr];
450450}
451451
452WRITE32_HANDLER(K037122_char_w)
452static WRITE32_HANDLER(K037122_char_w)
453453{
454454   int chip = get_cgboard_id();
455455
r1281r1282
463463   K037122_char_dirty[chip] = 1;
464464}
465465
466READ32_HANDLER(K037122_reg_r)
466static READ32_HANDLER(K037122_reg_r)
467467{
468468   int chip = get_cgboard_id();
469469
r1281r1282
477477   return K037122_reg[chip][offset];
478478}
479479
480WRITE32_HANDLER(K037122_reg_w)
480static WRITE32_HANDLER(K037122_reg_w)
481481{
482482   int chip = get_cgboard_id();
483483
r1281r1282
507507   voodoo_exit(1);
508508}
509509
510VIDEO_START( hornet )
510static VIDEO_START( hornet )
511511{
512512   add_exit_callback(machine, hornet_exit);
513513
r1281r1282
521521   K037122_vh_start(machine, 0);
522522}
523523
524VIDEO_START( hornet_2board )
524static VIDEO_START( hornet_2board )
525525{
526526   add_exit_callback(machine, hornet_2board_exit);
527527
r1281r1282
544544}
545545
546546
547VIDEO_UPDATE( hornet )
547static VIDEO_UPDATE( hornet )
548548{
549549   voodoo_update(0, bitmap, cliprect);
550550
r1281r1282
556556   return 0;
557557}
558558
559VIDEO_UPDATE( hornet_2board )
559static VIDEO_UPDATE( hornet_2board )
560560{
561561   voodoo_update(screen, bitmap, cliprect);
562562
src/mame/drivers/pipedrm.c
r1281r1282
122122 *
123123 *************************************/
124124
125MACHINE_RESET( pipedrm )
125static MACHINE_RESET( pipedrm )
126126{
127127   /* initialize main Z80 bank */
128128   memory_configure_bank(1, 0, 8, memory_region(REGION_CPU1) + 0x10000, 0x2000);
src/mame/drivers/exterm.c
r1281r1282
115115 *
116116 *************************************/
117117
118WRITE16_HANDLER( exterm_host_data_w )
118static WRITE16_HANDLER( exterm_host_data_w )
119119{
120120   tms34010_host_w(1, offset / TOWORD(0x00100000), data);
121121}
122122
123123
124READ16_HANDLER( exterm_host_data_r )
124static READ16_HANDLER( exterm_host_data_r )
125125{
126126   return tms34010_host_r(1, offset / TOWORD(0x00100000));
127127}
r1281r1282
162162}
163163
164164
165READ16_HANDLER( exterm_input_port_0_r )
165static READ16_HANDLER( exterm_input_port_0_r )
166166{
167167   return exterm_trackball_port_r(0, mem_mask);
168168}
169169
170170
171READ16_HANDLER( exterm_input_port_1_r )
171static READ16_HANDLER( exterm_input_port_1_r )
172172{
173173   return exterm_trackball_port_r(1, mem_mask);
174174}
r1281r1282
181181 *
182182 *************************************/
183183
184WRITE16_HANDLER( exterm_output_port_0_w )
184static WRITE16_HANDLER( exterm_output_port_0_w )
185185{
186186   /* All the outputs are activated on the rising edge */
187187   static UINT16 last = 0;
src/mame/drivers/dragrace.c
r1281r1282
9292   discrete_sound_w(DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0);   // HiTone enable
9393}
9494
95WRITE8_HANDLER( dragrace_misc_w )
95static WRITE8_HANDLER( dragrace_misc_w )
9696{
9797   /* Set/clear individual bit */
9898   UINT32 mask = 1 << offset;
r1281r1282
104104   dragrace_update_misc_flags();
105105   }
106106
107WRITE8_HANDLER( dragrace_misc_clear_w )
107static WRITE8_HANDLER( dragrace_misc_clear_w )
108108{
109109   /* Clear 8 bits */
110110   UINT32 mask = 0xff << (((offset >> 3) & 0x03) * 8);
r1281r1282
113113   dragrace_update_misc_flags();
114114}
115115
116READ8_HANDLER( dragrace_input_r )
116static READ8_HANDLER( dragrace_input_r )
117117{
118118   int val = readinputport(2);
119119
r1281r1282
141141}
142142
143143
144READ8_HANDLER( dragrace_steering_r )
144static READ8_HANDLER( dragrace_steering_r )
145145{
146146   int bitA[2];
147147   int bitB[2];
r1281r1282
162162}
163163
164164
165READ8_HANDLER( dragrace_scanline_r )
165static READ8_HANDLER( dragrace_scanline_r )
166166{
167167   return (video_screen_get_vpos(0) ^ 0xf0) | 0x0f;
168168}
src/mame/drivers/discoboy.c
r1281r1282
4949static UINT8 port_00;
5050UINT8 discoboy_gfxbank;
5151
52VIDEO_START( discoboy )
52static VIDEO_START( discoboy )
5353{
5454}
5555
r1281r1282
102102
103103
104104
105VIDEO_UPDATE( discoboy )
105static VIDEO_UPDATE( discoboy )
106106{
107107   UINT16 x,y;
108108   int i;
r1281r1282
299299   AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_RAM)
300300ADDRESS_MAP_END
301301
302READ8_HANDLER( discoboy_port_06_r )
302static READ8_HANDLER( discoboy_port_06_r )
303303{
304304   return 0x00;
305305}
r1281r1282
508508
509509MACHINE_DRIVER_END
510510
511DRIVER_INIT( discoboy )
511static DRIVER_INIT( discoboy )
512512{
513513   UINT8 *ROM = memory_region(REGION_CPU1);
514514
src/mame/drivers/orbit.c
r1281r1282
6666}
6767
6868
69WRITE8_HANDLER( orbit_misc_w )
69static WRITE8_HANDLER( orbit_misc_w )
7070{
7171   UINT8 bit = offset >> 1;
7272
src/mame/drivers/seibuspi.c
r1281r1282
18551855
18561856MACHINE_DRIVER_END
18571857
1858READ32_HANDLER ( senkyu_speedup_r )
1858static READ32_HANDLER ( senkyu_speedup_r )
18591859{
18601860   if (activecpu_get_pc()==0x00305bb2) cpu_spinuntil_int(); // idle
18611861   return spimainram[(0x0018cb4-0x800)/4];
18621862}
18631863
1864READ32_HANDLER( senkyua_speedup_r )
1864static READ32_HANDLER( senkyua_speedup_r )
18651865{
18661866   if (activecpu_get_pc()== 0x30582e) cpu_spinuntil_int(); // idle
18671867   return spimainram[(0x0018c9c-0x800)/4];
18681868}
18691869
1870READ32_HANDLER ( batlball_speedup_r )
1870static READ32_HANDLER ( batlball_speedup_r )
18711871{
18721872//  printf("activecpu_get_pc() %06x\n", activecpu_get_pc());
18731873
r1281r1282
18801880   return spimainram[(0x0018db4-0x800)/4];
18811881}
18821882
1883READ32_HANDLER ( rdft_speedup_r )
1883static READ32_HANDLER ( rdft_speedup_r )
18841884{
18851885   /* rdft */
18861886   if (activecpu_get_pc()==0x0203f0a) cpu_spinuntil_int(); // idle
r1281r1282
19021902   return spimainram[(0x00298d0-0x800)/4];
19031903}
19041904
1905READ32_HANDLER ( viprp1_speedup_r )
1905static READ32_HANDLER ( viprp1_speedup_r )
19061906{
19071907   /* viprp1 */
19081908   if (activecpu_get_pc()==0x0202769) cpu_spinuntil_int(); // idle
r1281r1282
19181918   return spimainram[(0x001e2e0-0x800)/4];
19191919}
19201920
1921READ32_HANDLER ( viprp1o_speedup_r )
1921static READ32_HANDLER ( viprp1o_speedup_r )
19221922{
19231923   /* viperp1o */
19241924   if (activecpu_get_pc()==0x0201f99) cpu_spinuntil_int(); // idle
r1281r1282
19361936}
19371937*/
19381938
1939READ32_HANDLER ( rf2_speedup_r )
1939static READ32_HANDLER ( rf2_speedup_r )
19401940{
19411941
19421942   /* rdft22kc */
r1281r1282
19561956   return spimainram[(0x0282AC-0x800)/4];
19571957}
19581958
1959READ32_HANDLER ( rfjet_speedup_r )
1959static READ32_HANDLER ( rfjet_speedup_r )
19601960{
19611961   /* rfjet, rfjetu, rfjeta */
19621962   if (activecpu_get_pc()==0x0206082) cpu_spinuntil_int(); // idle
src/mame/drivers/mwarr.c
r1281r1282
307307   SET_TILE_INFO(1,tileno,colour,0);
308308}
309309
310VIDEO_START( mwarr )
310static VIDEO_START( mwarr )
311311{
312312   bg_tilemap    = tilemap_create(get_bg_tile_info,   tilemap_scan_cols,TILEMAP_TYPE_PEN,      16, 16,64,16);
313313   mlow_tilemap  = tilemap_create(get_mlow_tile_info, tilemap_scan_cols,TILEMAP_TYPE_PEN, 16, 16,64,16);
r1281r1282
395395   }
396396}
397397
398VIDEO_UPDATE( mwarr )
398static VIDEO_UPDATE( mwarr )
399399{
400400   int i;
401401
src/mame/drivers/vroulet.c
r1281r1282
8484   SET_TILE_INFO(0, code, color, 0);
8585}
8686
87VIDEO_START(vroulet)
87static VIDEO_START(vroulet)
8888{
8989   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
9090      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
9191}
9292
93VIDEO_UPDATE(vroulet)
93static VIDEO_UPDATE(vroulet)
9494{
9595   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
9696   drawgfx(bitmap, machine->gfx[0], 0x320, 1, 0, 0,
src/mame/drivers/twins.c
r1281r1282
9191   AM_RANGE(0x000e, 0x000f) AM_WRITE(porte_paloff0_w)
9292ADDRESS_MAP_END
9393
94VIDEO_START(twins)
94static VIDEO_START(twins)
9595{
9696   twins_pal = auto_malloc(0x100*2);
9797}
9898
99VIDEO_UPDATE(twins)
99static VIDEO_UPDATE(twins)
100100{
101101   int y,x,count;
102102   int i;
r1281r1282
194194/* The second set has different palette hardware and a different port map */
195195
196196
197VIDEO_START(twinsa)
197static VIDEO_START(twinsa)
198198{
199199   twins_pal = auto_malloc(0x1000*2);
200200}
201201
202VIDEO_UPDATE(twinsa)
202static VIDEO_UPDATE(twinsa)
203203{
204204   int y,x,count;
205205   int i;
r1281r1282
229229   return 0;
230230}
231231
232WRITE16_HANDLER( twinsa_port4_w )
232static WRITE16_HANDLER( twinsa_port4_w )
233233{
234234   twins_pal[paloff&0xfff] = data;
235235   paloff++;
236236//  printf("paloff %04x\n",paloff);
237237}
238238
239READ16_HANDLER( twinsa_unk_r )
239static READ16_HANDLER( twinsa_unk_r )
240240{
241241   return 0xffff;
242242}
src/mame/drivers/system1.c
r1281r1282
8989   inport23_step = data;
9090}
9191
92WRITE8_HANDLER( hvymetal_videomode_w )
92static WRITE8_HANDLER( hvymetal_videomode_w )
9393{
9494   memory_set_bank(1, ((data & 0x04)>>2) + ((data & 0x40)>>5));
9595   system1_videomode_w(0, data);
9696}
9797
98WRITE8_HANDLER( brain_videomode_w )
98static WRITE8_HANDLER( brain_videomode_w )
9999{
100100   memory_set_bank(1, ((data & 0x04)>>2) + ((data & 0x40)>>5));
101101   system1_videomode_w(0, data);
102102}
103103
104WRITE8_HANDLER( chplft_videomode_w )
104static WRITE8_HANDLER( chplft_videomode_w )
105105{
106106   memory_set_bank(1, (data & 0x0c)>>2);
107107   system1_videomode_w(0, data);
108108}
109109
110110
111WRITE8_HANDLER( system1_soundport_w )
111static WRITE8_HANDLER( system1_soundport_w )
112112{
113113   soundlatch_w(0,data);
114114   cpunum_set_input_line(1,INPUT_LINE_NMI,PULSE_LINE);
r1281r1282
45854585
45864586static UINT8 dakkochn_control;
45874587
4588READ8_HANDLER( dakkochn_port_00_r )
4588static READ8_HANDLER( dakkochn_port_00_r )
45894589{
45904590   return 0x00;
45914591}
45924592
4593READ8_HANDLER( dakkochn_port_03_r )
4593static READ8_HANDLER( dakkochn_port_03_r )
45944594{
45954595   return 0x00;
45964596}
45974597
4598READ8_HANDLER( dakkochn_port_04_r )
4598static READ8_HANDLER( dakkochn_port_04_r )
45994599{
46004600   return 0x00;
46014601}
46024602
4603WRITE8_HANDLER( dakkochn_port_15_w )
4603static WRITE8_HANDLER( dakkochn_port_15_w )
46044604{
46054605   dakkochn_control = data; // check if any control multiplex bits are in here!
46064606   chplft_videomode_w(offset,data);
src/mame/drivers/tetriunk.c
r1281r1282
1818
1919static int bitmap_offset=0;
2020
21READ8_HANDLER( tetriunk_random_r )
21static READ8_HANDLER( tetriunk_random_r )
2222{
2323   return mame_rand(Machine);
2424}
r1281r1282
7878   AM_RANGE(0xf0000, 0xfffff) AM_ROM
7979ADDRESS_MAP_END
8080
81VIDEO_START(tetriunk)
81static VIDEO_START(tetriunk)
8282{
8383}
8484
85VIDEO_UPDATE(tetriunk)
85static VIDEO_UPDATE(tetriunk)
8686{
8787   int x,y,z;
8888   int count = 0;
src/mame/drivers/cultures.c
r1281r1282
4141   SET_TILE_INFO(0, code, 0, 0);
4242}
4343
44VIDEO_START( cultures )
44static VIDEO_START( cultures )
4545{
4646   bg2_tilemap = tilemap_create(get_bg2_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,512,512);
4747   bg1_tilemap = tilemap_create(get_bg1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,512,512);
r1281r1282
6060   tilemap_set_scrolldy(bg2_tilemap, 255, 0);
6161}
6262
63VIDEO_UPDATE( cultures )
63static VIDEO_UPDATE( cultures )
6464{
6565   int attr;
6666
src/mame/drivers/powerins.c
r1281r1282
325325
326326***************************************************************************/
327327
328MACHINE_RESET( powerins )
328static MACHINE_RESET( powerins )
329329{
330330   oki_bank = -1;   // samples bank "unitialised"
331331}
src/mame/drivers/quizo.c
r1281r1282
3737
3838static const UINT8 rombankLookup[]={ 2, 3, 4, 4, 4, 4, 4, 5, 0, 1};
3939
40PALETTE_INIT(quizo)
40static PALETTE_INIT(quizo)
4141{
4242   int i;
4343   for (i = 0;i < 16;i++)
r1281r1282
6464   }
6565}
6666
67VIDEO_START( quizo )
67static VIDEO_START( quizo )
6868{
6969   tmpbitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
7070}
7171
72VIDEO_UPDATE( quizo )
72static VIDEO_UPDATE( quizo )
7373{
7474   int x,y;
7575   if(dirty)
src/mame/drivers/suprnova.c
r1281r1282
284284*/
285285}
286286
287WRITE32_HANDLER ( skns_hit_w )
287static WRITE32_HANDLER ( skns_hit_w )
288288//void hit_w(UINT32 adr, UINT32 data, int type)
289289{
290290   int adr = offset * 4;
r1281r1282
348348   hit_recalc();
349349}
350350
351WRITE32_HANDLER ( skns_hit2_w )
351static WRITE32_HANDLER ( skns_hit2_w )
352352{
353353//  log_event("HIT", "Set disconnect to %02x", data);
354354   hit.disconnect = data;
355355}
356356
357357
358READ32_HANDLER( skns_hit_r )
358static READ32_HANDLER( skns_hit_r )
359359//UINT32 hit_r(UINT32 adr, int type)
360360{
361361   int adr = offset *4;
src/mame/drivers/seta2.c
r1281r1282
304304
305305***************************************************************************/
306306
307WRITE16_HANDLER( seta2_sound_bank_w )
307static WRITE16_HANDLER( seta2_sound_bank_w )
308308{
309309   if (ACCESSING_LSB)
310310   {
r1281r1282
394394   }
395395}
396396
397READ16_HANDLER( gundamex_eeprom_r )
397static READ16_HANDLER( gundamex_eeprom_r )
398398{
399399   return ((EEPROM_read_bit() & 1)) << 3;
400400}
401401
402WRITE16_HANDLER( gundamex_eeprom_w )
402static WRITE16_HANDLER( gundamex_eeprom_w )
403403{
404404      EEPROM_set_clock_line((data & 0x2) ? ASSERT_LINE : CLEAR_LINE);
405405      EEPROM_write_bit(data & 0x1);
r1281r1282
561561
562562/*  The game checks for a specific value read from the ROM region.
563563    The offset to use is stored in RAM at address 0x20BA16 */
564READ16_HANDLER( pzlbowl_protection_r )
564static READ16_HANDLER( pzlbowl_protection_r )
565565{
566566   UINT32 address = (program_read_word(0x20ba16) << 16) | program_read_word(0x20ba18);
567567   return memory_region(REGION_CPU1)[address - 2];
568568}
569569
570READ16_HANDLER( pzlbowl_coins_r )
570static READ16_HANDLER( pzlbowl_coins_r )
571571{
572572   return readinputport(4) | (mame_rand(Machine) & 0x80 );
573573}
574574
575WRITE16_HANDLER( pzlbowl_coin_counter_w )
575static WRITE16_HANDLER( pzlbowl_coin_counter_w )
576576{
577577   if (ACCESSING_LSB)
578578   {
src/mame/drivers/witch.c
r1281r1282
677677   GFXDECODE_ENTRY( REGION_GFX2, 0, tiles8x8_layout, 0, 16 )
678678GFXDECODE_END
679679
680VIDEO_START(witch)
680static VIDEO_START(witch)
681681{
682682   gfx0a_tilemap = tilemap_create(get_gfx0a_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
683683   gfx0b_tilemap = tilemap_create(get_gfx0b_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
r1281r1282
741741
742742}
743743
744VIDEO_UPDATE(witch)
744static VIDEO_UPDATE(witch)
745745{
746746   tilemap_set_scrollx( gfx1_tilemap, 0, scrollx-7 ); //offset to have it aligned with the sprites
747747   tilemap_set_scrolly( gfx1_tilemap, 0, scrolly+8 );
r1281r1282
847847   ROM_LOAD( "5.bin", 0x00000, 0x40000, CRC(62e42371) SHA1(5042abc2176d0c35fd6b698eca4145f93b0a3944) )
848848ROM_END
849849
850DRIVER_INIT(witch)
850static DRIVER_INIT(witch)
851851{
852852    UINT8 *ROM = (UINT8 *)memory_region(REGION_CPU1);
853853   memory_set_bankptr(1,&ROM[0x10000+UNBANKED_SIZE]);
src/mame/drivers/dynax.c
r1281r1282
106106   cpunum_set_input_line_and_vector(0, 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */
107107}
108108
109WRITE8_HANDLER( dynax_vblank_ack_w )
109static WRITE8_HANDLER( dynax_vblank_ack_w )
110110{
111111   dynax_vblank_irq = 0;
112112   sprtmtch_update_irq();
113113}
114114
115WRITE8_HANDLER( dynax_blitter_ack_w )
115static WRITE8_HANDLER( dynax_blitter_ack_w )
116116{
117117   dynax_blitter_irq = 0;
118118   sprtmtch_update_irq();
r1281r1282
146146   cpunum_set_input_line_and_vector(0, 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */
147147}
148148
149WRITE8_HANDLER( jantouki_vblank_ack_w )
149static WRITE8_HANDLER( jantouki_vblank_ack_w )
150150{
151151   dynax_vblank_irq = 0;
152152   jantouki_update_irq();
153153}
154154
155WRITE8_HANDLER( jantouki_blitter_ack_w )
155static WRITE8_HANDLER( jantouki_blitter_ack_w )
156156{
157157   dynax_blitter_irq = data;
158158   jantouki_update_irq();
159159}
160160
161WRITE8_HANDLER( jantouki_blitter2_ack_w )
161static WRITE8_HANDLER( jantouki_blitter2_ack_w )
162162{
163163   dynax_blitter2_irq = data;
164164   jantouki_update_irq();
r1281r1282
192192   jantouki_sound_update_irq();
193193}
194194
195WRITE8_HANDLER( jantouki_sound_vblank_ack_w )
195static WRITE8_HANDLER( jantouki_sound_vblank_ack_w )
196196{
197197   dynax_sound_vblank_irq = 0;
198198   jantouki_sound_update_irq();
r1281r1282
654654   hnoridur_bank = data;
655655}
656656
657WRITE8_HANDLER( yarunara_flipscreen_w )
657static WRITE8_HANDLER( yarunara_flipscreen_w )
658658{
659659   dynax_flipscreen_w(0,(data&2)?1:0);
660660}
r1281r1282
849849UINT8 dynax_soundlatch_full;
850850static UINT8 latch;
851851
852READ8_HANDLER( jantouki_soundlatch_ack_r )
852static READ8_HANDLER( jantouki_soundlatch_ack_r )
853853{
854854   return (dynax_soundlatch_ack) ? 0x80 : 0;
855855}
856856
857WRITE8_HANDLER( jantouki_soundlatch_w )
857static WRITE8_HANDLER( jantouki_soundlatch_w )
858858{
859859   dynax_soundlatch_ack = 1;
860860   dynax_soundlatch_full = 1;
r1281r1282
863863   jantouki_sound_update_irq();
864864}
865865
866READ8_HANDLER( jantouki_blitter_busy_r )
866static READ8_HANDLER( jantouki_blitter_busy_r )
867867{
868868   return 0;   // bit 0 & 1
869869}
r1281r1282
912912                            Jantouki - Sound CPU
913913***************************************************************************/
914914
915WRITE8_HANDLER( jantouki_soundlatch_ack_w )
915static WRITE8_HANDLER( jantouki_soundlatch_ack_w )
916916{
917917   dynax_soundlatch_ack = data;
918918   dynax_soundlatch_irq = 0;
919919   jantouki_sound_update_irq();
920920}
921921
922READ8_HANDLER( jantouki_soundlatch_r )
922static READ8_HANDLER( jantouki_soundlatch_r )
923923{
924924   dynax_soundlatch_full = 0;
925925   return latch;
926926}
927927
928READ8_HANDLER( jantouki_soundlatch_status_r )
928static READ8_HANDLER( jantouki_soundlatch_status_r )
929929{
930930   return (dynax_soundlatch_full) ? 0 : 0x80;
931931}
r1281r1282
54285428   ROM_RELOAD(          0x80000, 0x80000 )
54295429ROM_END
54305430
5431DRIVER_INIT( mjreach )
5431static DRIVER_INIT( mjreach )
54325432{
54335433   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x10060, 0x10060, 0, 0, yarunara_flipscreen_w);
54345434}
src/mame/drivers/contra.c
r1281r1282
3636VIDEO_START( contra );
3737
3838
39WRITE8_HANDLER( contra_bankswitch_w )
39static WRITE8_HANDLER( contra_bankswitch_w )
4040{
4141   int bankaddress;
4242   UINT8 *RAM = memory_region(REGION_CPU1);
r1281r1282
4747      memory_set_bankptr(1,&RAM[bankaddress]);
4848}
4949
50WRITE8_HANDLER( contra_sh_irqtrigger_w )
50static WRITE8_HANDLER( contra_sh_irqtrigger_w )
5151{
5252   cpunum_set_input_line(1,M6809_IRQ_LINE,HOLD_LINE);
5353}
5454
55WRITE8_HANDLER( contra_coin_counter_w )
55static WRITE8_HANDLER( contra_coin_counter_w )
5656{
5757   if (data & 0x01) coin_counter_w(0,data & 0x01);
5858   if (data & 0x02) coin_counter_w(1,(data & 0x02) >> 1);
src/mame/drivers/zn.c
r1281r1282
557557   cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE);
558558}
559559
560DRIVER_INIT( coh1000c )
560static DRIVER_INIT( coh1000c )
561561{
562562   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f3fffff, 0, 0, MRA32_BANK1 );     /* fixed game rom */
563563   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f7fffff, 0, 0, MRA32_BANK2 );     /* banked game rom */
r1281r1282
579579   }
580580}
581581
582MACHINE_RESET( coh1000c )
582static MACHINE_RESET( coh1000c )
583583{
584584   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */
585585   memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */
r1281r1282
844844   memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 + ( data * 0x400000 ) );
845845}
846846
847DRIVER_INIT( coh3002c )
847static DRIVER_INIT( coh3002c )
848848{
849849   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f3fffff, 0, 0, MRA32_BANK1 );     /* fixed game rom */
850850   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f7fffff, 0, 0, MRA32_BANK2 );     /* banked game rom */
r1281r1282
857857   zn_driver_init();
858858}
859859
860MACHINE_RESET( coh3002c )
860static MACHINE_RESET( coh3002c )
861861{
862862   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */
863863   memory_set_bankptr( 2, memory_region( REGION_USER2 ) + 0x400000 ); /* banked game rom */
r1281r1282
12161216   }
12171217}
12181218
1219DRIVER_INIT( coh1000ta )
1219static DRIVER_INIT( coh1000ta )
12201220{
12211221   taitofx1_eeprom_size1 = 0x200; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 );
12221222
r1281r1282
12311231   mb3773_init();
12321232}
12331233
1234MACHINE_RESET( coh1000ta )
1234static MACHINE_RESET( coh1000ta )
12351235{
12361236   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */
12371237   memory_set_bankptr( 2, taitofx1_eeprom1 );
r1281r1282
13661366   return data;
13671367}
13681368
1369DRIVER_INIT( coh1000tb )
1369static DRIVER_INIT( coh1000tb )
13701370{
13711371   taitofx1_eeprom_size1 = 0x400; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 );
13721372   taitofx1_eeprom_size2 = 0x200; taitofx1_eeprom2 = auto_malloc( taitofx1_eeprom_size2 );
r1281r1282
13851385   mb3773_init();
13861386}
13871387
1388MACHINE_RESET( coh1000tb )
1388static MACHINE_RESET( coh1000tb )
13891389{
13901390   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */
13911391   memory_set_bankptr( 2, taitofx1_eeprom1 );
r1281r1282
15881588   return coh3002t_unknown;
15891589}
15901590
1591DRIVER_INIT( coh3002t )
1591static DRIVER_INIT( coh3002t )
15921592{
15931593   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, MRA32_BANK1 );
15941594   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_w );
r1281r1282
15971597   zn_driver_init();
15981598}
15991599
1600MACHINE_RESET( coh3002t )
1600static MACHINE_RESET( coh3002t )
16011601{
16021602   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* GNET boot rom */
16031603   zn_machine_init();
r1281r1282
17901790   logerror("DMA write from %08x for %d bytes\n", n_address, n_size<<2);
17911791}
17921792
1793DRIVER_INIT( coh1000w )
1793static DRIVER_INIT( coh1000w )
17941794{
17951795   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, MRA32_BANK1 );
17961796   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f000003, 0, 0, MWA32_NOP );
r1281r1282
18071807   zn_driver_init();
18081808}
18091809
1810MACHINE_RESET( coh1000w )
1810static MACHINE_RESET( coh1000w )
18111811{
18121812   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */
18131813   zn_machine_init();
r1281r1282
20152015   }
20162016}
20172017
2018DRIVER_INIT( coh1002e )
2018static DRIVER_INIT( coh1002e )
20192019{
20202020   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, MRA32_BANK1 );
20212021   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w );
r1281r1282
20242024   zn_driver_init();
20252025}
20262026
2027MACHINE_RESET( coh1002e )
2027static MACHINE_RESET( coh1002e )
20282028{
20292029   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked game rom */
20302030   zn_machine_init();
r1281r1282
23602360   return data;
23612361}
23622362
2363DRIVER_INIT( coh1000a )
2363static DRIVER_INIT( coh1000a )
23642364{
23652365   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, MRA32_BANK1 );
23662366   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff00, 0x1fbfff03, 0, 0, acpsx_00_w );
r1281r1282
23932393   zn_driver_init();
23942394}
23952395
2396MACHINE_RESET( coh1000a )
2396static MACHINE_RESET( coh1000a )
23972397{
23982398   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */
23992399   zn_machine_init();
r1281r1282
25572557   memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) );
25582558}
25592559
2560DRIVER_INIT( coh1001l )
2560static DRIVER_INIT( coh1001l )
25612561{
25622562   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, MRA32_BANK1 ); /* banked rom */
25632563   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w );
r1281r1282
25652565   zn_driver_init();
25662566}
25672567
2568MACHINE_RESET( coh1001l )
2568static MACHINE_RESET( coh1001l )
25692569{
25702570   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* banked rom */
25712571   zn_machine_init();
r1281r1282
26272627   memory_set_bankptr( 2, memory_region( REGION_USER3 ) + ( data * 0x100000 ) );
26282628}
26292629
2630DRIVER_INIT( coh1002v )
2630static DRIVER_INIT( coh1002v )
26312631{
26322632   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f27ffff, 0, 0, MRA32_BANK1 );
26332633   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fbfffff, 0, 0, MRA32_BANK2 );
r1281r1282
26362636   zn_driver_init();
26372637}
26382638
2639MACHINE_RESET( coh1002v )
2639static MACHINE_RESET( coh1002v )
26402640{
26412641   memory_set_bankptr( 1, memory_region( REGION_USER2 ) ); /* fixed game rom */
26422642   memory_set_bankptr( 2, memory_region( REGION_USER3 ) ); /* banked rom */
r1281r1282
28732873   latch_to_z80 = data;
28742874}
28752875
2876DRIVER_INIT( coh1002m )
2876static DRIVER_INIT( coh1002m )
28772877{
28782878   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, MRA32_BANK1 );
28792879   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_r );
r1281r1282
28832883   zn_driver_init();
28842884}
28852885
2886MACHINE_RESET( coh1002m )
2886static MACHINE_RESET( coh1002m )
28872887{
28882888   memory_set_bankptr( 1, memory_region( REGION_USER2 ) );
28892889   zn_machine_init();
src/mame/drivers/paradise.c
r1281r1282
906906   ROM_LOAD( "s.u28",     0x00000, 0x80000, CRC(78f02584) SHA1(70542e126db73a573db9ef41399d3a07fb7ea94b) )
907907ROM_END
908908
909DRIVER_INIT (paradise)
909static DRIVER_INIT (paradise)
910910{
911911   paradise_sprite_inc = 0x20;
912912}
913913
914914// Inverted flipscreen and sprites are packed in less memory (same number though)
915DRIVER_INIT (tgtball)
915static DRIVER_INIT (tgtball)
916916{
917917   paradise_sprite_inc = 4;
918918   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x2001, 0x2001, 0, 0, tgtball_flipscreen_w );
919919}
920920
921DRIVER_INIT (torus)
921static DRIVER_INIT (torus)
922922{
923923   paradise_sprite_inc = 4;
924924   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x2070, 0x2070, 0, 0, torus_coin_counter_w);
src/mame/drivers/megadriv.c
r1281r1282
155155   }
156156}
157157
158WRITE16_HANDLER( megadriv_68k_z80_bank_write )
158static WRITE16_HANDLER( megadriv_68k_z80_bank_write )
159159{
160160   //logerror("%06x: 68k writing bit to bank register %01x\n", activecpu_get_pc(),data&0x01);
161161   megadriv_z80_bank_w(data&0x01);
162162}
163163
164WRITE8_HANDLER(megadriv_z80_z80_bank_w)
164static WRITE8_HANDLER(megadriv_z80_z80_bank_w)
165165{
166166   //logerror("%04x: z80 writing bit to bank register %01x\n", activecpu_get_pc(),data&0x01);
167167   megadriv_z80_bank_w(data&0x01);
168168}
169169
170170
171READ16_HANDLER( megadriv_68k_check_z80_bus );
172WRITE16_HANDLER(megadriv_68k_req_z80_bus);
171static READ16_HANDLER( megadriv_68k_check_z80_bus );
172static WRITE16_HANDLER(megadriv_68k_req_z80_bus);
173173
174READ16_HANDLER( megadriv_68k_read_z80_ram );
175WRITE16_HANDLER( megadriv_68k_write_z80_ram );
174static READ16_HANDLER( megadriv_68k_read_z80_ram );
175static WRITE16_HANDLER( megadriv_68k_write_z80_ram );
176176
177WRITE16_HANDLER( megadriv_68k_req_z80_reset );
177static WRITE16_HANDLER( megadriv_68k_req_z80_reset );
178178
179179
180180
r1281r1282
895895   }
896896}
897897
898WRITE16_HANDLER( megadriv_vdp_w )
898static WRITE16_HANDLER( megadriv_vdp_w )
899899{
900900
901901
r1281r1282
12901290
12911291}
12921292
1293READ16_HANDLER( megadriv_vdp_r )
1293static READ16_HANDLER( megadriv_vdp_r )
12941294{
12951295   UINT16 retvalue = 0;
12961296
r1281r1282
13341334   return retvalue;
13351335}
13361336
1337READ16_HANDLER( megadriv_68k_YM2612_read)
1337static READ16_HANDLER( megadriv_68k_YM2612_read)
13381338{
13391339   //mame_printf_debug("megadriv_68k_YM2612_read %02x %04x\n",offset,mem_mask);
13401340   if ( (genz80.z80_has_bus==0) && (genz80.z80_is_reset==0) )
r1281r1282
13621362
13631363
13641364
1365WRITE16_HANDLER( megadriv_68k_YM2612_write)
1365static WRITE16_HANDLER( megadriv_68k_YM2612_write)
13661366{
13671367   //mame_printf_debug("megadriv_68k_YM2612_write %02x %04x %04x\n",offset,data,mem_mask);
13681368   if ( (genz80.z80_has_bus==0) && (genz80.z80_is_reset==0) )
r1281r1282
13851385   }
13861386}
13871387
1388READ8_HANDLER( megadriv_z80_YM2612_read )
1388static READ8_HANDLER( megadriv_z80_YM2612_read )
13891389{
13901390   switch (offset)
13911391   {
r1281r1282
13991399   return 0x00;
14001400}
14011401
1402WRITE8_HANDLER( megadriv_z80_YM2612_write )
1402static WRITE8_HANDLER( megadriv_z80_YM2612_write )
14031403{
14041404   //mame_printf_debug("megadriv_z80_YM2612_write %02x %02x\n",offset,data);
14051405   switch (offset)
r1281r1282
19511951}
19521952
19531953
1954READ16_HANDLER( megadriv_68k_io_read )
1954static READ16_HANDLER( megadriv_68k_io_read )
19551955{
19561956   UINT8 retdata;
19571957
r1281r1282
20692069
20702070
20712071
2072WRITE16_HANDLER( megadriv_68k_io_write )
2072static WRITE16_HANDLER( megadriv_68k_io_write )
20732073{
20742074//  mame_printf_debug("IO Write #%02x data %04x mem_mask %04x\n",offset,data,mem_mask);
20752075
r1281r1282
21672167/* z80 sounds/sub CPU */
21682168
21692169
2170READ16_HANDLER( megadriv_68k_read_z80_ram )
2170static READ16_HANDLER( megadriv_68k_read_z80_ram )
21712171{
21722172   //mame_printf_debug("read z80 ram %04x\n",mem_mask);
21732173
r1281r1282
21822182   }
21832183}
21842184
2185WRITE16_HANDLER( megadriv_68k_write_z80_ram )
2185static WRITE16_HANDLER( megadriv_68k_write_z80_ram )
21862186{
21872187   //logerror("write z80 ram\n");
21882188
r1281r1282
22092209}
22102210
22112211
2212READ16_HANDLER( megadriv_68k_check_z80_bus )
2212static READ16_HANDLER( megadriv_68k_check_z80_bus )
22132213{
22142214   UINT16 retvalue;
22152215
r1281r1282
22532253}
22542254
22552255
2256WRITE16_HANDLER( megadriv_68k_req_z80_bus )
2256static WRITE16_HANDLER( megadriv_68k_req_z80_bus )
22572257{
22582258   /* Request the Z80 bus, allows 68k to read/write Z80 address space */
22592259   if (!ACCESSING_LSB) // byte access
r1281r1282
23042304   }
23052305}
23062306
2307WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
2307static WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
23082308{
23092309   if (!ACCESSING_LSB) // byte access
23102310   {
r1281r1282
23792379}
23802380
23812381
2382WRITE8_HANDLER( megadriv_z80_vdp_write )
2382static WRITE8_HANDLER( megadriv_z80_vdp_write )
23832383{
23842384
23852385
r1281r1282
24302430
24312431}
24322432
2433READ8_HANDLER( megadriv_z80_vdp_read )
2433static READ8_HANDLER( megadriv_z80_vdp_read )
24342434{
24352435   mame_printf_debug("megadriv_z80_vdp_read %02x\n",offset);
24362436   return mame_rand(Machine);
24372437}
24382438
2439READ8_HANDLER( megadriv_z80_unmapped_read )
2439static READ8_HANDLER( megadriv_z80_unmapped_read )
24402440{
24412441   return 0xff;
24422442}
r1281r1282
24722472
24732473/****************************************** 32X related ******************************************/
24742474
2475READ16_HANDLER( _32x_reg_r )
2475static READ16_HANDLER( _32x_reg_r )
24762476{
24772477   return mame_rand(Machine);
24782478}
r1281r1282
24802480UINT16 _32x_68k_comms[0x8];
24812481UINT16 _32x_palette[0x400/2];
24822482
2483READ16_HANDLER( _32x_68k_comms_r )
2483static READ16_HANDLER( _32x_68k_comms_r )
24842484{
24852485   return _32x_68k_comms[offset];
24862486}
24872487
2488WRITE16_HANDLER(_32x_68k_comms_w)
2488static WRITE16_HANDLER(_32x_68k_comms_w)
24892489{
24902490   _32x_68k_comms[offset] = data;
24912491}
24922492
2493READ16_HANDLER( _32x_68k_palette_r )
2493static READ16_HANDLER( _32x_68k_palette_r )
24942494{
24952495   return _32x_palette[offset];
24962496}
24972497
2498WRITE16_HANDLER( _32x_68k_palette_w )
2498static WRITE16_HANDLER( _32x_68k_palette_w )
24992499{
25002500   _32x_palette[offset] = data;
25012501}
src/mame/drivers/galpani3.c
r1281r1282
8888
8989
9090
91VIDEO_START(galpani3)
91static VIDEO_START(galpani3)
9292{
9393   /* so we can use suprnova.c */
9494   buffered_spriteram32 = auto_malloc ( 0x4000 );
r1281r1282
9999extern void skns_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect );
100100
101101
102VIDEO_UPDATE(galpani3)
102static VIDEO_UPDATE(galpani3)
103103{
104104   fillbitmap(bitmap, get_black_pen(machine), cliprect);
105105
r1281r1282
169169INPUT_PORTS_END
170170
171171
172WRITE16_HANDLER( galpani3_suprnova_sprite32_w )
172static WRITE16_HANDLER( galpani3_suprnova_sprite32_w )
173173{
174174   COMBINE_DATA(&galpani3_spriteram[offset]);
175175
r1281r1282
178178   buffered_spriteram32[offset]=(galpani3_spriteram[offset*2+1]<<16) | (galpani3_spriteram[offset*2]);
179179}
180180
181WRITE16_HANDLER( galpani3_suprnova_sprite32regs_w )
181static WRITE16_HANDLER( galpani3_suprnova_sprite32regs_w )
182182{
183183   COMBINE_DATA(&galpani3_sprregs[offset]);
184184
r1281r1282
303303GALPANI3_MCU_COM_W(2)
304304GALPANI3_MCU_COM_W(3)
305305
306READ16_HANDLER( galpani3_mcu_status_r )
306static READ16_HANDLER( galpani3_mcu_status_r )
307307{
308308   logerror("cpu #%d (PC=%06X): read mcu status\n", cpu_getactivecpu(), activecpu_get_previouspc());
309309   return 0;
r1281r1282
421421ROM_END
422422
423423
424DRIVER_INIT( galpani3 )
424static DRIVER_INIT( galpani3 )
425425{
426426   UINT16 *patchrom = (UINT16 *)memory_region(REGION_CPU1);
427427
src/mame/drivers/mexico86.c
r1281r1282
3030- In the KiKi KaiKai MCU simulation, I don't bother supporting the coinage dip
3131  switch settings. Therefore, it's hardwired to be 1 coin / 1 credit.
3232
33- Kick and Run is a rom swap for Kiki KaiKai as the pal chips are all A85-0x
34  A85 is the Taito rom code for Kiki KaiKai.  Even the MCU is socketted!
35
36Note MCU labeling:
37
38Kick and RUN     Bubble Bobble
39-------------    ------------
40TAITO  A87-01    TAITO A78-01
41JPH1021P         JPH1011P
42185              185
43PS4  J8648       PS4  J8635
44
3345***************************************************************************/
3446
3547#include "driver.h"
r1281r1282
368380static MACHINE_DRIVER_START( mexico86 )
369381
370382   /* basic machine hardware */
371   MDRV_CPU_ADD_TAG("main",Z80, 6000000)      /* 6 MHz??? */
383   MDRV_CPU_ADD_TAG("main",Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
372384   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
373385
374   MDRV_CPU_ADD(Z80, 6000000)      /* 6 MHz??? */
386   MDRV_CPU_ADD(Z80, 8000000/2)      /* 4 MHz, Uses 8Mhz OSC */
375387   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
376388   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
377389
r1281r1282
379391   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
380392   MDRV_CPU_VBLANK_INT(mexico86_m68705_interrupt,2)
381393
382   MDRV_CPU_ADD_TAG("sub", Z80, 6000000)      /* 6 MHz??? */
394   MDRV_CPU_ADD_TAG("sub", Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
383395   MDRV_CPU_PROGRAM_MAP(sub_cpu_map,0)
384396   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
385397
r1281r1282
445457
446458ROM_START( kikikai )
447459   ROM_REGION( 0x28000, REGION_CPU1, 0 )
448   ROM_LOAD( "a85-17.rom", 0x00000, 0x08000, CRC(c141d5ab) SHA1(fe3622ba283e514416c43a44f83f922a958b27cd) ) /* 1st half, main code        */
460   ROM_LOAD( "a85-17.h16", 0x00000, 0x08000, CRC(c141d5ab) SHA1(fe3622ba283e514416c43a44f83f922a958b27cd) ) /* 1st half, main code        */
449461   ROM_CONTINUE(           0x20000, 0x08000 )             /* 2nd half, banked at 0x8000 */
450   ROM_LOAD( "a85-16.rom", 0x10000, 0x10000, CRC(4094d750) SHA1(05e0ad177a3eb144b203784ecb6242a0fc5c4d4d) ) /* banked at 0x8000           */
462   ROM_LOAD( "a85-16.h18", 0x10000, 0x10000, CRC(4094d750) SHA1(05e0ad177a3eb144b203784ecb6242a0fc5c4d4d) ) /* banked at 0x8000           */
451463   ROM_COPY(  REGION_CPU1, 0x10000, 0x08000, 0x04000 ) //AT: set as default to avoid banking problems
452464
453465   ROM_REGION( 0x10000, REGION_CPU2, 0 )
454   ROM_LOAD( "a85-11.rom", 0x0000, 0x8000, CRC(cc3539db) SHA1(4239a40fdee65cba613e4b4ec54cf7899480e366) )
466   ROM_LOAD( "a85-11.f6", 0x0000, 0x8000, CRC(cc3539db) SHA1(4239a40fdee65cba613e4b4ec54cf7899480e366) )
455467
456   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller */
457   ROM_LOAD( "68701.bin",    0x0000, 0x0800, NO_DUMP )
468   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller (MC6801U4 type MCU) */
469   ROM_LOAD( "a85-01.g8",    0x0000, 0x0800, NO_DUMP )
458470
459471   ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT )
460   ROM_LOAD( "a85-15.rom", 0x00000, 0x10000, CRC(aebc8c32) SHA1(77347cf5780f084a77123eb636cd0bad672a39e8) )
461   ROM_LOAD( "a85-14.rom", 0x10000, 0x10000, CRC(a9df0453) SHA1(a5e9cd6266ab3ae46cd1b35a4603e13a2ca023fb) )
462   ROM_LOAD( "a85-13.rom", 0x20000, 0x10000, CRC(3eeaf878) SHA1(f8ae8938a8358d1222e9fdf7bc0094ac13faf404) )
463   ROM_LOAD( "a85-12.rom", 0x30000, 0x10000, CRC(91e58067) SHA1(c7eb9bf650039254fb7664758938b1012eacc597) )
472   ROM_LOAD( "a85-15.a1", 0x00000, 0x10000, CRC(aebc8c32) SHA1(77347cf5780f084a77123eb636cd0bad672a39e8) )
473   ROM_LOAD( "a85-14.a3", 0x10000, 0x10000, CRC(a9df0453) SHA1(a5e9cd6266ab3ae46cd1b35a4603e13a2ca023fb) )
474   ROM_LOAD( "a85-13.a4", 0x20000, 0x10000, CRC(3eeaf878) SHA1(f8ae8938a8358d1222e9fdf7bc0094ac13faf404) )
475   ROM_LOAD( "a85-12.a6", 0x30000, 0x10000, CRC(91e58067) SHA1(c7eb9bf650039254fb7664758938b1012eacc597) )
464476
465477   ROM_REGION( 0x0300, REGION_PROMS, 0 )
466   ROM_LOAD( "a85-08.rom", 0x0000, 0x0100, CRC(d15f61a8) SHA1(945c8aa26c85269c10373218bef13e04e25eb1e4) )
467   ROM_LOAD( "a85-10.rom", 0x0100, 0x0100, CRC(8fc3fa86) SHA1(d4d86f8e147bbf2a370de428ac20a28b0f146782) )
468   ROM_LOAD( "a85-09.rom", 0x0200, 0x0100, CRC(b931c94d) SHA1(fb554084f34c602d1ff7806fb945a06cf14332af) )
478   ROM_LOAD( "a85-08.g15", 0x0000, 0x0100, CRC(d15f61a8) SHA1(945c8aa26c85269c10373218bef13e04e25eb1e4) ) /* all proms are 63S141AN or compatible type */
479   ROM_LOAD( "a85-10.g12", 0x0100, 0x0100, CRC(8fc3fa86) SHA1(d4d86f8e147bbf2a370de428ac20a28b0f146782) )
480   ROM_LOAD( "a85-09.g14", 0x0200, 0x0100, CRC(b931c94d) SHA1(fb554084f34c602d1ff7806fb945a06cf14332af) )
469481ROM_END
470482
471483ROM_START( knightb )
472484   ROM_REGION( 0x28000, REGION_CPU1, 0 )
473   ROM_LOAD( "a85-17.rom", 0x00000, 0x08000, CRC(c141d5ab) SHA1(fe3622ba283e514416c43a44f83f922a958b27cd) ) /* 1st half, main code        */
485   ROM_LOAD( "a85-17.h16", 0x00000, 0x08000, CRC(c141d5ab) SHA1(fe3622ba283e514416c43a44f83f922a958b27cd) ) /* 1st half, main code        */
474486   ROM_CONTINUE(           0x20000, 0x08000 )             /* 2nd half, banked at 0x8000 */
475   ROM_LOAD( "a85-16.rom", 0x10000, 0x10000, CRC(4094d750) SHA1(05e0ad177a3eb144b203784ecb6242a0fc5c4d4d) ) /* banked at 0x8000           */
487   ROM_LOAD( "a85-16.h18", 0x10000, 0x10000, CRC(4094d750) SHA1(05e0ad177a3eb144b203784ecb6242a0fc5c4d4d) ) /* banked at 0x8000           */
476488   ROM_COPY(  REGION_CPU1, 0x10000, 0x08000, 0x04000 ) //AT: set as default to avoid banking problems
477489
478490   ROM_REGION( 0x10000, REGION_CPU2, 0 )
479   ROM_LOAD( "a85-11.rom", 0x0000, 0x8000, CRC(cc3539db) SHA1(4239a40fdee65cba613e4b4ec54cf7899480e366) )
491   ROM_LOAD( "a85-11.f6", 0x0000, 0x8000, CRC(cc3539db) SHA1(4239a40fdee65cba613e4b4ec54cf7899480e366) )
480492
481493   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller */
482494   ROM_LOAD( "knightb.uc", 0x0000, 0x0800, CRC(3cc2bbe4) SHA1(af018a1e0655b66fd859617a3bd0c01a4967c0e6) )
483495
484496   ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT )
485497   ROM_LOAD( "knightb.d",  0x00000, 0x10000, CRC(53ecdb3f) SHA1(f8b4822926f3712a426c014759b1cf382a7ad9d1) )
486   ROM_LOAD( "a85-14.rom", 0x10000, 0x10000, CRC(a9df0453) SHA1(a5e9cd6266ab3ae46cd1b35a4603e13a2ca023fb) )
498   ROM_LOAD( "a85-14.a3", 0x10000, 0x10000, CRC(a9df0453) SHA1(a5e9cd6266ab3ae46cd1b35a4603e13a2ca023fb) )
487499   ROM_LOAD( "knightb.b",  0x20000, 0x10000, CRC(63ad7df3) SHA1(8ce149b63032bcdd596a3fa52baba2f2c154e84e) )
488   ROM_LOAD( "a85-12.rom", 0x30000, 0x10000, CRC(91e58067) SHA1(c7eb9bf650039254fb7664758938b1012eacc597) )
500   ROM_LOAD( "a85-12.a6", 0x30000, 0x10000, CRC(91e58067) SHA1(c7eb9bf650039254fb7664758938b1012eacc597) )
489501
490502   ROM_REGION( 0x0300, REGION_PROMS, 0 )
491   ROM_LOAD( "a85-08.rom", 0x0000, 0x0100, CRC(d15f61a8) SHA1(945c8aa26c85269c10373218bef13e04e25eb1e4) )
492   ROM_LOAD( "a85-10.rom", 0x0100, 0x0100, CRC(8fc3fa86) SHA1(d4d86f8e147bbf2a370de428ac20a28b0f146782) )
493   ROM_LOAD( "a85-09.rom", 0x0200, 0x0100, CRC(b931c94d) SHA1(fb554084f34c602d1ff7806fb945a06cf14332af) )
503   ROM_LOAD( "a85-08.g15", 0x0000, 0x0100, CRC(d15f61a8) SHA1(945c8aa26c85269c10373218bef13e04e25eb1e4) ) /* all proms are 63S141AN or compatible type */
504   ROM_LOAD( "a85-10.g12", 0x0100, 0x0100, CRC(8fc3fa86) SHA1(d4d86f8e147bbf2a370de428ac20a28b0f146782) )
505   ROM_LOAD( "a85-09.g14", 0x0200, 0x0100, CRC(b931c94d) SHA1(fb554084f34c602d1ff7806fb945a06cf14332af) )
494506ROM_END
495507
496508ROM_START( kicknrun )
497509   ROM_REGION( 0x28000, REGION_CPU1, 0 )
498   ROM_LOAD( "a87-08.bin", 0x00000, 0x08000, CRC(715e1b04) SHA1(60b7259758ec73f1cc945556e9c2b25766b745a8) ) /* 1st half, main code        */
510   ROM_LOAD( "a87-08.h16", 0x00000, 0x08000, CRC(715e1b04) SHA1(60b7259758ec73f1cc945556e9c2b25766b745a8) ) /* 1st half, main code        */
499511   ROM_CONTINUE(           0x20000, 0x08000 )             /* 2nd half, banked at 0x8000 */
500   ROM_LOAD( "a87-07.bin", 0x10000, 0x10000, CRC(6cb6ebfe) SHA1(fca61fc2ad8fadc1e15b9ff84c7469b68d16e885) ) /* banked at 0x8000           */
512   ROM_LOAD( "a87-07.h18", 0x10000, 0x10000, CRC(6cb6ebfe) SHA1(fca61fc2ad8fadc1e15b9ff84c7469b68d16e885) ) /* banked at 0x8000           */
501513   ROM_COPY(  REGION_CPU1, 0x10000, 0x08000, 0x04000 ) //AT: set as default to avoid banking problems
502514
503515   ROM_REGION( 0x10000, REGION_CPU2, 0 )
504   ROM_LOAD( "a87-06.bin", 0x0000, 0x8000, CRC(1625b587) SHA1(7336384e13c114915de5e439df5731ce3fc2054a) )
516   ROM_LOAD( "a87-06.f6", 0x0000, 0x8000, CRC(1625b587) SHA1(7336384e13c114915de5e439df5731ce3fc2054a) )
505517
506   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller */
507   ROM_LOAD( "knrmcu.bin",   0x0000, 0x0800, BAD_DUMP CRC(8e821fa0) SHA1(331f5da31d8767674e2b5bf0e7f5b5ad2535e044)  )  /* manually crafted from the Mexico '86 one */
518   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller (MC6801U4 type MCU) */
519   /* MCU labeled TAITO A78 01,  JPH1021P, 185, PS4 */
520   ROM_LOAD( "a87-01.g8", 0x0000, 0x0800, BAD_DUMP CRC(8e821fa0) SHA1(331f5da31d8767674e2b5bf0e7f5b5ad2535e044)  )  /* manually crafted from the Mexico '86 one */
508521
509522   ROM_REGION( 0x10000, REGION_CPU4, 0 )    /* 64k for the cpu on the sub board */
510   ROM_LOAD( "9.bin",        0x0000, 0x4000, CRC(6a2ad32f) SHA1(42d4b97b25d219902ad215793f1d2c006ffe94dc) )
523   ROM_LOAD( "a87-09-1",  0x0000, 0x4000, CRC(6a2ad32f) SHA1(42d4b97b25d219902ad215793f1d2c006ffe94dc) )
511524
512525   ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT )
513   ROM_LOAD( "a87-05.bin", 0x08000, 0x08000, CRC(4eee3a8a) SHA1(2f0e4c2fb6cba48d0e2b95927fc14f0038557371) )
514   ROM_CONTINUE(           0x00000, 0x08000 )
515   ROM_LOAD( "a87-04.bin", 0x10000, 0x08000, CRC(8b438d20) SHA1(12e615f34b7e732157f893b97c9b7e99e9ef7d62) )
516   ROM_RELOAD(             0x18000, 0x08000 )
517   ROM_LOAD( "a87-03.bin", 0x28000, 0x08000, CRC(f42e8a88) SHA1(db2702141981ba368bdc665443a8a0662266e6d9) )
518   ROM_CONTINUE(           0x20000, 0x08000 )
519   ROM_LOAD( "a87-02.bin", 0x30000, 0x08000, CRC(64f1a85f) SHA1(04fb9824450812b08f7e6fc57e0af828be9bd575) )
520   ROM_RELOAD(             0x38000, 0x08000 )
526   ROM_LOAD( "a87-05.a1", 0x08000, 0x08000, CRC(4eee3a8a) SHA1(2f0e4c2fb6cba48d0e2b95927fc14f0038557371) )
527   ROM_CONTINUE(          0x00000, 0x08000 )
528   ROM_LOAD( "a87-04.a3", 0x10000, 0x08000, CRC(8b438d20) SHA1(12e615f34b7e732157f893b97c9b7e99e9ef7d62) )
529   ROM_RELOAD(            0x18000, 0x08000 )
530   ROM_LOAD( "a87-03.a4", 0x28000, 0x08000, CRC(f42e8a88) SHA1(db2702141981ba368bdc665443a8a0662266e6d9) )
531   ROM_CONTINUE(          0x20000, 0x08000 )
532   ROM_LOAD( "a87-02.a6", 0x30000, 0x08000, CRC(64f1a85f) SHA1(04fb9824450812b08f7e6fc57e0af828be9bd575) )
533   ROM_RELOAD(            0x38000, 0x08000 )
521534
522535   ROM_REGION( 0x0300, REGION_PROMS, 0 )
523   ROM_LOAD( "a87-10.bin", 0x0000, 0x0100, CRC(be6eb1f0) SHA1(f4d00e9b12bf116bf84edb2ff6caab158094b668) )
524   ROM_LOAD( "a87-12.bin", 0x0100, 0x0100, CRC(3e953444) SHA1(e9c84ca9390fd7c73738a8b681a02e87fbd51bb4) )
525   ROM_LOAD( "a87-11.bin", 0x0200, 0x0100, CRC(14f6c28d) SHA1(8c60974e4607906a3f77260bdd0704af60d596fc) )
536   ROM_LOAD( "a87-10.g15", 0x0000, 0x0100, CRC(be6eb1f0) SHA1(f4d00e9b12bf116bf84edb2ff6caab158094b668) ) /* all proms are 63S141AN or compatible type */
537   ROM_LOAD( "a87-12.g12", 0x0100, 0x0100, CRC(3e953444) SHA1(e9c84ca9390fd7c73738a8b681a02e87fbd51bb4) )
538   ROM_LOAD( "a87-11.g14", 0x0200, 0x0100, CRC(14f6c28d) SHA1(8c60974e4607906a3f77260bdd0704af60d596fc) )
526539ROM_END
527540
541ROM_START( kicknruu )
542   ROM_REGION( 0x28000, REGION_CPU1, 0 )
543   ROM_LOAD( "a87-23.h16", 0x00000, 0x08000, CRC(37182560) SHA1(8db393131f50af88b2e7489d6aae65bad0a5a65b) ) /* 1st half, main code        */
544   ROM_CONTINUE(           0x20000, 0x08000 )             /* 2nd half, banked at 0x8000 */
545   ROM_LOAD( "a87-22.h18", 0x10000, 0x10000, CRC(3b5a8354) SHA1(e0db4cb0657989d5a21f9a8d4e8f842adba636ad) ) /* banked at 0x8000           */
546   ROM_COPY(  REGION_CPU1, 0x10000, 0x08000, 0x04000 ) //AT: set as default to avoid banking problems
547
548   ROM_REGION( 0x10000, REGION_CPU2, 0 )
549   ROM_LOAD( "a87-06.f6", 0x0000, 0x8000, CRC(1625b587) SHA1(7336384e13c114915de5e439df5731ce3fc2054a) )
550
551   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller (MC6801U4 type MCU) */
552   /* MCU labeled TAITO A78 01,  JPH1021P, 185, PS4 */
553   ROM_LOAD( "a87-01.g8", 0x0000, 0x0800, BAD_DUMP CRC(8e821fa0) SHA1(331f5da31d8767674e2b5bf0e7f5b5ad2535e044)  )  /* manually crafted from the Mexico '86 one */
554
555   ROM_REGION( 0x10000, REGION_CPU4, 0 )    /* 64k for the cpu on the sub board */
556   ROM_LOAD( "a87-09-1",  0x0000, 0x4000, CRC(6a2ad32f) SHA1(42d4b97b25d219902ad215793f1d2c006ffe94dc) )
557
558   ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT )
559   ROM_LOAD( "a87-05.a1", 0x08000, 0x08000, CRC(4eee3a8a) SHA1(2f0e4c2fb6cba48d0e2b95927fc14f0038557371) )
560   ROM_CONTINUE(          0x00000, 0x08000 )
561   ROM_LOAD( "a87-04.a3", 0x10000, 0x08000, CRC(8b438d20) SHA1(12e615f34b7e732157f893b97c9b7e99e9ef7d62) )
562   ROM_RELOAD(            0x18000, 0x08000 )
563   ROM_LOAD( "a87-03.a4", 0x28000, 0x08000, CRC(f42e8a88) SHA1(db2702141981ba368bdc665443a8a0662266e6d9) )
564   ROM_CONTINUE(          0x20000, 0x08000 )
565   ROM_LOAD( "a87-02.a6", 0x30000, 0x08000, CRC(64f1a85f) SHA1(04fb9824450812b08f7e6fc57e0af828be9bd575) )
566   ROM_RELOAD(            0x38000, 0x08000 )
567
568   ROM_REGION( 0x0300, REGION_PROMS, 0 )
569   ROM_LOAD( "a87-10.g15", 0x0000, 0x0100, CRC(be6eb1f0) SHA1(f4d00e9b12bf116bf84edb2ff6caab158094b668) ) /* all proms are 63S141AN or compatible type */
570   ROM_LOAD( "a87-12.g12", 0x0100, 0x0100, CRC(3e953444) SHA1(e9c84ca9390fd7c73738a8b681a02e87fbd51bb4) )
571   ROM_LOAD( "a87-11.g14", 0x0200, 0x0100, CRC(14f6c28d) SHA1(8c60974e4607906a3f77260bdd0704af60d596fc) )
572ROM_END
573
528574ROM_START( mexico86 )
529575   ROM_REGION( 0x28000, REGION_CPU1, 0 )
530576   ROM_LOAD( "2_g.bin",    0x00000, 0x08000, CRC(2bbfe0fb) SHA1(8f047e001ea8e49d28f73e546c82812af1c2533c) ) /* 1st half, main code        */
r1281r1282
533579   ROM_COPY(  REGION_CPU1, 0x10000, 0x08000, 0x04000 ) //AT: set as default to avoid banking problems
534580
535581   ROM_REGION( 0x10000, REGION_CPU2, 0 )
536   ROM_LOAD( "a87-06.bin", 0x0000, 0x8000, CRC(1625b587) SHA1(7336384e13c114915de5e439df5731ce3fc2054a) )
582   ROM_LOAD( "a87-06.f6", 0x0000, 0x8000, CRC(1625b587) SHA1(7336384e13c114915de5e439df5731ce3fc2054a) )
537583
538584   ROM_REGION( 0x0800, REGION_CPU3, 0 )    /* 2k for the microcontroller */
539585   ROM_LOAD( "68_h.bin",   0x0000, 0x0800, CRC(ff92f816) SHA1(0015c3f2ed014052b3fa376409e3a7cca36fac72) )
540586
541587   ROM_REGION( 0x10000, REGION_CPU4, 0 )    /* 64k for the cpu on the sub board */
542   ROM_LOAD( "9.bin",      0x0000, 0x4000, CRC(6a2ad32f) SHA1(42d4b97b25d219902ad215793f1d2c006ffe94dc) )
588   ROM_LOAD( "a87-09-1",  0x0000, 0x4000, CRC(6a2ad32f) SHA1(42d4b97b25d219902ad215793f1d2c006ffe94dc) )
543589
544590   ROM_REGION( 0x40000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_INVERT )
545591   ROM_LOAD( "4_d.bin",    0x08000, 0x08000, CRC(57cfdbca) SHA1(89c305c380c3de14a956ee4bc85d3a0d343b638e) )
r1281r1282
552598   ROM_RELOAD(             0x38000, 0x08000 )
553599
554600   ROM_REGION( 0x0300, REGION_PROMS, 0 )
555   ROM_LOAD( "a87-10.bin", 0x0000, 0x0100, CRC(be6eb1f0) SHA1(f4d00e9b12bf116bf84edb2ff6caab158094b668) )
556   ROM_LOAD( "a87-12.bin", 0x0100, 0x0100, CRC(3e953444) SHA1(e9c84ca9390fd7c73738a8b681a02e87fbd51bb4) )
557   ROM_LOAD( "a87-11.bin", 0x0200, 0x0100, CRC(14f6c28d) SHA1(8c60974e4607906a3f77260bdd0704af60d596fc) )
601   ROM_LOAD( "a87-10.g15", 0x0000, 0x0100, CRC(be6eb1f0) SHA1(f4d00e9b12bf116bf84edb2ff6caab158094b668) ) /* all proms are 63S141AN or compatible type */
602   ROM_LOAD( "a87-12.g12", 0x0100, 0x0100, CRC(3e953444) SHA1(e9c84ca9390fd7c73738a8b681a02e87fbd51bb4) )
603   ROM_LOAD( "a87-11.g14", 0x0200, 0x0100, CRC(14f6c28d) SHA1(8c60974e4607906a3f77260bdd0704af60d596fc) )
558604ROM_END
559605
560606
561607GAME( 1986, kikikai,  0,        kikikai,  kikikai,  0, ROT90, "Taito Corporation", "KiKi KaiKai", 0 )
562608GAME( 1986, knightb,  kikikai,  knightb,  kikikai,  0, ROT90, "bootleg", "Knight Boy", 0 )
563GAME( 1986, kicknrun, 0,        mexico86, mexico86, 0, ROT0,  "Taito Corporation", "Kick and Run", 0 )
609GAME( 1986, kicknrun, 0,        mexico86, mexico86, 0, ROT0,  "Taito Corporation", "Kick and Run (World)", 0 )
610GAME( 1986, kicknruu, kicknrun, mexico86, mexico86, 0, ROT0,  "Taito America Corp", "Kick and Run (US)", 0 )
564611GAME( 1986, mexico86, kicknrun, mexico86, mexico86, 0, ROT0,  "bootleg", "Mexico 86", 0 )
src/mame/drivers/filetto.c
r1281r1282
9090
9191static void cga_alphanumeric_tilemap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs);
9292
93VIDEO_START( filetto )
93static VIDEO_START( filetto )
9494{
9595}
9696
r1281r1282
235235}
236236
237237
238VIDEO_UPDATE( filetto )
238static VIDEO_UPDATE( filetto )
239239{
240240/*          xx1x xxxx  Attribute bit 7. 0=blink, 1=Intesity
241241            xxx1 xxxx  640x200 mode
src/mame/drivers/terracre.c
r1281r1282
994994   ROM_LOAD( "kid_prom.4e",  0x400, 0x100, CRC(e4fb54ee) SHA1(aba89d347b24dc6680e6f25b4a6c0d6657bb6a83) ) /* ctable */
995995ROM_END
996996
997DRIVER_INIT( amazon )
997static DRIVER_INIT( amazon )
998998{
999999   mpProtData = mAmazonProtData;
10001000}
10011001
1002DRIVER_INIT( amatelas )
1002static DRIVER_INIT( amatelas )
10031003{
10041004   mpProtData = mAmatelasProtData;
10051005}
10061006
1007DRIVER_INIT( horekid )
1007static DRIVER_INIT( horekid )
10081008{
10091009   mpProtData = mHoreKidProtData;
10101010   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x44004, 0x44005, 0, 0, horekid_IN2_r);
src/mame/drivers/findout.c
r1281r1282
1818#include "sound/dac.h"
1919
2020
21VIDEO_UPDATE( findout )
21static VIDEO_UPDATE( findout )
2222{
2323   copybitmap(bitmap,tmpbitmap,0,0,0,0,cliprect,TRANSPARENCY_NONE,0);
2424   return 0;
r1281r1282
121121   { sound_w,   NULL },         /* Port C write */
122122};
123123
124MACHINE_RESET( findout )
124static MACHINE_RESET( findout )
125125{
126126   ppi8255_init(&ppi8255_intf);
127127
src/mame/drivers/mouser.c
r1281r1282
2929/* Mouser has external masking circuitry around
3030 * the NMI input on the main CPU */
3131
32WRITE8_HANDLER( mouser_nmi_enable_w )
32static WRITE8_HANDLER( mouser_nmi_enable_w )
3333{
3434   mouser_nmi_enable = data;
3535}
r1281r1282
4242
4343/* Sound CPU interrupted on write */
4444
45WRITE8_HANDLER( mouser_sound_interrupt_w )
45static WRITE8_HANDLER( mouser_sound_interrupt_w )
4646{
4747   mouser_sound_byte = data;
4848   cpunum_set_input_line(1, 0, HOLD_LINE);
4949}
5050
51READ8_HANDLER( mouser_sound_byte_r )
51static READ8_HANDLER( mouser_sound_byte_r )
5252{
5353   return mouser_sound_byte;
5454}
r1281r1282
283283ROM_END
284284
285285
286DRIVER_INIT( mouser )
286static DRIVER_INIT( mouser )
287287{
288288   /* Decode the opcodes */
289289
src/mame/drivers/undrfire.c
r1281r1282
704704   return undrfire_ram[0x4f8/4];
705705}
706706
707DRIVER_INIT( undrfire )
707static DRIVER_INIT( undrfire )
708708{
709709   UINT32 offset,i;
710710   UINT8 *gfx = memory_region(REGION_GFX3);
src/mame/drivers/malzak.c
r1281r1282
5555VIDEO_UPDATE( malzak );
5656WRITE8_HANDLER( playfield_w );
5757
58READ8_HANDLER( malzak_s2636_1_r )
58static READ8_HANDLER( malzak_s2636_1_r )
5959{
6060   return s2636_1_ram[offset];
6161}
6262
63READ8_HANDLER( malzak_s2636_2_r )
63static READ8_HANDLER( malzak_s2636_2_r )
6464{
6565   return s2636_2_ram[offset];
6666}
6767
68WRITE8_HANDLER( malzak_s2636_1_w )
68static WRITE8_HANDLER( malzak_s2636_1_w )
6969{
7070   s2636_w(s2636_1_ram,offset,data,s2636_1_dirty);
7171}
7272
73WRITE8_HANDLER( malzak_s2636_2_w )
73static WRITE8_HANDLER( malzak_s2636_2_w )
7474{
7575   s2636_w(s2636_2_ram,offset,data,s2636_2_dirty);
7676}
src/mame/drivers/grchamp.c
r1281r1282
7575 *
7676 *************************************/
7777
78MACHINE_START( grchamp )
78static MACHINE_START( grchamp )
7979{
8080   /* if the coin system is 1 way, lock Coin B (Page 40) */
8181   if (readinputport(1) & 0x10)
r1281r1282
423423 *
424424 *************************************/
425425
426WRITE8_HANDLER( grchamp_portA_0_w )
426static WRITE8_HANDLER( grchamp_portA_0_w )
427427{
428428   discrete_sound_w(GRCHAMP_A_DATA, data);
429429}
430430
431WRITE8_HANDLER( grchamp_portB_0_w )
431static WRITE8_HANDLER( grchamp_portB_0_w )
432432{
433433   discrete_sound_w(GRCHAMP_B_DATA, 255-data);
434434}
435435
436WRITE8_HANDLER( grchamp_portA_2_w )
436static WRITE8_HANDLER( grchamp_portA_2_w )
437437{
438438   /* A0/A1 modify the output of AY8910 #2 */
439439   /* A7 contributes to the discrete logic hanging off of AY8910 #0 */
440440}
441WRITE8_HANDLER( grchamp_portB_2_w )
441static WRITE8_HANDLER( grchamp_portB_2_w )
442442{
443443   /* B0 connects elsewhere */
444444}
src/mame/drivers/lkage.c
r1281r1282
555555   return res;
556556}
557557
558DRIVER_INIT( lkageb )
558static DRIVER_INIT( lkageb )
559559{
560560   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xf062, 0xf062, 0, 0, fake_mcu_r);
561561   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xf087, 0xf087, 0, 0, fake_status_r);
src/mame/drivers/superdq.c
r1281r1282
5252   SET_TILE_INFO(0,tile,superdq_color_bank,0);
5353}
5454
55VIDEO_START( superdq )
55static VIDEO_START( superdq )
5656{
5757   superdq_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8, 32, 32);
5858
5959   add_exit_callback(machine, video_cleanup);
6060}
6161
62VIDEO_UPDATE( superdq )
62static VIDEO_UPDATE( superdq )
6363{
6464   tilemap_draw(bitmap,cliprect,superdq_tilemap,0,0);
6565
r1281r1282
106106 *
107107 *************************************/
108108
109PALETTE_INIT( superdq )
109static PALETTE_INIT( superdq )
110110{
111111   int i;
112112   static const int resistances[3] = { 820, 390, 200 };
src/mame/drivers/bestleag.c
r1281r1282
6969   return offset;
7070}
7171
72VIDEO_START(bestleag)
72static VIDEO_START(bestleag)
7373{
7474   tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,256, 32);
7575   bg_tilemap = tilemap_create(get_bg_tile_info,bsb_bg_scan,TILEMAP_TYPE_PEN,16,16,128, 64);
r1281r1282
142142   }
143143}
144144
145VIDEO_UPDATE(bestleag)
145static VIDEO_UPDATE(bestleag)
146146{
147147   tilemap_set_scrollx(bg_tilemap,0,(bestleag_vregs[0x00/2] & 0xfff) + (bestleag_vregs[0x08/2] & 0x7) - 3);
148148   tilemap_set_scrolly(bg_tilemap,0,bestleag_vregs[0x02/2]);
r1281r1282
158158   return 0;
159159}
160160
161WRITE16_HANDLER( bestleag_txram_w )
161static WRITE16_HANDLER( bestleag_txram_w )
162162{
163163   bestleag_txram[offset] = data;
164164   tilemap_mark_tile_dirty(tx_tilemap,offset);
165165}
166166
167WRITE16_HANDLER( bestleag_bgram_w )
167static WRITE16_HANDLER( bestleag_bgram_w )
168168{
169169   bestleag_bgram[offset] = data;
170170   tilemap_mark_tile_dirty(bg_tilemap,offset);
171171}
172172
173WRITE16_HANDLER( bestleag_fgram_w )
173static WRITE16_HANDLER( bestleag_fgram_w )
174174{
175175   bestleag_fgram[offset] = data;
176176   tilemap_mark_tile_dirty(fg_tilemap,offset);
src/mame/drivers/aleck64.c
r1281r1282
421421   signal_rcp_interrupt(VI_INTERRUPT);
422422}
423423
424MACHINE_RESET( aleck64 )
424static MACHINE_RESET( aleck64 )
425425{
426426   n64_machine_reset();
427427}
r1281r1282
458458   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0)
459459MACHINE_DRIVER_END
460460
461DRIVER_INIT( aleck64 )
461static DRIVER_INIT( aleck64 )
462462{
463463   UINT8 *rom = memory_region(REGION_USER2);
464464
src/mame/drivers/lwings.c
r1281r1282
6363static UINT8 *avengers_soundlatch2, avengers_soundstate=0;
6464static UINT8 avengers_adpcm;
6565
66WRITE8_HANDLER( avengers_adpcm_w )
66static WRITE8_HANDLER( avengers_adpcm_w )
6767{
6868   avengers_adpcm = data;
6969}
7070
71READ8_HANDLER( avengers_adpcm_r )
71static READ8_HANDLER( avengers_adpcm_r )
7272{
7373   return avengers_adpcm;
7474}
src/mame/drivers/maxaflex.c
r1281r1282
531531   ROM_LOAD("maxprom.prm", 0x0000, 0x0200, CRC(edf5c950) SHA1(9ad046ea41a61585dd8d2f2d4167a3cc39d2928f))   /* for simulating keystrokes ?*/
532532ROM_END
533533
534DRIVER_INIT( a600xl )
534static DRIVER_INIT( a600xl )
535535{
536536   memcpy( memory_region(REGION_CPU1) + 0x5000, memory_region(REGION_CPU1) + 0xd000, 0x800 );
537537}
src/mame/drivers/punchout.c
r1281r1282
130130
131131
132132
133READ8_HANDLER( punchout_input_3_r )
133static READ8_HANDLER( punchout_input_3_r )
134134{
135135   int data = input_port_3_r(offset);
136136   /* bit 4 is busy pin level */
r1281r1282
139139   return data;
140140}
141141
142WRITE8_HANDLER( punchout_speech_reset_w )
142static WRITE8_HANDLER( punchout_speech_reset_w )
143143{
144144   VLM5030_RST( data&0x01 );
145145}
146146
147WRITE8_HANDLER( punchout_speech_st_w )
147static WRITE8_HANDLER( punchout_speech_st_w )
148148{
149149   VLM5030_ST( data&0x01 );
150150}
151151
152WRITE8_HANDLER( punchout_speech_vcu_w )
152static WRITE8_HANDLER( punchout_speech_vcu_w )
153153{
154154   VLM5030_VCU( data & 0x01 );
155155}
156156
157WRITE8_HANDLER( punchout_2a03_reset_w )
157static WRITE8_HANDLER( punchout_2a03_reset_w )
158158{
159159   if (data & 1)
160160      cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
src/mame/drivers/tecmo.c
r1281r1282
6666
6767
6868
69WRITE8_HANDLER( tecmo_bankswitch_w )
69static WRITE8_HANDLER( tecmo_bankswitch_w )
7070{
7171   int bankaddress;
7272   UINT8 *RAM = memory_region(REGION_CPU1);
r1281r1282
836836   video_type is used to distinguish Rygar, Silkworm and Gemini Wing.
837837   This is needed because there is a difference in the tile and sprite indexing.
838838*/
839DRIVER_INIT( rygar )    { tecmo_video_type = 0; }
840DRIVER_INIT( silkworm ) { tecmo_video_type = 1; }
841DRIVER_INIT( gemini )   { tecmo_video_type = 2; }
839static DRIVER_INIT( rygar )    { tecmo_video_type = 0; }
840static DRIVER_INIT( silkworm ) { tecmo_video_type = 1; }
841static DRIVER_INIT( gemini )   { tecmo_video_type = 2; }
842842
843843
844844
src/mame/drivers/galpanic.c
r1281r1282
133133VIDEO_UPDATE( comad );
134134
135135
136VIDEO_EOF( galpanic )
136static VIDEO_EOF( galpanic )
137137{
138138   pandora_eof(machine);
139139}
r1281r1282
240240}
241241
242242/* a kludge! */
243READ16_HANDLER( comad_OKIM6295_status_0_msb_r )
243static READ16_HANDLER( comad_OKIM6295_status_0_msb_r )
244244{
245245   UINT16 retvalue;
246246
src/mame/drivers/finalizr.c
r1281r1282
4848   coin_counter_w(1,data & 0x02);
4949}
5050
51WRITE8_HANDLER( finalizr_i8039_irq_w )
51static WRITE8_HANDLER( finalizr_i8039_irq_w )
5252{
5353   cpunum_set_input_line(1, 0, ASSERT_LINE);
5454}
src/mame/drivers/segaybd.c
r1281r1282
182182}
183183
184184
185MACHINE_RESET( yboard )
185static MACHINE_RESET( yboard )
186186{
187187    interrupt_timer = mame_timer_alloc(scanline_callback);
188188    mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 223, 0), 223, time_zero);
src/mame/drivers/cowrace.c
r1281r1282
3030   SET_TILE_INFO(1, code & 0x1ff, 0, TILE_FLIPYX( 0 ));;
3131}
3232
33VIDEO_START( cowrace )
33static VIDEO_START( cowrace )
3434{
3535   tmap = tilemap_create(   get_tile_info, tilemap_scan_rows,
3636                     TILEMAP_TYPE_PEN, 8,8, 0x20,0x20   );
r1281r1282
3838   tilemap_set_transparent_pen(tmap, 0);
3939}
4040
41VIDEO_UPDATE( cowrace )
41static VIDEO_UPDATE( cowrace )
4242{
4343   fillbitmap(bitmap,machine->pens[0],cliprect);
4444   tilemap_draw(bitmap,cliprect, tmap, 0, 0);
src/mame/drivers/koikoi.c
r1281r1282
188188
189189INPUT_PORTS_END
190190
191PALETTE_INIT( koikoi ) //wrong
191static PALETTE_INIT( koikoi ) //wrong
192192{
193193   int i;
194194
r1281r1282
209209   }
210210}
211211
212VIDEO_START(koikoi)
212static VIDEO_START(koikoi)
213213{
214214   koikoi_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
215215}
216216
217VIDEO_UPDATE(koikoi)
217static VIDEO_UPDATE(koikoi)
218218{
219219   tilemap_draw(bitmap,cliprect,koikoi_tilemap,0,0);
220220   return 0;
src/mame/drivers/gticlub.c
r1281r1282
8686   cpunum_set_input_line(0, INPUT_LINE_IRQ1, ASSERT_LINE);
8787}
8888
89VIDEO_START( hangplt )
89static VIDEO_START( hangplt )
9090{
9191   voodoo_start(0, 0, VOODOO_1, 2, 4, 4);
9292   voodoo_start(1, 1, VOODOO_1, 2, 4, 4);
r1281r1282
9999}
100100
101101
102VIDEO_UPDATE( hangplt )
102static VIDEO_UPDATE( hangplt )
103103{
104104   fillbitmap(bitmap, machine->remapped_colortable[0], cliprect);
105105
src/mame/drivers/mazerbla.c
r1281r1282
101101
102102static mame_bitmap * tmpbitmaps[4];
103103
104VIDEO_START( mazerbla )
104static VIDEO_START( mazerbla )
105105{
106106   tmpbitmaps[0] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
107107   tmpbitmaps[1] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
r1281r1282
236236
237237
238238/* these two VIDEO_UPDATE()s will be joined one day */
239VIDEO_UPDATE( greatgun )
239static VIDEO_UPDATE( greatgun )
240240{
241241
242242   UINT32 color_base=0;
r1281r1282
256256   return 0;
257257}
258258
259VIDEO_UPDATE( mazerbla )
259static VIDEO_UPDATE( mazerbla )
260260{
261261
262262   UINT32 color_base=0;
src/mame/drivers/namcona1.c
r1281r1282
15051505      NAMCONA_interface.metadata_offset = 0x70000/2;
15061506}
15071507
1508DRIVER_INIT( bkrtmaq ){      init_namcona1(NAMCO_BKRTMAQ); }
1509DRIVER_INIT( cgangpzl ){   init_namcona1(NAMCO_CGANGPZL); }
1510DRIVER_INIT( emeralda ){   init_namcona2(NAMCO_EMERALDA); } /* NA-2 Hardware */
1511DRIVER_INIT( emeraldj ){   init_namcona1(NAMCO_EMERALDA); } /* NA-1 Hardware */
1512DRIVER_INIT( exbania ){      init_namcona1(NAMCO_EXBANIA); }
1513DRIVER_INIT( fa ){           init_namcona1(NAMCO_FA); }
1514DRIVER_INIT( knckhead ){   init_namcona2(NAMCO_KNCKHEAD); }
1515DRIVER_INIT( numanath ){   init_namcona2(NAMCO_NUMANATH); }
1516DRIVER_INIT( quiztou ){      init_namcona2(NAMCO_QUIZTOU); }
1517DRIVER_INIT( swcourt ){      init_namcona1(NAMCO_SWCOURT); }
1518DRIVER_INIT( tinklpit ){   init_namcona1(NAMCO_TINKLPIT); }
1519DRIVER_INIT( xday2 ){      init_namcona2(NAMCO_XDAY2); }
1508static DRIVER_INIT( bkrtmaq ){      init_namcona1(NAMCO_BKRTMAQ); }
1509static DRIVER_INIT( cgangpzl ){   init_namcona1(NAMCO_CGANGPZL); }
1510static DRIVER_INIT( emeralda ){   init_namcona2(NAMCO_EMERALDA); } /* NA-2 Hardware */
1511static DRIVER_INIT( emeraldj ){   init_namcona1(NAMCO_EMERALDA); } /* NA-1 Hardware */
1512static DRIVER_INIT( exbania ){      init_namcona1(NAMCO_EXBANIA); }
1513static DRIVER_INIT( fa ){           init_namcona1(NAMCO_FA); }
1514static DRIVER_INIT( knckhead ){   init_namcona2(NAMCO_KNCKHEAD); }
1515static DRIVER_INIT( numanath ){   init_namcona2(NAMCO_NUMANATH); }
1516static DRIVER_INIT( quiztou ){      init_namcona2(NAMCO_QUIZTOU); }
1517static DRIVER_INIT( swcourt ){      init_namcona1(NAMCO_SWCOURT); }
1518static DRIVER_INIT( tinklpit ){   init_namcona1(NAMCO_TINKLPIT); }
1519static DRIVER_INIT( xday2 ){      init_namcona2(NAMCO_XDAY2); }
15201520
15211521ROM_START( bkrtmaq )
15221522   ROM_REGION( 0xa80000, REGION_CPU1, 0 )
src/mame/drivers/armedf.c
r1281r1282
13631363ROM_END
13641364
13651365
1366DRIVER_INIT( terraf )
1366static DRIVER_INIT( terraf )
13671367{
13681368   armedf_setgfxtype(0);
13691369}
13701370
1371DRIVER_INIT( terrafu )
1371static DRIVER_INIT( terrafu )
13721372{
13731373   armedf_setgfxtype(5);
13741374}
13751375
1376DRIVER_INIT( armedf )
1376static DRIVER_INIT( armedf )
13771377{
13781378   armedf_setgfxtype(1);
13791379}
13801380
13811381
1382DRIVER_INIT( kodure )
1382static DRIVER_INIT( kodure )
13831383{
13841384   armedf_setgfxtype(2);
13851385}
13861386
1387DRIVER_INIT( legion )
1387static DRIVER_INIT( legion )
13881388{
13891389#if LEGION_HACK
13901390   /* This is a hack to allow you to use the extra features
r1281r1282
13981398   armedf_setgfxtype(3);
13991399}
14001400
1401DRIVER_INIT( legiono )
1401static DRIVER_INIT( legiono )
14021402{
14031403#if LEGION_HACK
14041404   /* This is a hack to allow you to use the extra features
r1281r1282
14111411   armedf_setgfxtype(6);
14121412}
14131413
1414DRIVER_INIT( cclimbr2 )
1414static DRIVER_INIT( cclimbr2 )
14151415{
14161416   armedf_setgfxtype(4);
14171417}
src/mame/drivers/acefruit.c
r1281r1282
4646   mame_timer_adjust( acefruit_refresh_timer, video_screen_get_time_until_pos( 0, vpos, 0 ), 0, time_never );
4747}
4848
49VIDEO_START( acefruit )
49static VIDEO_START( acefruit )
5050{
5151   acefruit_refresh_timer = mame_timer_alloc( acefruit_refresh );
5252}
r1281r1282
5757   mame_timer_adjust( acefruit_refresh_timer, time_zero, 0, time_never );
5858}
5959
60VIDEO_UPDATE( acefruit )
60static VIDEO_UPDATE( acefruit )
6161{
6262   int startrow = cliprect->min_y / 8;
6363   int endrow = cliprect->max_y / 8;
r1281r1282
193193   }
194194}
195195
196WRITE8_HANDLER( acefruit_colorram_w )
196static WRITE8_HANDLER( acefruit_colorram_w )
197197{
198198   colorram[ offset ] = data & 0xf;
199199}
200200
201WRITE8_HANDLER( acefruit_coin_w )
201static WRITE8_HANDLER( acefruit_coin_w )
202202{
203203   /* TODO: ? */
204204}
205205
206WRITE8_HANDLER( acefruit_sound_w )
206static WRITE8_HANDLER( acefruit_sound_w )
207207{
208208   /* TODO: ? */
209209}
210210
211WRITE8_HANDLER( acefruit_lamp_w )
211static WRITE8_HANDLER( acefruit_lamp_w )
212212{
213213   int i;
214214
r1281r1282
218218   }
219219}
220220
221WRITE8_HANDLER( acefruit_solenoid_w )
221static WRITE8_HANDLER( acefruit_solenoid_w )
222222{
223223   int i;
224224
r1281r1282
228228   }
229229}
230230
231PALETTE_INIT( acefruit )
231static PALETTE_INIT( acefruit )
232232{
233233   /* sprites */
234234   palette_set_color( machine, 0, MAKE_RGB(0x00, 0x00, 0x00) );
src/mame/drivers/dkong.c
r1281r1282
289289   return 0;
290290}
291291
292WRITE8_HANDLER( hunchbkd_data_w )
292static WRITE8_HANDLER( hunchbkd_data_w )
293293{
294294   hunchloopback=data;
295295}
296296
297READ8_HANDLER( hunchbkd_port0_r )
297static READ8_HANDLER( hunchbkd_port0_r )
298298{
299299   logerror("port 0 : pc = %4x\n",activecpu_get_pc());
300300
r1281r1282
307307    return 0;
308308}
309309
310READ8_HANDLER( hunchbkd_port1_r )
310static READ8_HANDLER( hunchbkd_port1_r )
311311{
312312   return hunchloopback;
313313}
314314
315READ8_HANDLER( herbiedk_port1_r )
315static READ8_HANDLER( herbiedk_port1_r )
316316{
317317   switch (activecpu_get_pc())
318318   {
r1281r1282
323323    return 1;
324324}
325325
326READ8_HANDLER( spclforc_port0_r )
326static READ8_HANDLER( spclforc_port0_r )
327327{
328328   switch (activecpu_get_pc())
329329   {
r1281r1282
335335    return 0;
336336}
337337
338READ8_HANDLER( eightact_port1_r )
338static READ8_HANDLER( eightact_port1_r )
339339{
340340   switch (activecpu_get_pc())
341341   {
r1281r1282
346346    return 1;
347347}
348348
349READ8_HANDLER( shootgal_port0_r )
349static READ8_HANDLER( shootgal_port0_r )
350350{
351351   switch (activecpu_get_pc())
352352   {
r1281r1282
357357    return 0;
358358}
359359
360WRITE8_HANDLER( dkong3_2a03_reset_w )
360static WRITE8_HANDLER( dkong3_2a03_reset_w )
361361{
362362   if (data & 1)
363363   {
r1281r1282
687687   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
688688
689689   PORT_START      /* DSW0 */
690   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
690   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION( "SW1:!1,!2" )
691691   PORT_DIPSETTING(    0x00, "3" )
692692   PORT_DIPSETTING(    0x01, "4" )
693693   PORT_DIPSETTING(    0x02, "5" )
694694   PORT_DIPSETTING(    0x03, "6" )
695   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
695   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION( "SW1:!3,!4" )
696696   PORT_DIPSETTING(    0x00, "7000" )
697697   PORT_DIPSETTING(    0x04, "10000" )
698698   PORT_DIPSETTING(    0x08, "15000" )
699699   PORT_DIPSETTING(    0x0c, "20000" )
700   PORT_DIPNAME( 0x70, 0x00, DEF_STR( Coinage ) )
700   PORT_DIPNAME( 0x70, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION( "SW1:!5,!6,!7" )
701701   PORT_DIPSETTING(    0x70, DEF_STR( 5C_1C ) )
702702   PORT_DIPSETTING(    0x50, DEF_STR( 4C_1C ) )
703703   PORT_DIPSETTING(    0x30, DEF_STR( 3C_1C ) )
r1281r1282
706706   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
707707   PORT_DIPSETTING(    0x40, DEF_STR( 1C_3C ) )
708708   PORT_DIPSETTING(    0x60, DEF_STR( 1C_4C ) )
709   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
709   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )      PORT_DIPLOCATION( "SW1:!8" )
710710   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
711711   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
712712
r1281r1282
805805   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
806806
807807   PORT_START      /* DSW0 */
808   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
808   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )         PORT_DIPLOCATION("SW2:!1,!2,!3")
809809   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
810810   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
811811   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
r1281r1282
814814   PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
815815   PORT_DIPSETTING(    0x05, DEF_STR( 1C_5C ) )
816816   PORT_DIPSETTING(    0x07, DEF_STR( 1C_6C ) )
817   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
818   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
819   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
820   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
821   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
822   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
823   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
824   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
825   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
826   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME(DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2)
827   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
817   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
818   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!5" )
819   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!6" )
820   PORT_SERVICE_DIPLOC( 0x40, IP_ACTIVE_HIGH, "SW2:!7" )
821   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )         PORT_DIPLOCATION("SW2:!8")
828822   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
829823   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
830824
831825   PORT_START      /* DSW1 */
832   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
826   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )         PORT_DIPLOCATION("SW1:!1,!2")
833827   PORT_DIPSETTING(    0x00, "3" )
834828   PORT_DIPSETTING(    0x01, "4" )
835829   PORT_DIPSETTING(    0x02, "5" )
836830   PORT_DIPSETTING(    0x03, "6" )
837   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
831   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )      PORT_DIPLOCATION("SW1:!3,!4")
838832   PORT_DIPSETTING(    0x00, "30000" )
839833   PORT_DIPSETTING(    0x04, "40000" )
840834   PORT_DIPSETTING(    0x08, "50000" )
841835   PORT_DIPSETTING(    0x0c, DEF_STR( None ) )
842   PORT_DIPNAME( 0x30, 0x00, "Additional Bonus" )
836   PORT_DIPNAME( 0x30, 0x00, "Additional Bonus" )         PORT_DIPLOCATION("SW1:!5,!6")
843837   PORT_DIPSETTING(    0x00, "30000" )
844838   PORT_DIPSETTING(    0x10, "40000" )
845839   PORT_DIPSETTING(    0x20, "50000" )
846840   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
847   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
841   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )      PORT_DIPLOCATION("SW1:!7,!8")
848842   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
849843   PORT_DIPSETTING(    0x40, DEF_STR( Medium ) )
850844   PORT_DIPSETTING(    0x80, DEF_STR( Hard ) )
src/mame/drivers/travrusa.c
r1281r1282
485485   ROM_LOAD( "3.bpr",   0x0220, 0x0100, CRC(5db47092) SHA1(8e234ee88143755a4fd5ec86a03b55be5f9c5db8) )
486486ROM_END
487487
488DRIVER_INIT( motorace )
488static DRIVER_INIT( motorace )
489489{
490490   int A,j;
491491   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/hanaroku.c
r1281r1282
2020UINT8 *hanaroku_spriteram3;
2121
2222
23PALETTE_INIT( hanaroku )
23static PALETTE_INIT( hanaroku )
2424{
2525   int i;
2626   int r,g,b;
r1281r1282
3636}
3737
3838
39VIDEO_START(hanaroku)
39static VIDEO_START(hanaroku)
4040{
4141}
4242
r1281r1282
6565   }
6666}
6767
68VIDEO_UPDATE(hanaroku)
68static VIDEO_UPDATE(hanaroku)
6969{
7070   fillbitmap(bitmap, machine->pens[0x1f0], cliprect);   // ???
7171   draw_sprites(machine, bitmap, cliprect);
src/mame/drivers/aliens.c
r1281r1282
7070#endif
7171}
7272
73WRITE8_HANDLER( aliens_sh_irqtrigger_w )
73static WRITE8_HANDLER( aliens_sh_irqtrigger_w )
7474{
7575   soundlatch_w(offset,data);
7676   cpunum_set_input_line_and_vector(1, 0, HOLD_LINE, 0xff);
src/mame/drivers/ddenlovr.c
r1281r1282
180180   ddenlovr_blit_commands = ddenlovr_commands;
181181}
182182
183VIDEO_START(mmpanic)
183static VIDEO_START(mmpanic)
184184{
185185   video_start_ddenlovr(machine);
186186
187187   extra_layers = 1;
188188}
189189
190VIDEO_START(hanakanz)
190static VIDEO_START(hanakanz)
191191{
192192   video_start_ddenlovr(machine);
193193
r1281r1282
195195   ddenlovr_blit_commands = hanakanz_commands;
196196}
197197
198VIDEO_START(mjflove)
198static VIDEO_START(mjflove)
199199{
200200   video_start_ddenlovr(machine);
201201
r1281r1282
225225   ddenlovr_bgcolor = data;
226226}
227227
228WRITE8_HANDLER( ddenlovr_bgcolor2_w )
228static WRITE8_HANDLER( ddenlovr_bgcolor2_w )
229229{
230230   ddenlovr_bgcolor2 = data;
231231}
232232
233WRITE16_HANDLER( ddenlovr16_bgcolor_w )
233static WRITE16_HANDLER( ddenlovr16_bgcolor_w )
234234{
235235   if (ACCESSING_LSB)
236236      ddenlovr_bgcolor_w(offset,data);
r1281r1282
242242   ddenlovr_priority = data;
243243}
244244
245WRITE8_HANDLER( ddenlovr_priority2_w )
245static WRITE8_HANDLER( ddenlovr_priority2_w )
246246{
247247   ddenlovr_priority2 = data;
248248}
249249
250WRITE16_HANDLER( ddenlovr16_priority_w )
250static WRITE16_HANDLER( ddenlovr16_priority_w )
251251{
252252   if (ACCESSING_LSB)
253253      ddenlovr_priority_w(offset,data);
r1281r1282
259259   ddenlovr_layer_enable = data;
260260}
261261
262WRITE8_HANDLER( ddenlovr_layer_enable2_w )
262static WRITE8_HANDLER( ddenlovr_layer_enable2_w )
263263{
264264   ddenlovr_layer_enable2 = data;
265265}
266266
267267
268WRITE16_HANDLER( ddenlovr16_layer_enable_w )
268static WRITE16_HANDLER( ddenlovr16_layer_enable_w )
269269{
270270   if (ACCESSING_LSB)
271271      ddenlovr_layer_enable_w(offset,data);
r1281r1282
13211321   ddenlovr_layer_enable2 = enab2;
13221322}
13231323
1324READ16_HANDLER( ddenlovr_special_r )
1324static READ16_HANDLER( ddenlovr_special_r )
13251325{
13261326   int res = readinputport(2) | (ddenlovr_blitter_irq_flag << 6);
13271327
r1281r1282
13711371{
13721372   ddenlovr_palette_base[offset] = data;
13731373}
1374WRITE8_HANDLER( ddenlovr_palette_base2_w )
1374static WRITE8_HANDLER( ddenlovr_palette_base2_w )
13751375{
13761376   ddenlovr_palette_base[offset+4] = data;
13771377}
r1281r1282
13801380{
13811381   ddenlovr_palette_mask[offset] = data;
13821382}
1383WRITE8_HANDLER( ddenlovr_palette_mask2_w )
1383static WRITE8_HANDLER( ddenlovr_palette_mask2_w )
13841384{
13851385   ddenlovr_palette_mask[offset+4] = data;
13861386}
r1281r1282
13891389{
13901390   ddenlovr_transparency_pen[offset] = data;
13911391}
1392WRITE8_HANDLER( ddenlovr_transparency_pen2_w )
1392static WRITE8_HANDLER( ddenlovr_transparency_pen2_w )
13931393{
13941394   ddenlovr_transparency_pen[offset+4] = data;
13951395}
r1281r1282
13981398{
13991399   ddenlovr_transparency_mask[offset] = data;
14001400}
1401WRITE8_HANDLER( ddenlovr_transparency_mask2_w )
1401static WRITE8_HANDLER( ddenlovr_transparency_mask2_w )
14021402{
14031403   ddenlovr_transparency_mask[offset+4] = data;
14041404}
14051405
14061406
1407WRITE16_HANDLER( ddenlovr16_palette_base_w )
1407static WRITE16_HANDLER( ddenlovr16_palette_base_w )
14081408{
14091409   if (ACCESSING_LSB)
14101410      ddenlovr_palette_base[offset] = data & 0xff;
14111411}
14121412
1413WRITE16_HANDLER( ddenlovr16_palette_mask_w )
1413static WRITE16_HANDLER( ddenlovr16_palette_mask_w )
14141414{
14151415   if (ACCESSING_LSB)
14161416      ddenlovr_palette_mask[offset] = data & 0xff;
14171417}
14181418
1419WRITE16_HANDLER( ddenlovr16_transparency_pen_w )
1419static WRITE16_HANDLER( ddenlovr16_transparency_pen_w )
14201420{
14211421   if (ACCESSING_LSB)
14221422      ddenlovr_transparency_pen[offset] = data & 0xff;
14231423}
14241424
1425WRITE16_HANDLER( ddenlovr16_transparency_mask_w )
1425static WRITE16_HANDLER( ddenlovr16_transparency_mask_w )
14261426{
14271427   if (ACCESSING_LSB)
14281428      ddenlovr_transparency_mask[offset] = data & 0xff;
r1281r1282
14761476
14771477static UINT8 ddenlovr_select, ddenlovr_select2;
14781478
1479WRITE8_HANDLER( ddenlovr_select_w )
1479static WRITE8_HANDLER( ddenlovr_select_w )
14801480{
14811481   ddenlovr_select = data;
14821482}
14831483
1484WRITE16_HANDLER( ddenlovr_select_16_w )
1484static WRITE16_HANDLER( ddenlovr_select_16_w )
14851485{
14861486   if (ACCESSING_LSB)
14871487      ddenlovr_select = data;
14881488}
14891489
1490WRITE8_HANDLER( ddenlovr_select2_w )
1490static WRITE8_HANDLER( ddenlovr_select2_w )
14911491{
14921492   ddenlovr_select2 = data;
14931493}
14941494
1495WRITE16_HANDLER( ddenlovr_select2_16_w )
1495static WRITE16_HANDLER( ddenlovr_select2_16_w )
14961496{
14971497   if (ACCESSING_LSB)
14981498      ddenlovr_select2 = data;
14991499}
15001500
1501READ8_HANDLER( rongrong_input2_r )
1501static READ8_HANDLER( rongrong_input2_r )
15021502{
15031503//  logerror("%04x: input2_r offset %d select %x\n",activecpu_get_pc(),offset,ddenlovr_select2 );
15041504   /* 0 and 1 are read from offset 1, 2 from offset 0... */
r1281r1282
15121512}
15131513
15141514
1515READ8_HANDLER( quiz365_input_r )
1515static READ8_HANDLER( quiz365_input_r )
15161516{
15171517   if (!(ddenlovr_select & 0x01))   return readinputport(3);
15181518   if (!(ddenlovr_select & 0x02))   return readinputport(4);
r1281r1282
15221522   return 0xff;
15231523}
15241524
1525READ16_HANDLER( quiz365_input2_r )
1525static READ16_HANDLER( quiz365_input2_r )
15261526{
15271527//  logerror("%04x: input2_r offset %d select %x\n",activecpu_get_pc(),offset,ddenlovr_select2 );
15281528   /* 0 and 1 are read from offset 1, 2 from offset 0... */
r1281r1282
15371537
15381538static UINT8 rongrong_blitter_busy_select;
15391539
1540WRITE8_HANDLER( rongrong_blitter_busy_w )
1540static WRITE8_HANDLER( rongrong_blitter_busy_w )
15411541{
15421542   rongrong_blitter_busy_select = data;
15431543   if (data != 0x18)
15441544      logerror("%04x: rongrong_blitter_busy_w data = %02x\n",activecpu_get_pc(),data);
15451545}
1546READ8_HANDLER( rongrong_blitter_busy_r )
1546static READ8_HANDLER( rongrong_blitter_busy_r )
15471547{
15481548   switch( rongrong_blitter_busy_select )
15491549   {
r1281r1282
18261826                                Rong Rong
18271827***************************************************************************/
18281828
1829READ8_HANDLER( rongrong_input_r )
1829static READ8_HANDLER( rongrong_input_r )
18301830{
18311831   if (!(ddenlovr_select & 0x01))   return readinputport(3);
18321832   if (!(ddenlovr_select & 0x02))   return readinputport(4);
r1281r1282
18361836   return 0xff;
18371837}
18381838
1839WRITE8_HANDLER( rongrong_select_w )
1839static WRITE8_HANDLER( rongrong_select_w )
18401840{
18411841   UINT8 *rom = memory_region(REGION_CPU1);
18421842
r1281r1282
21362136   blitter_w_funkyfig(0,offset,data,0xe0);
21372137}
21382138
2139WRITE8_HANDLER( funkyfig_rombank_w )
2139static WRITE8_HANDLER( funkyfig_rombank_w )
21402140{
21412141   UINT8 *rom = memory_region(REGION_CPU1);
21422142
r1281r1282
21472147   memory_set_bankptr(2, &rom[0x90000 + 0x1000 * ((data & 0xe0) >> 5)]);
21482148}
21492149
2150READ8_HANDLER( funkyfig_dsw_r )
2150static READ8_HANDLER( funkyfig_dsw_r )
21512151{
21522152   if (!(ddenlovr_select & 0x01))   return readinputport(3);
21532153   if (!(ddenlovr_select & 0x02))   return readinputport(4);
r1281r1282
21582158
21592159static UINT8 funkyfig_lockout;
21602160
2161READ8_HANDLER( funkyfig_coin_r )
2161static READ8_HANDLER( funkyfig_coin_r )
21622162{
21632163   switch( ddenlovr_select2 )
21642164   {
r1281r1282
21692169   return 0xff;
21702170}
21712171
2172READ8_HANDLER( funkyfig_key_r )
2172static READ8_HANDLER( funkyfig_key_r )
21732173{
21742174   switch( ddenlovr_select2 )
21752175   {
r1281r1282
22492249
22502250***************************************************************************/
22512251
2252WRITE8_HANDLER( hanakanz_rombank_w )
2252static WRITE8_HANDLER( hanakanz_rombank_w )
22532253{
22542254   UINT8 *rom = memory_region(REGION_CPU1);
22552255
src/mame/drivers/chinagat.c
r1281r1282
112112   sound_irq = INPUT_LINE_NMI;
113113}
114114
115WRITE8_HANDLER( chinagat_video_ctrl_w )
115static WRITE8_HANDLER( chinagat_video_ctrl_w )
116116{
117117   /***************************
118118    ---- ---x   X Scroll MSB
src/mame/drivers/kaneko16.c
r1281r1282
229229
230230***************************************************************************/
231231
232READ16_HANDLER( kaneko16_rnd_r )
232static READ16_HANDLER( kaneko16_rnd_r )
233233{
234234   return mame_rand(Machine) & 0xffff;
235235}
236236
237WRITE16_HANDLER( kaneko16_coin_lockout_w )
237static WRITE16_HANDLER( kaneko16_coin_lockout_w )
238238{
239239   if (ACCESSING_MSB)
240240   {
r1281r1282
256256
257257***************************************************************************/
258258
259WRITE16_HANDLER( kaneko16_soundlatch_w )
259static WRITE16_HANDLER( kaneko16_soundlatch_w )
260260{
261261   if (ACCESSING_MSB)
262262   {
r1281r1282
267267
268268/* Two identically mapped YM2149 chips */
269269
270READ16_HANDLER( kaneko16_YM2149_0_r )
270static READ16_HANDLER( kaneko16_YM2149_0_r )
271271{
272272   /* Each 2149 register is mapped to a different address */
273273   AY8910_control_port_0_w(0,offset);
274274   return AY8910_read_port_0_r(0);
275275}
276READ16_HANDLER( kaneko16_YM2149_1_r )
276static READ16_HANDLER( kaneko16_YM2149_1_r )
277277{
278278   /* Each 2149 register is mapped to a different address */
279279   AY8910_control_port_1_w(0,offset);
280280   return AY8910_read_port_1_r(0);
281281}
282282
283WRITE16_HANDLER( kaneko16_YM2149_0_w )
283static WRITE16_HANDLER( kaneko16_YM2149_0_w )
284284{
285285   /* Each 2149 register is mapped to a different address */
286286   AY8910_control_port_0_w(0,offset);
r1281r1282
288288   if (ACCESSING_LSB)   AY8910_write_port_0_w(0, data       & 0xff);
289289   else            AY8910_write_port_0_w(0,(data >> 8) & 0xff);
290290}
291WRITE16_HANDLER( kaneko16_YM2149_1_w )
291static WRITE16_HANDLER( kaneko16_YM2149_1_w )
292292{
293293   /* Each 2149 register is mapped to a different address */
294294   AY8910_control_port_1_w(0,offset);
r1281r1282
306306
307307***************************************************************************/
308308
309READ8_HANDLER( kaneko16_eeprom_r )
309static READ8_HANDLER( kaneko16_eeprom_r )
310310{
311311   return EEPROM_read_bit() & 1;
312312}
313313
314WRITE8_HANDLER( kaneko16_eeprom_reset_w )
314static WRITE8_HANDLER( kaneko16_eeprom_reset_w )
315315{
316316   // reset line asserted: reset.
317317   EEPROM_set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE );
318318}
319319
320WRITE16_HANDLER( kaneko16_eeprom_w )
320static WRITE16_HANDLER( kaneko16_eeprom_w )
321321{
322322   if (ACCESSING_LSB)
323323   {
r1281r1282
388388/* The two YM2149 chips are only used when entering high score initials, and */
389389/* when the game is fully completed. Overkill??? */
390390
391WRITE16_HANDLER( bakubrkr_oki_bank_sw )
391static WRITE16_HANDLER( bakubrkr_oki_bank_sw )
392392{
393393   if (ACCESSING_LSB) {
394394      OKIM6295_set_bank_base(0, 0x40000 * (data & 0x7) );
r1281r1282
589589***************************************************************************/
590590
591591
592READ16_HANDLER( gtmr_wheel_r )
592static READ16_HANDLER( gtmr_wheel_r )
593593{
594594   if ( (readinputport(4) & 0x1800) == 0x10)   // DSW setting
595595      return   readinputport(5)<<8;         // 360' Wheel
r1281r1282
597597      return   readinputport(5);            // 270' Wheel
598598}
599599
600WRITE16_HANDLER( gtmr_oki_0_bank_w )
600static WRITE16_HANDLER( gtmr_oki_0_bank_w )
601601{
602602   if (ACCESSING_LSB)
603603   {
r1281r1282
606606   }
607607}
608608
609WRITE16_HANDLER( gtmr_oki_1_bank_w )
609static WRITE16_HANDLER( gtmr_oki_1_bank_w )
610610{
611611   if (ACCESSING_LSB)
612612   {
r1281r1282
615615   }
616616}
617617
618WRITE16_HANDLER( gtmr_oki_0_data_w )
618static WRITE16_HANDLER( gtmr_oki_0_data_w )
619619{
620620   if (ACCESSING_LSB)
621621   {
r1281r1282
624624   }
625625}
626626
627WRITE16_HANDLER( gtmr_oki_1_data_w )
627static WRITE16_HANDLER( gtmr_oki_1_data_w )
628628{
629629   if (ACCESSING_LSB)
630630   {
r1281r1282
694694***************************************************************************/
695695
696696
697READ16_HANDLER( gtmr2_wheel_r )
697static READ16_HANDLER( gtmr2_wheel_r )
698698{
699699   switch (readinputport(4) & 0x1800)
700700   {
r1281r1282
714714   }
715715}
716716
717READ16_HANDLER( gtmr2_IN1_r )
717static READ16_HANDLER( gtmr2_IN1_r )
718718{
719719   return   (readinputport(1) & (readinputport(8) | ~0x7100));
720720}
r1281r1282
782782***************************************************************************/
783783
784784/* Untested */
785WRITE16_HANDLER( shogwarr_oki_bank_w )
785static WRITE16_HANDLER( shogwarr_oki_bank_w )
786786{
787787   if (ACCESSING_LSB)
788788   {
r1281r1282
21832183   }
21842184}
21852185
2186DRIVER_INIT( kaneko16 )
2186static DRIVER_INIT( kaneko16 )
21872187{
21882188   kaneko16_unscramble_tiles(REGION_GFX2);
21892189   kaneko16_unscramble_tiles(REGION_GFX3);
21902190}
21912191
2192DRIVER_INIT( berlwall )
2192static DRIVER_INIT( berlwall )
21932193{
21942194   kaneko16_unscramble_tiles(REGION_GFX2);
21952195}
21962196
2197DRIVER_INIT( samplebank )
2197static DRIVER_INIT( samplebank )
21982198{
21992199   kaneko16_unscramble_tiles(REGION_GFX2);
22002200   kaneko16_unscramble_tiles(REGION_GFX3);
r1281r1282
32063206ROM_END
32073207
32083208
3209DRIVER_INIT( shogwarr )
3209static DRIVER_INIT( shogwarr )
32103210{
32113211   driver_init_kaneko16(machine);
32123212
src/mame/drivers/goldstar.c
r1281r1282
446446ROM_END
447447
448448
449DRIVER_INIT(goldstar)
449static DRIVER_INIT(goldstar)
450450{
451451   int A;
452452   UINT8 *RAM = memory_region(REGION_CPU1);
src/mame/drivers/cybertnk.c
r1281r1282
190190         0);
191191}
192192
193VIDEO_START( cybertnk )
193static VIDEO_START( cybertnk )
194194{
195195   tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,128,32);
196196}
197197
198VIDEO_UPDATE( cybertnk )
198static VIDEO_UPDATE( cybertnk )
199199{
200200   tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
201201   return 0;
202202}
203203
204DRIVER_INIT( cybertnk )
204static DRIVER_INIT( cybertnk )
205205{
206206#ifdef IGNORE_MISSING_ROM
207207   UINT16 *ROM = (UINT16*)memory_region(REGION_CPU1);
src/mame/drivers/namcos10.c
r1281r1282
370370   decrypt_bios( 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb );
371371}
372372
373MACHINE_RESET( namcos10 )
373static MACHINE_RESET( namcos10 )
374374{
375375   psx_machine_init();
376376}
src/mame/drivers/ms32.c
r1281r1282
408408   AM_RANGE(0xffe00000, 0xffffffff) AM_WRITE(MWA32_ROM)
409409ADDRESS_MAP_END
410410
411/********** INPUT PORTS **********/
411/*************************************
412 *
413 *  Generic port definitions
414 *
415 *************************************/
412416
413#define MS32_UNUSED_PORT \
414   PORT_START_TAG("UNUSED") \
415   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) \
416   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) \
417   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) \
418   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) \
419   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) \
420   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) \
421   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) \
422   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
423
424#define MS32_SYSTEM_INPUTS \
425   PORT_START_TAG("IN1") \
426   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) \
427   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) \
428   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
429   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) \
430   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) \
431   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
432   /* bits 6 and 7 might be different from game to game */
433
434#define MS32_UNKNOWN_INPUTS \
435   PORT_START_TAG("UNKNOWN") \
436   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
437   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
438   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
439   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
440   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
441   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
442   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
417static INPUT_PORTS_START( ms32 )
418   PORT_START_TAG("IN0")
419   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
420   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
421   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
422   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
423   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
424   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
425   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
443426   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
444427
445#define MS32_PLAYER_INPUTS(_n_, _b1_, _b2_, _b3_, _b4_) \
446   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(_n_) \
447   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(_n_) \
448   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(_n_) \
449   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(_n_) \
450   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_##_b1_         ) PORT_PLAYER(_n_) \
451   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_##_b2_         ) PORT_PLAYER(_n_) \
452   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_##_b3_         ) PORT_PLAYER(_n_) \
453   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_##_b4_         ) PORT_PLAYER(_n_)
454
455#define MS32_DIP1 \
456   PORT_START_TAG("DSW1") \
457   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) \
458   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) ) \
459   PORT_DIPSETTING(    0x80, DEF_STR( 4C_1C ) ) \
460   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) ) \
461   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) ) \
462   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) ) \
463   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) ) \
464   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) ) \
465   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) ) \
466   PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) \
467   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) ) \
468   PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) ) \
469   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) ) \
470   PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) ) \
471   PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) ) \
472   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) ) \
473   PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) ) \
474   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) ) \
475   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play ) ) \
476   PORT_DIPSETTING(    0x02, DEF_STR( Off ) ) \
477   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
478   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
479
480
481static INPUT_PORTS_START( ms32 )
482   MS32_UNKNOWN_INPUTS
483
484   MS32_SYSTEM_INPUTS
428   PORT_START_TAG("IN1")
429   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
430   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
431   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
432   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
433   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
434   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
485435   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
486436   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
487437
488438   PORT_START_TAG("IN2")
489   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
439   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
440   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
441   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
442   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
443   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
444   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
445   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
446   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
490447
491448   PORT_START_TAG("IN3")
492   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
449   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
450   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
451   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
452   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
453   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
454   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
455   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
456   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
493457
494   MS32_DIP1
458   PORT_START_TAG("DSW1")
459   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")\
460   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
461   PORT_DIPSETTING(    0x80, DEF_STR( 4C_1C ) )
462   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
463   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
464   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
465   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
466   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
467   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
468   PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
469   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
470   PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) )
471   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
472   PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
473   PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
474   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
475   PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) )
476   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
477   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:7")
478   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
479   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
480   PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
495481
496482   PORT_START_TAG("DSW2")
497   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
483   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:1")
498484   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
499485   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
500   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
486   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:2")
501487   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
502488   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
503   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
489   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3")
504490   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
505491   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
506   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
492   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
507493   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
508494   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
509   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
495   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
510496   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
511497   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
512   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
498   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
513499   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
514500   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
515   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
501   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7")
516502   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
517503   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
518   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
504   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
519505   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
520506   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
521507
522508   PORT_START_TAG("DSW3")
523   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
509   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:1")
524510   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
525511   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
526   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
512   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:2")
527513   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
528514   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
529   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
515   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:3")
530516   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
531517   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
532   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
518   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:4")
533519   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
534520   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
535   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
521   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:5")
536522   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
537523   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
538   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
524   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:6")
539525   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
540526   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
541   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
527   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:7")
542528   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
543529   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
544   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
530   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:8")
545531   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
546532   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
547533
548   MS32_UNUSED_PORT
534   PORT_START_TAG("UNUSED")
535   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
536   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
537   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
538   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
539   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
540   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
541   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
542   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
549543
550544INPUT_PORTS_END
551545
546/*************************************
547 *
548 *  Game-specific port definitions
549 *
550 *************************************/
551
552552static INPUT_PORTS_START( bbbxing )
553   MS32_UNKNOWN_INPUTS
553   PORT_INCLUDE( ms32 )
554554
555   MS32_SYSTEM_INPUTS
556   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )         // BUTTON5 in "test mode"
557   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )         // BUTTON5 in "test mode"
558
559   PORT_START_TAG("IN2")
560   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)   // BUTTON4 in "test mode"
561
562   PORT_START_TAG("IN3")
563   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)   // BUTTON4 in "test mode"
564
565   MS32_DIP1
566
567   PORT_START_TAG("DSW2")
568   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
555   PORT_MODIFY("DSW2")
556   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
569557   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
570558   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
571559   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
572560   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
573   PORT_DIPNAME( 0x30, 0x00, "Timer Speed" )
561   PORT_DIPNAME( 0x30, 0x30, "Timer Speed" ) PORT_DIPLOCATION("SW2:4,3")
574562   PORT_DIPSETTING(    0x00, "60/60" )
575563   PORT_DIPSETTING(    0x20, "50/60" )
576564   PORT_DIPSETTING(    0x10, "40/60" )
577565   PORT_DIPSETTING(    0x30, "35/60" )
578   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
579   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
566   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6")
582567   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
583568   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
584   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Language ) )
569   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:7")
585570   PORT_DIPSETTING(    0x02, DEF_STR( Japanese ) )
586571   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
587   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
572   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
588573   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
589574   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
590575
591   PORT_START_TAG("DSW3")
592   PORT_DIPNAME( 0x80, 0x80, "Jyoji's Attacking Power" )
576   PORT_MODIFY("DSW3")
577   PORT_DIPNAME( 0x80, 0x80, "Jyoji's Attacking Power" ) PORT_DIPLOCATION("SW3:1")
593578   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
594579   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
595   PORT_DIPNAME( 0x40, 0x40, "Kim's Attacking Power" )
580   PORT_DIPNAME( 0x40, 0x40, "Kim's Attacking Power" ) PORT_DIPLOCATION("SW3:2")
596581   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
597582   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
598   PORT_DIPNAME( 0x20, 0x20, "Thamalatt's Attacking Power" )
583   PORT_DIPNAME( 0x20, 0x20, "Thamalatt's Attacking Power" ) PORT_DIPLOCATION("SW3:3")
599584   PORT_DIPSETTING(    0x20, DEF_STR( Normal ) )
600585   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
601   PORT_DIPNAME( 0x10, 0x10, "Jose's Attacking Power" )
586   PORT_DIPNAME( 0x10, 0x10, "Jose's Attacking Power" ) PORT_DIPLOCATION("SW3:4")
602587   PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )
603588   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
604   PORT_DIPNAME( 0x08, 0x08, "Carolde's Attacking Power" )
589   PORT_DIPNAME( 0x08, 0x08, "Carolde's Attacking Power" ) PORT_DIPLOCATION("SW3:5")
605590   PORT_DIPSETTING(    0x08, DEF_STR( Normal ) )
606591   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
607   PORT_DIPNAME( 0x04, 0x04, "Biff's Attacking Power" )
592   PORT_DIPNAME( 0x04, 0x04, "Biff's Attacking Power" ) PORT_DIPLOCATION("SW3:6")
608593   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
609594   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
610   PORT_DIPNAME( 0x02, 0x02, "Grute's Attacking Power" )
595   PORT_DIPNAME( 0x02, 0x02, "Grute's Attacking Power" ) PORT_DIPLOCATION("SW3:7")
611596   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
612597   PORT_DIPSETTING(    0x00, DEF_STR( Harder ) )
613   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
614   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
615   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
616598
617   MS32_UNUSED_PORT
618
619599INPUT_PORTS_END
620600
621601static INPUT_PORTS_START( desertwr )
622   MS32_UNKNOWN_INPUTS
602   PORT_INCLUDE( ms32 )
623603
624   MS32_SYSTEM_INPUTS
625   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
626   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
627
628   PORT_START_TAG("IN2")
629   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)
630
631   PORT_START_TAG("IN3")
632   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)
633
634   MS32_DIP1
635
636   PORT_START_TAG("DSW2")
637   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
604   PORT_MODIFY("DSW2")
605   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
638606   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
639607   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
640608   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
641609   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
642   PORT_DIPNAME( 0x30, 0x30, "Armors" )
610   PORT_DIPNAME( 0x30, 0x30, "Armors" ) PORT_DIPLOCATION("SW2:4,3")
643611//  PORT_DIPSETTING(    0x00, "2" )     // duplicate setting ?
644612   PORT_DIPSETTING(    0x10, "2" )
645613   PORT_DIPSETTING(    0x30, "3" )
646614   PORT_DIPSETTING(    0x20, "4" )
647   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
648   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
649   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
650   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
651   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
652   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
653   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
615   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
654616   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
655617   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
656   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
618   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
657619   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
658620   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
659621
660   PORT_START_TAG("DSW3")
661   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
622   PORT_MODIFY("DSW3")
623   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
662624   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
663625   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
664   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
626   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
665627   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
666628   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
667   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
668   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
669   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
670   PORT_DIPNAME( 0x10, 0x00, "Title screen" )
629   PORT_DIPNAME( 0x10, 0x00, "Title screen" ) PORT_DIPLOCATION("SW3:4")
671630   PORT_DIPSETTING(    0x10, DEF_STR( Japanese ) )
672631   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
673   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
674   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
675   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
676   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
677   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
678   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
679   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
680   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
681   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
682   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
683   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
684   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
685632
686   MS32_UNUSED_PORT
687
688633INPUT_PORTS_END
689634
690635static INPUT_PORTS_START( gametngk )
691   MS32_UNKNOWN_INPUTS
636   PORT_INCLUDE( ms32 )
692637
693   MS32_SYSTEM_INPUTS
694   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
695   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
696
697   PORT_START_TAG("IN2")
698   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
699
700   PORT_START_TAG("IN3")
701   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
702
703   MS32_DIP1
704
705   PORT_START_TAG("DSW2")
706   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
638   PORT_MODIFY("DSW2")
639   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
707640   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
708641   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
709642   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
710643   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
711   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
644   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:4,3")
712645   PORT_DIPSETTING(    0x00, "1" )
713646   PORT_DIPSETTING(    0x30, "3" )
714647   PORT_DIPSETTING(    0x10, "4" )
715648   PORT_DIPSETTING(    0x20, "5" )
716   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
717   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
718   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
719   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
720   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
721   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
722   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
649   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
723650   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
724651   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
725   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
652   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
726653   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
727654   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
728655
729   PORT_START_TAG("DSW3")
730   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
656   PORT_MODIFY("DSW3")
657   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
731658   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
732659   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
733   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
660   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
734661   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
735662   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
736   PORT_DIPNAME( 0x20, 0x20, "Voice" )
663   PORT_DIPNAME( 0x20, 0x20, "Voice" ) PORT_DIPLOCATION("SW3:3")
737664   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
738665   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
739   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
740   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
741   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
742   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
743   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
744   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
745   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
746   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
747   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
748   PORT_DIPNAME( 0x02, 0x02, "Invulnerability (Cheat)")
666   PORT_DIPNAME( 0x02, 0x02, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW3:7")
749667   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
750668   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
751   PORT_DIPNAME( 0x01, 0x01, "Freeze" )
669   PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW3:8")
752670   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
753671   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
754672
755   MS32_UNUSED_PORT
756
757673INPUT_PORTS_END
758674
759675static INPUT_PORTS_START( tetrisp )
760   MS32_UNKNOWN_INPUTS
676   PORT_INCLUDE( ms32 )
761677
762   MS32_SYSTEM_INPUTS
763   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
764   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
765
766678   /* There are inputs for players 3 and 4 in the "test mode",
767679       but NO addresses are read to check them ! */
768680
769   PORT_START_TAG("IN2")
770   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
771   PORT_START_TAG("IN3")
772   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
773
774   MS32_DIP1
775
776   PORT_START_TAG("DSW2")
777   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
681   PORT_MODIFY("DSW2")
682   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
778683   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
779684   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
780685   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
781686   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
782   PORT_DIPNAME( 0x30, 0x30, "Winning Rounds (Player VS Player)" )
687   PORT_DIPNAME( 0x30, 0x30, "Winning Rounds (Player VS Player)" ) PORT_DIPLOCATION("SW2:4,3")
783688   PORT_DIPSETTING(    0x00, "1/1" )
784689   PORT_DIPSETTING(    0x30, "2/3" )
785690   PORT_DIPSETTING(    0x10, "3/5" )
786691   PORT_DIPSETTING(    0x20, "4/7" )
787   PORT_DIPNAME( 0x0c, 0x0c, "Join In" )
692   PORT_DIPNAME( 0x0c, 0x0c, "Join In" ) PORT_DIPLOCATION("SW2:6,5")
788693   PORT_DIPSETTING(    0x0c, "All Modes" )
789694   PORT_DIPSETTING(    0x04, "Normal and Puzzle Modes" )
790695   PORT_DIPSETTING(    0x08, "VS Mode" )
791696//  PORT_DIPSETTING(    0x00, "Normal and Puzzle Modes" )       // "can't play normal mode" in "test mode"
792   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
697   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
793698   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
794699   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
795   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
700   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
796701   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
797702   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
798703
799   PORT_START_TAG("DSW3")
800   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
704   PORT_MODIFY("DSW3")
705   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
801706   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
802707   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
803   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
708   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
804709   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
805710   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
806   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
807   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
808   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
809   PORT_DIPNAME( 0x10, 0x10, "Voice" )
711   PORT_DIPNAME( 0x10, 0x10, "Voice" ) PORT_DIPLOCATION("SW3:4")
810712   PORT_DIPSETTING(    0x00, "English Only" )
811713   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
812   PORT_DIPNAME( 0x08, 0x08, "After VS Mode" )
714   PORT_DIPNAME( 0x08, 0x08, "After VS Mode" ) PORT_DIPLOCATION("SW3:5")
813715   PORT_DIPSETTING(    0x08, "Game Ends" )
814716   PORT_DIPSETTING(    0x00, "Winner Continues" )
815   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
816   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
817   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
818   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
819   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
820   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
821   PORT_DIPNAME( 0x01, 0x01, "Freeze" )
717   PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW3:8")
822718   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
823719   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
824720
825   MS32_UNUSED_PORT
826
827721INPUT_PORTS_END
828722
829723static INPUT_PORTS_START( tp2m32 )
830   MS32_UNKNOWN_INPUTS
724   PORT_INCLUDE( ms32 )
831725
832   MS32_SYSTEM_INPUTS
833   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
834   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
835
836   PORT_START_TAG("IN2")
837   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
838
839   PORT_START_TAG("IN3")
840   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
841
842   MS32_DIP1
843
844   PORT_START_TAG("DSW2")
845   PORT_DIPNAME( 0xc0, 0xc0, "Endless Difficulty" )
726   PORT_MODIFY("DSW2")
727   PORT_DIPNAME( 0xc0, 0xc0, "Endless Difficulty" ) PORT_DIPLOCATION("SW2:2,1")
846728   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
847729   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
848730   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
849731   PORT_DIPSETTING(    0x80, DEF_STR( Very_Hard ) )
850   PORT_DIPNAME( 0x30, 0x30, "Puzzle Difficulty" )
732   PORT_DIPNAME( 0x30, 0x30, "Puzzle Difficulty" ) PORT_DIPLOCATION("SW2:4,3")
851733   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
852734   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
853735   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
854736   PORT_DIPSETTING(    0x20, DEF_STR( Very_Hard ) )
855   PORT_DIPNAME( 0x0c, 0x0c, "VS Match" )
737   PORT_DIPNAME( 0x0c, 0x0c, "VS Match" ) PORT_DIPLOCATION("SW2:6,5")
856738   PORT_DIPSETTING(    0x00, "1" )
857739   PORT_DIPSETTING(    0x0c, "3" )
858740   PORT_DIPSETTING(    0x04, "5" )
859741   PORT_DIPSETTING(    0x08, "7" )
860   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
742   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
861743   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
862744   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
863   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
745   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
864746   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
865747   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
866748
867   PORT_START_TAG("DSW3")
868   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
749   PORT_MODIFY("DSW3")
750   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
869751   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
870752   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
871   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
753   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
872754   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
873755   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
874   PORT_DIPNAME( 0x20, 0x20, "Voice" )
756   PORT_DIPNAME( 0x20, 0x20, "Voice" ) PORT_DIPLOCATION("SW3:3")
875757   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
876758   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
877   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
878   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
879   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
880   PORT_DIPNAME( 0x08, 0x08, "Join In" )
759   PORT_DIPNAME( 0x08, 0x08, "Join In" ) PORT_DIPLOCATION("SW3:5")
881760   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
882761   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
883   PORT_DIPNAME( 0x06, 0x06, "Bomb" )
762   PORT_DIPNAME( 0x06, 0x06, "Bomb" ) PORT_DIPLOCATION("SW3:7,6")
884763   PORT_DIPSETTING(    0x04, "0" )
885764   PORT_DIPSETTING(    0x02, "1" )
886765   PORT_DIPSETTING(    0x06, "2" )
887766   PORT_DIPSETTING(    0x00, "3" )
888   PORT_DIPNAME( 0x01, 0x01, "Freeze" )
767   PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW3:8")
889768   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
890769   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
891770
892   MS32_UNUSED_PORT
893
894771INPUT_PORTS_END
895772
896/* The Dip Switches for this game are completely wrong in the "test mode" ! */
897773static INPUT_PORTS_START( p47aces )
898   MS32_UNKNOWN_INPUTS
774   PORT_INCLUDE( ms32 )
899775
900   MS32_SYSTEM_INPUTS
901   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
902   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
776   /* The Dip Switches for this game are completely wrong in the "test mode" ! */
903777
904   PORT_START_TAG("IN2")
905   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
906
907   PORT_START_TAG("IN3")
908   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, UNKNOWN, UNKNOWN)   // BUTTON3 and BUTTON4 in "test mode"
909
910   MS32_DIP1
911
912   PORT_START_TAG("DSW2")
913   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
778   PORT_MODIFY("DSW2")
779   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
914780   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
915781   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
916782   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
917783   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
918   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
784   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:4,3")
919785   PORT_DIPSETTING(    0x00, "1" )
920786   PORT_DIPSETTING(    0x20, "2" )
921787   PORT_DIPSETTING(    0x30, "3" )
922788   PORT_DIPSETTING(    0x10, "4" )
923   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
924   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
925   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
926   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
789   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:6")
927790   PORT_DIPSETTING(    0x04, "500k" )
928791   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
929   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
792   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
930793   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
931794   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
932   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
795   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
933796   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
934797   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
935798
936   PORT_START_TAG("DSW3")
937   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
799   PORT_MODIFY("DSW3")
800   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
938801   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
939802   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
940   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
803   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
941804   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
942805   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
943   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
944   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
945   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
946   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
947   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
948   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
949   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
950   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
951   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
952   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
953   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
954   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
955   PORT_DIPNAME( 0x03, 0x03, "FG/BG X offset" )
806   PORT_DIPNAME( 0x03, 0x03, "FG/BG X offset" ) PORT_DIPLOCATION("SW3:8,7")
956807   PORT_DIPSETTING(    0x03, "0/0" )
957808   PORT_DIPSETTING(    0x02, "5/5" )
958809//  PORT_DIPSETTING(    0x01, "5/5" )
959810   PORT_DIPSETTING(    0x00, "2/4" )
960811
961   MS32_UNUSED_PORT
962
963812INPUT_PORTS_END
964813
965814static INPUT_PORTS_START( gratia )
966   MS32_UNKNOWN_INPUTS
815   PORT_INCLUDE( ms32 )
967816
968   MS32_SYSTEM_INPUTS
969   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
970   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
971
972   PORT_START_TAG("IN2")
973   MS32_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)   // BUTTON4 in "test mode"
974
975   PORT_START_TAG("IN3")
976   MS32_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)   // BUTTON4 in "test mode"
977
978   MS32_DIP1
979
980   PORT_START_TAG("DSW2")
981   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
817   PORT_MODIFY("DSW2")
818   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
982819   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
983820   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
984821   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
985822   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
986   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
823   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:4,3")
987824   PORT_DIPSETTING(    0x00, "1" )
988825   PORT_DIPSETTING(    0x20, "2" )
989826   PORT_DIPSETTING(    0x30, "3" )
990827   PORT_DIPSETTING(    0x10, "4" )
991   PORT_DIPNAME( 0x08, 0x08, "Invulnerability (Cheat)")
828   PORT_DIPNAME( 0x08, 0x08, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW2:5")
992829   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
993830   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
994   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
831   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:6")
995832   PORT_DIPSETTING(    0x04, "200k and every 1000k" )
996833   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
997   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
834   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
998835   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
999836   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1000   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
837   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
1001838   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1002839   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1003840
1004   PORT_START_TAG("DSW3")
1005   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
841   PORT_MODIFY("DSW3")
842   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
1006843   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
1007844   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
1008   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" )
845   PORT_DIPNAME( 0x40, 0x40, "FBI Logo" ) PORT_DIPLOCATION("SW3:2")
1009846   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
1010847   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1011   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
1012   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1013   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1014   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
1015   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1016   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1017   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
1018   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1019   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1020   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
1021   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1022   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1023   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
1024   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1025   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1026   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1027   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1028   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1029848
1030   MS32_UNUSED_PORT
1031
1032849INPUT_PORTS_END
1033850
1034851static INPUT_PORTS_START( hayaosi2 )
1035   MS32_UNKNOWN_INPUTS
852   PORT_INCLUDE( ms32 )
1036853
1037   MS32_SYSTEM_INPUTS
854   PORT_MODIFY("IN1")
1038855   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1039856   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1040857
1041   PORT_START_TAG("IN2")
858   PORT_MODIFY("IN2")
1042859   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1043860   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1044861   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
r1281r1282
1048865   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)   // "Buzzer" (input 0 in "test mode")
1049866   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3)   // "Buzzer" (input 0 in "test mode")
1050867
1051   PORT_START_TAG("IN3")
868   PORT_MODIFY("IN3")
1052869   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1053870   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
1054871   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r1281r1282
1058875   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)   // "Buzzer" (input 0 in "test mode")
1059876   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1060877
1061   PORT_START_TAG("DSW1")
1062   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
1063   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
1064   PORT_DIPSETTING(    0x80, DEF_STR( 4C_1C ) )
1065   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
1066   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
1067   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
1068   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
1069   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
1070   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
1071   PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) )
1072   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
1073   PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) )
1074   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
1075   PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
1076   PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
1077   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
1078   PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) )
1079   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
1080   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play ) )
1081   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1082   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1083   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
878   PORT_MODIFY("DSW1")
879   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
1084880   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1085881   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1086882
1087   PORT_START_TAG("DSW2")
1088   PORT_DIPNAME( 0xc0, 0xc0, "Computer's AI (VS Mode)" )
883   PORT_MODIFY("DSW2")
884   PORT_DIPNAME( 0xc0, 0xc0, "Computer's AI (VS Mode)" ) PORT_DIPLOCATION("SW2:2,1")
1089885   PORT_DIPSETTING(    0x40, DEF_STR( Low ) )
1090886   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
1091887   PORT_DIPSETTING(    0x80, DEF_STR( High ) )
r1281r1282
1097893      /*   4     1:30       10     */
1098894      /*   4     2:00       14     */
1099895      /* final   2:00       18     */
1100   PORT_DIPNAME( 0x30, 0x30, "Time (Race Mode)" )
896   PORT_DIPNAME( 0x30, 0x30, "Time (Race Mode)" ) PORT_DIPLOCATION("SW2:4,3")
1101897   PORT_DIPSETTING(    0x00, "Default - 0:15" )
1102898   PORT_DIPSETTING(    0x20, "Default - 0:10" )
1103899   PORT_DIPSETTING(    0x30, "Default" )
1104900   PORT_DIPSETTING(    0x10, "Default + 0:15" )
1105901   /* Round   Default    More */
1106902      /*   1       10        15  */
1107   PORT_DIPNAME( 0x08, 0x08, "Questions (VS Mode)" )   // TO DO : check all rounds
903   PORT_DIPNAME( 0x08, 0x08, "Questions (VS Mode)" ) PORT_DIPLOCATION("SW2:5")   // TO DO : check all rounds
1108904   PORT_DIPSETTING(    0x08, "Default" )
1109905   PORT_DIPSETTING(    0x00, "More" )
1110   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      // "Unused" ?
1111   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1112   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1113   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      // "Demo Sounds" ?
906   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6")
907   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
908   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
909   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7")
1114910   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1115911   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1116   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )      // "Flip Screen" ?
912   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
1117913   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1118914   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1119915
1120   PORT_START_TAG("DSW3")
1121   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
1122   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1123   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1124   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
1125   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1126   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1127   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
1128   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1130   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) )
1131   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1132   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1133   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
1134   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1135   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1136   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
916INPUT_PORTS_END
917
918static INPUT_PORTS_START( hayaosi3 )
919   PORT_INCLUDE( hayaosi2 )
920
921   PORT_MODIFY("DSW2")
922   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6")
1137923   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1138924   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1139   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
1140   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1141   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1142   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1143   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1144   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
925   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
926   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
927   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1145928
1146   MS32_UNUSED_PORT
1147
1148929INPUT_PORTS_END
1149930
1150931static INPUT_PORTS_START( kirarast )   // player 1 inputs done? others?
1151   MS32_UNKNOWN_INPUTS
932   PORT_INCLUDE( ms32 )
1152933
1153   PORT_START_TAG("IN1")
934   PORT_MODIFY("IN1")
1154935   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1155936   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1156937   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r1281r1282
1162943   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1163944   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1164945
1165   MS32_UNUSED_PORT // p1
1166   MS32_UNUSED_PORT // p2
946   PORT_MODIFY("IN2")
947   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
948   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
949   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
950   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
951   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
952   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
953   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
954   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1167955
1168   MS32_DIP1
956   PORT_MODIFY("IN3")
957   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
958   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
959   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
960   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
961   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
962   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
963   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
964   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1169965
1170   PORT_START_TAG("DSW2")
1171   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR (Difficulty) )
966   PORT_MODIFY("DSW1")
967   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,2,1")\
968   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
969   PORT_DIPSETTING(    0x80, DEF_STR( 4C_1C ) )
970   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
971   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
972   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
973   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
974   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
975   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
976   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4")
977   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
978   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
979   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:5")
980   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
981   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
982   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:6")
983   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
984   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
985
986   PORT_MODIFY("DSW2")
987   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR (Difficulty) ) PORT_DIPLOCATION("SW2:3,2,1")
1172988   PORT_DIPSETTING(    0x00, DEF_STR( Easiest ) )
1173989   PORT_DIPSETTING(    0x80, DEF_STR( Very_Easy) )
1174990   PORT_DIPSETTING(    0x40, DEF_STR( Easier ) )
r1281r1282
1177993   PORT_DIPSETTING(    0x60, DEF_STR( Hard ) )
1178994   PORT_DIPSETTING(    0xa0, DEF_STR( Harder ) )
1179995   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
1180   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds) )
996   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds) ) PORT_DIPLOCATION("SW2:4")
1181997   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
1182998   PORT_DIPSETTING( 0x10, DEF_STR( On ) )
1183   PORT_DIPNAME( 0x08, 0x08, "Tumo Pinfu" )
999   PORT_DIPNAME( 0x08, 0x08, "Tumo Pinfu" ) PORT_DIPLOCATION("SW2:5")
11841000   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
11851001   PORT_DIPSETTING( 0x08, DEF_STR( On ) )
1186   PORT_DIPNAME( 0x04, 0x04, "Campaign Mode" )
1002   PORT_DIPNAME( 0x04, 0x04, "Campaign Mode" ) PORT_DIPLOCATION("SW2:6")
11871003   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
11881004   PORT_DIPSETTING( 0x04, DEF_STR( On ) )
1189   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1190   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
1191   PORT_DIPSETTING( 0x02, DEF_STR( On ) )
1192   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1005   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
11931006   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
11941007   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11951008
1196   PORT_START_TAG("DSW3")
1197   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1198   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1199   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1200   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1201   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1202   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1203   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1204   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1205   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1206   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1207   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1208   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1209   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1210   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1211   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1212   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1213   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1214   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1215   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1216   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1217   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1218   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1219   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1220   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1221
1222   MS32_UNUSED_PORT
1223
12241009   PORT_START_TAG("MJ0")   // Mahjong Inputs 0x01
12251010   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
12261011   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_A )
r1281r1282
12611046   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
12621047   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
12631048
1264   PORT_START_TAG("MJ4")   // Mahjong Inputs 0x10
1265   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1266   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1267   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1268   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1269   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1270   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1271   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1049   PORT_START_TAG("MJ4")   // Mahjong Inputs 0x10 unused ?
1050   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1051   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1052   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1053   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1054   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1055   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1056   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1057   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1058
1059INPUT_PORTS_END
1060
1061static INPUT_PORTS_START( 47pie2 )   // player 1 inputs done? others?
1062   PORT_INCLUDE( kirarast )
1063
1064   PORT_MODIFY("IN1")
1065//PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) /* coin 2 is unused */
1066   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
1067
1068   PORT_MODIFY("DSW1")
1069   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds) ) PORT_DIPLOCATION("SW1:4")
1070   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1071   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1072   PORT_DIPNAME( 0x08, 0x08, "Tumo Pinfu" ) PORT_DIPLOCATION("SW1:5")
1073   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1074   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1075   PORT_DIPNAME( 0x04, 0x04, "Campaign Mode" ) PORT_DIPLOCATION("SW1:6")
1076   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1077   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1078
1079   PORT_MODIFY("DSW2")
1080   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1")
1081   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
1082   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
1083   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
1084   PORT_DIPSETTING(    0x80, DEF_STR( Hardest ) )
1085   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3")
12721086   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
12731087   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1274   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1088   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
12751089   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
12761090   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1277   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1091   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
12781092   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
12791093   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1280   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1094   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
12811095   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
12821096   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1283   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1097   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7")
12841098   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
12851099   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1286   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1100   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
12871101   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
12881102   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1289INPUT_PORTS_END
12901103
1291static INPUT_PORTS_START( akiss )   // player 1 inputs done? others?
1292   PORT_INCLUDE( kirarast )
1293
1294   PORT_MODIFY("IN1")
1295//PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) /* coin 2 is unused */
1296   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
12971104INPUT_PORTS_END
12981105
12991106static INPUT_PORTS_START( f1superb )   // Mostly wrong !
1300   MS32_UNKNOWN_INPUTS
1107   PORT_INCLUDE( ms32 )
13011108
1302   MS32_SYSTEM_INPUTS
1303   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
1304   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
1305
1306   PORT_START_TAG("IN2")
1109   PORT_MODIFY("IN2")
13071110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
13081111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
13091112   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r1281r1282
13131116   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
13141117   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
13151118
1316   PORT_START_TAG("IN3")
1119   PORT_MODIFY("IN3")
13171120   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
13181121   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
13191122   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r1281r1282
13231126   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
13241127   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
13251128
1326   MS32_DIP1
1327
1328   PORT_START_TAG("DSW2")
1329   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1129   PORT_MODIFY("DSW2")
1130   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1")
13301131   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13311132   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1332   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1133   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2")
13331134   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
13341135   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1335   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1136   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3")
13361137   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
13371138   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1338   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1139   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4")
13391140   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
13401141   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1341   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1142   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5")
13421143   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
13431144   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1344   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1145   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6")
13451146   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13461147   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1347   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1148   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7")
13481149   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
13491150   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1350   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1151   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
13511152   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
13521153   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13531154
1354   PORT_START_TAG("DSW3")
1355   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1155   PORT_MODIFY("DSW3")
1156   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:1")
13561157   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13571158   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1358   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1159   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:2")
13591160   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
13601161   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1361   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1162   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:3")
13621163   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
13631164   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1364   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1165   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:4")
13651166   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
13661167   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1367   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1168   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:5")
13681169   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
13691170   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1370   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1171   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:6")
13711172   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13721173   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1373   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1174   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:7")
13741175   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
13751176   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1376   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1177   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:8")
13771178   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
13781179   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13791180
1380   MS32_UNUSED_PORT
1381
13821181   PORT_START_TAG("AN0")   // Acceleration (wrong?)
13831182   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
13841183
r1281r1282
24512250
24522251
24532252GAME( 1994, hayaosi2, 0,        ms32, hayaosi2, ss92046_01, ROT0,   "Jaleco", "Hayaoshi Quiz Grand Champion Taikai", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
2454GAME( 1994, hayaosi3, 0,        ms32, hayaosi2, ss92046_01, ROT0,   "Jaleco", "Hayaoshi Quiz Nettou Namahousou", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
2253GAME( 1994, hayaosi3, 0,        ms32, hayaosi3, ss92046_01, ROT0,   "Jaleco", "Hayaoshi Quiz Nettou Namahousou", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
24552254GAME( 1994, bbbxing,  0,        ms32, bbbxing,  ss92046_01, ROT0,   "Jaleco", "Best Bout Boxing", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
2456GAME( 1994, 47pie2,   0,        ms32, akiss,    47pie2,     ROT0,   "Jaleco", "Idol Janshi Su-Chi-Pie 2 (v1.1)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
2457GAME( 1994, 47pie2o,  47pie2,   ms32, akiss,    47pie2,     ROT0,   "Jaleco", "Idol Janshi Su-Chi-Pie 2 (v1.0)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
2255GAME( 1994, 47pie2,   0,        ms32, 47pie2,   47pie2,     ROT0,   "Jaleco", "Idol Janshi Su-Chi-Pie 2 (v1.1)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
2256GAME( 1994, 47pie2o,  47pie2,   ms32, 47pie2,   47pie2,     ROT0,   "Jaleco", "Idol Janshi Su-Chi-Pie 2 (v1.0)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24582257GAME( 1995, desertwr, 0,        ms32, desertwr, ss91022_10, ROT270, "Jaleco", "Desert War / Wangan Sensou", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24592258GAME( 1995, gametngk, 0,        ms32, gametngk, ss91022_10, ROT270, "Jaleco", "The Game Paradise - Master of Shooting! / Game Tengoku - The Game Paradise", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24602259GAME( 1995, tetrisp,  0,        ms32, tetrisp,  ss92046_01, ROT0,   "Jaleco / BPS", "Tetris Plus", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24612260GAME( 1995, p47aces,  0,        ms32, p47aces,  ss92048_01, ROT0,   "Jaleco", "P-47 Aces", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
2462GAME( 1995, akiss,    0,        ms32, akiss,    kirarast,   ROT0,   "Jaleco", "Mahjong Angel Kiss", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
2261GAME( 1995, akiss,    0,        ms32, 47pie2,   kirarast,   ROT0,   "Jaleco", "Mahjong Angel Kiss", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24632262GAME( 1996, gratia,   0,        ms32, gratia,   ss92047_01, ROT0,   "Jaleco", "Gratia - Second Earth (92047-01 version)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24642263GAME( 1996, gratiaa,  gratia,   ms32, gratia,   ss91022_10, ROT0,   "Jaleco", "Gratia - Second Earth (91022-10 version)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
24652264GAME( 1996, kirarast, 0,        ms32, kirarast, kirarast,   ROT0,   "Jaleco", "Ryuusei Janshi Kirara Star", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/mpu4.c
r1281r1282
11/***************************************************************************
2  MPU4 highly preliminary driver by J.Wallace, and Anonymous.
2  Barcrest MPU4 highly preliminary driver by J.Wallace, and Anonymous.
3  This is the core driver, no game specific stuff should go in here.
34
45     09-2007: Haze: Added Deal 'Em video support.
56  03-08-2007: J Wallace: Removed audio filter for now, since sound is more accurate without them.
r1281r1282
7475and related PIA and PTM for improved audio (This was eventually made the only way to generate sound in MOD4 of the hardware,
7576when the AY8913 was removed from the main board)
7677
77For the Barcrest MPU4 Video system, the cartridge contains the MPU4 video bios in the usual ROM space (occupying 16k), an interface
78interface card to connect an additional Video board, and a 6850 serial IO to communicate with said board.
79This version of the game card does not have the OKI chip, or the characteriser.
80
81The VIDEO BOARD is driven by a 10mhz 68000 processor, and contains a 6840PTM, 6850 serial IO (the other end of the
82communications), an SAA1099 for stereo sound and SCN2674 gfx chip.
83
84The VIDEO CARTRIDGE plugs into the video board, and contains the program roms for the video based game. Like the MPU4 game
85card, in some cases an extra OKI sound chip is added to the video board's game card,as well as extra RAM.
86There is a protection chip similar to and replacing the MPU4 Characteriser, which is often fed question data to descramble
87(unknown how it works). In non-question cases, however, the protection chip works near identically to the original.
88
89No video card schematics ever left the PCB factory, but some decent scans of the board have been made,
90now also available for review.
91
92Additional: 68k HALT line is tied to the reset circuit of the MPU4.
93
94Emulating the standalone MPU4 is a priority, unless this works, the video won't run.
95The copy of this driver held by AGEMAME is currently set up to run two UK standalone
96games (Celebration Club and Connect 4), as well as a title using one of the later 'mods' (Old Timer,
97a Dutch machine).
9878Everything here is preliminary...  the boards are quite fussy with regards their self tests
9979and the timing may have to be perfect for them to function correctly.  (as the comms are
10080timer driven, the video is capable of various raster effects etc.)
r1281r1282
257237 1000-FFFF | R | D D D D D D D D | ROM (can be bank switched by 0x850 in 8 banks of 64 k ) (NV)
258238-----------+---+-----------------+--------------------------------------------------------------------------
259239
260 TODO: - Input timing is completely wrong, need more info.
261       - Get MPU4 board working properly, so that video layer will operate.
262       - Confirm that MC6850 emulation is sufficient.
263       - MPU4 Master clock value taken from schematic, but 68k value is not.
264       - On IRQ, inhibit line goes low.
265
266       - Test mode appears to malfunction in Refill mode in Deal 'Em
267       - Distinguish door switches using manual
240TODO: - Fix lamp timing, MAME doesn't update fast enough to see everything
241      - Distinguish door switches using manual
268242*****************************************************************************************/
269243
270244#include "driver.h"
r1281r1282
276250#include "timer.h"
277251#include "cpu/m6809/m6809.h"
278252#include "sound/ay8910.h"
279#include "sound/flt_rc.h"
280253#include "machine/steppers.h"   // stepper motor
281254#include "machine/roc10937.h"   // vfd
282255#include "machine/mmtr.h"
283256
284// Video
285#include "cpu/m68000/m68000.h"
286#include "machine/6850acia.h"
287#include "sound/saa1099.h"
288
289//Deal 'Em
290#include "video/crtc6845.h"
291
292257#ifdef MAME_DEBUG
293258#define LOG(x)logerror x
294259#define LOG_CHR(x)logerror x
295260#define LOG_CHR_FULL(x)logerror x
296261#define LOG_IC3(x)logerror x
297262#define LOG_IC8(x)logerror x
298#define LOGSTUFF(x)logerror x
299263#else
300264#define LOG(x)
301265#define LOG_CHR(x)
302266#define LOG_CHR_FULL(x)
303267#define LOG_IC3(x)
304268#define LOG_IC8(x)
305#define LOGSTUFF(x)
306269#endif
307270
271#ifndef AWP_VIDEO //Defined for fruit machines with mechanical reels
272#define draw_reel(x)
273#else
274#define draw_reel(x) awp_draw_reel x
275#endif
308276#include "mpu4.lh"
309277#include "connect4.lh"
310278#define MPU4_MASTER_CLOCK (6880000)
311#define VIDEO_MASTER_CLOCK (10000000)
312//#include "video/awpvid.h"     //Fruit Machines Only
313279// local vars /////////////////////////////////////////////////////////////
314280static int mod_number;
315281static int mmtr_data;
r1281r1282
329295static int lamp_col;
330296static int ic23_active;
331297static int led_extend;
298static int serial_card_connected;
332299static mame_timer *ic24_timer;
333static mame_timer *freq_timer;
334300static TIMER_CALLBACK( ic24_timeout );
335static TIMER_CALLBACK( freq_timeout );
336301
337302static int   input_strobe;     // IC23 74LS138 A = CA2 IC7, B = CA2 IC4, C = CA2 IC8
338303static UINT8  lamp_strobe,lamp_strobe2;
r1281r1282
348313                        // Each connector carries two banks of eight inputs and two enable signals
349314static int optic_pattern;
350315
351// Video
352
353static UINT8 m6840_irq_state;
354static UINT8 m6850_irq_state;
355static UINT8 scn2674_irq_state;
356static int serial_card_connected;
357
358/* UART source/sinks */
359static UINT8 m68k_m6809_line;
360static UINT8 m6809_m68k_line;
361
362static int mpu4_gfx_index;
363static UINT16 * mpu4_vid_vidram;
364static UINT8 * mpu4_vid_vidram_is_dirty;
365static UINT16 * mpu4_vid_mainram;
366
367static UINT8 scn2674_IR[16];
368static UINT8 scn2675_IR_pointer;
369static UINT8 scn2674_screen1_l;
370static UINT8 scn2674_screen1_h;
371static UINT8 scn2674_cursor_l;
372static UINT8 scn2674_cursor_h;
373static UINT8 scn2674_screen2_l;
374static UINT8 scn2674_screen2_h;
375
376// End of Video
377316/*
378317LED Segments related to pins (5 is not connected):
379318Unlike the controllers emulated in the layout code, each
r1281r1282
407346      output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i]));
408347      output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64]));
409348   }
410
411349}
412350
413351static void update_lamps(void)
r1281r1282
422360
423361   if (led_extend)
424362   {
425      //Connect 4 uses 'programmable' displays, built from lights.
363      //Some games uses 'programmable' displays, built from lights.
426364      UINT8 pled_segs[2] = {0,0};
427365
428366      static const int lamps1[8] = { 106, 107, 108, 109, 104, 105, 110, 133 };
r1281r1282
442380
443381// palette initialisation /////////////////////////////////////////////////
444382
445PALETTE_INIT( mpu4 )
383static PALETTE_INIT( mpu4 )
446384{
447385   int i;
448386   static const rgb_t color[16] =
r1281r1282
498436
499437      memory_configure_bank(1, 0, 8, &rom[0x01000], 0x10000);
500438
501      memory_set_bank(1,0);//?
439      memory_set_bank(1,0);
502440   }
503441
504442}
505443
506444///////////////////////////////////////////////////////////////////////////
507445
508static MACHINE_RESET( mpu4_vid )
509{
510   ROC10937_reset(0);   // reset display1
511
512//  cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
513   mpu4_stepper_reset();
514
515   lamp_strobe    = 0;
516   lamp_strobe2   = 0;
517   lamp_data      = 0;
518
519   IC23GC    = 0;
520   IC23GB    = 0;
521   IC23GA    = 0;
522   IC23G1    = 1;
523   IC23G2A   = 0;
524   IC23G2B   = 0;
525
526   prot_col  = 0;
527}
528
529///////////////////////////////////////////////////////////////////////////
530
531446static void cpu0_irq(int state)
532447{
533448   if (!serial_card_connected)
r1281r1282
559474   // the output from timer2 is the input clock for timer3
560475   // the output from timer3 is used as a square wave for the alarm output
561476   // and as an external clock source for timer 1!
562
563477}
564478
565479static WRITE8_HANDLER( ic2_o2_callback )
r1281r1282
571485static WRITE8_HANDLER( ic2_o3_callback )
572486{
573487   ptm6840_set_c1(   0, data); // copy output value to IC2 c1
574
575/*  if (serial_card_connected)
576    {
577        m6809_m68k_line=data;
578    }*/
579488}
580489
581490static const ptm6840_interface ptm_ic2_intf =
r1281r1282
615524
616525static WRITE8_HANDLER( pia_ic3_ca2_w )
617526{
618   LOG_IC3(("%04x IC3 PIA Write CA2 (alpha data), %02X\n", activecpu_get_previouspc(),data&0xff));
527   LOG_IC3(("%04x IC3 PIA Write CA2 (alpha data), %02X\n", activecpu_get_previouspc(),data));
619528
620529   alpha_data_line = data;
621530   ROC10937_draw_16seg(0);
r1281r1282
623532
624533static WRITE8_HANDLER( pia_ic3_cb2_w )
625534{
626   LOG_IC3(("%04x IC3 PIA Write CB (alpha reset), %02X\n",activecpu_get_previouspc(),data&0xff));
535   LOG_IC3(("%04x IC3 PIA Write CB (alpha reset), %02X\n",activecpu_get_previouspc(),data));
627536
628537   if ( data ) ROC10937_reset(0);
629538   ROC10937_draw_16seg(0);
r1281r1282
644553IC23 is a 74LS138 1-of-8 Decoder
645554
646555It is used as a multiplexer for the LEDs, lamp selects and inputs.
647
648556*/
649557
650558static void ic23_update(void)
r1281r1282
754662
755663static WRITE8_HANDLER( pia_ic4_ca2_w )
756664{
757   LOG_IC3(("%04x IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", activecpu_get_previouspc(),data&0xFF));
665   LOG_IC3(("%04x IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", activecpu_get_previouspc(),data));
758666
759667   IC23GB = data;
760668   ic23_update();
r1281r1282
773681static READ8_HANDLER( pia_ic5_porta_r )
774682{
775683   LOG(("%04x IC5 PIA Read of Port A (AUX1)\n",activecpu_get_previouspc()));
684//  popmessage("%d",(pia_get_output_a(2) & 0x01));
776685   return readinputportbytag("AUX1");
777686}
778687
r1281r1282
879788      if ( Stepper_optic_state(1) ) optic_pattern |=  0x02;
880789      else                          optic_pattern &= ~0x02;
881790   }
882//  awp_draw_reel(0);
883//  awp_draw_reel(1);
791   draw_reel((0));
792   draw_reel((1));
884793}
885794
886795static WRITE8_HANDLER( pia_ic6_porta_w )
r1281r1282
936845      if ( Stepper_optic_state(3) ) optic_pattern |=  0x08;
937846      else                          optic_pattern &= ~0x08;
938847   }
939//  awp_draw_reel(2);
940//  awp_draw_reel(3);
848   draw_reel((2));
849   draw_reel((3));
941850}
942851
943852static WRITE8_HANDLER( pia_ic7_portb_w )
r1281r1282
1047956};
1048957
1049958
1050// Video
1051
1052/*************************************
1053 *
1054 *  Interrupt system
1055 *
1056 *************************************/
1057
1058/* The interrupt system consists of a 74148 priority encoder
1059   with the following interrupt priorites.  A lower number
1060   indicates a lower priority:
1061
1062    7 - Game Card
1063    6 - Game Card
1064    5 - Game Card
1065    4 - Game Card
1066    3 - 2674 AVDC
1067    2 - 6850 ACIA
1068    1 - 6840 PTM
1069    0 - Unused
1070*/
1071
1072static void update_mpu68_interrupts(void)
1073{
1074   int newstate = 0;
1075
1076   if (m6840_irq_state)//1
1077      newstate = 1;
1078   if (m6850_irq_state)//2
1079      newstate = 2;
1080   if (scn2674_irq_state)//3
1081      newstate = 3;
1082
1083   /* set the new state of the IRQ lines */
1084   if (newstate)
1085   {
1086      LOG(("68k IRQ, %x\n", newstate));
1087      cpunum_set_input_line(1, newstate, ASSERT_LINE);
1088   }
1089   else
1090   {
1091      LOG(("68k IRQ Clear, %x\n", newstate));
1092      cpunum_set_input_line(1, 7, CLEAR_LINE);
1093   }
1094//  m6840_irq_state = 0;
1095//  m6850_irq_state = 0;
1096//  scn2674_irq_state = 0;
1097
1098}
1099
1100// Communications ////////////////////////////////////////////////////////
1101/* Clock values are currently unknown, and are derived from the 68k board.
1102For now, it's fixed to the frequency set by the PTM on initialisation.*/
1103static void cpu1a_acia_irq(int state)
1104{
1105   cpunum_set_input_line(0, M6809_IRQ_LINE, state ? CLEAR_LINE : ASSERT_LINE);
1106//  m6850_irq_state = state;
1107//  update_mpu68_interrupts();
1108   logerror("6809 acia irq \n");
1109}
1110static void cpu1_acia_irq(int state)
1111{
1112//  cpunum_set_input_line(0, M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE);
1113     m6850_irq_state = state;
1114     update_mpu68_interrupts();
1115   logerror("68k acia irq \n");
1116}
1117
1118static struct acia6850_interface m6809_acia_if =
1119{
1120   MPU4_MASTER_CLOCK/44,//This isn't a real division, this is just to work around
1121   MPU4_MASTER_CLOCK/44,//the ACIA code's hard coding
1122   &m68k_m6809_line,
1123   &m6809_m68k_line,
1124   NULL,
1125   NULL,
1126   NULL,
1127   cpu1a_acia_irq
1128};
1129
1130static struct acia6850_interface m68k_acia_if =
1131{
1132   MPU4_MASTER_CLOCK/44,
1133   MPU4_MASTER_CLOCK/44,
1134   &m6809_m68k_line,
1135   &m68k_m6809_line,
1136   NULL,
1137   NULL,
1138   NULL,
1139   cpu1_acia_irq
1140};
1141
1142static void cpu1_irq(int state)
1143{
1144   LOG(("68k IRQ set, %x\n", state));
1145   m6840_irq_state = state;
1146   update_mpu68_interrupts();
1147}
1148
1149static WRITE8_HANDLER( vid_o1_callback )
1150{
1151   ptm6840_set_c2(   1, data); // copy output value to c2
1152}
1153
1154static WRITE8_HANDLER( vid_o2_callback )
1155{
1156   ptm6840_set_c3(   1, data); // copy output value to c3
1157   m6809_m68k_line=data;
1158   m68k_m6809_line=data;
1159}
1160
1161static WRITE8_HANDLER( vid_o3_callback )
1162{
1163   ptm6840_set_c1(   1, data); // copy output value to c1
1164}
1165
1166//Again, this PTM clock might be wrong, it needs tracing from the PCB
1167static const ptm6840_interface ptm_vid_intf =
1168{
1169   VIDEO_MASTER_CLOCK/10,
1170   { MPU4_MASTER_CLOCK/4,0,0 },
1171   { vid_o1_callback, vid_o2_callback, vid_o3_callback },
1172   cpu1_irq
1173};
1174
1175// SCN2674 AVDC emulation
1176
1177/* the chip is actually more complex than this.. character aren't limited to 8 rows high... but I
1178 don't *think* the MPU4 stuff needs otherwise.. yet .. */
1179
1180static const gfx_layout mpu4_vid_char_8x8_layout =
1181{
1182   8,8,
1183   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
1184   4,
1185   { 0,8,16,24 },
1186   { 0,1,2,3,4,5,6,7 },
1187   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
1188   8*32
1189};
1190
1191/* double height */
1192static const gfx_layout mpu4_vid_char_8x16_layout =
1193{
1194   8,16,
1195   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
1196   4,
1197   { 0,8,16,24 },
1198   { 0,1,2,3,4,5,6,7 },
1199   { 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
1200   8*32
1201};
1202
1203/* double width */
1204static const gfx_layout mpu4_vid_char_16x8_layout =
1205{
1206   16,8,
1207   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
1208   4,
1209   { 0,8,16,24 },
1210   { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
1211   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
1212   8*32
1213};
1214
1215/* double height & width */
1216static const gfx_layout mpu4_vid_char_16x16_layout =
1217{
1218   16,16,
1219   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
1220   4,
1221   { 0,8,16,24 },
1222   { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
1223   { 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
1224   8*32
1225};
1226
1227///////////////////////////////////////////////////////////////////////////
1228
1229static UINT8 IR0_scn2674_double_ht_wd;
1230static UINT8 IR0_scn2674_scanline_per_char_row;
1231static UINT8 IR0_scn2674_sync_select;
1232static UINT8 IR0_scn2674_buffer_mode_select;
1233static UINT8 IR1_scn2674_interlace_enable;
1234static UINT8 IR1_scn2674_equalizing_constant;
1235static UINT8 IR2_scn2674_row_table;
1236static UINT8 IR2_scn2674_horz_sync_width;
1237static UINT8 IR2_scn2674_horz_back_porch;
1238static UINT8 IR3_scn2674_vert_front_porch;
1239static UINT8 IR3_scn2674_vert_back_porch;
1240static UINT8 IR4_scn2674_rows_per_screen;
1241static UINT8 IR4_scn2674_character_blink_rate;
1242static UINT8 IR5_scn2674_character_per_row;
1243static UINT8 IR8_scn2674_display_buffer_first_address_LSB;
1244static UINT8 IR9_scn2674_display_buffer_first_address_MSB;
1245static UINT8 IR9_scn2674_display_buffer_last_address;
1246static UINT8 IR10_scn2674_display_pointer_address_lower;
1247static UINT8 IR11_scn2674_display_pointer_address_upper;
1248static UINT8 IR12_scn2674_scroll_start;
1249static UINT8 IR12_scn2674_split_register_1;
1250static UINT8 IR13_scn2674_scroll_end;
1251static UINT8 IR13_scn2674_split_register_2;
1252
1253VIDEO_UPDATE( mpu4_vid )
1254{
1255   int i;
1256
1257   int x,y,count = 0;
1258
1259   fillbitmap(bitmap,machine->pens[0],cliprect);
1260
1261   for (i=0; i < 0x1000; i++)
1262      if (mpu4_vid_vidram_is_dirty[i]==1)
1263      {
1264         decodechar(machine->gfx[mpu4_gfx_index+0], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_8x8_layout);
1265         decodechar(machine->gfx[mpu4_gfx_index+1], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_8x16_layout);
1266         decodechar(machine->gfx[mpu4_gfx_index+2], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_16x8_layout);
1267         decodechar(machine->gfx[mpu4_gfx_index+3], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_16x16_layout);
1268         mpu4_vid_vidram_is_dirty[i]=0;
1269      }
1270
1271
1272   /* this is in main ram.. i think it must transfer it out of here??? */
1273   // count = 0x0018b6/2; // crmaze
1274   // count = 0x004950/2; // turnover
1275
1276   /* we're in row table mode...thats why */
1277
1278   for(y=0;y<=IR4_scn2674_rows_per_screen;y++)
1279   {
1280      int screen2_base = (scn2674_screen2_h<<8)|(scn2674_screen2_l);
1281
1282      UINT16 rowbase = (mpu4_vid_mainram[1+screen2_base+(y*2)]<<8)|mpu4_vid_mainram[screen2_base+(y*2)];
1283      int dbl_size;
1284      int gfxregion = 0;
1285
1286      dbl_size = (rowbase & 0xc000)>>14;  // ONLY if double size is enabled.. otherwise it can address more chars given more RAM
1287
1288      if (dbl_size&2) gfxregion = 1;
1289
1290
1291      for(x=0;x<=IR5_scn2674_character_per_row;x++)
1292      {
1293         UINT16 tiledat;
1294         UINT16 colattr;
1295
1296         tiledat = mpu4_vid_mainram[(rowbase+x)&0x7fff];
1297         colattr = tiledat >>12;
1298         tiledat &= 0x0fff;
1299
1300         drawgfx(bitmap,machine->gfx[gfxregion],tiledat,colattr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0);
1301
1302         count++;
1303      }
1304
1305      if (dbl_size&2) y++; // skip a row?
1306
1307   }
1308
1309   popmessage("%02x %02x %02x %02x %02x %02x",scn2674_screen1_l,scn2674_screen1_h,scn2674_cursor_l, scn2674_cursor_h,scn2674_screen2_l,scn2674_screen2_h);
1310
1311   for (i=0; i<8; i++)
1312      mpu4_draw_led(i, led_segs[i]);
1313
1314   return 0;
1315}
1316
1317READ16_HANDLER( mpu4_vid_vidram_r )
1318{
1319   return mpu4_vid_vidram[offset];
1320}
1321
1322WRITE16_HANDLER( mpu4_vid_vidram_w )
1323{
1324   COMBINE_DATA(&mpu4_vid_vidram[offset]);
1325   offset <<= 1;
1326   mpu4_vid_vidram_is_dirty[offset/0x20]=1;
1327}
1328
1329/*
1330SCN2674 - Advanced Video Display Controller (AVDC)  (Video Chip)
1331
133215 Initialization Registers (8-bit each)
1333
1334-- fill me in later ---
1335
1336IR0  ---- ----
1337IR1  ---- ----
1338IR2  ---- ----
1339IR3  ---- ----
1340IR4  ---- ----
1341IR5  ---- ----
1342IR6  ---- ----
1343IR7  ---- ----
1344IR8  ---- ----
1345IR9  ---- ----
1346IR10 ---- ----
1347IR11 ---- ----
1348IR12 ---- ----
1349IR13 ---- ----
1350IR14 ---- ----
1351
1352*/
1353
1354static void scn2674_write_init_regs(UINT8 data)
1355{
1356   LOGSTUFF(("scn2674_write_init_regs %02x %02x\n",scn2675_IR_pointer,data));
1357
1358   scn2674_IR[scn2675_IR_pointer]=data;
1359
1360
1361   switch ( scn2675_IR_pointer) // display some debug info, set mame specific variables
1362   {
1363      case 0:
1364         IR0_scn2674_double_ht_wd = (data & 0x80)>>7;
1365         IR0_scn2674_scanline_per_char_row = (data & 0x78)>>3;
1366         IR0_scn2674_sync_select = (data&0x04)>>2;
1367         IR0_scn2674_buffer_mode_select = (data&0x03);
1368
1369            LOGSTUFF(("IR0 - Double Ht Wd %02x\n",IR0_scn2674_double_ht_wd));
1370            LOGSTUFF(("IR0 - Scanlines per Character Row %02x\n",IR0_scn2674_scanline_per_char_row));
1371            LOGSTUFF(("IR0 - Sync Select %02x\n",IR0_scn2674_sync_select));
1372            LOGSTUFF(("IR0 - Buffer Mode Select %02x\n",IR0_scn2674_buffer_mode_select));
1373         break;
1374
1375      case 1:
1376         IR1_scn2674_interlace_enable = (data&0x80)>>7;
1377         IR1_scn2674_equalizing_constant = (data&0x7f);
1378
1379            LOGSTUFF(("IR1 - Interlace Enable %02x\n",IR1_scn2674_interlace_enable));
1380         LOGSTUFF(("IR1 - Equalizing Constant %02x\n",IR1_scn2674_equalizing_constant));
1381         break;
1382
1383      case 2:
1384         IR2_scn2674_row_table = (data&0x80)>>7;
1385         IR2_scn2674_horz_sync_width = (data&0x78)>>3;
1386         IR2_scn2674_horz_back_porch = (data&0x07);
1387
1388            LOGSTUFF(("IR2 - Row Table %02x\n",IR2_scn2674_row_table));
1389         LOGSTUFF(("IR2 - Horizontal Sync Width %02x\n",IR2_scn2674_horz_sync_width));
1390         LOGSTUFF(("IR2 - Horizontal Back Porch %02x\n",IR2_scn2674_horz_back_porch));
1391         break;
1392
1393      case 3:
1394         IR3_scn2674_vert_front_porch = (data&0xe0)>>5;
1395         IR3_scn2674_vert_back_porch = (data&0x1f)>>0;
1396
1397            LOGSTUFF(("IR3 - Vertical Front Porch %02x\n",IR3_scn2674_vert_front_porch));
1398            LOGSTUFF(("IR3 - Vertical Back Porch %02x\n",IR3_scn2674_vert_back_porch));
1399         break;
1400
1401      case 4:
1402            IR4_scn2674_rows_per_screen = data&0x7f;
1403         IR4_scn2674_character_blink_rate = (data & 0x80)>>7;
1404
1405            LOGSTUFF(("IR4 - Rows Per Screen %02x\n",IR4_scn2674_rows_per_screen));
1406            LOGSTUFF(("IR4 - Character Blink Rate %02x\n",IR4_scn2674_character_blink_rate));
1407         break;
1408
1409      case 5:
1410         /* IR5 - Active Characters Per Row
1411             cccc cccc
1412             c = Characters Per Row */
1413            IR5_scn2674_character_per_row = data;
1414            LOGSTUFF(("IR5 - Active Characters Per Row %02x\n",IR5_scn2674_character_per_row));
1415         break;
1416
1417      case 6:
1418         break;
1419
1420      case 7:
1421         break;
1422
1423      case 8:
1424         IR8_scn2674_display_buffer_first_address_LSB = data;
1425            LOGSTUFF(("IR8 - Display Buffer First Address LSB %02x\n",IR8_scn2674_display_buffer_first_address_LSB));
1426         break;
1427
1428      case 9:
1429         IR9_scn2674_display_buffer_first_address_MSB = data & 0x0f;
1430         IR9_scn2674_display_buffer_last_address = (data & 0xf0)>>4;
1431            LOGSTUFF(("IR9 - Display Buffer First Address MSB %02x\n",IR9_scn2674_display_buffer_first_address_MSB));
1432            LOGSTUFF(("IR9 - Display Buffer Last Address %02x\n",IR9_scn2674_display_buffer_last_address));
1433         break;
1434
1435      case 10:
1436         IR10_scn2674_display_pointer_address_lower = data;
1437            LOGSTUFF(("IR10 - Display Pointer Address Lower %02x\n",IR10_scn2674_display_pointer_address_lower));
1438         break;
1439
1440      case 11:
1441         IR11_scn2674_display_pointer_address_upper= data&0x3f;
1442            LOGSTUFF(("IR11 - Display Pointer Address Lower %02x\n",IR11_scn2674_display_pointer_address_upper));
1443         break;
1444
1445      case 12:
1446         IR12_scn2674_scroll_start = (data & 0x80)>>7;
1447         IR12_scn2674_split_register_1 = (data & 0x7f);
1448            LOGSTUFF(("IR12 - Scroll Start %02x\n",IR12_scn2674_scroll_start));
1449            LOGSTUFF(("IR12 - Split Register 1 %02x\n",IR12_scn2674_split_register_1));
1450         break;
1451
1452      case 13:
1453         IR13_scn2674_scroll_end = (data & 0x80)>>7;
1454         IR13_scn2674_split_register_2 = (data & 0x7f);
1455            LOGSTUFF(("IR13 - Scroll End %02x\n",IR13_scn2674_scroll_end));
1456            LOGSTUFF(("IR13 - Split Register 2 %02x\n",IR13_scn2674_split_register_2));
1457         break;
1458
1459      case 14:
1460         break;
1461
1462      case 15: // not valid!
1463         break;
1464
1465
1466   }
1467
1468   scn2675_IR_pointer++;
1469   if (scn2675_IR_pointer>14)scn2675_IR_pointer=14;
1470}
1471
1472static UINT8 scn2674_irq_register = 0;
1473static UINT8 scn2674_status_register = 0;
1474static UINT8 scn2674_irq_mask = 0;
1475static UINT8 scn2674_gfx_enabled;
1476static UINT8 scn2674_display_enabled;
1477static UINT8 scn2674_cursor_enabled;
1478
1479static void scn2674_write_command(UINT8 data)
1480{
1481   UINT8 oprand;
1482
1483   LOGSTUFF(("scn2674_write_command %02x\n",data));
1484
1485   if (data==0x00)
1486   {
1487      // master reset
1488      LOGSTUFF(("master reset %02x\n",data));
1489   }
1490
1491   if ((data&0xf0)==0x10)
1492   {
1493      // set IR pointer
1494      LOGSTUFF(("set IR pointer %02x\n",data));
1495
1496      oprand = data & 0x0f;
1497      scn2675_IR_pointer=oprand;
1498
1499   }
1500
1501   /*** ANY COMBINATION OF THESE ARE POSSIBLE */
1502
1503   if ((data&0xe3)==0x22)
1504   {
1505      // Disable GFX
1506      LOGSTUFF(("disable GFX %02x\n",data));
1507      scn2674_gfx_enabled = 0;
1508   }
1509
1510   if ((data&0xe3)==0x23)
1511   {
1512      // Enable GFX
1513      LOGSTUFF(("enable GFX %02x\n",data));
1514      scn2674_gfx_enabled = 1;
1515   }
1516
1517   if ((data&0xe9)==0x28)
1518   {
1519      // Display off
1520      oprand = data & 0x04;
1521
1522      scn2674_display_enabled = 0;
1523
1524      if (oprand)
1525         LOGSTUFF(("display OFF - float DADD bus %02x\n",data));
1526      else
1527         LOGSTUFF(("display OFF - no float DADD bus %02x\n",data));
1528   }
1529
1530   if ((data&0xe9)==0x29)
1531   {
1532      // Display on
1533      oprand = data & 0x04;
1534
1535      scn2674_display_enabled = 1;
1536
1537      if (oprand)
1538         LOGSTUFF(("display ON - next field %02x\n",data));
1539      else
1540         LOGSTUFF(("display ON - next scanline %02x\n",data));
1541
1542   }
1543
1544   if ((data&0xf1)==0x30)
1545   {
1546      // Cursor Off
1547      LOGSTUFF(("cursor off %02x\n",data));
1548      scn2674_cursor_enabled = 0;
1549   }
1550
1551   if ((data&0xf1)==0x31)
1552   {
1553      // Cursor On
1554      LOGSTUFF(("cursor on %02x\n",data));
1555      scn2674_cursor_enabled = 1;
1556   }
1557
1558   /*** END ***/
1559
1560   if ((data&0xe0)==0x40)
1561   {
1562      // Reset Interrupt / Status bit
1563      oprand = data & 0x1f;
1564      LOGSTUFF(("reset interrupt / status bit %02x\n",data));
1565
1566      LOGSTUFF(("Split 2   IRQ: %d Reset\n",(data>>0)&1));
1567      LOGSTUFF(("Ready     IRQ: %d Reset\n",(data>>1)&1));
1568      LOGSTUFF(("Split 1   IRQ: %d Reset\n",(data>>2)&1));
1569      LOGSTUFF(("Line Zero IRQ: %d Reset\n",(data>>3)&1));
1570      LOGSTUFF(("V-Blank   IRQ: %d Reset\n",(data>>4)&1));
1571
1572      scn2674_irq_register &= ((data & 0x1f)^0x1f);
1573      scn2674_status_register &= ((data & 0x1f)^0x1f);
1574
1575      if(data&0x10) //cpunum_set_input_line(1, 3, ASSERT_LINE); // maybe .. or maybe it just changes the register
1576      {
1577         scn2674_irq_state = 1;
1578         update_mpu68_interrupts();
1579      }
1580      else
1581      scn2674_irq_state = 0;
1582      update_mpu68_interrupts();
1583   }
1584   if ((data&0xe0)==0x80)
1585   {
1586      // Disable Interrupt
1587      oprand = data & 0x1f;
1588      LOGSTUFF(("disable interrupt %02x\n",data));
1589      LOGSTUFF(("Split 2   IRQ: %d Disabled\n",(data>>0)&1));
1590      LOGSTUFF(("Ready     IRQ: %d Disabled\n",(data>>1)&1));
1591      LOGSTUFF(("Split 1   IRQ: %d Disabled\n",(data>>2)&1));
1592      LOGSTUFF(("Line Zero IRQ: %d Disabled\n",(data>>3)&1));
1593      LOGSTUFF(("V-Blank   IRQ: %d Disabled\n",(data>>4)&1));
1594
1595//      scn2674_irq_mask &= ((data & 0x1f)^0x1f); // disables.. doesn't enable?
1596
1597      scn2674_irq_mask &= ~(data & 0x1f);
1598   }
1599
1600   if ((data&0xe0)==0x60)
1601   {
1602      // Enable Interrupt
1603      LOGSTUFF(("enable interrupt %02x\n",data));
1604      LOGSTUFF(("Split 2   IRQ: %d Enabled\n",(data>>0)&1));
1605      LOGSTUFF(("Ready     IRQ: %d Enabled\n",(data>>1)&1));
1606      LOGSTUFF(("Split 1   IRQ: %d Enabled\n",(data>>2)&1));
1607      LOGSTUFF(("Line Zero IRQ: %d Enabled\n",(data>>3)&1));
1608      LOGSTUFF(("V-Blank   IRQ: %d Enabled\n",(data>>4)&1));
1609
1610      scn2674_irq_mask |= (data & 0x1f);  // enables .. doesn't disable?
1611
1612   }
1613
1614   /**** Delayed Commands ****/
1615
1616   if (data == 0xa4)
1617   {
1618      // read at pointer address
1619      LOGSTUFF(("read at pointer address %02x\n",data));
1620   }
1621
1622   if (data == 0xa2)
1623   {
1624      // write at pointer address
1625      LOGSTUFF(("write at pointer address %02x\n",data));
1626   }
1627
1628   if (data == 0xa9)
1629   {
1630      // increase cursor address
1631      LOGSTUFF(("increase cursor address %02x\n",data));
1632   }
1633
1634   if (data == 0xac)
1635   {
1636      // read at cursor address
1637      LOGSTUFF(("read at cursor address %02x\n",data));
1638   }
1639
1640   if (data == 0xaa)
1641   {
1642      // write at cursor address
1643      LOGSTUFF(("write at cursor address %02x\n",data));
1644   }
1645
1646   if (data == 0xad)
1647   {
1648      // read at cursor address + incrememnt
1649      LOGSTUFF(("read at cursor address+increment %02x\n",data));
1650   }
1651
1652   if (data == 0xab)
1653   {
1654      // write at cursor address + incrememnt
1655      LOGSTUFF(("write at cursor address+increment %02x\n",data));
1656   }
1657
1658   if (data == 0xbb)
1659   {
1660      // write from cursor address to pointer address
1661      LOGSTUFF(("write from cursor address to pointer address %02x\n",data));
1662   }
1663
1664   if (data == 0xbd)
1665   {
1666      // read from cursor address to pointer address
1667      LOGSTUFF(("read from cursor address to pointer address %02x\n",data));
1668   }
1669
1670}
1671
1672READ16_HANDLER( mpu4_vid_scn2674_r )
1673{
1674   /*
1675    Offset:  Purpose
1676     0       Interrupt Register
1677     1       Status Register
1678     2       Screen Start 1 Lower Register
1679     3       Screen Start 1 Upper Register
1680     4       Cursor Address Lower Register
1681     5       Cursor Address Upper Register
1682     6       Screen Start 2 Lower Register
1683     7       Screen Start 2 Upper Register
1684    */
1685
1686   switch (offset)
1687   {
1688
1689      /*  Status / Irq Register
1690
1691            --RV ZSRs
1692
1693            -- = ALWAYS 0
1694            R  = RDFLG (Status Register Only)
1695            V  = Vblank
1696            Z  = Line Zero
1697            S  = Split 1
1698            R  = Ready
1699            s  = Split 2
1700        */
1701      case 0:
1702         LOGSTUFF(("Read Irq Register %06x\n",activecpu_get_pc()));
1703         return scn2674_irq_register;
1704
1705      case 1:
1706         LOGSTUFF(("Read Status Register %06x\n",activecpu_get_pc()));
1707         return scn2674_status_register;
1708
1709      case 2: LOGSTUFF(("Read Screen1_l Register %06x\n",activecpu_get_pc()));return scn2674_screen1_l;
1710      case 3: LOGSTUFF(("Read Screen1_h Register %06x\n",activecpu_get_pc()));return scn2674_screen1_h;
1711      case 4: LOGSTUFF(("Read Cursor_l Register %06x\n",activecpu_get_pc()));return scn2674_cursor_l;
1712      case 5: LOGSTUFF(("Read Cursor_h Register %06x\n",activecpu_get_pc()));return scn2674_cursor_h;
1713      case 6:   LOGSTUFF(("Read Screen2_l Register %06x\n",activecpu_get_pc()));return scn2674_screen2_l;
1714      case 7: LOGSTUFF(("Read Screen2_h Register %06x\n",activecpu_get_pc()));return scn2674_screen2_h;
1715   }
1716
1717   return 0xffff;
1718}
1719
1720WRITE16_HANDLER( mpu4_vid_scn2674_w )
1721{
1722   /*
1723    Offset:  Purpose
1724     0       Initialization Registers
1725     1       Command Register
1726     2       Screen Start 1 Lower Register
1727     3       Screen Start 1 Upper Register
1728     4       Cursor Address Lower Register
1729     5       Cursor Address Upper Register
1730     6       Screen Start 2 Lower Register
1731     7       Screen Start 2 Upper Register
1732    */
1733
1734   data &=0x00ff; // it's an 8-bit chip on a 16-bit board, feel the cheapness.
1735
1736   switch (offset)
1737   {
1738      case 0:
1739         scn2674_write_init_regs(data);
1740         break;
1741
1742      case 1:
1743         scn2674_write_command(data);
1744         break;
1745
1746      case 2: scn2674_screen1_l = data; break;
1747      case 3: scn2674_screen1_h = data; break;
1748      case 4: scn2674_cursor_l  = data; break;
1749      case 5: scn2674_cursor_h  = data; break;
1750      case 6:   scn2674_screen2_l = data; break;
1751      case 7: scn2674_screen2_h = data; break;
1752   }
1753}
1754
1755READ16_HANDLER( mpu4_vid_unmap_r )
1756{
1757   //logerror("Data %s Offset %s", data, offset);
1758   return mame_rand(Machine);
1759}
1760
1761WRITE16_HANDLER( mpu4_vid_unmap_w )
1762{
1763   LOG(("WData %d WOffset %d", data, offset));
1764}
1765
1766VIDEO_START( mpu4_vid )
1767{
1768   /* if anything uses tile sizes other than 8x8 we can't really do it this way.. we'll have to draw tiles by hand.
1769      maybe we will anyway, but for now we don't need to */
1770
1771   mpu4_vid_vidram = auto_malloc (0x20000);
1772   mpu4_vid_vidram_is_dirty = auto_malloc(0x1000);
1773
1774   memset(mpu4_vid_vidram_is_dirty,1,0x1000);
1775   memset(mpu4_vid_vidram,0,0x20000);
1776
1777    /* find first empty slot to decode gfx */
1778   for (mpu4_gfx_index = 0; mpu4_gfx_index < MAX_GFX_ELEMENTS; mpu4_gfx_index++)
1779      if (machine->gfx[mpu4_gfx_index] == 0)
1780         break;
1781
1782   assert(mpu4_gfx_index != MAX_GFX_ELEMENTS);
1783
1784   /* create the char set (gfx will then be updated dynamically from RAM) */
1785   machine->gfx[mpu4_gfx_index+0] = allocgfx(&mpu4_vid_char_8x8_layout);
1786   machine->gfx[mpu4_gfx_index+1] = allocgfx(&mpu4_vid_char_8x16_layout);
1787   machine->gfx[mpu4_gfx_index+2] = allocgfx(&mpu4_vid_char_16x8_layout);
1788   machine->gfx[mpu4_gfx_index+3] = allocgfx(&mpu4_vid_char_16x16_layout);
1789
1790   /* set the color information */
1791   machine->gfx[mpu4_gfx_index+0]->total_colors = machine->drv->total_colors / 16;
1792   machine->gfx[mpu4_gfx_index+1]->total_colors = machine->drv->total_colors / 16;
1793   machine->gfx[mpu4_gfx_index+2]->total_colors = machine->drv->total_colors / 16;
1794   machine->gfx[mpu4_gfx_index+3]->total_colors = machine->drv->total_colors / 16;
1795
1796   scn2675_IR_pointer = 0;
1797}
1798
1799/* palette support is very preliminary */
1800static UINT8 ef9369_palette[32];
1801static UINT8 ef9369_counter;
1802
1803static WRITE16_HANDLER( ef9369_data_w )
1804{
1805   int color;
1806   UINT16 coldat;
1807
1808   data &=0x00ff;
1809
1810   ef9369_palette[ef9369_counter] = data;
1811
1812   color = ef9369_counter/2;
1813   coldat = (ef9369_palette[color*2+1]<<8)|ef9369_palette[color*2];
1814   palette_set_color_rgb(Machine,color,pal4bit(coldat >> 0),pal4bit(coldat >> 8),pal4bit(coldat >> 4));
1815
1816   ef9369_counter++;
1817   if (ef9369_counter>31) ef9369_counter = 31;
1818}
1819
1820static WRITE16_HANDLER( ef9369_address_w )
1821{
1822   data &=0x00ff;
1823
1824   ef9369_counter = data*2; // = 0?
1825
1826   if (ef9369_counter>30) ef9369_counter = 30;
1827
1828}
1829
1830959// input ports for MPU4 board ////////////////////////////////////////
1831960
1832961static INPUT_PORTS_START( mpu4 )
r1281r1282
1851980   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("15")
1852981
1853982   PORT_START_TAG("BLACK1")
1854   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("16")
1855   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("17")
1856   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("18")
1857   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("19")
1858   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("20")
1859   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test Switch")
983   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Hi")
984   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Lo")
985   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER)   PORT_NAME("18")
986   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER)   PORT_NAME("19")
987   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER)    PORT_NAME("20")
988   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W)
1860989   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
1861   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Door Switch?") PORT_TOGGLE
990   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
1862991
1863992   PORT_START_TAG("BLACK2")
1864993   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("24")
1865994   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("25")
1866   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("26")
1867   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("27")
1868   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("28")
1869   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("29")
1870   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("30")
1871   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("31")
995   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Cancel")
996   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Hold 1")
997   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Hold 2")
998   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Hold 3")
999   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Hold 4")
1000   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_START1)
18721001
18731002   PORT_START_TAG("DIL1")
18741003   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
r1281r1282
20471176   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6")
20481177   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7")
20491178
2050   PORT_START_TAG("AUX2")
2051   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
1179     PORT_START_TAG("AUX2")
1180     PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
20521181   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
20531182   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
20541183   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
r1281r1282
20591188
20601189INPUT_PORTS_END
20611190
2062static INPUT_PORTS_START( crmaze )
2063   PORT_START_TAG("ORANGE1")
2064   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("00")
2065   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("01")
2066   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("02")
2067   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("03")
2068   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("04")
2069   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("05")
2070   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("06")
2071   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("07")
2072
2073   PORT_START_TAG("ORANGE2")
2074   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("08")
2075   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("09")
2076   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10")
2077   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("11")
2078   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("12")
2079   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("13")
2080   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("14")
2081   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("200p?")
2082
2083   PORT_START_TAG("BLACK1")
2084   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("16")
2085   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("17")
2086   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("18")
2087   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("19")
2088   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("20")
2089   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Switch")
2090   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
2091   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Door Switch?") PORT_TOGGLE
2092
2093   PORT_START_TAG("BLACK2")
2094   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Yellow")
2095   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Red")
2096   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("26")
2097   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Yellow")
2098   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Red")
2099   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Getout Yellow")
2100   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Getout Red")//Labelled Escape on cabinet
2101   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("100p Service?")PORT_IMPULSE(100)
2102
2103   PORT_START_TAG("DIL1")
2104   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
2105   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2106   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
2107   PORT_DIPNAME( 0x02, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
2108   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2109   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2110   PORT_DIPNAME( 0x04, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
2111   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2112   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2113   PORT_DIPNAME( 0x08, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
2114   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2115   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
2116   PORT_DIPNAME( 0x10, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
2117   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2118   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2119   PORT_DIPNAME( 0x20, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
2120   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2121   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2122   PORT_DIPNAME( 0x40, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
2123   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2124   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2125   PORT_DIPNAME( 0x80, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
2126   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2127   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2128
2129   PORT_START_TAG("DIL2")
2130   PORT_DIPNAME( 0x01, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
2131   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2132   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
2133   PORT_DIPNAME( 0x02, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
2134   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2135   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2136   PORT_DIPNAME( 0x04, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
2137   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2138   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2139   PORT_DIPNAME( 0x08, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
2140   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2141   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
2142   PORT_DIPNAME( 0x10, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
2143   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2144   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2145   PORT_DIPNAME( 0x20, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
2146   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2147   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2148   PORT_DIPNAME( 0x40, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
2149   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2150   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2151   PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
2152   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2153   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2154
2155   PORT_START_TAG("AUX1")//Presumed to be trackball, but only one phase available?
2156   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0")
2157   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1")
2158   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2")
2159   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3")
2160   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4")
2161   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5")
2162   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6")
2163   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7")
2164
2165   PORT_START_TAG("AUX2")
2166   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
2167   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
2168   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
2169   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
2170   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
2171   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
2172   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
2173   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
2174
2175INPUT_PORTS_END
2176
2177static INPUT_PORTS_START( dealem )
2178   PORT_START_TAG("ORANGE1")
2179   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Gamble")
2180   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Pontoon")
2181   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2182   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2183   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2184   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2185   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2186   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Rear Door") PORT_TOGGLE
2187
2188   PORT_START_TAG("ORANGE2")
2189   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN5) PORT_NAME("20p Token")PORT_IMPULSE(3)
2190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
2191   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2192   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2193   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2194   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2195   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2196   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2197
2198   PORT_START_TAG("BLACK1")
2199   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Collect")
2200   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) //Duplicate for Pontoon button
2201   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2202   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2203   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2204   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W)
2205   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
2206   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
2207
2208   PORT_START_TAG("BLACK2")
2209   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Hi-Lo")
2210   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
2211   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Twist")
2212   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Lo")
2213   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Hi")
2214   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Stick")
2215   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2216   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Deal")
2217
2218   PORT_START_TAG("DIL1")
2219   PORT_DIPNAME( 0x0f, 0x00, "Cabinet Set Up Mode" ) PORT_DIPLOCATION("DIL1:01,02,03,04")
2220   PORT_DIPSETTING(    0x00, "Stop The Clock" )
2221   PORT_DIPSETTING(    0x01, "Hit the Top" )
2222   PORT_DIPSETTING(    0x02, "Way In" )
2223   PORT_DIPSETTING(    0x03, "Smash and Grab" )
2224   PORT_DIPSETTING(    0x04, "Ready Steady Go-1" )
2225   PORT_DIPSETTING(    0x05, "Ready Steady Go-2" )
2226   PORT_DIPSETTING(    0x06, "Top Gears-1" )
2227   PORT_DIPSETTING(    0x07, "Top Gears-2" )
2228   PORT_DIPSETTING(    0x08, "Nifty Fifty" )
2229   PORT_DIPSETTING(    0x09, "Super Tubes" )
2230   PORT_DIPNAME( 0x70, 0x00, "Target Payout Percentage" ) PORT_DIPLOCATION("DIL1:05,06,07")
2231   PORT_DIPSETTING(    0x00, "72%" )
2232   PORT_DIPSETTING(    0x10, "74%" )
2233   PORT_DIPSETTING(    0x20, "76%" )
2234   PORT_DIPSETTING(    0x30, "78%" )
2235   PORT_DIPSETTING(    0x40, "80%" )
2236   PORT_DIPSETTING(    0x50, "82%" )
2237   PORT_DIPSETTING(    0x60, "84%" )
2238   PORT_DIPSETTING(    0x70, "86%" )
2239   PORT_DIPNAME( 0x80, 0x00, "Display Switch Settings on Monitor" ) PORT_DIPLOCATION("DIL1:08")
2240   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2241   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2242
2243   PORT_START_TAG("DIL2")
2244   PORT_DIPNAME( 0x01, 0x00, "Payout Limit" ) PORT_DIPLOCATION("DIL2:01")
2245   PORT_DIPSETTING(    0x00, "200p (All Cash)")
2246   PORT_DIPSETTING(    0x01, "200p (Cash)+400p (Token)")
2247   PORT_DIPNAME( 0x02, 0x00, "10p Payout Priority" ) PORT_DIPLOCATION("DIL2:02")
2248   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2249   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2250   PORT_DIPNAME( 0x04, 0x00, "Clear Credits and bank at power on?" ) PORT_DIPLOCATION("DIL2:03")
2251   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2252   PORT_DIPSETTING(    0x04, DEF_STR( Yes  ) )
2253   PORT_DIPNAME( 0x08, 0x00, "50p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:04")
2254   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2255   PORT_DIPSETTING(    0x08, DEF_STR( Yes  ) )
2256   PORT_DIPNAME( 0x10, 0x00, "100p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:05")
2257   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2258   PORT_DIPSETTING(    0x10, DEF_STR( Yes  ) )
2259   PORT_DIPNAME( 0x20, 0x00, "Coin alarms active?" ) PORT_DIPLOCATION("DIL2:06")
2260   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
2261   PORT_DIPSETTING(    0x00, DEF_STR( Yes  ) )
2262   PORT_DIPNAME( 0x40, 0x00, "Price of Play" ) PORT_DIPLOCATION("DIL2:07")
2263   PORT_DIPSETTING(    0x00, "10p 1 Game" )
2264   PORT_DIPSETTING(    0x40, "10p 2 Games" )
2265   PORT_DIPNAME( 0x80, 0x00, "Coin Entry" ) PORT_DIPLOCATION("DIL2:08")
2266   PORT_DIPSETTING(    0x00, "Multi" )
2267   PORT_DIPSETTING(    0x80, DEF_STR(Single))
2268
2269   PORT_START_TAG("AUX1")
2270   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
2271   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
2272   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2273   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2274   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2275   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2276   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2277   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2278
2279   PORT_START_TAG("AUX2")
2280   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
2281   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
2282   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
2283   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
2284   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
2285   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
2286   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
2287   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
2288
2289INPUT_PORTS_END
2290
2291/*
2292
2293IRQ  1  MC68A40 PTM   // On VDU board
2294IRQ  2  MC68A50 ACIA  // On MPU4 cart?
2295IRQ  3  SCN2674 AVDC  // On VDU board
2296IRQ 4-7 Program Card
2297
2298*/
2299
2300INTERRUPT_GEN(mpu4_vid_irq)
2301{
2302//  if (cpu_getiloops()&1)
2303//      cpunum_set_input_line(1, 1, ASSERT_LINE);
2304//  else
2305  LOGSTUFF(("scn2674_irq_mask %02x",scn2674_irq_mask));
2306
2307   if (cpu_getiloops()==0) // vbl
2308   {
2309   //  if (scn2674_display_enabled) // ?
2310      {
2311         if (scn2674_irq_mask&0x10)
2312         {
2313            LOGSTUFF(("vblank irq\n"));
2314            scn2674_irq_state = 1;
2315            update_mpu68_interrupts();
2316
2317            scn2674_irq_register |= 0x10;
2318            scn2674_irq_state = 0;
2319         }
2320      }
2321      scn2674_status_register |= 0x10;
2322
2323   }
2324}
2325
23261191static void mpu4_config_common(void)
23271192{
23281193   pia_config(0,&pia_ic3_intf);
r1281r1282
23321197   pia_config(4,&pia_ic7_intf);
23331198   pia_config(5,&pia_ic8_intf);
23341199
2335   freq_timer = mame_timer_alloc(freq_timeout);
23361200   ic24_timer = mame_timer_alloc(ic24_timeout);
23371201   // setup ptm ////////////////////////////////////////////////////////////
23381202   ptm6840_config(0, &ptm_ic2_intf );
23391203}
23401204
2341// machine start (called only once) /////////////////////////////////////
2342
2343MACHINE_START( mpu4_vid )
2344{
2345   mpu4_config_common();
2346   pia_reset();
2347
2348   ptm6840_config(1, &ptm_vid_intf );
2349
2350// setup comms///////////////////////////////////////////////////////////
2351   serial_card_connected=1;
2352   acia6850_config(0, &m6809_acia_if);
2353   acia6850_config(1, &m68k_acia_if);
2354
2355// setup 8 mechanical meters ////////////////////////////////////////////
2356   Mechmtr_init(8);
2357
2358// setup 4 default 96 half step reels ///////////////////////////////////
2359
2360   Stepper_init(0, BARCREST_48STEP_REEL);
2361   Stepper_init(1, BARCREST_48STEP_REEL);
2362   Stepper_init(2, BARCREST_48STEP_REEL);
2363   Stepper_init(3, BARCREST_48STEP_REEL);
2364
2365/*  Stepper_set_index(0,92,8,0);
2366    Stepper_set_index(1,92,8,0);
2367    Stepper_set_index(2,92,8,0);
2368    Stepper_set_index(3,92,8,0);*/
2369
2370// setup the standard oki MSC1937 display ///////////////////////////////
2371
2372   ROC10937_init(0, MSC1937,0);   // ?
2373}
2374
23751205static MACHINE_START( mpu4mod2 )
23761206{
23771207   mpu4_config_common();
r1281r1282
23891219   Stepper_init(2, BARCREST_48STEP_REEL);
23901220   Stepper_init(3, BARCREST_48STEP_REEL);
23911221
2392/*  Stepper_set_index(0,92,8,0);
2393    Stepper_set_index(1,5,6,0);
2394    Stepper_set_index(2,92,8,0);
2395    Stepper_set_index(3,1,6,0);*/
2396
23971222// setup the standard oki MSC1937 display ///////////////////////////////
23981223   ROC10937_init(0, MSC1937,0);
23991224}
r1281r1282
24231248The initial 'PALTEST' routine as found in the Barcrest programs simply writes the first 'call' to the CHR space,
24241249to read back the 'response'. There is no attempt to alter the order or anything else, just
24251250a simple runthrough of the entire data table. The only 'catch' in this is to note that the CHR chip always scans
2426through the table starting at the last accessed data value - there are duplications within the table to catch out
2427the unwary.
1251through the table starting at the last accessed data value, unless 00 is used to reset to the beginning.
24281252
24291253However, a final 8 byte row, that controls the lamp matrix is not tested - to date, no-one outside of Barcrest knows
24301254how this is generated, and currently trial and error is the only sensible method. It is noted that the default,
24311255of all 00, is sometimes the correct answer, particularly in non-Barcrest use of the CHR chip, though when used normally,
24321256there are again fixed call values.
2433
2434Despite the potential to radically overhaul the design, the 68k version of the chip appears to just be a
243516-bit version of the previous design, with some endian-swapping necessary. It is unclear, however, if it has any capacity
2436to affect lamp matrices in the same way as before, as no software seen makes any request for the 'lamp' row.
2437It has been left in the table, as it clearly exists, but is unused.
2438The 'quiz' games on the board did use an address-scrambling PAL for encryption, and the very last mod had a characteriser capable
2439of scrambling the ROM address lines.
24401257*/
24411258
24421259static WRITE8_HANDLER( characteriser_w )
r1281r1282
25001317   return 0;
25011318}
25021319
2503static WRITE16_HANDLER( characteriser16_w )
2504{
2505   int x;
2506   int call=data;
2507   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", activecpu_get_previouspc(),offset,data));
2508   for ( x = prot_col; x < 64; x++ )
2509   {
2510      if (call == 0)
2511      {
2512         prot_col = 0;
2513      }
2514      else
2515      {
2516         if   (MPU4_chr_lut[(x)] == call)
2517         {
2518            prot_col = x;
2519            LOG_CHR(("Characteriser find column %02X\n",prot_col));
2520            break;
2521         }
2522      }
2523   }
2524}
2525
2526static READ16_HANDLER( characteriser16_r )
2527{
2528   LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", activecpu_get_previouspc(),offset,MPU4_chr_data[prot_col]));
2529   LOG_CHR(("Characteriser read offset %02X \n",offset));
2530   LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col]));
2531   return MPU4_chr_data[prot_col];
2532}
2533
25341320// generate a 50 Hz signal (based on an RC time) //////////////////////////
2535
2536static TIMER_CALLBACK( freq_timeout )
2537{
2538   signal_50hz = 0;
2539   pia_set_input_ca1(1,0);   // signal is connected to IC4 CA1
2540}
2541
25421321static INTERRUPT_GEN( gen_50hz )
25431322{
2544   signal_50hz = 1;
1323   // Although reported as a '50Hz' signal, the fact that both rising and
1324   // falling edges of the pulse are used, the timer actually gives a 100Hz
1325   // oscillating signal.
1326   signal_50hz = signal_50hz?0:1;
25451327
2546   pia_set_input_ca1(1,1);   // signal is connected to IC4 CA1
2547
2548   mame_timer_adjust(freq_timer, MAME_TIME_IN_HZ(100), 0, time_zero);
1328   pia_set_input_ca1(1,signal_50hz);   // signal is connected to IC4 CA1
25491329}
25501330
2551static ADDRESS_MAP_START( mpu4_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
2552   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2553
2554//  AM_RANGE(0x600000, 0x63ffff) AM_RAM? In expanded games (mating)
2555
2556   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) // mainram / char address ram?
2557
2558   /* what is here, the sound chip? Assume so */
2559   AM_RANGE(0x900000, 0x900001) AM_WRITE(saa1099_control_port_0_lsb_w)
2560   AM_RANGE(0x900002, 0x900003) AM_WRITE(saa1099_write_port_0_lsb_w)
2561
2562   /* the palette chip */
2563   AM_RANGE(0xa00000, 0xa00001) AM_WRITE(ef9369_data_w)
2564   AM_RANGE(0xa00002, 0xa00003) AM_WRITE(ef9369_address_w)
2565   AM_RANGE(0xa00004, 0xa0000f) //AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w)
2566
2567   AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
2568
2569   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
2570
2571   /* comms with the MPU4 */
2572    AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(acia6850_1_stat_lsb_r, acia6850_1_ctrl_lsb_w)
2573    AM_RANGE(0xff8002, 0xff8003) AM_READWRITE(acia6850_1_data_lsb_r, acia6850_1_data_lsb_w)
2574
2575   AM_RANGE(0xff9000, 0xff900f) AM_READ(  ptm6840_1_lsb_r)
2576   AM_RANGE(0xff9000, 0xff900f) AM_WRITE( ptm6840_1_lsb_w)
2577
2578   /* characterizer */
2579   AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) // Word-based version of old CHR???
2580ADDRESS_MAP_END
2581
2582/* TODO: Fix up MPU4 map*/
2583static ADDRESS_MAP_START( mpu4_6809_map, ADDRESS_SPACE_PROGRAM, 8 )
2584   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
2585
2586   AM_RANGE(0x0800, 0x0800) AM_READWRITE(acia6850_0_stat_r, acia6850_0_ctrl_w)
2587   AM_RANGE(0x0801, 0x0801) AM_READWRITE(acia6850_0_data_r, acia6850_0_data_w)
2588
2589   //AM_RANGE(0x0880, 0x0880) AM_READ(uart1stat_r)     // Could be a UART datalogger is here.
2590   //AM_RANGE(0x0880, 0x0880) AM_WRITE(uart1ctrl_w)    // Or a PIA?
2591   //AM_RANGE(0x0881, 0x0881) AM_READ(uart1data_r)
2592   //AM_RANGE(0x0881, 0x0881) AM_WRITE(uart1data_w)
2593   AM_RANGE(0x0880, 0x0881) AM_NOP
2594
2595   AM_RANGE(0x0900, 0x0907) AM_READ( ptm6840_0_r)     // 6840PTM IC2
2596   AM_RANGE(0x0900, 0x0907) AM_WRITE(ptm6840_0_w)
2597
2598   AM_RANGE(0x0A00, 0x0A03) AM_WRITE(pia_0_w)         // PIA6821 IC3
2599   AM_RANGE(0x0A00, 0x0A03) AM_READ( pia_0_r)
2600
2601   AM_RANGE(0x0B00, 0x0B03) AM_WRITE(pia_1_w)         // PIA6821 IC4
2602   AM_RANGE(0x0B00, 0x0B03) AM_READ( pia_1_r)
2603
2604   AM_RANGE(0x0C00, 0x0C03) AM_WRITE(pia_2_w)         // PIA6821 IC5
2605   AM_RANGE(0x0C00, 0x0C03) AM_READ( pia_2_r)
2606
2607   AM_RANGE(0x0D00, 0x0D03) AM_WRITE(pia_3_w)         // PIA6821 IC6
2608   AM_RANGE(0x0D00, 0x0D03) AM_READ( pia_3_r)
2609
2610   AM_RANGE(0x0E00, 0x0E03) AM_WRITE(pia_4_w)         // PIA6821 IC7
2611   AM_RANGE(0x0E00, 0x0E03) AM_READ( pia_4_r)
2612
2613   AM_RANGE(0x0F00, 0x0F03) AM_WRITE(pia_5_w)         // PIA6821 IC8
2614   AM_RANGE(0x0F00, 0x0F03) AM_READ( pia_5_r)
2615
2616   AM_RANGE(0x4000, 0x40ff) AM_RAM // it actually runs code from here...
2617
2618   AM_RANGE(0xBE00, 0xBFFF) AM_RAM //00 written on startup
2619   AM_RANGE(0xC000, 0xFFFF) AM_ROM   AM_REGION(REGION_CPU1,0)  // 64k EPROM on board, only this region read
2620ADDRESS_MAP_END
2621
26221331static ADDRESS_MAP_START( mod2_memmap, ADDRESS_SPACE_PROGRAM, 8 )
26231332   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
26241333
r1281r1282
26541363   AM_RANGE(0x1000, 0xffff) AM_READ(MRA8_BANK1)   // 64k  paged ROM (4 pages)
26551364ADDRESS_MAP_END
26561365
2657//Deal 'Em was designed as an enhanced gamecard, to fit into an existing MPU4 cabinet
2658//It's an unoffical addon, and does all its work through the existing 6809 CPU
2659
2660static const gfx_layout dealemcharlayout =
2661{
2662   8,8,
2663   RGN_FRAC(1,1),
2664   4,
2665   { 0, 1, 2, 3 },
2666   { 3*4, 2*4, 1*4, 0*4, 7*4, 6*4, 5*4, 4*4  },
2667   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
2668   32*8
2669};
2670
2671static GFXDECODE_START( dealem )
2672   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, dealemcharlayout, 0, 1 )
2673GFXDECODE_END
2674
2675UINT8 *dealem_videoram,*dealem_charram;
2676
2677/***************************************************************************
2678
2679  Convert the color PROMs into a more useable format.
2680
2681  The palette PROM is connected to the RGB output this way:
2682
2683  Red:      1K      Bit 0
2684            470R
2685            220R
2686
2687  Green:    1K      Bit 3
2688            470R
2689            220R
2690
2691  Blue:     470R
2692            220R    Bit 7
2693
2694***************************************************************************/
2695
2696PALETTE_INIT( dealem )
2697{
2698   int i;
2699   for (i = 0;i < memory_region_length(REGION_PROMS);i++)
2700   {
2701      int bit0,bit1,bit2,r,g,b;
2702
2703      /* red component */
2704      bit0 = BIT(*color_prom,0);
2705      bit1 = BIT(*color_prom,1);
2706      bit2 = BIT(*color_prom,2);
2707      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
2708      /* green component */
2709      bit0 = BIT(*color_prom,3);
2710      bit1 = BIT(*color_prom,4);
2711      bit2 = BIT(*color_prom,5);
2712      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
2713      /* blue component */
2714      bit0 = 0;
2715      bit1 = BIT(*color_prom,6);
2716      bit2 = BIT(*color_prom,7);
2717      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
2718
2719      palette_set_color(machine,i,MAKE_RGB(r,g,b));
2720      color_prom++;
2721   }
2722
2723}
2724
2725VIDEO_START(dealem)
2726{
2727}
2728
2729VIDEO_UPDATE(dealem)
2730{
2731   int x,y;
2732   int count = 0;
2733
2734   for (y=0;y<32;y++)
2735   {
2736      for (x=0;x<40;x++)
2737      {
2738         int tile = dealem_videoram[count+0x1000] | (dealem_videoram[count] << 8);
2739         count++;
2740         drawgfx(bitmap,machine->gfx[0],tile,0,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0);
2741      }
2742   }
2743
2744   return 0;
2745}
2746
2747static ADDRESS_MAP_START( dealem_memmap, ADDRESS_SPACE_PROGRAM, 8 )
2748
2749   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
2750
2751   AM_RANGE(0x0800, 0x0800) AM_WRITE(crtc6845_address_w)
2752   AM_RANGE(0x0801, 0x0801) AM_READWRITE(crtc6845_register_r, crtc6845_register_w)
2753
2754//  AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select)
2755
2756//  AM_RANGE(0x08E0, 0x08E7) AM_READ( 68681_duart_r)
2757//  AM_RANGE(0x08E0, 0x08E7) AM_WRITE( 68681_duart_w)
2758
2759   AM_RANGE(0x0900, 0x0907) AM_READ( ptm6840_0_r)  // 6840PTM
2760   AM_RANGE(0x0900, 0x0907) AM_WRITE(ptm6840_0_w)
2761
2762   AM_RANGE(0x0A00, 0x0A03) AM_WRITE(pia_0_w)      // PIA6821 IC3
2763   AM_RANGE(0x0A00, 0x0A03) AM_READ( pia_0_r)
2764
2765   AM_RANGE(0x0B00, 0x0B03) AM_WRITE(pia_1_w)      // PIA6821 IC4
2766   AM_RANGE(0x0B00, 0x0B03) AM_READ( pia_1_r)
2767
2768   AM_RANGE(0x0C00, 0x0C03) AM_WRITE(pia_2_w)      // PIA6821 IC5
2769   AM_RANGE(0x0C00, 0x0C03) AM_READ( pia_2_r)
2770
2771   AM_RANGE(0x0D00, 0x0D03) AM_WRITE(pia_3_w)      // PIA6821 IC6
2772   AM_RANGE(0x0D00, 0x0D03) AM_READ( pia_3_r)
2773
2774   AM_RANGE(0x0E00, 0x0E03) AM_WRITE(pia_4_w)      // PIA6821 IC7
2775   AM_RANGE(0x0E00, 0x0E03) AM_READ( pia_4_r)
2776
2777   AM_RANGE(0x0F00, 0x0F03) AM_WRITE(pia_5_w)      // PIA6821 IC8
2778   AM_RANGE(0x0F00, 0x0F03) AM_READ( pia_5_r)
2779
2780   AM_RANGE(0x1000, 0x2fff) AM_RAM AM_BASE(&dealem_videoram)
2781   AM_RANGE(0x8000, 0xffff) AM_ROM   AM_WRITENOP// 64k  paged ROM (4 pages)
2782
2783ADDRESS_MAP_END
2784
2785static MACHINE_DRIVER_START( mpu4_vid )
2786
2787   MDRV_CPU_ADD_TAG("main", M6809, MPU4_MASTER_CLOCK/4 )
2788   MDRV_CPU_PROGRAM_MAP(mpu4_6809_map,0)
2789   MDRV_CPU_PERIODIC_INT(gen_50hz, 50 )
2790
2791   MDRV_CPU_ADD_TAG("video", M68000, VIDEO_MASTER_CLOCK )
2792   MDRV_CPU_PROGRAM_MAP(mpu4_68k_map,0)
2793   MDRV_CPU_VBLANK_INT(mpu4_vid_irq,1)
2794
2795   MDRV_NVRAM_HANDLER(generic_0fill)            // confirm
2796
2797   MDRV_INTERLEAVE(16)
2798   /* video hardware */
2799   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
2800   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
2801   MDRV_SCREEN_SIZE(64*8, 64*8)
2802   MDRV_SCREEN_VISIBLE_AREA(0*8, 63*8-1, 0*8, 37*8-1)
2803   MDRV_SCREEN_REFRESH_RATE(50)
2804   MDRV_MACHINE_START(mpu4_vid)
2805   MDRV_MACHINE_RESET(mpu4_vid)
2806   MDRV_VIDEO_START (mpu4_vid)
2807   MDRV_VIDEO_UPDATE(mpu4_vid)
2808
2809   MDRV_PALETTE_LENGTH(16)
2810
2811   MDRV_SPEAKER_STANDARD_MONO("mono")
2812   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
2813   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2814
2815   MDRV_SPEAKER_STANDARD_STEREO("left", "right")// Present on all video cards
2816   MDRV_SOUND_ADD(SAA1099, 8000000)
2817   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.00)
2818   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.00)
2819
2820MACHINE_DRIVER_END
2821
28221366// machine driver for barcrest mpu4 board /////////////////////////////////
28231367
28241368static MACHINE_DRIVER_START( mpu4mod2 )
r1281r1282
28281372   MDRV_CPU_ADD_TAG("main", M6809, MPU4_MASTER_CLOCK/4)
28291373   MDRV_CPU_PROGRAM_MAP(mod2_memmap,0)
28301374
2831   MDRV_CPU_PERIODIC_INT(gen_50hz, 50)
1375   MDRV_CPU_PERIODIC_INT(gen_50hz, 100)
28321376
28331377   MDRV_SPEAKER_STANDARD_MONO("mono")
28341378   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
r1281r1282
28491393   MDRV_PALETTE_INIT(mpu4)
28501394MACHINE_DRIVER_END
28511395
2852// machine driver for zenitone dealem board /////////////////////////////////
2853
2854static MACHINE_DRIVER_START( dealem )
2855
2856   MDRV_MACHINE_START(mpu4mod2)                     // main mpu4 board initialisation
2857   MDRV_MACHINE_RESET(mpu4_vid)
2858   MDRV_CPU_ADD_TAG("main", M6809, MPU4_MASTER_CLOCK/4)   // 6809 CPU
2859   MDRV_CPU_PROGRAM_MAP(dealem_memmap,0)               // setup read and write memorymap
2860
2861   MDRV_CPU_PERIODIC_INT(gen_50hz, 50)   // generate 50 hz signal
2862
2863   MDRV_SCREEN_REFRESH_RATE(56)//Measured accurately from the flip-flop
2864   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
2865   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
2866
2867   MDRV_SPEAKER_STANDARD_MONO("mono")
2868   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
2869   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2870
2871   MDRV_NVRAM_HANDLER(generic_0fill)               // load/save nv RAM
2872   /* video hardware */
2873   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
2874   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
2875   MDRV_SCREEN_SIZE((54+1)*8, (32+1)*8)                  /* Taken from MC6845 init, registers 00 & 04. Normally programmed with (value-1) */
2876   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 31*8-1)    /* Taken from MC6845 init, registers 01 & 06 */
2877   MDRV_SCREEN_REFRESH_RATE(50)
2878   MDRV_VIDEO_START( dealem)
2879   MDRV_GFXDECODE(dealem)
2880   MDRV_VIDEO_UPDATE(dealem)
2881
2882   MDRV_PALETTE_LENGTH(32)
2883   MDRV_COLORTABLE_LENGTH(32)
2884   MDRV_PALETTE_INIT(dealem)
2885
2886MACHINE_DRIVER_END
2887
28881396   const UINT8 MPU4_chr_lut[72]= {   0x00,0x1A,0x04,0x10,0x18,0x0F,0x13,0x1B,
28891397                           0x03,0x07,0x17,0x1D,0x36,0x35,0x2B,0x28,
28901398                           0x39,0x21,0x22,0x25,0x2C,0x29,0x31,0x34,
r1281r1282
28951403                           0x0D,0x1F,0x16,0x05,0x13,0x1C,0x02,0x00,
28961404                           0x00,0x01,0x04,0x09,0x10,0x19,0x24,0x31};
28971405
2898DRIVER_INIT (crmaze)
2899{
2900   int x;
2901   static const UINT8 chr_table[72]={0x00,0x84,0x94,0x3C,0xEC,0x5C,0xEC,0x50,
2902                              0x2C,0x68,0x60,0xAC,0x74,0x00,0xAC,0x58,
2903                             0xEC,0x7C,0xEC,0x58,0xE0,0x90,0x18,0xEC,
2904                             0x54,0x28,0x68,0x44,0x84,0xB4,0x10,0x20,
2905                             0x84,0xBC,0xE8,0x70,0x24,0x84,0xB8,0xE0,
2906                             0x94,0x14,0x2C,0x64,0x8C,0x50,0x28,0x4C,
2907                             0x6C,0x60,0xA0,0xBC,0xCC,0x78,0xE8,0x50,
2908                             0x20,0xAC,0x74,0x04,0xA4,0x94,0x3C,0x00,
2909                             0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
2910
2911   for (x=0; x < 72; x++)
2912   {
2913      MPU4_chr_data[(x)] = chr_table[(x)];
2914   }
2915}
2916
2917DRIVER_INIT (mating)
2918{
2919   int x;
2920   static const UINT8 chr_table[72]={0x00,0x18,0xC8,0xA4,0x0C,0x80,0x0C,0x90,
2921                             0x34,0x30,0x00,0x58,0xC8,0x84,0x4C,0xA0,
2922                             0x4C,0xC0,0x3C,0xC8,0xA4,0x4C,0x80,0x0C,
2923                             0x80,0x0C,0xE0,0x1C,0x88,0xA4,0x0C,0xA0,
2924                             0x0C,0x80,0x4C,0xA0,0x3C,0x98,0xEC,0x84,
2925                             0x0C,0xC0,0x1C,0xA8,0x84,0x0C,0xA0,0x5C,
2926                             0xE8,0xA4,0x0C,0xD0,0x04,0x38,0xA8,0xC4,
2927                             0x2C,0x90,0x44,0x18,0xE8,0x84,0x3C,0x00,
2928                             0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
2929
2930   for (x=0; x < 72; x++)
2931   {
2932      MPU4_chr_data[(x)] = chr_table[(x)];
2933   }
2934}
2935
2936DRIVER_INIT (connect4)
2937{
2938   led_extend=1;
2939}
2940
2941/*
2942   Barcrest released two different games called "The Crystal Maze".
2943   One is a non-video AWP, and uses only the MPU4 card, and the other SWP is the one we're interested in running
2944   Some of the dumps available seem to confuse the two, due to an early database not distinguishing
2945   between MPU4 and MPU4Video, as the latter had not been emulated at all at that stage. */
2946
2947#define VID_BIOS \
2948   ROM_LOAD("vid.p1",  0x00000, 0x10000,  CRC(e996bc18) SHA1(49798165640627eb31024319353da04380787b10))
2949
2950ROM_START( bctvidbs )
2951   ROM_REGION( 0x10000, REGION_CPU1, 0 )
2952   VID_BIOS
2953ROM_END
2954
2955ROM_START( crmaze ) // this set runs in MFME, so should be OK */
2956   ROM_REGION( 0x10000, REGION_CPU1, 0 )
2957   VID_BIOS
2958
2959   ROM_REGION( 0x800000, REGION_CPU2, 0 )
2960   ROM_LOAD16_BYTE( "cm3.p1",  0x000000, 0x80000,  CRC(2d2edee5) SHA1(0281ec97aaaaf4c7969340bd5995ac1541dbad54) )
2961   ROM_LOAD16_BYTE( "cm3.p2",  0x000001, 0x80000,  CRC(c223d7b9) SHA1(da9d730716a30d0e93f2a02c1efa7f19457ae010) )
2962   ROM_LOAD16_BYTE( "cm3.p3",  0x100000, 0x80000,  CRC(2959c77b) SHA1(8de533bfad48ad19a635dddcafa2a0825133b4de) )
2963   ROM_LOAD16_BYTE( "cm3.p4",  0x100001, 0x80000,  CRC(b7873e9a) SHA1(a71fac883e02d5f49aee0a20f92dbdb00640ce8d) )
2964   ROM_LOAD16_BYTE( "cm3.p5",  0x200000, 0x80000,  CRC(c8375070) SHA1(da2ba6591d8765f896c40d6526da8e945d02a182) )
2965   ROM_LOAD16_BYTE( "cm3.p6",  0x200001, 0x80000,  CRC(1ea36938) SHA1(43f62935b21232d23f662e1e124663267edb1283) )
2966   ROM_LOAD16_BYTE( "cm3.p7",  0x300000, 0x80000,  CRC(9de3802e) SHA1(ec792f115a0708d68046ba0beb314b7e1f1eb422) )
2967   ROM_LOAD16_BYTE( "cm3.p8",  0x300001, 0x80000,  CRC(1e6e60b0) SHA1(5e71714747073dd89852a84585642388ee440325) )
2968   ROM_LOAD16_BYTE( "cm3.p9",  0x400000, 0x80000,  CRC(bfba55a7) SHA1(22eb9b1f9fe83d3b424fd521b68e2976a1940df9) )
2969   ROM_LOAD16_BYTE( "cm3.pa",  0x400001, 0x80000,  CRC(07edda81) SHA1(e94525be03f30e407051992925bb0d693f3d809b) )
2970ROM_END
2971
2972ROM_START( crmazea )
2973   ROM_REGION( 0x10000, REGION_CPU1, 0 )
2974   VID_BIOS
2975
2976   ROM_REGION( 0x800000, REGION_CPU2, 0 )
2977   ROM_LOAD16_BYTE( "am1z.p1",  0x000000, 0x80000,  CRC(d2fdda6d) SHA1(96c27dedc3cf1dd478e6169200844d418a276f14) )
2978   ROM_LOAD16_BYTE( "am1z.p2",  0x000001, 0x80000,  CRC(1637170f) SHA1(fd17a0e7794f01bf4ad7a16b185f87cb060c70ab) )
2979   ROM_LOAD16_BYTE( "am1g.p1",  0x100000, 0x80000,  CRC(e8cf8203) SHA1(e9f42e5c18b97807f51284ad2416346578ed73c4) )
2980   ROM_LOAD16_BYTE( "am1g.p2",  0x100001, 0x80000,  CRC(7b036151) SHA1(7b0040c296059b1e1798ddedf0ecb4582d67ee70) )
2981   ROM_LOAD16_BYTE( "am1g.p3",  0x200000, 0x80000,  CRC(48f17b20) SHA1(711c46fcfd86ded8ff7da883188d70560d20e42f) )
2982   ROM_LOAD16_BYTE( "am1g.p4",  0x200001, 0x80000,  CRC(2b3d9a97) SHA1(7468fffd90d840d245a70475b42308f1e48c5017) )
2983   ROM_LOAD16_BYTE( "am1g.p5",  0x300000, 0x80000,  CRC(68286bb1) SHA1(c307e3ad1e0fd92314216c8e554aafa949559452) )
2984   ROM_LOAD16_BYTE( "am1g.p6",  0x300001, 0x80000,  CRC(a6b498ad) SHA1(117e1a4ec7e2d3c7d530c5a56cbc1d24b0ddc747) )
2985   ROM_LOAD16_BYTE( "am1g.p7",  0x400000, 0x80000,  CRC(15882699) SHA1(b29a331e51a37554323b91330a7c2b62b33a943a) )
2986   ROM_LOAD16_BYTE( "am1g.p8",  0x400001, 0x80000,  CRC(6f0f855b) SHA1(ab411d1af0f88049a6c435bafd4b1fa63f5519b1) )
2987ROM_END
2988
2989ROM_START( crmazeb )
2990   ROM_REGION( 0x10000, REGION_CPU1, 0 )
2991   VID_BIOS
2992
2993   ROM_REGION( 0x800000, REGION_CPU2, 0 )
2994   ROM_LOAD16_BYTE( "am2z.p1",  0x000000, 0x80000,  CRC(f27e02f0) SHA1(8637904c201ece4f08ad63b4fd6d06a860fa762f) )
2995   ROM_LOAD16_BYTE( "am2z.p2",  0x000001, 0x80000,  CRC(4d24f482) SHA1(9e3687db9d0233e56999017f3ed59ec543bce303) )
2996   ROM_LOAD16_BYTE( "am2g.p1",  0x100000, 0x80000,  CRC(115402db) SHA1(250f2eded1b88a1abf82febb009eadbb90936f8a) )
2997   ROM_LOAD16_BYTE( "am2g.p2",  0x100001, 0x80000,  CRC(5d804fbb) SHA1(8dc02eb9329f9c29d4bcc9a0315ae96085625d3e) )
2998   ROM_LOAD16_BYTE( "am2g.p3",  0x200000, 0x80000,  CRC(5ead0c06) SHA1(35d9aefc60e2c391e32f8119a6dc44434d91c09e) )
2999   ROM_LOAD16_BYTE( "am2g.p4",  0x200001, 0x80000,  CRC(de4fb542) SHA1(4bf8f8f6850fd819d91827d3c474bd488e61e5ac) )
3000   ROM_LOAD16_BYTE( "am2g.p5",  0x300000, 0x80000,  CRC(80b01ce2) SHA1(4a3a4bcff4bd9affd1a5eeca5781b6af05bbcc16) )
3001   ROM_LOAD16_BYTE( "am2g.p6",  0x300001, 0x80000,  CRC(3e134ecc) SHA1(1f8cdce62e693eb07c4620b64cc467339c0563de) )
3002   ROM_LOAD16_BYTE( "am2g.p7",  0x400000, 0x80000,  CRC(6eb36f1d) SHA1(08b9ec184d64bdbdfa61d3e991a3647e74a7756f) )
3003   ROM_LOAD16_BYTE( "am2g.p8",  0x400001, 0x80000,  CRC(dda353ef) SHA1(56a5b43f0b0bd9dbf348946a5758ebe63eadb8cf) )
3004ROM_END
3005
3006ROM_START( turnover )
3007   ROM_REGION( 0x10000, REGION_CPU1, 0 )
3008   VID_BIOS
3009
3010   ROM_REGION( 0x800000, REGION_CPU2, 0 )
3011   ROM_LOAD16_BYTE( "tos.p1",  0x000000, 0x010000,  CRC(4044dbeb) SHA1(3aa553055c56f14564b1e33e1c1975337e639f70) )
3012   ROM_LOAD16_BYTE( "to.p2",   0x000001, 0x010000,  CRC(4bc4659a) SHA1(0e282134c4fe4e8c1cc7b16957903179e23c7abc) )
3013   ROM_LOAD16_BYTE( "to.p3",   0x020000, 0x010000,  CRC(273c7c14) SHA1(71feb555a05a0ff1ec674505cab72d93c9fbdf65) )
3014   ROM_LOAD16_BYTE( "to.p4",   0x020001, 0x010000,  CRC(83d29546) SHA1(cef90455b9d8a92424fe1aa10f20fd075d0e3091) )
3015   ROM_LOAD16_BYTE( "to.p5",   0x040000, 0x010000,  CRC(dceac511) SHA1(7a6d65464e23d832943f771c4cf580aabc6f0e44) )
3016   ROM_LOAD16_BYTE( "to.p6",   0x040001, 0x010000,  CRC(54c6afb7) SHA1(b724b87b6f4e47d220310b38c97be2fa73dcd617) )
3017   ROM_LOAD16_BYTE( "to.p7",   0x060000, 0x010000,  CRC(acf19542) SHA1(ad46ffb3c2c078a8e3712eff27aa61f0d1a7c059) )
3018   ROM_LOAD16_BYTE( "to.p8",   0x060001, 0x010000,  CRC(a5ca385d) SHA1(8df26a33ea7f5b577761c6f9d2fa4eaed74661f8) )
3019   ROM_LOAD16_BYTE( "to.p9",   0x080000, 0x010000,  CRC(6e85fde3) SHA1(14868d58829e13987e66f52e1899c4385987a87b) )
3020   ROM_LOAD16_BYTE( "to.p10",  0x080001, 0x010000,  CRC(fadd11a2) SHA1(2b2fbb0769ef6035688d495464f3ea3bc8c7c660) )
3021   ROM_LOAD16_BYTE( "to.p11",  0x0a0000, 0x010000,  CRC(2d72a61a) SHA1(ce455ab6fea452f96a3ad365178e0e5a0b437867) )
3022   ROM_LOAD16_BYTE( "to.p12",  0x0a0001, 0x010000,  CRC(a14eedb6) SHA1(219b887a334ff28a88ed2e50f0caff4b510cd549) )
3023   ROM_LOAD16_BYTE( "to.p13",  0x0c0000, 0x010000,  CRC(3f66ef6b) SHA1(60be6d3f8da1f3084db15ac1bb2470e55c0271de) )
3024   ROM_LOAD16_BYTE( "to.p14",  0x0c0001, 0x010000,  CRC(127ba65d) SHA1(e34dcd19efd31dc712daac940277bb17694ea61a) )
3025   ROM_LOAD16_BYTE( "to.p15",  0x0e0000, 0x010000,  CRC(ad787e31) SHA1(314ba312adfc71e4b3b2d52355ec692c192b74eb) )
3026   ROM_LOAD16_BYTE( "to.p16",  0x0e0001, 0x010000,  CRC(e635c942) SHA1(08f8b5fdb738647bc0b49938da05533be42a2d60) )
3027ROM_END
3028
3029ROM_START( skiltrek )
3030   ROM_REGION( 0x10000, REGION_CPU1, 0 )
3031   VID_BIOS
3032
3033   ROM_REGION( 0x800000, REGION_CPU2, 0 )
3034   ROM_LOAD16_BYTE( "st.p1",  0x000000, 0x010000,  CRC(d9de47a5) SHA1(625bf40780203293fc34cd8cea8278b4b4a52a75) )
3035   ROM_LOAD16_BYTE( "st.p2",  0x000001, 0x010000,  CRC(b62575c2) SHA1(06d75e8a364750663d329650720021279e195236) )
3036   ROM_LOAD16_BYTE( "st.p3",  0x020000, 0x010000,  CRC(9506da76) SHA1(6ef28ab8ec1af455be8ecfab20243f0823dca7c1) )
3037   ROM_LOAD16_BYTE( "st.p4",  0x020001, 0x010000,  CRC(6ab447bc) SHA1(d01c209dbf4d19a6a7f878fa54ff1cb51e7dcba5) )
3038   ROM_LOAD16_BYTE( "st.q1",  0x040000, 0x010000,  CRC(4faca475) SHA1(69b498c543600b8e37ab0ed1863ba57845648f3c) )
3039   ROM_LOAD16_BYTE( "st.q2",  0x040001, 0x010000,  CRC(9f2c5938) SHA1(85527c4c0b7a1e66576d56607d89750fab082580) )
3040   ROM_LOAD16_BYTE( "st.q3",  0x060000, 0x010000,  CRC(6b6cb194) SHA1(aeac5dcc0827c17e758e3e821ae8a78a3a16ddce) )
3041   ROM_LOAD16_BYTE( "st.q4",  0x060001, 0x010000,  CRC(ec57bc17) SHA1(d9f522739dbb190fb941ca654299bbedbb8fb703) )
3042   ROM_LOAD16_BYTE( "st.q5",  0x080000, 0x010000,  CRC(7740a88b) SHA1(d9a683d3e0d6c1b4b59520f90f825124b7a61168) )
3043   ROM_LOAD16_BYTE( "st.q6",  0x080001, 0x010000,  CRC(95e97796) SHA1(f1a8de0ad02aca31f79a4fe8ba5044546163e3c4) )
3044   ROM_LOAD16_BYTE( "st.q7",  0x0a0000, 0x010000,  CRC(f3b8fe7f) SHA1(52d5be3f8cab419103f4727d0fb9d30f34c8f651) )
3045   ROM_LOAD16_BYTE( "st.q8",  0x0a0001, 0x010000,  CRC(b85e75a2) SHA1(b7b03b090c0ec6d92e9a25abb7fec0507356bdfc) )
3046   ROM_LOAD16_BYTE( "st.q9",  0x0c0000, 0x010000,  CRC(835f6001) SHA1(2cd9084c102d74bcb578c8ea22bbc9ea58f0ceab) )
3047   ROM_LOAD16_BYTE( "st.qa",  0x0c0001, 0x010000,  CRC(3fc62a0e) SHA1(0628de4b962d3fcca3757cd4e89b3005c9bfd218) )
3048ROM_END
3049
3050ROM_START( timemchn )
3051   ROM_REGION( 0x10000, REGION_CPU1, 0 )
3052   VID_BIOS
3053
3054   ROM_REGION( 0x800000, REGION_CPU2, 0 )
3055   ROM_LOAD16_BYTE( "tm20.p1",  0x000000, 0x010000,  CRC(6919697c) SHA1(786d7b9ab218dbf54ff839d1f83580c409c725b3) )
3056   ROM_LOAD16_BYTE( "tm20.p2",  0x000001, 0x010000,  CRC(d13b56e4) SHA1(623e73995da93c07b51ce0a5843dba1f853529dd) )
3057   ROM_LOAD16_BYTE( "tm20.p3",  0x020000, 0x010000,  CRC(efd3ae64) SHA1(9d2a3b65048e04842205751c6921d2550f38bd52) )
3058   ROM_LOAD16_BYTE( "tm20.p4",  0x020001, 0x010000,  CRC(602ba3fb) SHA1(7243f58df9a26adfd1a149a1e60630b187787dd0) )
3059   ROM_LOAD16_BYTE( "q12.p5" ,  0x040000, 0x010000,  CRC(adddd8a7) SHA1(73a8dd191eda2f4b41b79d4b55723731953b8970) )
3060   ROM_LOAD16_BYTE( "q11.p6" ,  0x040001, 0x010000,  CRC(e8ed736f) SHA1(e7068c550aa39a6e8f1692a16794147e996D36b4) )
3061   ROM_LOAD16_BYTE( "q14.p7" ,  0x060000, 0x010000,  CRC(02abb026) SHA1(42224678e5913090c91c21672661beb8e27127a8) )
3062   ROM_LOAD16_BYTE( "q13.p8" ,  0x060001, 0x010000,  CRC(3de147dd) SHA1(d2111d54d1604fe2da0133102bbfee706f8f542e) )
3063   ROM_LOAD16_BYTE( "q16.p9" ,  0x080000, 0x010000,  CRC(ce2bf15e) SHA1(29c7f2e718bce415b0b8dc6d902bf74dad6b1ef4) )
3064   ROM_LOAD16_BYTE( "q15.p10",  0x080001, 0x010000,  CRC(7894ac8b) SHA1(dc46bd108ac4f67a9062bb7ace91aa51f069cbc8) )
3065   ROM_LOAD16_BYTE( "q18.p11",  0x0a0000, 0x010000,  CRC(27de90b3) SHA1(625c98e555f7b627ea96653926b8917996a2fdb7) )
3066   ROM_LOAD16_BYTE( "q17.p12",  0x0a0001, 0x010000,  CRC(5cab773e) SHA1(59a235c51a975b341bdbb88e909729507408f75b) )
3067   ROM_LOAD16_BYTE( "q20.p13",  0x0c0000, 0x010000,  CRC(083f6c65) SHA1(291ad39ee5f8eba9da293d9206b1f6a6d852f9bd) )
3068   ROM_LOAD16_BYTE( "q19.p14",  0x0c0001, 0x010000,  CRC(73747644) SHA1(ae252fc95c069a3c82e155220fbfcb74dd43bf89) )
3069ROM_END
3070
3071ROM_START( mating )
3072   ROM_REGION( 0x10000, REGION_CPU1, 0 )
3073   VID_BIOS
3074
3075   ROM_REGION( 0x800000, REGION_CPU2, 0 )
3076   ROM_LOAD16_BYTE( "matd.p1",  0x000000, 0x080000,  CRC(e660909f) SHA1(0acd990264fd7faf1f91a796d2438e8c2c7b83d1) )
3077   ROM_LOAD16_BYTE( "matd.p2",  0x000001, 0x080000,  CRC(a4c7e9b4) SHA1(30148c0257181bb88159e02d2b7cd79995ee84a7) )
3078   ROM_LOAD16_BYTE( "matg.p3",  0x100000, 0x080000,  CRC(571f4e8e) SHA1(51babacb5d9fb1cc9e1e56a3b2a355597d04f178) )
3079   ROM_LOAD16_BYTE( "matg.p4",  0x100001, 0x080000,  CRC(52d8657b) SHA1(e44e1db13c4abd4fedcd72df9dce1df594f74e44) )
3080   ROM_LOAD16_BYTE( "matg.p5",  0x200000, 0x080000,  CRC(9f0c9552) SHA1(8b1197f20853e18841a8f64fd5ff58cdd0bd1dbd) )
3081   ROM_LOAD16_BYTE( "matg.p6",  0x200001, 0x080000,  CRC(59f2b6a8) SHA1(4921cf1fc4c3bc50d2598b63726f61f68b41658c) )
3082   ROM_LOAD16_BYTE( "matg.p7",  0x300000, 0x080000,  CRC(64c0031a) SHA1(a519addd5d8f4696967ec84c163d28cb81ff9f32) )
3083   ROM_LOAD16_BYTE( "matg.p8",  0x300001, 0x080000,  CRC(22370dae) SHA1(72b1686b458750b5ee9dfe5599c308329d2c79d5) )
3084   ROM_LOAD16_BYTE( "matq.p9",  0x400000, 0x040000,  CRC(2d42e982) SHA1(80e476d5d65662059daa93a2fd383aecb74903c1) )
3085   ROM_LOAD16_BYTE( "matq.p10", 0x400001, 0x040000,  CRC(90364c3c) SHA1(6a4d2a3dd2cf9040887503888e6f38341578ad64) )
3086
3087   /* Mating Game has an extra OKI sound chip */
3088   ROM_REGION( 0x200000, REGION_SOUND1, 0 )
3089   ROM_LOAD( "matsnd.p1",  0x000000, 0x080000,  CRC(f16df9e3) SHA1(fd9b82d73e18e635a9ea4aabd8c0b4aa2c8c6fdb) )
3090   ROM_LOAD( "matsnd.p2",  0x080000, 0x080000,  CRC(0c041621) SHA1(9156bf17ef6652968d9fbdc0b2bde64d3a67459c) )
3091   ROM_LOAD( "matsnd.p3",  0x100000, 0x080000,  CRC(c7435af9) SHA1(bd6080afaaaecca0d65e6d4125b46849aa4d1f33) )
3092   ROM_LOAD( "matsnd.p4",  0x180000, 0x080000,  CRC(d7e65c5b) SHA1(5575fb9f948158f2e94c986bf4bca9c9ee66a489) )
3093ROM_END
3094
3095ROM_START( matinga )
3096   ROM_REGION( 0x10000, REGION_CPU1, 0 )
3097   VID_BIOS
3098
3099   ROM_REGION( 0x800000, REGION_CPU2, 0 )
3100   ROM_LOAD16_BYTE( "mats.p1",  0x000000, 0x080000,  CRC(ebc7ea7e) SHA1(11015489a803ba5c8dbdafd632424bbd6080aece) ) // 3 bytes changed from above set...
3101   ROM_LOAD16_BYTE( "mats.p2",  0x000001, 0x080000,  CRC(a4c7e9b4) SHA1(30148c0257181bb88159e02d2b7cd79995ee84a7) ) // Just enough to disable the data logger
3102   ROM_LOAD16_BYTE( "matg.p3",  0x100000, 0x080000,  CRC(571f4e8e) SHA1(51babacb5d9fb1cc9e1e56a3b2a355597d04f178) )
3103   ROM_LOAD16_BYTE( "matg.p4",  0x100001, 0x080000,  CRC(52d8657b) SHA1(e44e1db13c4abd4fedcd72df9dce1df594f74e44) )
3104   ROM_LOAD16_BYTE( "matg.p5",  0x200000, 0x080000,  CRC(9f0c9552) SHA1(8b1197f20853e18841a8f64fd5ff58cdd0bd1dbd) )
3105   ROM_LOAD16_BYTE( "matg.p6",  0x200001, 0x080000,  CRC(59f2b6a8) SHA1(4921cf1fc4c3bc50d2598b63726f61f68b41658c) )
3106   ROM_LOAD16_BYTE( "matg.p7",  0x300000, 0x080000,  CRC(64c0031a) SHA1(a519addd5d8f4696967ec84c163d28cb81ff9f32) )
3107   ROM_LOAD16_BYTE( "matg.p8",  0x300001, 0x080000,  CRC(22370dae) SHA1(72b1686b458750b5ee9dfe5599c308329d2c79d5) )
3108   ROM_LOAD16_BYTE( "matq.p9",  0x400000, 0x040000,  CRC(2d42e982) SHA1(80e476d5d65662059daa93a2fd383aecb74903c1) )
3109   ROM_LOAD16_BYTE( "matq.p10", 0x400001, 0x040000,  CRC(90364c3c) SHA1(6a4d2a3dd2cf9040887503888e6f38341578ad64) )
3110
3111   /* Mating Game has an extra OKI sound chip */
3112   ROM_REGION( 0x200000, REGION_SOUND1, 0 )
3113   ROM_LOAD( "matsnd.p1",  0x000000, 0x080000,  CRC(f16df9e3) SHA1(fd9b82d73e18e635a9ea4aabd8c0b4aa2c8c6fdb) )
3114   ROM_LOAD( "matsnd.p2",  0x080000, 0x080000,  CRC(0c041621) SHA1(9156bf17ef6652968d9fbdc0b2bde64d3a67459c) )
3115   ROM_LOAD( "matsnd.p3",  0x100000, 0x080000,  CRC(c7435af9) SHA1(bd6080afaaaecca0d65e6d4125b46849aa4d1f33) )
3116   ROM_LOAD( "matsnd.p4",  0x180000, 0x080000,  CRC(d7e65c5b) SHA1(5575fb9f948158f2e94c986bf4bca9c9ee66a489) )
3117ROM_END
3118
3119ROM_START( connect4 )
3120   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
3121   ROM_LOAD( "connect4.p2",  0x8000, 0x4000,  CRC(6090633c) SHA1(0cd2725a235bf93cfe94f2ca648d5fccb87b8e5c) )
3122   ROM_LOAD( "connect4.p1",  0xC000, 0x4000,  CRC(b1af50c0) SHA1(7c9645ea378f0857b849ca24a239d9114f62da7f) )
3123ROM_END
3124
3125ROM_START( dealem )
3126   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
3127   ROM_LOAD( "zenndlem.u6",   0x8000, 0x8000,  CRC(571e5c05) SHA1(89b4c331407a04eae34bb187b036791e0a671533) )
3128
3129   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
3130   ROM_LOAD( "zenndlem.u24",   0x0000, 0x10000, CRC(3a1950c4) SHA1(7138346d4e8b3cffbd9751b4d7ebd367b9ad8da9) )    /* text layer */
3131
3132   ROM_REGION( 0x020, REGION_PROMS, 0 )
3133   ROM_LOAD( "zenndlem.u22",   0x000, 0x020, CRC(29988304) SHA1(42f61b8f9e1ee96b65db3b70833eb2f6e7a6ae0a) )
3134
3135   ROM_REGION( 0x200, REGION_PLDS, 0 )
3136   ROM_LOAD( "zenndlem.u10",   0x000, 0x104, CRC(e3103c05) SHA1(91b7be75c5fb37025039ab54b484e46a033969b5) )
3137ROM_END
3138
3139GAMEL(1989?,connect4,0,       mpu4mod2, connect4, connect4, 0,   "Dolbeck Systems", "Connect 4",                                          GAME_IMPERFECT_GRAPHICS,layout_connect4 )
3140GAME( 199?, bctvidbs,0,       mpu4mod2, mpu4,     0,    ROT0,   "Barcrest",       "MPU4 Video Firmware",                                    GAME_IS_BIOS_ROOT )
3141
3142//Deal 'Em was a conversion kit designed to make early MPU4 machines into video games by replacing the top glass
3143//and reel assembly with this kit and a supplied monitor.
3144//The real Deal 'Em ran on Summit Coin hardware, and was made by someone else.
3145//A further different release was made in 2000, running on the Barcrest MPU4 Video, rather than this one.
3146GAME( 1987, dealem,    0,        dealem,   dealem,   0,    ROT0,   "Zenitone",       "Deal 'Em (MPU4 Conversion Kit, v7.0)",                        GAME_IMPERFECT_GRAPHICS )
3147
3148GAME( 1994?,crmaze,  bctvidbs,mpu4_vid, crmaze,   crmaze,ROT0,   "Barcrest",       "The Crystal Maze: Team Challenge (SWP)",                     GAME_NOT_WORKING|GAME_NO_SOUND )
3149GAME( 1992?,crmazea, crmaze,  mpu4_vid, crmaze,   crmaze,ROT0,   "Barcrest",       "The Crystal Maze (AMLD version SWP)",                        GAME_NOT_WORKING|GAME_NO_SOUND )
3150GAME( 1993?,crmazeb, crmaze,  mpu4_vid, crmaze,   0,     ROT0,   "Barcrest",       "The Crystal Maze - Now Featuring Ocean Zone (AMLD Version SWP)",   GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
3151GAME( 1990, turnover,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Turnover",                                             GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
3152GAME( 1992, skiltrek,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Skill Trek",                                          GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
3153GAME( 1990, timemchn,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Time Machine v2.0",                                    GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
3154GAME( 199?, mating,  bctvidbs,mpu4_vid, mpu4,     mating,ROT0,   "Barcrest",       "The Mating Game (Datapak)",                              GAME_NOT_WORKING|GAME_NO_SOUND )
3155GAME( 199?, matinga, mating,  mpu4_vid, mpu4,     mating,ROT0,   "Barcrest",       "The Mating Game (Standard)",                              GAME_NOT_WORKING|GAME_NO_SOUND )
1406#include "drivers/mpu4drvr.c"
src/mame/drivers/skylncr.c
r1281r1282
6767         (row % TILES_PER_PAGE_Y) * TILES_PER_PAGE_X;
6868}
6969
70VIDEO_START( skylncr )
70static VIDEO_START( skylncr )
7171{
7272
7373   tmap = tilemap_create(   get_tile_info, tilemap_scan_rows,
r1281r1282
8181   tilemap_set_transparent_pen(tmap2, 0);
8282}
8383
84VIDEO_UPDATE( skylncr )
84static VIDEO_UPDATE( skylncr )
8585{
8686   fillbitmap(bitmap,machine->pens[0],cliprect);
8787   tilemap_draw(bitmap,cliprect, tmap2, 0, 0);
src/mame/drivers/limenko.c
r1281r1282
272272   }
273273}
274274
275VIDEO_START( limenko )
275static VIDEO_START( limenko )
276276{
277277   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     8,8,128,64);
278278   md_tilemap = tilemap_create(get_md_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,128,64);
r1281r1282
282282   tilemap_set_transparent_pen(fg_tilemap,0);
283283}
284284
285VIDEO_UPDATE( limenko )
285static VIDEO_UPDATE( limenko )
286286{
287287   fillbitmap(priority_bitmap,0,cliprect);
288288
r1281r1282
863863   return mainram[0x6626c/4];
864864}
865865
866DRIVER_INIT( dynabomb )
866static DRIVER_INIT( dynabomb )
867867{
868868   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xe2784, 0xe2787, 0, 0, dynabomb_speedup_r );
869869}
870870
871DRIVER_INIT( legendoh )
871static DRIVER_INIT( legendoh )
872872{
873873   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x32ab0, 0x32ab3, 0, 0, legendoh_speedup_r );
874874}
875875
876DRIVER_INIT( sb2003 )
876static DRIVER_INIT( sb2003 )
877877{
878878   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x135800, 0x135803, 0, 0, sb2003_speedup_r );
879879}
880880
881DRIVER_INIT( spotty )
881static DRIVER_INIT( spotty )
882882{
883883   UINT8 *dst    = memory_region(REGION_GFX1);
884884   UINT8 *src    = memory_region(REGION_USER2);
src/mame/drivers/redalert.c
r1281r1282
401401   /*irqs   : A/B             */ 0, 0
402402};
403403
404MACHINE_START( demoneye )
404static MACHINE_START( demoneye )
405405{
406406   pia_config(0, &pia_0_intf);
407407}
408408
409MACHINE_RESET( demoneye )
409static MACHINE_RESET( demoneye )
410410{
411411   pia_reset();
412412}
src/mame/drivers/pipeline.c
r1281r1282
8787   );
8888}
8989
90VIDEO_START ( pipeline )
90static VIDEO_START ( pipeline )
9191{
9292   palram=auto_malloc(0x1000);
9393   tilemap1 = tilemap_create( get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32 );
r1281r1282
9595   tilemap_set_transparent_pen(tilemap2,0);
9696}
9797
98VIDEO_UPDATE ( pipeline)
98static VIDEO_UPDATE ( pipeline)
9999{
100100   tilemap_draw(bitmap,cliprect,tilemap1, 0,0);
101101   tilemap_draw(bitmap,cliprect,tilemap2, 0,0);
r1281r1282
344344   }
345345}
346346
347MACHINE_RESET( pipeline )
347static MACHINE_RESET( pipeline )
348348{
349349   ctc_intf.baseclock = machine->drv->cpu[0].clock;
350350   z80ctc_init(0, &ctc_intf);
src/mame/drivers/aladbl.c
r1281r1282
129129   ROM_LOAD16_BYTE( "m4.bin", 0x100000, 0x080000,  CRC(bc712661) SHA1(dfd554d000399e17b4ddc69761e572195ed4e1f0))
130130ROM_END
131131
132WRITE16_HANDLER( aladbl_w )
132static WRITE16_HANDLER( aladbl_w )
133133{
134134    /*
135135    Values returned from the log file :
r1281r1282
141141   logerror("aladbl_w : %06x - data = %04x\n",activecpu_get_pc(),data);
142142}
143143
144READ16_HANDLER( aladbl_r )
144static READ16_HANDLER( aladbl_r )
145145{
146146   if (activecpu_get_pc()==0x1b2a56) return (readinputportbytag("MCU") & 0xff0f);             // coins
147147   if (activecpu_get_pc()==0x1b2a72) return 0x0000;
r1281r1282
153153   return 0x0000;
154154}
155155
156DRIVER_INIT( aladbl )
156static DRIVER_INIT( aladbl )
157157{
158158   // 220000 = writes to mcu? 330000 = reads?
159159   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x220000, 0x220001, 0, 0, aladbl_w);
src/mame/drivers/polepos.c
r1281r1282
266266/* Pole Position II protection                                                       */
267267/*************************************************************************************/
268268
269READ16_HANDLER( polepos2_ic25_r )
269static READ16_HANDLER( polepos2_ic25_r )
270270{
271271   int result;
272272   /* protection states */
src/mame/drivers/viper.c
r1281r1282
4040static UINT8 backup_ram[0x2000];
4141
4242
43VIDEO_START(viper)
43static VIDEO_START(viper)
4444{
4545   voodoo_start(0, 0, VOODOO_3, 16, 16, 16);
4646}
4747
48VIDEO_UPDATE(viper)
48static VIDEO_UPDATE(viper)
4949{
5050   return voodoo_update(0, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
5151}
src/mame/drivers/mw8080bw.c
r1281r1282
961961 *
962962 *************************************/
963963
964MACHINE_START( boothill )
964static MACHINE_START( boothill )
965965{
966966   /* setup for save states */
967967   state_save_register_global(rev_shift_res);
r1281r1282
14871487 *
14881488 *************************************/
14891489
1490MACHINE_START( gmissile )
1490static MACHINE_START( gmissile )
14911491{
14921492   /* setup for save states */
14931493   state_save_register_global(rev_shift_res);
r1281r1282
15791579 *
15801580 *************************************/
15811581
1582MACHINE_START( m4 )
1582static MACHINE_START( m4 )
15831583{
15841584   /* setup for save states */
15851585   state_save_register_global(rev_shift_res);
src/mame/drivers/suna8.c
r1281r1282
8282                                Hard Head
8383***************************************************************************/
8484
85DRIVER_INIT( hardhead )
85static DRIVER_INIT( hardhead )
8686{
8787   UINT8 *rom = memory_region(REGION_CPU1);
8888   int i;
r1281r1282
157157   return decrypt;
158158}
159159
160DRIVER_INIT( brickzn )
160static DRIVER_INIT( brickzn )
161161{
162162   UINT8   *RAM   =   memory_region(REGION_CPU1);
163163   UINT8   *decrypt = brickzn_decrypt();
r1281r1282
188188   memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x4000);
189189}
190190
191DRIVER_INIT( brickzn3 )
191static DRIVER_INIT( brickzn3 )
192192{
193193   UINT8   *RAM   =   memory_region(REGION_CPU1);
194194   UINT8   *decrypt = brickzn_decrypt();
r1281r1282
224224                                Hard Head 2
225225***************************************************************************/
226226
227DRIVER_INIT( hardhea2 )
227static DRIVER_INIT( hardhea2 )
228228{
229229   UINT8   *RAM   =   memory_region(REGION_CPU1);
230230   size_t   size   =   memory_region_length(REGION_CPU1);
r1281r1282
310310                                Star Fighter
311311***************************************************************************/
312312
313DRIVER_INIT( starfigh )
313static DRIVER_INIT( starfigh )
314314{
315315   UINT8   *RAM   =   memory_region(REGION_CPU1);
316316   size_t   size   =   memory_region_length(REGION_CPU1);
r1281r1282
751751   if (data & ~0x01)    logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",activecpu_get_pc(),data);
752752}
753753
754WRITE8_HANDLER( hardhea2_leds_w )
754static WRITE8_HANDLER( hardhea2_leds_w )
755755{
756756   set_led_status(0, data & 0x01);
757757   set_led_status(1, data & 0x02);
r1281r1282
924924   if (data & ~0x01)    logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",activecpu_get_pc(),data);
925925}
926926
927WRITE8_HANDLER( sparkman_leds_w )
927static WRITE8_HANDLER( sparkman_leds_w )
928928{
929929   set_led_status(0, data & 0x01);
930930   set_led_status(1, data & 0x02);
src/mame/drivers/cps1.c
r1281r1282
273273   }
274274}
275275
276WRITE16_HANDLER( cpsq_coinctrl2_w )
276static WRITE16_HANDLER( cpsq_coinctrl2_w )
277277{
278278   if (ACCESSING_LSB)
279279   {
r1281r1282
319319}
320320
321321
322READ16_HANDLER( qsound_rom_r )
322static READ16_HANDLER( qsound_rom_r )
323323{
324324   UINT8 *rom = memory_region(REGION_USER1);
325325
src/mame/drivers/yunsun16.c
r1281r1282
173173   }
174174}
175175
176DRIVER_INIT( magicbub )
176static DRIVER_INIT( magicbub )
177177{
178178//  remove_mem_write16_handler (0, 0x800180, 0x800181 );
179179   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x800188, 0x800189, 0, 0, magicbub_sound_command_w);
src/mame/drivers/calorie.c
r1281r1282
107107}
108108
109109
110VIDEO_START( calorie )
110static VIDEO_START( calorie )
111111{
112112   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     16,16,16,16);
113113   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,32,32);
r1281r1282
115115   tilemap_set_transparent_pen(fg_tilemap,0);
116116}
117117
118VIDEO_UPDATE( calorie )
118static VIDEO_UPDATE( calorie )
119119{
120120   int x;
121121
src/mame/drivers/drtomy.c
r1281r1282
8989   }
9090}
9191
92VIDEO_START( drtomy )
92static VIDEO_START( drtomy )
9393{
9494   tilemap_bg = tilemap_create(get_tile_info_bg,tilemap_scan_rows,TILEMAP_TYPE_PEN,      16,16,32,32);
9595   tilemap_fg = tilemap_create(get_tile_info_fg,tilemap_scan_rows,TILEMAP_TYPE_PEN, 16,16,32,32);
r1281r1282
9797   tilemap_set_transparent_pen(tilemap_fg,0);
9898}
9999
100VIDEO_UPDATE( drtomy )
100static VIDEO_UPDATE( drtomy )
101101{
102102   tilemap_draw(bitmap,cliprect,tilemap_bg,0,0);
103103   tilemap_draw(bitmap,cliprect,tilemap_fg,0,0);
r1281r1282
105105   return 0;
106106}
107107
108WRITE16_HANDLER( drtomy_vram_fg_w )
108static WRITE16_HANDLER( drtomy_vram_fg_w )
109109{
110110   COMBINE_DATA(&drtomy_videoram_fg[offset]);
111111   tilemap_mark_tile_dirty(tilemap_fg,offset);
112112}
113113
114WRITE16_HANDLER( drtomy_vram_bg_w )
114static WRITE16_HANDLER( drtomy_vram_bg_w )
115115{
116116   COMBINE_DATA(&drtomy_videoram_bg[offset]);
117117   tilemap_mark_tile_dirty(tilemap_bg,offset);
118118}
119119
120WRITE16_HANDLER( drtomy_okibank_w )
120static WRITE16_HANDLER( drtomy_okibank_w )
121121{
122122   static int oki_bank;
123123
src/mame/drivers/namcos11.c
r1281r1282
883883   state_save_register_global( m_n_oldcoin );
884884}
885885
886MACHINE_RESET( namcos11 )
886static MACHINE_RESET( namcos11 )
887887{
888888   memset( namcos11_keycus, 0, namcos11_keycus_size );
889889   psx_machine_init();
src/mame/drivers/kickgoal.c
r1281r1282
105105
106106#define oki_time_base 0x08
107107
108static int kickgoal_sound;
109static int kickgoal_melody;
108//static int kickgoal_sound;
109//static int kickgoal_melody;
110110static int kickgoal_melody_loop;
111static int kickgoal_snd_bank;
111//static int kickgoal_snd_bank;
112112static int snd_new, snd_sam[4];
113113
114114
r1281r1282
125125VIDEO_UPDATE( actionhw );
126126
127127
128#ifdef UNUSED_FUNCTION
128129static void kickgoal_play(int melody, int data)
129130{
130131   int status = OKIM6295_status_0_r(0);
r1281r1282
209210      }
210211   }
211212}
213#endif
212214
213WRITE16_HANDLER( actionhw_snd_w )
215static WRITE16_HANDLER( actionhw_snd_w )
214216{
215217   logerror("PC:%06x Writing %04x to Sound CPU - mask %04x\n",activecpu_get_previouspc(),data,mem_mask);
216218
r1281r1282
791793
792794/* GAME drivers **************************************************************/
793795
794DRIVER_INIT( kickgoal )
796static DRIVER_INIT( kickgoal )
795797{
796798#if 0 /* we should find a real fix instead  */
797799   UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
src/mame/drivers/galaxian.c
r1281r1282
620620
621621
622622
623READ8_HANDLER( scramb2_protection_r ) { return 0x25; }
624READ8_HANDLER( scramb2_port0_r ) { return (readinputport(0)>>offset)&0x1; }
625READ8_HANDLER( scramb2_port1_r ) { return (readinputport(1)>>offset)&0x1; }
626READ8_HANDLER( scramb2_port2_r ) { return (readinputport(2)>>offset)&0x1; }
623static READ8_HANDLER( scramb2_protection_r ) { return 0x25; }
624static READ8_HANDLER( scramb2_port0_r ) { return (readinputport(0)>>offset)&0x1; }
625static READ8_HANDLER( scramb2_port1_r ) { return (readinputport(1)>>offset)&0x1; }
626static READ8_HANDLER( scramb2_port2_r ) { return (readinputport(2)>>offset)&0x1; }
627627
628628static ADDRESS_MAP_START( scramb2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
629629   AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_ROM)
src/mame/drivers/bbusters.c
r1281r1282
909909}
910910#endif
911911
912DRIVER_INIT( bbusters )
912static DRIVER_INIT( bbusters )
913913{
914914   #if BBUSTERS_HACK
915915   bbusters_patch_code(0x00234c);
916916   #endif
917917}
918918
919DRIVER_INIT( mechatt )
919static DRIVER_INIT( mechatt )
920920{
921921   #if MECHATT_HACK
922922   bbusters_patch_code(0x003306);
src/mame/drivers/hyprduel.c
r1281r1282
206206   update_irq_state();
207207}
208208
209MACHINE_RESET( hyprduel )
209static MACHINE_RESET( hyprduel )
210210{
211211   /* start with cpu2 halted */
212212   cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
r1281r1282
228228
229229static UINT16 *hyprduel_rombank;
230230
231READ16_HANDLER( hyprduel_bankedrom_r )
231static READ16_HANDLER( hyprduel_bankedrom_r )
232232{
233233   const int region = REGION_GFX1;
234234
src/mame/drivers/fcrash.c
r1281r1282
122122   }
123123}
124124
125VIDEO_UPDATE( fcrash )
125static VIDEO_UPDATE( fcrash )
126126{
127127      int layercontrol,l0,l1,l2,l3;
128128   int videocontrol=cps1_port(0x22);
src/mame/drivers/strnskil.c
r1281r1282
2929extern VIDEO_START( strnskil );
3030extern VIDEO_UPDATE( strnskil );
3131
32WRITE8_HANDLER( strnskil_sharedram_w )
32static WRITE8_HANDLER( strnskil_sharedram_w )
3333{
3434   strnskil_sharedram[offset] = data;
3535}
3636
37READ8_HANDLER( strnskil_sharedram_r )
37static READ8_HANDLER( strnskil_sharedram_r )
3838{
3939   return strnskil_sharedram[offset];
4040}
4141
42READ8_HANDLER( strnskil_d800_r )
42static READ8_HANDLER( strnskil_d800_r )
4343{
4444/* bit0: interrupt type?, bit1: CPU2 busack? */
4545
r1281r1282
516516   ROM_LOAD( "ban-rom12.ic2", 0x0000,  0x2000, CRC(044bb2f6) SHA1(829b2152740061e0506c7504885d8404fb8fe360) )
517517ROM_END
518518
519DRIVER_INIT( pettanp )
519static DRIVER_INIT( pettanp )
520520{
521521//  AM_RANGE(0xd80c, 0xd80c) AM_WRITE(MWA8_NOP)     /* protection reset? */
522522//  AM_RANGE(0xd80d, 0xd80d) AM_WRITE(protection_w) /* protection data write (pettanp) */
r1281r1282
528528
529529}
530530
531DRIVER_INIT( banbam )
531static DRIVER_INIT( banbam )
532532{
533533   /* Fujitsu MB8841 4-Bit MCU */
534534   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xd806, 0xd806, 0, 0, banbam_protection_r);
src/mame/drivers/sfkick.c
r1281r1282
6868INPUT_PORTS_END
6969
7070
71VIDEO_START( sfkick )
71static VIDEO_START( sfkick )
7272{
7373}
7474
75VIDEO_UPDATE( sfkick )
75static VIDEO_UPDATE( sfkick )
7676{
7777
7878   return 0;
src/mame/drivers/dgpix.c
r1281r1282
233233ADDRESS_MAP_END
234234
235235
236NVRAM_HANDLER( flashroms )
236static NVRAM_HANDLER( flashroms )
237237{
238238   if (read_or_write)
239239   {
r1281r1282
297297   PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNUSED )
298298INPUT_PORTS_END
299299
300VIDEO_START( dgpix )
300static VIDEO_START( dgpix )
301301{
302302   vram = auto_malloc(0x40000*2);
303303   bitmaps[0] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
304304   bitmaps[1] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
305305}
306306
307VIDEO_UPDATE( dgpix )
307static VIDEO_UPDATE( dgpix )
308308{
309309   copybitmap(bitmap,bitmaps[vbuffer ^ 1],0,0,0,0,cliprect,TRANSPARENCY_NONE,0);
310310   return 0;
src/mame/drivers/cosmic.c
r1281r1282
109109   #endif
110110}
111111
112WRITE8_HANDLER( panic_sound_output2_w )
112static WRITE8_HANDLER( panic_sound_output2_w )
113113{
114114   panic_sound_output_w(offset+15, data);
115115}
116116
117WRITE8_HANDLER( cosmicg_output_w )
117static WRITE8_HANDLER( cosmicg_output_w )
118118{
119119   static int march_select;
120120    static int gun_die_select;
src/mame/drivers/sangho.c
r1281r1282
329329   /* 15 empty */
330330ROM_END
331331
332DRIVER_INIT(sangho)
332static DRIVER_INIT(sangho)
333333{
334334   sangho_ram = auto_malloc(0x20000);
335335}
src/mame/drivers/mjsiyoub.c
r1281r1282
3535#include "sound/msm5205.h"
3636
3737
38VIDEO_START(mjsiyoub)
38static VIDEO_START(mjsiyoub)
3939{
4040}
4141
42VIDEO_UPDATE(mjsiyoub)
42static VIDEO_UPDATE(mjsiyoub)
4343{
4444   return 0;
4545}
src/mame/drivers/lazercmd.c
r1281r1282
768768ROM_END
769769
770770
771DRIVER_INIT( lazercmd )
771static DRIVER_INIT( lazercmd )
772772{
773773int i, y;
774774
r1281r1282
796796   }
797797}
798798
799DRIVER_INIT( medlanes )
799static DRIVER_INIT( medlanes )
800800{
801801int i, y;
802802
r1281r1282
824824   }
825825}
826826
827DRIVER_INIT( bbonk )
827static DRIVER_INIT( bbonk )
828828{
829829int i, y;
830830
src/mame/drivers/popeye.c
r1281r1282
667667
668668
669669
670DRIVER_INIT( skyskipr )
670static DRIVER_INIT( skyskipr )
671671{
672672   UINT8 *buffer;
673673   UINT8 *rom = memory_region(REGION_CPU1);
r1281r1282
684684   }
685685}
686686
687DRIVER_INIT( popeye )
687static DRIVER_INIT( popeye )
688688{
689689   UINT8 *buffer;
690690   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/gstream.c
r1281r1282
323323}
324324
325325
326VIDEO_START(gstream)
326static VIDEO_START(gstream)
327327{
328328   gstream_tilemap1 = tilemap_create(get_gs1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 32, 32,16,16);
329329   gstream_tilemap2 = tilemap_create(get_gs2_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 32, 32,16,16);
r1281r1282
333333   tilemap_set_transparent_pen(gstream_tilemap2,0);
334334}
335335
336VIDEO_UPDATE(gstream)
336static VIDEO_UPDATE(gstream)
337337{
338338   /* The tilemaps and sprite sre interleaved together.
339339       Even Words are tilemap tiles
src/mame/drivers/taxidrvr.c
r1281r1282
104104   { p0c_w, p1c_w, p2c_w, p3c_w, p4c_w }   /* Port C write */
105105};
106106
107MACHINE_RESET( taxidrvr )
107static MACHINE_RESET( taxidrvr )
108108{
109109   ppi8255_init(&ppi8255_intf);
110110}
src/mame/drivers/blockade.c
r1281r1282
4040static UINT8 coin_latch;  /* Active Low */
4141static UINT8 just_been_reset;
4242
43DRIVER_INIT( blockade )
43static DRIVER_INIT( blockade )
4444{
4545   coin_latch = 1;
4646   just_been_reset = 0;
r1281r1282
7474   }
7575}
7676
77READ8_HANDLER( blockade_input_port_0_r )
77static READ8_HANDLER( blockade_input_port_0_r )
7878{
7979    /* coin latch is bit 7 */
8080
r1281r1282
8282    return (coin_latch<<7) | (temp);
8383}
8484
85WRITE8_HANDLER( blockade_coin_latch_w )
85static WRITE8_HANDLER( blockade_coin_latch_w )
8686{
8787    if (data & 0x80)
8888    {
src/mame/drivers/cps2.c
r1281r1282
557557Export this function so that the video routine can drive the
558558Q-Sound hardware
559559*/
560#ifdef UNUSED_FUNCTION
560561WRITE16_HANDLER( cps2_qsound_sharedram_w )
561562{
562563    qsound_sharedram1_w(offset/2, data, 0xff00);
563564}
565#endif
564566
565567/* Maximum size of Q Sound Z80 region */
566568#define QSOUND_SIZE 0x50000
r1281r1282
654656   }
655657}
656658
657READ16_HANDLER( cps2_eeprom_port_r )
659static READ16_HANDLER( cps2_eeprom_port_r )
658660{
659661    return (input_port_2_word_r(offset,0) & 0xfffe) | EEPROM_read_bit();
660662}
661663
662WRITE16_HANDLER( cps2_eeprom_port_w )
664static WRITE16_HANDLER( cps2_eeprom_port_w )
663665{
664666    if (ACCESSING_MSB)
665667    {
r1281r1282
727729    }
728730}
729731
730READ16_HANDLER( cps2_qsound_volume_r )
732static READ16_HANDLER( cps2_qsound_volume_r )
731733{
732734   /* Extra adapter memory (0x660000-0x663fff) available when bit 14 = 0 */
733735   /* Network adapter (ssf2tb) present when bit 15 = 0 */
src/mame/drivers/pushman.c
r1281r1282
125125   shared_ram[offset]=data;
126126}
127127
128MACHINE_RESET( bballs )
128static MACHINE_RESET( bballs )
129129{
130130   latch=0x400;
131131}
src/mame/drivers/zerozone.c
r1281r1282
5656}
5757
5858
59WRITE16_HANDLER( zerozone_sound_w )
59static WRITE16_HANDLER( zerozone_sound_w )
6060{
6161   if (ACCESSING_MSB)
6262   {
src/mame/drivers/tiamc1.c
r1281r1282
143143
144144static UINT8 *video_ram;
145145
146DRIVER_INIT( tiamc1 )
146static DRIVER_INIT( tiamc1 )
147147{
148148   video_ram = auto_malloc(0x3040);
149149}
150150
151MACHINE_RESET( tiamc1 )
151static MACHINE_RESET( tiamc1 )
152152{
153153   memset(video_ram, 0, 0x3040);
154154
r1281r1282
165165   state_save_register_global_pointer(video_ram, 0x3040);
166166}
167167
168WRITE8_HANDLER( tiamc1_control_w )
168static WRITE8_HANDLER( tiamc1_control_w )
169169{
170170   coin_lockout_w(0, ~data & 0x02);
171171   coin_counter_w(0, data & 0x04);
src/mame/drivers/toaplan1.c
r1281r1282
23992399ROM_END
24002400
24012401
2402DRIVER_INIT( toaplan1 )
2402static DRIVER_INIT( toaplan1 )
24032403{
24042404   toaplan1_driver_savestate();
24052405}
24062406
2407DRIVER_INIT( demonwld )
2407static DRIVER_INIT( demonwld )
24082408{
24092409   toaplan1_driver_savestate();
24102410   demonwld_driver_savestate();
24112411}
24122412
2413DRIVER_INIT( vimana )
2413static DRIVER_INIT( vimana )
24142414{
24152415   toaplan1_driver_savestate();
24162416   vimana_driver_savestate();
src/mame/drivers/magic10.c
r1281r1282
292292}
293293
294294
295VIDEO_START( magic10 )
295static VIDEO_START( magic10 )
296296{
297297   layer0_tilemap = tilemap_create(get_layer0_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     16,16,32,32);
298298   layer1_tilemap = tilemap_create(get_layer1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,32,32);
r1281r1282
305305   tilemap_set_scrolly(layer2_tilemap,0,layer2_offset[1]);
306306}
307307
308VIDEO_UPDATE( magic10 )
308static VIDEO_UPDATE( magic10 )
309309{
310310   tilemap_draw(bitmap,cliprect,layer0_tilemap,0,0);
311311   tilemap_draw(bitmap,cliprect,layer1_tilemap,0,0);
r1281r1282
461461   ROM_LOAD( "7.u32",        0x00000, 0x40000, CRC(47804af7) SHA1(602dc0361869b52532e2adcb0de3cbdd042761b3) )
462462ROM_END
463463
464DRIVER_INIT( magic10 )
464static DRIVER_INIT( magic10 )
465465{
466466   layer2_offset[0] = 32;
467467   layer2_offset[1] = 2;
468468}
469469
470DRIVER_INIT( magic102 )
470static DRIVER_INIT( magic102 )
471471{
472472   layer2_offset[0] = 8;
473473   layer2_offset[1] = 20;
src/mame/drivers/shanghai.c
r1281r1282
657657
658658
659659
660PALETTE_INIT( shanghai )
660static PALETTE_INIT( shanghai )
661661{
662662   int i;
663663
r1281r1282
687687   }
688688}
689689
690VIDEO_START( shanghai )
690static VIDEO_START( shanghai )
691691{
692692   HD63484_start();
693693}
694694
695VIDEO_UPDATE( shanghai )
695static VIDEO_UPDATE( shanghai )
696696{
697697   int x,y,b;
698698
src/mame/drivers/tmnt.c
r1281r1282
130130   K052109_word_w(offset,data,mem_mask);
131131}
132132
133WRITE16_HANDLER( punkshot_K052109_word_w )
133static WRITE16_HANDLER( punkshot_K052109_word_w )
134134{
135135   /* it seems that a word write is supposed to affect only the MSB. The */
136136   /* "ROUND 1" text in punkshtj goes lost otherwise. */
r1281r1282
290290   return K053260_0_r(2 + offset);
291291}
292292
293READ8_HANDLER( tmnt_sres_r )
293static READ8_HANDLER( tmnt_sres_r )
294294{
295295   return tmnt_soundlatch;
296296}
297297
298WRITE8_HANDLER( tmnt_sres_w )
298static WRITE8_HANDLER( tmnt_sres_w )
299299{
300300   /* bit 1 resets the UPD7795C sound chip */
301301   upd7759_reset_w(0, data & 2);
r1281r1282
10231023   else if (addr >= 0x104000/2 && addr <= 0x107fff/2) sunset_104000[addr-0x104000/2] = data;
10241024}
10251025
1026WRITE16_HANDLER( tmnt2_1c0800_w )
1026static WRITE16_HANDLER( tmnt2_1c0800_w )
10271027{
10281028   UINT32 src_addr, dst_addr, mod_addr, attr1, code, attr2, cbase, cmod, color;
10291029   int xoffs, yoffs, xmod, ymod, zmod, xzoom, yzoom, i;
r1281r1282
11391139   tmnt2_put_word(dst_addr + 12, attr2 | color);
11401140}
11411141#else // for reference; do not remove
1142WRITE16_HANDLER( tmnt2_1c0800_w )
1142static WRITE16_HANDLER( tmnt2_1c0800_w )
11431143{
11441144    COMBINE_DATA( tmnt2_1c0800 + offset);
11451145    if ( offset == 0x0008 && ( tmnt2_1c0800[0x8] & 0xff00 ) == 0x8200 )
src/mame/drivers/namcos12.c
r1281r1282
11011101   return data;
11021102}
11031103
1104MACHINE_RESET( namcos12 )
1104static MACHINE_RESET( namcos12 )
11051105{
11061106   psx_machine_init();
11071107   bankoffset_w(0,0,0);
src/mame/drivers/raiden2.c
r1281r1282
216216
217217/* VIDEO START (move to video file) */
218218
219VIDEO_START( raiden2 )
219static VIDEO_START( raiden2 )
220220{
221221   text_layer       = tilemap_create(get_text_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN,  8, 8, 64,32 );
222222   background_layer = tilemap_create(get_back_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16,16, 32,32 );
r1281r1282
241241
242242/* VIDEO UPDATE (move to video file) */
243243
244VIDEO_UPDATE ( raiden2 )
244static VIDEO_UPDATE ( raiden2 )
245245{
246246   int info_1, info_2, info_3;
247247
src/mame/drivers/mogura.c
r1281r1282
77UINT8* mogura_gfxram;
88static tilemap *mogura_tilemap;
99
10PALETTE_INIT( mogura )
10static PALETTE_INIT( mogura )
1111{
1212   int i,j;
1313   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
r1281r1282
5353}
5454
5555
56VIDEO_START( mogura )
56static VIDEO_START( mogura )
5757{
5858   mogura_tilemap = tilemap_create(get_mogura_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64, 32);
5959}
6060
61VIDEO_UPDATE( mogura )
61static VIDEO_UPDATE( mogura )
6262{
6363   /* tilemap layout is a bit strange ... */
6464   rectangle clip;
r1281r1282
7979   return 0;
8080}
8181
82WRITE8_HANDLER( mogura_tileram_w )
82static WRITE8_HANDLER( mogura_tileram_w )
8383{
8484   mogura_tileram[offset] = data;
8585   tilemap_mark_tile_dirty(mogura_tilemap,offset&0x7ff);
r1281r1282
111111ADDRESS_MAP_END
112112
113113
114WRITE8_HANDLER ( mogura_gfxram_w )
114static WRITE8_HANDLER ( mogura_gfxram_w )
115115{
116116   mogura_gfxram[offset] = data ;
117117
src/mame/drivers/missb2.c
r1281r1282
3333
3434/* Video Hardware */
3535
36VIDEO_UPDATE( missb2 )
36static VIDEO_UPDATE( missb2 )
3737{
3838   int offs;
3939   int sx,sy,xc,yc;
src/mame/drivers/ddealer.c
r1281r1282
110110static int respcount;
111111
112112
113VIDEO_START( ddealer )
113static VIDEO_START( ddealer )
114114{
115115}
116116
r1281r1282
136136
137137}
138138
139VIDEO_UPDATE( ddealer )
139static VIDEO_UPDATE( ddealer )
140140{
141141   ddealer_protection(machine);
142142   return 0;
src/mame/drivers/berzerk.c
r1281r1282
286286 *
287287 *************************************/
288288
289MACHINE_RESET( berzerk )
289static MACHINE_RESET( berzerk )
290290{
291291   irq_enabled = 0;
292292   nmi_enabled = 0;
src/mame/drivers/citycon.c
r1281r1282
1919VIDEO_START( citycon );
2020
2121
22READ8_HANDLER( citycon_in_r )
22static READ8_HANDLER( citycon_in_r )
2323{
2424   return readinputport(flip_screen ? 1 : 0);
2525}
src/mame/drivers/psikyo.c
r1281r1282
8686static UINT8 psikyo_soundlatch;
8787static int z80_nmi, mcu_status;
8888
89MACHINE_RESET( psikyo )
89static MACHINE_RESET( psikyo )
9090{
9191   z80_nmi = mcu_status = 0;
9292}
r1281r1282
137137   return ret;
138138}
139139
140READ32_HANDLER( sngkace_input_r )
140static READ32_HANDLER( sngkace_input_r )
141141{
142142   switch(offset)
143143   {
r1281r1282
149149   }
150150}
151151
152READ32_HANDLER( gunbird_input_r )
152static READ32_HANDLER( gunbird_input_r )
153153{
154154   switch(offset)
155155   {
r1281r1282
168168   z80_nmi = 1;
169169}
170170
171WRITE32_HANDLER( psikyo_soundlatch_w )
171static WRITE32_HANDLER( psikyo_soundlatch_w )
172172{
173173   if (ACCESSING_LSB32)
174174      timer_call_after_resynch(data & 0xff, psikyo_soundlatch_callback);
r1281r1282
178178                        Strikers 1945 / Tengai
179179***************************************************************************/
180180
181WRITE32_HANDLER( s1945_soundlatch_w )
181static WRITE32_HANDLER( s1945_soundlatch_w )
182182{
183183   if (!(mem_mask & 0x00ff0000))
184184      timer_call_after_resynch((data >> 16) & 0xff, psikyo_soundlatch_callback);
r1281r1282
220220   s1945_mcu_bctrl = 0x00;
221221}
222222
223WRITE32_HANDLER( s1945_mcu_w )
223static WRITE32_HANDLER( s1945_mcu_w )
224224{
225225   // Accesses are always bytes, so resolve it
226226   int suboff;
r1281r1282
284284   }
285285}
286286
287READ32_HANDLER( s1945_mcu_r )
287static READ32_HANDLER( s1945_mcu_r )
288288{
289289   switch(offset) {
290290   case 0: {
r1281r1282
305305   return 0;
306306}
307307
308READ32_HANDLER( s1945_input_r )
308static READ32_HANDLER( s1945_input_r )
309309{
310310   switch(offset)
311311   {
r1281r1282
373373   cpunum_set_input_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
374374}
375375
376READ8_HANDLER( psikyo_soundlatch_r )
376static READ8_HANDLER( psikyo_soundlatch_r )
377377{
378378   return psikyo_soundlatch;
379379}
380380
381WRITE8_HANDLER( psikyo_clear_nmi_w )
381static WRITE8_HANDLER( psikyo_clear_nmi_w )
382382{
383383   cpunum_set_input_line(1, INPUT_LINE_NMI, CLEAR_LINE);
384384   z80_nmi = 0;
r1281r1282
389389                        Sengoku Ace / Samurai Aces
390390***************************************************************************/
391391
392WRITE8_HANDLER( sngkace_sound_bankswitch_w )
392static WRITE8_HANDLER( sngkace_sound_bankswitch_w )
393393{
394394   UINT8 *RAM = memory_region(REGION_CPU2);
395395   int bank = data & 3;
r1281r1282
431431                                Gun Bird
432432***************************************************************************/
433433
434WRITE8_HANDLER( gunbird_sound_bankswitch_w )
434static WRITE8_HANDLER( gunbird_sound_bankswitch_w )
435435{
436436   UINT8 *RAM = memory_region(REGION_CPU2);
437437   int bank = (data >> 4) & 3;
r1281r1282
17951795
17961796ROM_END
17971797
1798DRIVER_INIT( sngkace )
1798static DRIVER_INIT( sngkace )
17991799{
18001800   {
18011801      UINT8 *RAM   =   memory_region(REGION_SOUND1);
r1281r1282
19801980
19811981
19821982
1983DRIVER_INIT( gunbird )
1983static DRIVER_INIT( gunbird )
19841984{
19851985   /* input ports */
19861986   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
r1281r1282
20382038
20392039ROM_END
20402040
2041DRIVER_INIT( s1945jn )
2041static DRIVER_INIT( s1945jn )
20422042{
20432043   /* input ports */
20442044   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
r1281r1282
21932193
21942194ROM_END
21952195
2196DRIVER_INIT( s1945 )
2196static DRIVER_INIT( s1945 )
21972197{
21982198   /* input ports */
21992199   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
r1281r1282
22082208   psikyo_ka302c_banking = 0; // Banking is controlled by mcu
22092209}
22102210
2211DRIVER_INIT( s1945a )
2211static DRIVER_INIT( s1945a )
22122212{
22132213   /* input ports */
22142214   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
r1281r1282
22232223   psikyo_ka302c_banking = 0; // Banking is controlled by mcu
22242224}
22252225
2226DRIVER_INIT( s1945j )
2226static DRIVER_INIT( s1945j )
22272227{
22282228   /* input ports*/
22292229   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
r1281r1282
22902290
22912291ROM_END
22922292
2293DRIVER_INIT( tengai )
2293static DRIVER_INIT( tengai )
22942294{
22952295   /* input ports */
22962296   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
src/mame/drivers/dynadice.c
r1281r1282
3737static tilemap *bg_tilemap,*top_tilemap;
3838static int ay_data;
3939
40WRITE8_HANDLER( dynadice_videoram_w )
40static WRITE8_HANDLER( dynadice_videoram_w )
4141{
4242   videoram[offset] = data;
4343   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
171171   SET_TILE_INFO(1, code, 0, 0);
172172}
173173
174VIDEO_START( dynadice )
174static VIDEO_START( dynadice )
175175{
176176   /* pacman - style videoram layout */
177177   bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
r1281r1282
179179   tilemap_set_scrollx(bg_tilemap, 0, -16 );
180180}
181181
182VIDEO_UPDATE( dynadice )
182static VIDEO_UPDATE( dynadice )
183183{
184184   rectangle myclip=*cliprect;
185185   myclip.max_x=15;
r1281r1282
188188   return 0;
189189}
190190
191PALETTE_INIT( dynadice )
191static PALETTE_INIT( dynadice )
192192{
193193   int i;
194194   for(i=0;i<8;i++)
src/mame/drivers/dacholer.c
r1281r1282
252252   SET_TILE_INFO(0,fgvideoram[tile_index],0,0);
253253}
254254
255VIDEO_START( dacholer )
255static VIDEO_START( dacholer )
256256{
257257   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     8,8,32,32);
258258   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
r1281r1282
292292   }
293293}
294294
295VIDEO_UPDATE(dacholer)
295static VIDEO_UPDATE(dacholer)
296296{
297297   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
298298   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
src/mame/drivers/esd16.c
r1281r1282
6363
6464***************************************************************************/
6565
66WRITE16_HANDLER( esd16_spriteram_w ) {   COMBINE_DATA(&spriteram16[offset]);   }
66static WRITE16_HANDLER( esd16_spriteram_w ) {   COMBINE_DATA(&spriteram16[offset]);   }
6767
68WRITE16_HANDLER( esd16_sound_command_w )
68static WRITE16_HANDLER( esd16_sound_command_w )
6969{
7070   if (ACCESSING_LSB)
7171   {
r1281r1282
116116   AM_RANGE(0x60000c, 0x60000d) AM_WRITE(esd16_sound_command_w         )   // To Sound CPU
117117ADDRESS_MAP_END
118118
119WRITE16_HANDLER(hedpanic_platform_w)
119static WRITE16_HANDLER(hedpanic_platform_w)
120120{
121121   int offsets = headpanic_platform_x[0]+0x40* headpanic_platform_y[0];
122122
r1281r1282
282282   AM_RANGE(0xf800, 0xffff) AM_WRITE(MWA8_RAM      )   // RAM
283283ADDRESS_MAP_END
284284
285READ8_HANDLER( esd16_sound_command_r )
285static READ8_HANDLER( esd16_sound_command_r )
286286{
287287   /* Clear IRQ only after reading the command, or some get lost */
288288   cpunum_set_input_line(1,0,CLEAR_LINE);
src/mame/drivers/namcos21.c
r1281r1282
22082208   namcos21_init( NAMCOS21_AIRCOMBAT );
22092209}
22102210
2211DRIVER_INIT( starblad )
2211static DRIVER_INIT( starblad )
22122212{
22132213   namcos21_init( NAMCOS21_STARBLADE );
22142214}
22152215
22162216
2217DRIVER_INIT( cybsled )
2217static DRIVER_INIT( cybsled )
22182218{
22192219   namcos21_init( NAMCOS21_CYBERSLED );
22202220}
22212221
2222DRIVER_INIT( solvalou )
2222static DRIVER_INIT( solvalou )
22232223{
22242224   UINT16 *mem = (UINT16 *)memory_region(REGION_CPU1);
22252225   mem[0x20ce4/2+1] = 0x0000; // $200128
r1281r1282
22302230   namcos21_init( NAMCOS21_SOLVALOU );
22312231}
22322232
2233DRIVER_INIT( driveyes )
2233static DRIVER_INIT( driveyes )
22342234{
22352235   UINT16 *pMem = (UINT16 *)memory_region(REGION_CPU5);
22362236   int pc = 0;
src/mame/drivers/pgm.c
r1281r1282
474474   return ((data / 10) << 4) | (data % 10);
475475}
476476
477READ16_HANDLER( pgm_calendar_r )
477static READ16_HANDLER( pgm_calendar_r )
478478{
479479   UINT8 calr;
480480   calr = (CalVal & CalMask) ? 1 : 0;
r1281r1282
482482   return calr;
483483}
484484
485WRITE16_HANDLER( pgm_calendar_w )
485static WRITE16_HANDLER( pgm_calendar_w )
486486{
487487   static mame_system_time systime;
488488
r1281r1282
729729
730730UINT16 kovsh_highlatch, kovsh_lowlatch;
731731
732READ32_HANDLER( kovsh_arm7_protlatch_r )
732static READ32_HANDLER( kovsh_arm7_protlatch_r )
733733{
734734//  return 0x00880000;
735735//  return 0x0088ff66;
r1281r1282
737737   return (kovsh_highlatch << 16) | (kovsh_lowlatch);
738738}
739739
740WRITE32_HANDLER( kovsh_arm7_protlatch_w )
740static WRITE32_HANDLER( kovsh_arm7_protlatch_w )
741741{
742742   if (!(mem_mask & 0xffff0000))
743743   {
r1281r1282
752752//  cpu_spinuntil_time(MAME_TIME_IN_CYCLES(100, 0));
753753}
754754
755READ16_HANDLER( kovsh_68k_protlatch_r )
755static READ16_HANDLER( kovsh_68k_protlatch_r )
756756{
757757   //cpu_boost_interleave(time_zero, MAME_TIME_IN_USEC(200));
758758   cpu_spinuntil_time(MAME_TIME_IN_CYCLES(600, 0));
r1281r1282
765765   return -1;
766766}
767767
768WRITE16_HANDLER( kovsh_68k_protlatch_w )
768static WRITE16_HANDLER( kovsh_68k_protlatch_w )
769769{
770770   switch (offset)
771771   {
r1281r1282
805805   AM_RANGE(0x500000, 0x500003) AM_READWRITE(kovsh_68k_protlatch_r, kovsh_68k_protlatch_w) /* ARM7 Latch */
806806ADDRESS_MAP_END
807807
808READ32_HANDLER( kovsh_arm7_unk_r )
808static READ32_HANDLER( kovsh_arm7_unk_r )
809809{
810810   return 0x00000000;
811811}
r1281r1282
18661866static int reg;
18671867static int ptr;
18681868
1869WRITE16_HANDLER( killbld_prot_w )
1869static WRITE16_HANDLER( killbld_prot_w )
18701870{
18711871//  mame_printf_debug("killbrd prot r\n");
18721872//  return 0;
r1281r1282
20272027   }
20282028}
20292029
2030READ16_HANDLER( killbld_prot_r )
2030static READ16_HANDLER( killbld_prot_r )
20312031{
20322032//  mame_printf_debug("killbld prot w\n");
20332033   UINT16 res ;
r1281r1282
21192119}
21202120
21212121
2122READ16_HANDLER(ddp2_protram_r)
2122static READ16_HANDLER(ddp2_protram_r)
21232123{
21242124   if (PGMLOGERROR) logerror("prot_r %04x, %04x\n", offset,ddp2_protram[offset]);
21252125
r1281r1282
21302130   return ddp2_protram[offset];
21312131}
21322132
2133WRITE16_HANDLER(ddp2_protram_w)
2133static WRITE16_HANDLER(ddp2_protram_w)
21342134{
21352135   if (PGMLOGERROR) logerror("prot_w %04x, %02x\n", offset,data);
21362136   COMBINE_DATA(&ddp2_protram[offset]);
src/mame/drivers/iqblock.c
r1281r1282
121121   { port_C_w },            /* Port C write */
122122};
123123
124MACHINE_RESET( iqblock )
124static MACHINE_RESET( iqblock )
125125{
126126   ppi8255_init(&ppi8255_intf);
127127}
src/mame/drivers/ikki.c
r1281r1282
1919WRITE8_HANDLER( ikki_scroll_w );
2020WRITE8_HANDLER( ikki_scrn_ctrl_w );
2121
22READ8_HANDLER( ikki_e000_r )
22static READ8_HANDLER( ikki_e000_r )
2323{
2424/* bit1: interrupt type?, bit0: CPU2 busack? */
2525
r1281r1282
2828   return 2;
2929}
3030
31WRITE8_HANDLER( ikki_coin_counters )
31static WRITE8_HANDLER( ikki_coin_counters )
3232{
3333   coin_counter_w( 0, data & 0x01 );
3434   coin_counter_w( 1, data & 0x02 );
src/mame/drivers/capbowl.c
r1281r1282
146146 *
147147 *************************************/
148148
149WRITE8_HANDLER( capbowl_rom_select_w )
149static WRITE8_HANDLER( capbowl_rom_select_w )
150150{
151151   int bankaddress = ((data & 0x0c) << 13) + ((data & 0x01) << 14);
152152   memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x10000 + bankaddress);
src/mame/drivers/darius.c
r1281r1282
139139#include "darius.lh"
140140
141141
142MACHINE_START( darius );
143MACHINE_RESET( darius );
142static MACHINE_START( darius );
143static MACHINE_RESET( darius );
144144
145145VIDEO_START( darius );
146146VIDEO_UPDATE( darius );
r1281r1282
12191219}
12201220
12211221
1222MACHINE_START( darius )
1222static MACHINE_START( darius )
12231223{
12241224   state_save_register_global(cpua_ctrl);
12251225   state_save_register_func_postload(parse_control);
r1281r1282
12321232}
12331233
12341234
1235MACHINE_RESET( darius )
1235static MACHINE_RESET( darius )
12361236{
12371237   int  i;
12381238
src/mame/drivers/ssingles.c
r1281r1282
4949   ssingles_vram[offset]=data;
5050}
5151
52VIDEO_START(ssingles)
52static VIDEO_START(ssingles)
5353{
5454}
5555
56VIDEO_UPDATE(ssingles)
56static VIDEO_UPDATE(ssingles)
5757{
5858   int x,y;
5959   int addr=0;
src/mame/drivers/kinst.c
r1281r1282
206206 *
207207 *************************************/
208208
209VIDEO_UPDATE( kinst )
209static VIDEO_UPDATE( kinst )
210210{
211211   int y;
212212
src/mame/drivers/cbasebal.c
r1281r1282
314314ROM_END
315315
316316
317DRIVER_INIT( cbasebal )
317static DRIVER_INIT( cbasebal )
318318{
319319   memory_configure_bank(1, 0, 32, memory_region(REGION_CPU1) + 0x10000, 0x4000);
320320   pang_decode();
src/mame/drivers/cchasm.c
r1281r1282
146146   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* Test 3, not used in cchasm */
147147INPUT_PORTS_END
148148
149MACHINE_START( cchasm )
149static MACHINE_START( cchasm )
150150{
151151   ptm6840_config(0, &cchasm_6840_intf );
152152}
src/mame/drivers/sbasketb.c
r1281r1282
4242extern READ8_HANDLER( hyperspt_sh_timer_r );
4343
4444
45WRITE8_HANDLER( sbasketb_sh_irqtrigger_w )
45static WRITE8_HANDLER( sbasketb_sh_irqtrigger_w )
4646{
4747   cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff);
4848}
src/mame/drivers/smstrv.c
r1281r1282
195195ADDRESS_MAP_END
196196
197197
198VIDEO_START( smstrv )
198static VIDEO_START( smstrv )
199199{
200200}
201201
202VIDEO_UPDATE( smstrv )
202static VIDEO_UPDATE( smstrv )
203203{
204204   return 0;
205205}
r1281r1282
216216};
217217
218218
219MACHINE_RESET( smstrv )
219static MACHINE_RESET( smstrv )
220220{
221221   ppi8255_init(&ppi8255_intf);
222222}
src/mame/drivers/skyarmy.c
r1281r1282
4545   SET_TILE_INFO( 0, code, attr, 0);
4646}
4747
48WRITE8_HANDLER( skyarmy_videoram_w )
48static WRITE8_HANDLER( skyarmy_videoram_w )
4949{
5050        skyarmy_videoram[offset] = data;
5151        tilemap_mark_tile_dirty(skyarmy_tilemap,offset);
5252}
5353
54WRITE8_HANDLER( skyarmy_colorram_w )
54static WRITE8_HANDLER( skyarmy_colorram_w )
5555{
5656        skyarmy_colorram[offset] = data;
5757        tilemap_mark_tile_dirty(skyarmy_tilemap,offset);
5858}
5959
60WRITE8_HANDLER( skyarmy_scrollram_w )
60static WRITE8_HANDLER( skyarmy_scrollram_w )
6161{
6262        skyarmy_scrollram[offset] = data;
6363}
6464
6565
66READ8_HANDLER( skyarmy_scrollram_r )
66static READ8_HANDLER( skyarmy_scrollram_r )
6767{
6868        return skyarmy_scrollram[offset];
6969}
7070
7171
72PALETTE_INIT( skyarmy )
72static PALETTE_INIT( skyarmy )
7373{
7474   int i;
7575
r1281r1282
9797   }
9898}
9999
100VIDEO_START( skyarmy )
100static VIDEO_START( skyarmy )
101101{
102102        skyarmy_tilemap = tilemap_create(get_skyarmy_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
103103        tilemap_set_scroll_cols(skyarmy_tilemap,32);
104104}
105105
106106
107VIDEO_UPDATE( skyarmy )
107static VIDEO_UPDATE( skyarmy )
108108{
109109        int sx, sy, flipx, flipy, offs,pal;
110110        int i;
src/mame/drivers/suprgolf.c
r1281r1282
8989   AM_RANGE(0xf800, 0xffff) AM_RAM
9090ADDRESS_MAP_END
9191
92READ8_HANDLER( suprgolf_random )
92static READ8_HANDLER( suprgolf_random )
9393{
9494   return mame_rand(Machine);
9595}
r1281r1282
246246   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
247247INPUT_PORTS_END
248248
249WRITE8_HANDLER( suprgolf_writeA )
249static WRITE8_HANDLER( suprgolf_writeA )
250250{
251251   mame_printf_debug("ymwA\n");
252252}
253253
254WRITE8_HANDLER( suprgolf_writeB )
254static WRITE8_HANDLER( suprgolf_writeB )
255255{
256256   mame_printf_debug("ymwA\n");
257257}
src/mame/drivers/xexex.c
r1281r1282
7474VIDEO_UPDATE( xexex );
7575void xexex_set_alpha(int on);
7676
77MACHINE_START( xexex );
78MACHINE_RESET( xexex );
77static MACHINE_START( xexex );
78static MACHINE_RESET( xexex );
7979
8080static UINT16 *xexex_workram;
8181static UINT16 cur_control2;
r1281r1282
617617   ROM_LOAD( "067_b07.rom", 0x200000, 0x100000, CRC(ec87fe1b) SHA1(ec9823aea5a1fc5c47c8262e15e10b28be87231c) )
618618ROM_END
619619
620MACHINE_RESET( xexex )
620static MACHINE_RESET( xexex )
621621{
622622   cur_sound_region = 0;
623623   suspension_active = 0;
624624   K054539_init_flags(0, K054539_REVERSE_STEREO);
625625}
626626
627MACHINE_START( xexex )
627static MACHINE_START( xexex )
628628{
629629   state_save_register_global(cur_control2);
630630   state_save_register_func_postload(parse_control2);
src/mame/drivers/wallc.c
r1281r1282
125125   SET_TILE_INFO(0, videoram[tile_index] + 0x100, 1, 0);
126126}
127127
128VIDEO_START( wallc )
128static VIDEO_START( wallc )
129129{
130130   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols_flip_y,   TILEMAP_TYPE_PEN, 8, 8, 32, 32);
131131}
132132
133VIDEO_UPDATE( wallc )
133static VIDEO_UPDATE( wallc )
134134{
135135   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
136136   return 0;
src/mame/drivers/marinedt.c
r1281r1282
406406   GFXDECODE_ENTRY( REGION_GFX3, 0, marinedt_objlayout,  32, 4 )
407407GFXDECODE_END
408408
409PALETTE_INIT( marinedt )
409static PALETTE_INIT( marinedt )
410410{
411411   int i,r,b,g;
412412
r1281r1282
448448   SET_TILE_INFO(0, code, color, flags);
449449}
450450
451VIDEO_START( marinedt )
451static VIDEO_START( marinedt )
452452{
453453   tx_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8,32,32);
454454
r1281r1282
475475#define OBJ_FLIPX(a)   ((marinedt_pf & 0x02) == 0)
476476#define OBJ_FLIPY(a)   ((a) & 0x80)
477477
478VIDEO_UPDATE( marinedt )
478static VIDEO_UPDATE( marinedt )
479479{
480480   int sx, sy;
481481
src/mame/drivers/adp.c
r1281r1282
142142   AM_RANGE(0xfc0000, 0xffffff) AM_RAM
143143ADDRESS_MAP_END
144144
145VIDEO_START(skattv)
145static VIDEO_START(skattv)
146146{
147147}
148148
149VIDEO_UPDATE(skattv)
149static VIDEO_UPDATE(skattv)
150150{
151151   return 0;
152152}
src/mame/drivers/sliver.c
r1281r1282
438438   AM_RANGE(0x0001, 0x0001) AM_WRITE( oki_setbank )
439439ADDRESS_MAP_END
440440
441VIDEO_START(sliver)
441static VIDEO_START(sliver)
442442{
443443   sliver_bitmap_bg = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
444444   sliver_bitmap_fg = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
445445}
446446
447VIDEO_UPDATE(sliver)
447static VIDEO_UPDATE(sliver)
448448{
449449   copybitmap(bitmap, sliver_bitmap_bg, 0, 0, 0, 0, cliprect, TRANSPARENCY_NONE, 0);
450450   copybitmap(bitmap, sliver_bitmap_fg, 0, 0, 0, 0, cliprect, TRANSPARENCY_PEN, 0);
src/mame/drivers/epos.c
r1281r1282
3636
3737static int counter = 0;
3838
39MACHINE_RESET( dealer );
39static MACHINE_RESET( dealer );
4040
41WRITE8_HANDLER( dealer_decrypt_rom )
41static WRITE8_HANDLER( dealer_decrypt_rom )
4242{
4343   UINT8 *rom = memory_region(REGION_CPU1);
4444
r1281r1282
555555   ROM_LOAD( "82s123.u66",      0x0000, 0x0020, NO_DUMP )   /* missing */
556556ROM_END
557557
558MACHINE_RESET( dealer )
558static MACHINE_RESET( dealer )
559559{
560560   memory_set_bankptr(1, memory_region(REGION_CPU1));
561561
562562   ppi8255_init(&ppi8255_intf);
563563}
564564
565DRIVER_INIT( dealer )
565static DRIVER_INIT( dealer )
566566{
567567   UINT8 *rom = memory_region(REGION_CPU1);
568568   int A;
src/mame/drivers/cps3.c
r1281r1282
729729
730730
731731
732DRIVER_INIT( cps3crpt )
732static DRIVER_INIT( cps3crpt )
733733{
734734   const char *gamename = machine->gamedrv->name;
735735   const struct game_keys2 *k = &keys_table2[0];
r1281r1282
891891}
892892#endif
893893
894VIDEO_START(cps3)
894static VIDEO_START(cps3)
895895{
896896   cps3_ss_ram       = auto_malloc(0x10000);
897897   cps3_ss_ram_dirty = auto_malloc(0x400);
r1281r1282
10281028   }
10291029}
10301030
1031VIDEO_UPDATE(cps3)
1031static VIDEO_UPDATE(cps3)
10321032{
10331033   int y,x, count;
10341034//  int offset;
r1281r1282
13601360   return 0;
13611361}
13621362
1363READ32_HANDLER( cps3_ssram_r )
1363static READ32_HANDLER( cps3_ssram_r )
13641364{
13651365   if (offset>0x8000/4)
13661366      return LITTLE_ENDIANIZE_INT32(cps3_ss_ram[offset]);
r1281r1282
13681368      return cps3_ss_ram[offset];
13691369}
13701370
1371WRITE32_HANDLER( cps3_ssram_w )
1371static WRITE32_HANDLER( cps3_ssram_w )
13721372{
13731373   if (offset>0x8000/4)
13741374   {
r1281r1282
13831383   COMBINE_DATA(&cps3_ss_ram[offset]);
13841384}
13851385
1386WRITE32_HANDLER( cps3_0xc0000000_ram_w )
1386static WRITE32_HANDLER( cps3_0xc0000000_ram_w )
13871387{
13881388   COMBINE_DATA( &cps3_0xc0000000_ram[offset] );
13891389   // store a decrypted copy
r1281r1282
14771477
14781478/* FLASH ROM ACCESS */
14791479
1480READ32_HANDLER( cps3_gfxflash_r )
1480static READ32_HANDLER( cps3_gfxflash_r )
14811481{
14821482   UINT32 result = 0;
14831483   int flash1 = 8;
r1281r1282
15151515   return result;
15161516}
15171517
1518WRITE32_HANDLER( cps3_gfxflash_w )
1518static WRITE32_HANDLER( cps3_gfxflash_w )
15191519{
15201520   int command;
15211521   int flash1 = 8;
r1281r1282
16441644   { 0 }   // end of table
16451645};
16461646
1647DRIVER_INIT( cps3_testhacks )
1647static DRIVER_INIT( cps3_testhacks )
16481648{
16491649   const char *gamename = machine->gamedrv->name;
16501650   const struct cps3_test_hacks *k = &testhack_table[0];
r1281r1282
16661666}
16671667
16681668
1669READ32_HANDLER( cps3_flash1_r )
1669static READ32_HANDLER( cps3_flash1_r )
16701670{
16711671   UINT32 retvalue = cps3_flashmain_r(0, offset,mem_mask);
16721672
r1281r1282
16781678   return retvalue;
16791679}
16801680
1681READ32_HANDLER( cps3_flash2_r )
1681static READ32_HANDLER( cps3_flash2_r )
16821682{
16831683   UINT32 retvalue = cps3_flashmain_r(4, offset,mem_mask);
16841684
r1281r1282
17591759*/
17601760
17611761}
1762WRITE32_HANDLER( cps3_flash1_w )
1762static WRITE32_HANDLER( cps3_flash1_w )
17631763{
17641764   cps3_flashmain_w(0, offset,data,mem_mask);
17651765}
17661766
1767WRITE32_HANDLER( cps3_flash2_w )
1767static WRITE32_HANDLER( cps3_flash2_w )
17681768{
17691769   cps3_flashmain_w(4, offset,data,mem_mask);
17701770}
r1281r1282
18241824   }
18251825}
18261826
1827READ32_HANDLER( cps3_io1_r )
1827static READ32_HANDLER( cps3_io1_r )
18281828{
18291829   return readinputport(0);
18301830}
18311831
1832READ32_HANDLER( cps3_io2_r )
1832static READ32_HANDLER( cps3_io2_r )
18331833{
18341834   return readinputport(1);
18351835}
18361836
18371837// this seems to be dma active flags, and maybe vblank... not if it is anything else
1838READ32_HANDLER( cps3_vbl_r )
1838static READ32_HANDLER( cps3_vbl_r )
18391839{
18401840   return 0x00000000;
18411841}
18421842
1843READ32_HANDLER( cps3_unk_io_r )
1843static READ32_HANDLER( cps3_unk_io_r )
18441844{
18451845   //  warzard will crash before booting if you return anything here
18461846   return 0xffffffff;
18471847}
18481848
1849READ32_HANDLER( cps3_40C0000_r )
1849static READ32_HANDLER( cps3_40C0000_r )
18501850{
18511851   return 0x00000000;
18521852}
18531853
1854READ32_HANDLER( cps3_40C0004_r )
1854static READ32_HANDLER( cps3_40C0004_r )
18551855{
18561856   return 0x00000000;
18571857}
r1281r1282
18601860   additional interface, as these writes aren't normal for the type of eeprom we have */
18611861UINT16 cps3_current_eeprom_read;
18621862
1863READ32_HANDLER( cps3_eeprom_r )
1863static READ32_HANDLER( cps3_eeprom_r )
18641864{
18651865   int addr = offset*4;
18661866
r1281r1282
18891889   return 0x00000000;
18901890}
18911891
1892WRITE32_HANDLER( cps3_eeprom_w )
1892static WRITE32_HANDLER( cps3_eeprom_w )
18931893{
18941894   int addr = offset*4;
18951895
r1281r1282
19111911
19121912}
19131913
1914READ32_HANDLER( cps3_cdrom_r )
1914static READ32_HANDLER( cps3_cdrom_r )
19151915{
19161916
19171917   UINT32 retval = 0;
r1281r1282
19291929   return retval;
19301930}
19311931
1932WRITE32_HANDLER( cps3_cdrom_w )
1932static WRITE32_HANDLER( cps3_cdrom_w )
19331933{
19341934   if (ACCESSING_MSB32)
19351935   {
r1281r1282
19421942   }
19431943}
19441944
1945WRITE32_HANDLER( cps3_ss_bank_base_w )
1945static WRITE32_HANDLER( cps3_ss_bank_base_w )
19461946{
19471947   // might be scroll registers or something else..
19481948   // used to display bank with 'insert coin' on during sfiii2 attract intro
r1281r1282
19511951//  printf("cps3_ss_bank_base_w %08x %08x\n", data, mem_mask);
19521952}
19531953
1954WRITE32_HANDLER( cps3_ss_pal_base_w )
1954static WRITE32_HANDLER( cps3_ss_pal_base_w )
19551955{
19561956    if(DEBUG_PRINTF) printf ("cps3_ss_pal_base_w %08x %08x\n", data, mem_mask);
19571957
r1281r1282
19821982static UINT32 paldma_other2;
19831983static UINT32 paldma_length;
19841984
1985WRITE32_HANDLER( cps3_palettedma_w )
1985static WRITE32_HANDLER( cps3_palettedma_w )
19861986{
19871987   if (offset==0)
19881988   {
r1281r1282
22692269   }
22702270}
22712271
2272WRITE32_HANDLER( cps3_characterdma_w )
2272static WRITE32_HANDLER( cps3_characterdma_w )
22732273{
22742274   if(DEBUG_PRINTF) printf("chardma_w %08x %08x %08x\n", offset, data, mem_mask);
22752275
r1281r1282
23142314   }
23152315}
23162316
2317WRITE32_HANDLER( cps3_irq10_ack_w )
2317static WRITE32_HANDLER( cps3_irq10_ack_w )
23182318{
23192319   cpunum_set_input_line(0,10, CLEAR_LINE); return;
23202320}
23212321
2322WRITE32_HANDLER( cps3_irq12_ack_w )
2322static WRITE32_HANDLER( cps3_irq12_ack_w )
23232323{
23242324   cpunum_set_input_line(0,12, CLEAR_LINE); return;
23252325}
23262326
2327WRITE32_HANDLER( cps3_unk_vidregs_w )
2327static WRITE32_HANDLER( cps3_unk_vidregs_w )
23282328{
23292329   COMBINE_DATA(&cps3_unk_vidregs[offset]);
23302330}
23312331
2332READ32_HANDLER( cps3_colourram_r )
2332static READ32_HANDLER( cps3_colourram_r )
23332333{
23342334   UINT16* src = (UINT16*)cps3_colourram;
23352335
23362336   return src[offset*2+1] | (src[offset*2+0]<<16);
23372337}
23382338
2339WRITE32_HANDLER( cps3_colourram_w )
2339static WRITE32_HANDLER( cps3_colourram_w )
23402340{
23412341//  COMBINE_DATA(&cps3_colourram[offset]);
23422342
r1281r1282
25092509   NULL         /* command completion IRQ */
25102510};
25112511
2512MACHINE_RESET( cps3 )
2512static MACHINE_RESET( cps3 )
25132513{
25142514   wd33c93_init(&scsi_intf);
25152515
r1281r1282
30573057   { 0 }   // end of table
30583058};
30593059
3060READ32_HANDLER(cps3_speedup_r)
3060static READ32_HANDLER(cps3_speedup_r)
30613061{
30623062//  printf("speedup read %08x %d\n",activecpu_get_pc(), cpu_getexecutingcpu());
30633063   if (cpu_getexecutingcpu()>=0) // prevent cheat search crash..
r1281r1282
30663066   return cps3_mainram[cps3_speedup_ram_address/4];
30673067}
30683068
3069DRIVER_INIT( cps3_speedups )
3069static DRIVER_INIT( cps3_speedups )
30703070{
30713071   const char *gamename = machine->gamedrv->name;
30723072   const struct cps3_speedups *k = &speedup_table[0];
r1281r1282
30943094/* PLEASE leave the region / NOCD information here even once CD emulation is done, its useful for debugging */
30953095
30963096
3097DRIVER_INIT( jojo )
3097static DRIVER_INIT( jojo )
30983098{
30993099   // XXXXXX 0
31003100   // JAPAN 1
r1281r1282
31223122
31233123}
31243124
3125DRIVER_INIT (jojoba)
3125static DRIVER_INIT (jojoba)
31263126{
31273127   // XXXXXX 0
31283128   // JAPAN 1
r1281r1282
31493149}
31503150
31513151
3152DRIVER_INIT( warzard )
3152static DRIVER_INIT( warzard )
31533153{
31543154   // JAPAN 1
31553155   // ASIA 2
r1281r1282
31753175}
31763176
31773177
3178DRIVER_INIT( sfiii )
3178static DRIVER_INIT( sfiii )
31793179{
31803180   // JAPAN 1
31813181   // ASIA NCD 2
r1281r1282
32013201
32023202}
32033203
3204DRIVER_INIT( sfiii2 )
3204static DRIVER_INIT( sfiii2 )
32053205{
32063206   // JAPAN 1
32073207   // ASIA NCD 2
r1281r1282
32253225}
32263226
32273227
3228DRIVER_INIT( sfiii3 )
3228static DRIVER_INIT( sfiii3 )
32293229{
32303230   // JAPAN 1
32313231   // ASIA 2
src/mame/drivers/cinemat.c
r1281r1282
5555 *
5656 *************************************/
5757
58MACHINE_START( cinemat )
58static MACHINE_START( cinemat )
5959{
6060   state_save_register_global(coin_detected);
6161   state_save_register_global(coin_last_input);
src/mame/drivers/toaplan2.c
r1281r1282
561561  Toaplan games
562562***************************************************************************/
563563
564READ16_HANDLER( toaplan2_inputport_0_word_r )
564static READ16_HANDLER( toaplan2_inputport_0_word_r )
565565{
566566   return ((video_screen_get_vpos(0) + 15) % 262) >= 245;
567567}
src/mame/drivers/ddz.c
r1281r1282
3030   return 0;
3131}
3232
33VIDEO_EOF(ddz)
33static VIDEO_EOF(ddz)
3434{
3535
3636}
src/mame/drivers/mjkjidai.c
r1281r1282
140140static UINT8 *nvram;
141141static size_t nvram_size;
142142
143NVRAM_HANDLER( mjkjidai )
143static NVRAM_HANDLER( mjkjidai )
144144{
145145   if (read_or_write)
146146      mame_fwrite(file, nvram, nvram_size);
src/mame/drivers/jchan.c
r1281r1282
384384JCHAN_MCU_COM_W(2)
385385JCHAN_MCU_COM_W(3)
386386
387READ16_HANDLER( jchan_mcu_status_r )
387static READ16_HANDLER( jchan_mcu_status_r )
388388{
389389   logerror("cpu #%d (PC=%06X): read mcu status\n", cpu_getactivecpu(), activecpu_get_previouspc());
390390   return 0;
r1281r1282
408408
409409
410410
411VIDEO_START(jchan)
411static VIDEO_START(jchan)
412412{
413413   /* so we can use suprnova.c */
414414   buffered_spriteram32 = auto_malloc ( 0x4000 );
r1281r1282
419419extern void skns_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect );
420420
421421
422VIDEO_UPDATE(jchan)
422static VIDEO_UPDATE(jchan)
423423{
424424   fillbitmap(bitmap, get_black_pen(machine), cliprect);
425425
r1281r1282
440440*/
441441static UINT16 *jchan_ctrl;
442442
443WRITE16_HANDLER( jchan_ctrl_w )
443static WRITE16_HANDLER( jchan_ctrl_w )
444444{
445445// Player 1 buttons C/D for are ON
446446// Coin 1 affects Button C and sometimes(!) makes Player 2 buttons C/D both ON definitively
r1281r1282
451451   jchan_ctrl[6/2] = -1;
452452}
453453
454READ16_HANDLER ( jchan_ctrl_r )
454static READ16_HANDLER ( jchan_ctrl_r )
455455{
456456   switch(offset)
457457   {
r1281r1282
476476#define main2sub_param(n) mainsub_shared_ram[(0x03c02 + (n))/2]
477477#define sub2main_cmd      mainsub_shared_ram[0x00000/2]
478478
479WRITE16_HANDLER( main2sub_cmd_w )
479static WRITE16_HANDLER( main2sub_cmd_w )
480480{
481481   COMBINE_DATA(&main2sub_cmd);
482482   logerror("cpu #%d (PC=%06X): write cmd %04x to subcpu\n", cpu_getactivecpu(), activecpu_get_previouspc(), main2sub_cmd);
483483   cpunum_set_input_line(1, 4, HOLD_LINE);
484484}
485READ16_HANDLER ( main2sub_status_r )
485static READ16_HANDLER ( main2sub_status_r )
486486{
487487   return main2sub_status;
488488}
489WRITE16_HANDLER( main2sub_status_w )
489static WRITE16_HANDLER( main2sub_status_w )
490490{
491491   COMBINE_DATA(&main2sub_status);
492492   logerror("cpu #%d (PC=%06X): write status (%04x)\n", cpu_getactivecpu(), activecpu_get_previouspc(), main2sub_status);
493493}
494READ16_HANDLER ( main2sub_result_r )
494static READ16_HANDLER ( main2sub_result_r )
495495{
496496   logerror("cpu #%d (PC=%06X): read subcpu result (%04x)\n", cpu_getactivecpu(), activecpu_get_previouspc(), main2sub_result);
497497   return main2sub_result;
498498}
499WRITE16_HANDLER( main2sub_unknown )
499static WRITE16_HANDLER( main2sub_unknown )
500500{
501501#define mainsub_unknown (0x400100+offset/2)
502502   COMBINE_DATA(&mainsub_shared_ram[offset]);
503503   logerror("cpu #%d (PC=%06X): write unknown (%06X):%04x to subcpu\n", cpu_getactivecpu(), activecpu_get_previouspc(), mainsub_unknown, main2sub_param(offset));
504504}
505505
506WRITE16_HANDLER( main2sub_param_w )
506static WRITE16_HANDLER( main2sub_param_w )
507507{
508508   COMBINE_DATA(&main2sub_param(offset));
509509   logerror("cpu #%d (PC=%06X): write param(%d):%04x to subcpu\n", cpu_getactivecpu(), activecpu_get_previouspc(), offset, main2sub_param(offset));
510510}
511511
512WRITE16_HANDLER( sub2main_cmd_w )
512static WRITE16_HANDLER( sub2main_cmd_w )
513513{
514514   COMBINE_DATA(&sub2main_cmd);
515515   logerror("cpu #%d (PC=%06X): write cmd %04x to maincpu\n", cpu_getactivecpu(), activecpu_get_previouspc(), sub2main_cmd);
516516   cpunum_set_input_line(0, 3, HOLD_LINE);
517517}
518READ16_HANDLER ( sub2main_cmd_r )
518static READ16_HANDLER ( sub2main_cmd_r )
519519{
520520   logerror("cpu #%d (PC=%06X): read cmd %04x from subcpu\n", cpu_getactivecpu(), activecpu_get_previouspc(), sub2main_cmd);
521521   return sub2main_cmd;
522522}
523523
524WRITE16_HANDLER( jchan_suprnova_sprite32_w )
524static WRITE16_HANDLER( jchan_suprnova_sprite32_w )
525525{
526526//  UINT32 dat32;
527527
r1281r1282
534534
535535UINT16* jchan_sprregs;
536536
537WRITE16_HANDLER( jchan_suprnova_sprite32regs_w )
537static WRITE16_HANDLER( jchan_suprnova_sprite32regs_w )
538538{
539539//  UINT32 dat32;
540540
r1281r1282
860860   ROM_LOAD( "j2d1x1.u13", 0x000000, 0x020000, CRC(b2b7fc90) SHA1(1b90c13bb41a313c4ed791a15d56073a7c29928b) )
861861ROM_END
862862
863DRIVER_INIT( jchan )
863static DRIVER_INIT( jchan )
864864{
865865   memset(jchan_mcu_com, 0, 4 * sizeof( UINT16) );
866866}
src/mame/drivers/couple.c
r1281r1282
6363   SET_TILE_INFO(region, code, color, 0);
6464}
6565
66VIDEO_START( couple )
66static VIDEO_START( couple )
6767{
6868   bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32);
6969}
7070
71VIDEO_UPDATE( couple )
71static VIDEO_UPDATE( couple )
7272{
7373   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
7474   return 0;
src/mame/drivers/mlanding.c
r1281r1282
197197
198198ADDRESS_MAP_END
199199
200VIDEO_START(mlanding)
200static VIDEO_START(mlanding)
201201{
202202   int i;
203203   for(i=0;i<ML_CHARS;i++)
r1281r1282
209209      ml_bitmap[i] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
210210}
211211
212VIDEO_UPDATE(mlanding)
212static VIDEO_UPDATE(mlanding)
213213{
214214   fillbitmap(bitmap, get_black_pen(machine), cliprect);
215215
src/mame/drivers/gaelco.c
r1281r1282
7373   AM_RANGE(0xff8000, 0xffffff) AM_READ(MRA16_RAM)         /* Work RAM */
7474ADDRESS_MAP_END
7575
76WRITE16_HANDLER( bigkarnk_sound_command_w )
76static WRITE16_HANDLER( bigkarnk_sound_command_w )
7777{
7878   if (ACCESSING_LSB){
7979      soundlatch_w(0,data & 0xff);
r1281r1282
8181   }
8282}
8383
84WRITE16_HANDLER( bigkarnk_coin_w )
84static WRITE16_HANDLER( bigkarnk_coin_w )
8585{
8686   if (ACCESSING_LSB){
8787      switch ((offset >> 3)){
r1281r1282
10381038   return data;
10391039}
10401040
1041WRITE16_HANDLER( gaelco_vram_encrypted_w )
1041static WRITE16_HANDLER( gaelco_vram_encrypted_w )
10421042{
10431043//  mame_printf_debug("gaelco_vram_encrypted_w!!\n");
10441044
r1281r1282
10491049}
10501050
10511051
1052WRITE16_HANDLER(gaelco_encrypted_w)
1052static WRITE16_HANDLER(gaelco_encrypted_w)
10531053{
10541054//  mame_printf_debug("gaelco_encrypted_w!!\n");
10551055
r1281r1282
10571057        COMBINE_DATA(&gaelco_screen[offset]);
10581058}
10591059
1060WRITE16_HANDLER( thoop_vram_encrypted_w )
1060static WRITE16_HANDLER( thoop_vram_encrypted_w )
10611061{
10621062//  mame_printf_debug("gaelco_vram_encrypted_w!!\n");
10631063
r1281r1282
10671067   tilemap_mark_tile_dirty(gaelco_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 2);
10681068}
10691069
1070WRITE16_HANDLER(thoop_encrypted_w)
1070static WRITE16_HANDLER(thoop_encrypted_w)
10711071{
10721072//  mame_printf_debug("gaelco_encrypted_w!!\n");
10731073
src/mame/drivers/tankbust.c
r1281r1282
127127
128128
129129
130PALETTE_INIT( tankbust )
130static PALETTE_INIT( tankbust )
131131{
132132   int i;
133133
src/mame/drivers/wecleman.c
r1281r1282
590590   if (ACCESSING_LSB)      K051316_ctrl_1_w(offset, data & 0xff);
591591}
592592
593WRITE16_HANDLER( hotchase_soundlatch_w );
593static WRITE16_HANDLER( hotchase_soundlatch_w );
594594
595595static ADDRESS_MAP_START( hotchase_map, ADDRESS_SPACE_PROGRAM, 16 )
596596   AM_RANGE(0x000000, 0x03ffff) AM_ROM
r1281r1282
682682
683683** sample playing ends when a byte with bit 7 set is reached **/
684684
685WRITE8_HANDLER( wecleman_K00723216_bank_w )
685static WRITE8_HANDLER( wecleman_K00723216_bank_w )
686686{
687687   K007232_set_bank( 0, 0, ~data&1 );   //* (wecleman062gre)
688688}
r1281r1282
714714***************************************************************************/
715715
716716/* 140001.b */
717WRITE16_HANDLER( hotchase_soundlatch_w )
717static WRITE16_HANDLER( hotchase_soundlatch_w )
718718{
719719   if (ACCESSING_LSB)
720720   {
r1281r1282
738738   REGION_SOUND3
739739};
740740
741WRITE8_HANDLER( hotchase_sound_control_w )
741static WRITE8_HANDLER( hotchase_sound_control_w )
742742{
743743   int reg[8];
744744
r1281r1282
11041104   REGION_SOUND1   /* but the 2 channels use different ROMs !*/
11051105};
11061106
1107MACHINE_RESET( wecleman )
1107static MACHINE_RESET( wecleman )
11081108{
11091109   K007232_set_bank( 0, 0, 1 );
11101110}
r1281r1282
13051305}
13061306
13071307/* Unpack sprites data and do some patching */
1308DRIVER_INIT( wecleman )
1308static DRIVER_INIT( wecleman )
13091309{
13101310   int i;
13111311   UINT8 *RAM;
r1281r1282
14471447}
14481448
14491449/* Unpack sprites data and do some patching */
1450DRIVER_INIT( hotchase )
1450static DRIVER_INIT( hotchase )
14511451{
14521452//  UINT16 *RAM1 = (UINT16) memory_region(REGION_CPU1); /* Main CPU patches */
14531453//  RAM[0x1140/2] = 0x0015; RAM[0x195c/2] = 0x601A; // faster self test
src/mame/drivers/crbaloon.c
r1281r1282
6565   state_save_register_global(val0a);
6666}
6767
68WRITE8_HANDLER( crbaloon_06_w )
68static WRITE8_HANDLER( crbaloon_06_w )
6969{
7070   val06 = data;
7171
r1281r1282
8989   discrete_sound_w(CRBALOON_LAUGH_EN, data & 0x40);
9090}
9191
92WRITE8_HANDLER( crbaloon_08_w )
92static WRITE8_HANDLER( crbaloon_08_w )
9393{
9494   val08 = data;
9595
9696   crbaloon_flipscreen_w(offset,data & 1);
9797}
9898
99WRITE8_HANDLER( crbaloon_0a_w )
99static WRITE8_HANDLER( crbaloon_0a_w )
100100{
101101   val0a = data;
102102}
103103
104READ8_HANDLER( crbaloon_IN2_r )
104static READ8_HANDLER( crbaloon_IN2_r )
105105{
106106   if (crbaloon_collision != 0)
107107   {
r1281r1282
121121   }
122122}
123123
124READ8_HANDLER( crbaloon_IN3_r )
124static READ8_HANDLER( crbaloon_IN3_r )
125125{
126126   if (val08 & 0x02)
127127      /* enable coin & start input? Wild guess!!! */
r1281r1282
141141}
142142
143143
144READ8_HANDLER( crbaloon_IN_r )
144static READ8_HANDLER( crbaloon_IN_r )
145145{
146146   switch (offset & 0x03)
147147   {
r1281r1282
161161   return 0;
162162}
163163
164WRITE8_HANDLER( crbaloon_tone_w )
164static WRITE8_HANDLER( crbaloon_tone_w )
165165{
166166   discrete_sound_w(CRBALOON_MUSIC_DATA, data);
167167}
src/mame/drivers/dmndrby.c
r1281r1282
132132
133133GFXDECODE_END
134134
135VIDEO_START(dderby)
135static VIDEO_START(dderby)
136136{
137137}
138138
139VIDEO_UPDATE(dderby)
139static VIDEO_UPDATE(dderby)
140140{
141141   int x,y,count;
142142   const gfx_element *gfx = machine->gfx[0];
src/mame/drivers/munchmo.c
r1281r1282
5757   else if( mnchmobl_nmi_enable ) cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE);
5858}
5959
60WRITE8_HANDLER( mnchmobl_soundlatch_w )
60static WRITE8_HANDLER( mnchmobl_soundlatch_w )
6161{
6262   soundlatch_w( offset, data );
6363   cpunum_set_input_line( 1, 0, HOLD_LINE );
src/mame/drivers/tetrisp2.c
r1281r1282
246246static UINT16 *tetrisp2_nvram;
247247static size_t tetrisp2_nvram_size;
248248
249NVRAM_HANDLER( tetrisp2 )
249static NVRAM_HANDLER( tetrisp2 )
250250{
251251   if (read_or_write)
252252      mame_fwrite(file,tetrisp2_nvram,tetrisp2_nvram_size);
r1281r1282
264264
265265
266266/* The game only ever writes even bytes and reads odd bytes */
267READ16_HANDLER( tetrisp2_nvram_r )
267static READ16_HANDLER( tetrisp2_nvram_r )
268268{
269269   return   ( (tetrisp2_nvram[offset] >> 8) & 0x00ff ) |
270270         ( (tetrisp2_nvram[offset] << 8) & 0xff00 ) ;
271271}
272272
273WRITE16_HANDLER( tetrisp2_nvram_w )
273static WRITE16_HANDLER( tetrisp2_nvram_w )
274274{
275275   COMBINE_DATA(&tetrisp2_nvram[offset]);
276276}
277277
278READ16_HANDLER( rockn_nvram_r )
278static READ16_HANDLER( rockn_nvram_r )
279279{
280280   return   tetrisp2_nvram[offset];
281281}
r1281r1282
292292static UINT16 rocknms_main2sub;
293293static UINT16 rocknms_sub2main;
294294
295READ16_HANDLER( rocknms_main2sub_r )
295static READ16_HANDLER( rocknms_main2sub_r )
296296{
297297   return rocknms_main2sub;
298298}
299299
300WRITE16_HANDLER( rocknms_main2sub_w )
300static WRITE16_HANDLER( rocknms_main2sub_w )
301301{
302302   if (ACCESSING_LSB)
303303      rocknms_main2sub = (data ^ 0xffff);
304304}
305305
306READ16_HANDLER( rocknms_port_0_r )
306static READ16_HANDLER( rocknms_port_0_r )
307307{
308308   return ((readinputport(0) & 0xfffc ) | (rocknms_sub2main & 0x0003));
309309}
310310
311WRITE16_HANDLER( rocknms_sub2main_w )
311static WRITE16_HANDLER( rocknms_sub2main_w )
312312{
313313   if (ACCESSING_LSB)
314314      rocknms_sub2main = (data ^ 0xffff);
315315}
316316
317317
318WRITE16_HANDLER( tetrisp2_coincounter_w )
318static WRITE16_HANDLER( tetrisp2_coincounter_w )
319319{
320320   coin_counter_w( 0, (data & 0x0001));
321321}
r1281r1282
10341034   state_save_register_global(rockn_soundvolume);
10351035}
10361036
1037DRIVER_INIT( rockn )
1037static DRIVER_INIT( rockn )
10381038{
10391039   init_rockn_timer(machine);
10401040   rockn_protectdata = 1;
10411041}
10421042
1043DRIVER_INIT( rockn1 )
1043static DRIVER_INIT( rockn1 )
10441044{
10451045   init_rockn_timer(machine);
10461046   rockn_protectdata = 1;
10471047}
10481048
1049DRIVER_INIT( rockn2 )
1049static DRIVER_INIT( rockn2 )
10501050{
10511051   init_rockn_timer(machine);
10521052   rockn_protectdata = 2;
10531053}
10541054
1055DRIVER_INIT( rocknms )
1055static DRIVER_INIT( rocknms )
10561056{
10571057   init_rockn_timer(machine);
10581058
r1281r1282
10631063
10641064}
10651065
1066DRIVER_INIT( rockn3 )
1066static DRIVER_INIT( rockn3 )
10671067{
10681068   init_rockn_timer(machine);
10691069   rockn_protectdata = 4;
src/mame/drivers/alpha68k.c
r1281r1282
222222   credits   = 0;
223223}
224224
225MACHINE_RESET( tnexspce )
225static MACHINE_RESET( tnexspce )
226226{
227227   alpha68k_flipscreen_w(0);
228228}
229229
230230/******************************************************************************/
231231
232WRITE16_HANDLER( tnexspce_coin_counters_w )
232static WRITE16_HANDLER( tnexspce_coin_counters_w )
233233{
234234   coin_counter_w(offset, data & 0x01);
235235}
236236
237WRITE16_HANDLER( tnexspce_unknown_w )
237static WRITE16_HANDLER( tnexspce_unknown_w )
238238{
239239   logerror("tnexspce_unknown_w : PC = %04x - offset = %04x - data = %04x\n",activecpu_get_pc(),offset,data);
240240   if (offset==0)
src/mame/drivers/lucky8.c
r1281r1282
2929
3030static tilemap *bg_tilemap;
3131
32PALETTE_INIT( lucky8 )
32static PALETTE_INIT( lucky8 )
3333{
3434   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
3535
r1281r1282
7575   }
7676}
7777
78WRITE8_HANDLER( lucky8_videoram_w )
78static WRITE8_HANDLER( lucky8_videoram_w )
7979{
8080   videoram[offset] = data;
8181   tilemap_mark_tile_dirty(bg_tilemap, offset);
8282}
8383
84WRITE8_HANDLER( lucky8_colorram_w )
84static WRITE8_HANDLER( lucky8_colorram_w )
8585{
8686   colorram[offset] = data;
8787   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
9696   SET_TILE_INFO(0, code, color, 0);
9797}
9898
99VIDEO_START(lucky8)
99static VIDEO_START(lucky8)
100100{
101101   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
102102      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
103103}
104104
105VIDEO_UPDATE(lucky8)
105static VIDEO_UPDATE(lucky8)
106106{
107107   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
108108   return 0;
src/mame/drivers/starfire.c
r1281r1282
7878}
7979
8080
81MACHINE_RESET( starfire )
81static MACHINE_RESET( starfire )
8282{
8383   mame_timer_set(video_screen_get_time_until_pos(0, 32 + SCANLINE_UPDATE_CHUNK - 1, 0), 32, update_callback);
8484}
src/mame/drivers/tmaster.c
r1281r1282
1616#include "driver.h"
1717#include "sound/okim6295.h"
1818
19VIDEO_START( tmaster )
19static VIDEO_START( tmaster )
2020{
2121}
2222
23VIDEO_UPDATE( tmaster )
23static VIDEO_UPDATE( tmaster )
2424{
2525   return 0;
2626}
2727
28READ16_HANDLER( tmaster_unk_0x300010_r )
28static READ16_HANDLER( tmaster_unk_0x300010_r )
2929{
3030   return mame_rand(Machine);
3131}
3232
33WRITE16_HANDLER( tmaster_unk_0x300020_w )
33static WRITE16_HANDLER( tmaster_unk_0x300020_w )
3434{
3535
3636}
3737
38WRITE16_HANDLER( tmaster_unk_0x300040_w )
38static WRITE16_HANDLER( tmaster_unk_0x300040_w )
3939{
4040
4141}
4242
43WRITE16_HANDLER( tmaster_unk_0x300070_w )
43static WRITE16_HANDLER( tmaster_unk_0x300070_w )
4444{
4545
4646}
4747
48WRITE16_HANDLER( tmaster_unk_0x500010_w )
48static WRITE16_HANDLER( tmaster_unk_0x500010_w )
4949{
5050
5151}
5252
53WRITE16_HANDLER( tmaster_unk_0x500020_w )
53static WRITE16_HANDLER( tmaster_unk_0x500020_w )
5454{
5555
5656}
5757
58WRITE16_HANDLER( tmaster_unk_0x500000_range_w )
58static WRITE16_HANDLER( tmaster_unk_0x500000_range_w )
5959{
6060
6161}
6262
63WRITE16_HANDLER( tmaster_unk_0x800010_w )
63static WRITE16_HANDLER( tmaster_unk_0x800010_w )
6464{
6565
6666}
6767
68READ16_HANDLER( tmaster_unk_0x500010_r )
68static READ16_HANDLER( tmaster_unk_0x500010_r )
6969{
7070   return mame_rand(Machine);
7171}
src/mame/drivers/tcl.c
r1281r1282
4141#include "sound/ay8910.h"
4242
4343
44VIDEO_START( tcl )
44static VIDEO_START( tcl )
4545{
4646}
47VIDEO_UPDATE( tcl )
47static VIDEO_UPDATE( tcl )
4848{
4949   return 0;
5050}
r1281r1282
9797   { NULL, NULL },
9898};
9999
100MACHINE_RESET( tcl )
100static MACHINE_RESET( tcl )
101101{
102102   ppi8255_init(&ppi8255_intf);
103103}
r1281r1282
166166      dest[idx+0x10000]=(n)^0xff;   \
167167      idx++;
168168
169DRIVER_INIT(tcl)
169static DRIVER_INIT(tcl)
170170{
171171   /* only the first part is decrypted (and verified)*/
172172
src/mame/drivers/freekick.c
r1281r1282
608608   { NULL,             NULL },            /* Port C write */
609609};
610610
611MACHINE_RESET( freekckb )
611static MACHINE_RESET( freekckb )
612612{
613613   ppi8255_init(&ppi8255_intf);
614614}
src/mame/drivers/cischeat.c
r1281r1282
223223                                Big Run
224224**************************************************************************/
225225
226WRITE16_HANDLER( bigrun_paletteram16_w )
226static WRITE16_HANDLER( bigrun_paletteram16_w )
227227{
228228   UINT16 word = COMBINE_DATA(&paletteram16[offset]);
229229   int r = pal5bit(((word >> 11) & 0x1E ) | ((word >> 3) & 0x01));
r1281r1282
295295    bd000-bd3ff     bd000-bdfff     sprites
296296    bec00-befff     <               text        */
297297
298WRITE16_HANDLER( cischeat_paletteram16_w )
298static WRITE16_HANDLER( cischeat_paletteram16_w )
299299{
300300   UINT16 word = COMBINE_DATA(&paletteram16[offset]);
301301   int r = pal5bit(((word >> 11) & 0x1E ) | ((word >> 3) & 0x01));
r1281r1282
363363                            F1 GrandPrix Star
364364**************************************************************************/
365365
366WRITE16_HANDLER( f1gpstar_paletteram16_w )
366static WRITE16_HANDLER( f1gpstar_paletteram16_w )
367367{
368368   UINT16 word = COMBINE_DATA(&paletteram16[offset]);
369369   int r = pal5bit(((word >> 11) & 0x1E ) | ((word >> 3) & 0x01));
r1281r1282
475475                            Scud Hammer
476476**************************************************************************/
477477
478WRITE16_HANDLER( scudhamm_paletteram16_w )
478static WRITE16_HANDLER( scudhamm_paletteram16_w )
479479{
480480   int newword = COMBINE_DATA(&paletteram16[offset]);
481481
r1281r1282
523523
524524    Within $20 vblanks the motor must reach the target. */
525525
526WRITE16_HANDLER( scudhamm_motor_command_w )
526static WRITE16_HANDLER( scudhamm_motor_command_w )
527527{
528528   COMBINE_DATA( &scudhamm_motor_command );
529529}
r1281r1282
540540    port (coins, tilt, buttons, select etc.) triggers the corresponding bit
541541    in this word. I mapped the 3 buttons to the first 3 led.
542542*/
543WRITE16_HANDLER( scudhamm_leds_w )
543static WRITE16_HANDLER( scudhamm_leds_w )
544544{
545545   if (ACCESSING_MSB)
546546   {
r1281r1282
561561    $FFFC during self test, $FFFF onwards.
562562    It could be audio(L/R) or layers(0/2) enable.
563563*/
564WRITE16_HANDLER( scudhamm_enable_w )
564static WRITE16_HANDLER( scudhamm_enable_w )
565565{
566566}
567567
568568
569WRITE16_HANDLER( scudhamm_oki_bank_w )
569static WRITE16_HANDLER( scudhamm_oki_bank_w )
570570{
571571   if (ACCESSING_LSB)
572572   {
r1281r1282
830830                                Big Run
831831**************************************************************************/
832832
833WRITE16_HANDLER( bigrun_soundbank_w )
833static WRITE16_HANDLER( bigrun_soundbank_w )
834834{
835835   if (ACCESSING_LSB)
836836   {
r1281r1282
864864                                Cisco Heat
865865**************************************************************************/
866866
867WRITE16_HANDLER( cischeat_soundbank_0_w )
867static WRITE16_HANDLER( cischeat_soundbank_0_w )
868868{
869869   if (ACCESSING_LSB)   OKIM6295_set_bank_base(0, 0x40000 * (data & 1) );
870870}
871WRITE16_HANDLER( cischeat_soundbank_1_w )
871static WRITE16_HANDLER( cischeat_soundbank_1_w )
872872{
873873   if (ACCESSING_LSB)   OKIM6295_set_bank_base(1, 0x40000 * (data & 1) );
874874}
r1281r1282
955955
956956**************************************************************************/
957957
958READ16_HANDLER ( f1gpstr2_io_r )   { return megasys1_vregs[offset + 0x1000/2]; }
959WRITE16_HANDLER( f1gpstr2_io_w )   { COMBINE_DATA(&megasys1_vregs[offset + 0x1000/2]); }
958static READ16_HANDLER ( f1gpstr2_io_r )   { return megasys1_vregs[offset + 0x1000/2]; }
959static WRITE16_HANDLER( f1gpstr2_io_w )   { COMBINE_DATA(&megasys1_vregs[offset + 0x1000/2]); }
960960
961961static ADDRESS_MAP_START( f1gpstr2_io_readmem, ADDRESS_SPACE_PROGRAM, 16 )
962962   AM_RANGE(0x000000, 0x07ffff) AM_READ(MRA16_ROM                  )   // ROM
r1281r1282
21202120   ROM_LOAD( "br8951b.23",  0x000000, 0x010000, CRC(b9474fec) SHA1(f1f0eab014e8f52572484b83f56189e0ff6f2b0d) )   // 000xxxxxxxxxxxxx
21212121ROM_END
21222122
2123DRIVER_INIT( bigrun )
2123static DRIVER_INIT( bigrun )
21242124{
21252125   /* Split ROMs */
21262126   rom_1 = (UINT16 *) memory_region(REGION_USER1);
r1281r1282
22422242   ROM_LOAD( "ch9072.03",  0x000000, 0x040000, CRC(7e79151a) SHA1(5a305cff8600446be426641ce112208b379094b9) )
22432243ROM_END
22442244
2245DRIVER_INIT( cischeat )
2245static DRIVER_INIT( cischeat )
22462246{
22472247   /* Split ROMs */
22482248   rom_1 = (UINT16 *) (memory_region(REGION_USER1) + 0x00000);
r1281r1282
24692469   ROM_LOAD( "pr90015b",  0x000000, 0x000100, CRC(be240dac) SHA1(6203b73c1a5e09e525380a78b555c3818929d5eb) )   // FIXED BITS (000xxxxx000xxxx1)
24702470ROM_END
24712471
2472DRIVER_INIT( f1gpstar )
2472static DRIVER_INIT( f1gpstar )
24732473{
24742474   /* Split ROMs */
24752475   rom_1 = (UINT16 *) memory_region(REGION_USER1);
r1281r1282
26842684   ROM_LOAD( "pr90015b.bin", 0x000000, 0x0100, CRC(be240dac) SHA1(6203b73c1a5e09e525380a78b555c3818929d5eb) )
26852685ROM_END
26862686
2687DRIVER_INIT( wildplt )
2687static DRIVER_INIT( wildplt )
26882688{
26892689   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x080000, 0x087fff, 0, 0, wildplt_vregs_r );
26902690
src/mame/drivers/namcos22.c
r1281r1282
42114211   mSpotRAM.RAM = auto_malloc(SPOTRAM_SIZE*2);
42124212}
42134213
4214DRIVER_INIT( alpiner )
4214static DRIVER_INIT( alpiner )
42154215{
42164216   namcos22s_init(NAMCOS22_ALPINE_RACER);
42174217
r1281r1282
42204220   install_130_speedup();
42214221}
42224222
4223DRIVER_INIT( alpiner2 )
4223static DRIVER_INIT( alpiner2 )
42244224{
42254225   namcos22s_init(NAMCOS22_ALPINE_RACER_2);
42264226
r1281r1282
42294229   install_130_speedup();
42304230}
42314231
4232DRIVER_INIT( alpinesa )
4232static DRIVER_INIT( alpinesa )
42334233{
42344234   namcos22s_init(NAMCOS22_ALPINE_SURFER);
42354235
r1281r1282
42384238   install_141_speedup();
42394239}
42404240
4241DRIVER_INIT( airco22 )
4241static DRIVER_INIT( airco22 )
42424242{
42434243   namcos22s_init(NAMCOS22_AIR_COMBAT22);
42444244
42454245   memory_install_read8_handler(3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, airco22_mcu_adc_r);
42464246}
42474247
4248DRIVER_INIT( propcycl )
4248static DRIVER_INIT( propcycl )
42494249{
42504250   UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1);
42514251
r1281r1282
42714271   install_141_speedup();
42724272}
42734273
4274DRIVER_INIT( ridgeraj )
4274static DRIVER_INIT( ridgeraj )
42754275{
42764276   namcos22_init(NAMCOS22_RIDGE_RACER);
42774277
r1281r1282
42814281   credits1 = credits2 = 0;
42824282}
42834283
4284DRIVER_INIT( ridger2j )
4284static DRIVER_INIT( ridger2j )
42854285{
42864286   namcos22_init(NAMCOS22_RIDGE_RACER2);
42874287
r1281r1282
42914291   credits1 = credits2 = 0;
42924292}
42934293
4294DRIVER_INIT( acedrvr )
4294static DRIVER_INIT( acedrvr )
42954295{
42964296   namcos22_init(NAMCOS22_ACE_DRIVER);
42974297
r1281r1282
43014301   credits1 = credits2 = 0;
43024302}
43034303
4304DRIVER_INIT( victlap )
4304static DRIVER_INIT( victlap )
43054305{
43064306   namcos22_init(NAMCOS22_VICTORY_LAP);
43074307
r1281r1282
43114311   credits1 = credits2 = 0;
43124312}
43134313
4314DRIVER_INIT( raveracw )
4314static DRIVER_INIT( raveracw )
43154315{
43164316   namcos22_init(NAMCOS22_RAVE_RACER);
43174317
r1281r1282
43214321   credits1 = credits2 = 0;
43224322}
43234323
4324DRIVER_INIT( cybrcomm )
4324static DRIVER_INIT( cybrcomm )
43254325{
43264326   UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1);
43274327   pROM[0x18ade8/4] = 0x4e714e71;
r1281r1282
43384338   credits1 = credits2 = 0;
43394339}
43404340
4341DRIVER_INIT( cybrcyc )
4341static DRIVER_INIT( cybrcyc )
43424342{
43434343   /* patch DSP RAM test */
43444344   UINT32 *pROM = (UINT32 *)memory_region(REGION_CPU1);
r1281r1282
43524352   install_130_speedup();
43534353}
43544354
4355DRIVER_INIT( timecris )
4355static DRIVER_INIT( timecris )
43564356{
43574357   namcos22s_init(NAMCOS22_TIME_CRISIS);
43584358
src/mame/drivers/flyball.c
r1281r1282
8383
8484/* two physical buttons (start game and stop runner) share the same port bit */
8585
86READ8_HANDLER( flyball_input_r )
86static READ8_HANDLER( flyball_input_r )
8787{
8888   return readinputport(0) & readinputport(5);
8989}
9090
91READ8_HANDLER( flyball_scanline_r )
91static READ8_HANDLER( flyball_scanline_r )
9292{
9393   return video_screen_get_vpos(0) & 0x3f;
9494}
9595
96READ8_HANDLER( flyball_potsense_r )
96static READ8_HANDLER( flyball_potsense_r )
9797{
9898   return flyball_potsense & ~flyball_potmask;
9999}
100100
101WRITE8_HANDLER( flyball_potmask_w )
101static WRITE8_HANDLER( flyball_potmask_w )
102102{
103103   flyball_potmask |= data & 0xf;
104104}
105105
106WRITE8_HANDLER( flyball_pitcher_pic_w )
106static WRITE8_HANDLER( flyball_pitcher_pic_w )
107107{
108108   flyball_pitcher_pic = data & 0xf;
109109}
110110
111WRITE8_HANDLER( flyball_ball_vert_w )
111static WRITE8_HANDLER( flyball_ball_vert_w )
112112{
113113   flyball_ball_vert = data;
114114}
115115
116WRITE8_HANDLER( flyball_ball_horz_w )
116static WRITE8_HANDLER( flyball_ball_horz_w )
117117{
118118   flyball_ball_horz = data;
119119}
120120
121WRITE8_HANDLER( flyball_pitcher_vert_w )
121static WRITE8_HANDLER( flyball_pitcher_vert_w )
122122{
123123   flyball_pitcher_vert = data;
124124}
125125
126WRITE8_HANDLER( flyball_pitcher_horz_w )
126static WRITE8_HANDLER( flyball_pitcher_horz_w )
127127{
128128   flyball_pitcher_horz = data;
129129}
130130
131WRITE8_HANDLER( flyball_misc_w )
131static WRITE8_HANDLER( flyball_misc_w )
132132{
133133   int bit = ~data & 1;
134134
r1281r1282
249249GFXDECODE_END
250250
251251
252PALETTE_INIT( flyball )
252static PALETTE_INIT( flyball )
253253{
254254   palette_set_color(machine, 0, MAKE_RGB(0x3F, 0x3F, 0x3F));  /* tiles, ball */
255255   palette_set_color(machine, 1, MAKE_RGB(0xFF, 0xFF, 0xFF));
src/mame/drivers/magicfly.c
r1281r1282
323323
324324static tilemap *bg_tilemap;
325325
326WRITE8_HANDLER( magicfly_videoram_w )
326static WRITE8_HANDLER( magicfly_videoram_w )
327327{
328328   videoram[offset] = data;
329329   tilemap_mark_tile_dirty(bg_tilemap, offset);
330330}
331331
332WRITE8_HANDLER( magicfly_colorram_w )
332static WRITE8_HANDLER( magicfly_colorram_w )
333333{
334334   colorram[offset] = data;
335335   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
361361   SET_TILE_INFO(bank, code, color, 0);
362362}
363363
364VIDEO_START(magicfly)
364static VIDEO_START(magicfly)
365365{
366366   bg_tilemap = tilemap_create(get_magicfly_tile_info, tilemap_scan_rows,
367367      TILEMAP_TYPE_PEN, 8, 8, 32, 29);
r1281r1282
393393   SET_TILE_INFO(bank, code, color, 0);
394394}
395395
396VIDEO_START( 7mezzo )
396static VIDEO_START( 7mezzo )
397397{
398398   bg_tilemap = tilemap_create(get_7mezzo_tile_info, tilemap_scan_rows,
399399      TILEMAP_TYPE_PEN, 8, 8, 32, 29);
400400}
401401
402VIDEO_UPDATE( magicfly )
402static VIDEO_UPDATE( magicfly )
403403{
404404   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
405405   return 0;
406406}
407407
408PALETTE_INIT( magicfly )
408static PALETTE_INIT( magicfly )
409409{
410410    /* 1st gfx bank */
411411   palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00));
src/mame/drivers/wgp.c
r1281r1282
632632   reset_sound_region();
633633}
634634
635WRITE16_HANDLER( wgp_sound_w )
635static WRITE16_HANDLER( wgp_sound_w )
636636{
637637   if (offset == 0)
638638      taitosound_port_w (0, data & 0xff);
r1281r1282
640640      taitosound_comm_w (0, data & 0xff);
641641}
642642
643READ16_HANDLER( wgp_sound_r )
643static READ16_HANDLER( wgp_sound_r )
644644{
645645   if (offset == 1)
646646      return ((taitosound_comm_r (0) & 0xff));
r1281r1282
12691269ROM_END
12701270
12711271
1272DRIVER_INIT( wgp )
1272static DRIVER_INIT( wgp )
12731273{
12741274#if 0
12751275   /* Patch for coding error that causes corrupt data in
r1281r1282
12821282   cpua_ctrl = 0xff;
12831283}
12841284
1285DRIVER_INIT( wgp2 )
1285static DRIVER_INIT( wgp2 )
12861286{
12871287   /* Code patches to prevent failure in memory checks */
12881288   UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU3);
src/mame/drivers/turbosub.c
r1281r1282
5858static UINT8 *FDT_B;
5959static UINT8 INTER_CPU_REG;
6060
61VIDEO_START( turbosub )
61static VIDEO_START( turbosub )
6262{
6363}
6464
65VIDEO_UPDATE( turbosub )
65static VIDEO_UPDATE( turbosub )
6666{
6767   return 0;
6868}
src/mame/drivers/pturn.c
r1281r1282
117117   SET_TILE_INFO(1,tileno+bgbank*256,palno,0);
118118}
119119
120VIDEO_START(pturn)
120static VIDEO_START(pturn)
121121{
122122   pturn_fgmap = tilemap_create(get_pturn_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,32,32);
123123   tilemap_set_transparent_pen(pturn_fgmap,0);
r1281r1282
125125   tilemap_set_transparent_pen(pturn_bgmap,0);
126126}
127127
128VIDEO_UPDATE(pturn)
128static VIDEO_UPDATE(pturn)
129129{
130130   int offs;
131131   int sx, sy;
src/mame/drivers/ssv.c
r1281r1282
135135                tilemap sprites use the yoffset specified in the sprites-list?
136136                (see the 8 pixel gap between the backgrounds and the black rows)
137137
138- janjans2  :   Coin inputs don't register in the input test
139
140- jsk       :   Coin inputs don't register in the input test
141
138142- keithlcy  :   Backgrounds are offset by $20 pixels, so they're kludged to work; there is a
139143                x&y offsets in the sprite list but in a same frame there are sprite with yoffset = 0
140144                and sprite with a yoffset = $7c but for all sprite the offset must be the same ($20)
141145
146- mslider   :   Coin inputs don't register in the input test
147
142148- srmp4     :   Backgrounds are offset by $60 pixels, so they're kludged to work
149                Coin inputs don't register in the input test
143150
144151- srmp7     :   Needs interrupts by the sound chip (not properly hooked up yet). Kludged to work.
145152
r1281r1282
152159
153160- ultrax    :   Backgrounds are offset by $10 pixels, so they're kludged to work
154161
162Notes:
155163
164- gdfs      :   Hold 1P Start on startup to enter test mode
165
166- jsk       :   Push 1P Start and 2P Start to advance to sound test
167
168
156169    code @ $e75cdc
157170
158171     W:
r1281r1282
205218   return 0;
206219}
207220
208WRITE16_HANDLER( ssv_irq_ack_w )
221static WRITE16_HANDLER( ssv_irq_ack_w )
209222{
210223   int level = ((offset * 2) & 0x70) >> 4;
211224   requested_int &= ~(1 << level);
r1281r1282
231244    ultrax:     40,00 at the start then 42,4a
232245    twineag2:   40,00 at the start then 42,4a
233246*/
234WRITE16_HANDLER( ssv_irq_enable_w )
247static WRITE16_HANDLER( ssv_irq_enable_w )
235248{
236249   COMBINE_DATA(&irq_enable);
237250}
r1281r1282
321334   }
322335}
323336
324MACHINE_RESET( ssv )
337static MACHINE_RESET( ssv )
325338{
326339   requested_int = 0;
327340   cpunum_set_irq_callback(0, ssv_irq_callback);
r1281r1282
340353static UINT16 *ssv_nvram;
341354static size_t    ssv_nvram_size;
342355
343NVRAM_HANDLER( ssv )
356static NVRAM_HANDLER( ssv )
344357{
345358   if (read_or_write)
346359      mame_fwrite(file, ssv_nvram, ssv_nvram_size);
r1281r1282
349362         mame_fread(file, ssv_nvram, ssv_nvram_size);
350363}
351364
352NVRAM_HANDLER( gdfs )
365static NVRAM_HANDLER( gdfs )
353366{
354367   if (read_or_write)
355368      EEPROM_save(file);
r1281r1282
476489static int gdfs_gfxram_bank, gdfs_lightgun_select;
477490static UINT16 *gdfs_blitram;
478491
479READ16_HANDLER( gdfs_eeprom_r )
492static READ16_HANDLER( gdfs_eeprom_r )
480493{
481494   return (((gdfs_lightgun_select & 1) ? 0 : 0xff) ^ readinputport(5 + gdfs_lightgun_select)) | (EEPROM_read_bit() << 8);
482495}
483496
484WRITE16_HANDLER( gdfs_eeprom_w )
497static WRITE16_HANDLER( gdfs_eeprom_w )
485498{
486499   static UINT16 data_old;
487500
r1281r1282
11211134
11221135
11231136/***************************************************************************
1124                          Change Air Blade
1137                        Basic Coinage Settings
11251138***************************************************************************/
11261139
1127static INPUT_PORTS_START( cairblad )
1128   PORT_START   // IN0
1129   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )   PORT_DIPLOCATION( "DSW1:1,2,3" )
1130   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
1131   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
1132   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
1133   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
1134   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
1135   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
1136   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
1137   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1138   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )   PORT_DIPLOCATION( "DSW1:4,5,6" )
1139   PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
1140   PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
1141   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
1142   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1143   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
1144   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
1145   PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
1146   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1147   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW1:7" ) /* Manual lists this dip as "Unused" */
1148   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW1:8" ) /* Manual lists this dip as "Unused" */
1140#define SSV_COINAGE_BASIC( shift, default, name, diploc )                                 \
1141   PORT_DIPNAME( 0x0003 << (shift), (default) << (shift), (name) )   PORT_DIPLOCATION( (diploc) )   \
1142   PORT_DIPSETTING(                 0x0001 << (shift), DEF_STR( 2C_1C ) )                     \
1143   PORT_DIPSETTING(                 0x0003 << (shift), DEF_STR( 1C_1C ) )                     \
1144   PORT_DIPSETTING(                 0x0000 << (shift), DEF_STR( 2C_3C ) )                     \
1145   PORT_DIPSETTING(                 0x0002 << (shift), DEF_STR( 1C_2C ) )
11491146
1150   PORT_START   // IN1
1151   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
1152   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
1153   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1154   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW2:2" )
1155   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1156   PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
1157   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:3,4" )
1158   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
1159   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
1160   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
1161   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
1162   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Free_Play ) )   PORT_DIPLOCATION( "DSW2:5" )
1163   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
1164   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1165   PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION( "DSW2:6,7" )
1166   PORT_DIPSETTING(      0x0040, "Every 2 Mil" )
1167   PORT_DIPSETTING(      0x0060, "2 Mil/6 Mil" )
1168   PORT_DIPSETTING(      0x0020, "4 Million" )
1169   PORT_DIPSETTING(      0x0000, DEF_STR( None ) )
1170   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
1147#define SSV_COINAGE_STANDARD( shift, default, name, diploc )                              \
1148   PORT_DIPNAME( 0x0007 << (shift), (default) << (shift), (name) )   PORT_DIPLOCATION( (diploc) )   \
1149   PORT_DIPSETTING(                 0x0005 << (shift), DEF_STR( 3C_1C ) )                     \
1150   PORT_DIPSETTING(                 0x0006 << (shift), DEF_STR( 2C_1C ) )                     \
1151   PORT_DIPSETTING(                 0x0007 << (shift), DEF_STR( 1C_1C ) )                     \
1152   PORT_DIPSETTING(                 0x0004 << (shift), DEF_STR( 1C_2C ) )                     \
1153   PORT_DIPSETTING(                 0x0003 << (shift), DEF_STR( 1C_3C ) )                     \
1154   PORT_DIPSETTING(                 0x0002 << (shift), DEF_STR( 1C_4C ) )                     \
1155   PORT_DIPSETTING(                 0x0001 << (shift), DEF_STR( 1C_5C ) )                     \
1156   PORT_DIPSETTING(                 0x0000 << (shift), DEF_STR( 1C_6C ) )
11711157
1172   PORT_START   // IN2
1158#define SSV_COINAGE_EXTENDED( shift, default, name, diploc )                              \
1159   PORT_DIPNAME( 0x000f << (shift), (default) << (shift), (name) )   PORT_DIPLOCATION( (diploc) )   \
1160   PORT_DIPSETTING(                 0x0007 << (shift), DEF_STR( 4C_1C ) )                     \
1161   PORT_DIPSETTING(                 0x0008 << (shift), DEF_STR( 3C_1C ) )                     \
1162   PORT_DIPSETTING(                 0x0009 << (shift), DEF_STR( 2C_1C ) )                     \
1163   PORT_DIPSETTING(                 0x000f << (shift), DEF_STR( 1C_1C ) )                     \
1164   PORT_DIPSETTING(                 0x0006 << (shift), DEF_STR( 2C_3C ) )                     \
1165   PORT_DIPSETTING(                 0x000e << (shift), DEF_STR( 1C_2C ) )                     \
1166   PORT_DIPSETTING(                 0x000d << (shift), DEF_STR( 1C_3C ) )                     \
1167   PORT_DIPSETTING(                 0x000c << (shift), DEF_STR( 1C_4C ) )                     \
1168   PORT_DIPSETTING(                 0x000b << (shift), DEF_STR( 1C_5C ) )                     \
1169   PORT_DIPSETTING(                 0x000a << (shift), DEF_STR( 1C_6C ) )                     \
1170/* "** ADDED MULTIPLE COIN FEATURE **" */                                             \
1171   PORT_DIPSETTING(                 0x0005 << (shift), "Multiple Coin Feature A" )               \
1172/* 2c-1c, 4c-2c, 5c-3c & 6c-4c */                                                   \
1173   PORT_DIPSETTING(                 0x0004 << (shift), "Multiple Coin Feature B" )               \
1174/* 2c-1c, 4c-3c */                                                               \
1175   PORT_DIPSETTING(                 0x0003 << (shift), "Multiple Coin Feature C" )               \
1176/* 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c */                                                \
1177   PORT_DIPSETTING(                 0x0002 << (shift), "Multiple Coin Feature D" )               \
1178/* 1c-1c, 2c-2c, 3c-3c & 4c-5c */                                                   \
1179   PORT_DIPSETTING(                 0x0001 << (shift), "Multiple Coin Feature E" )               \
1180/* 1c-1c, 2c-3c */                                                               \
1181/* Meaning of all "ON" varies between games so it's not included here */
1182
1183
1184/***************************************************************************
1185                        Common Joystick Inputs
1186***************************************************************************/
1187
1188static INPUT_PORTS_START( ssv_joystick )
1189   PORT_START_TAG("DSW1")   // IN0 - $210002
1190   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Modified below */
1191
1192   PORT_START_TAG("DSW2")   // IN1 - $210004
1193   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Modified below */
1194
1195   PORT_START_TAG("IN2")   // IN2 - $210008
11731196   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
11741197   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
11751198   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r1281r1282
11791202   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
11801203   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
11811204
1182   PORT_START   // IN3
1205   PORT_START_TAG("IN3")   // IN3 - $21000a
11831206   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
11841207   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
11851208   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r1281r1282
11891212   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
11901213   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
11911214
1192   PORT_START   // IN4
1215   PORT_START_TAG("IN4")   // IN4 - $21000c
11931216   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
11941217   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
11951218   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
11961219   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1220   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
1221   PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1222INPUT_PORTS_END
1223
1224
1225/***************************************************************************
1226                        Common Mahjong Inputs
1227***************************************************************************/
1228
1229static INPUT_PORTS_START( ssv_mahjong )
1230   PORT_INCLUDE(ssv_joystick)
1231
1232   PORT_START_TAG("IN5")   // IN5 - $800002(0)
1233   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
1234   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1235   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
1236   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
1237   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_H )
1238   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_D )
1239   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1240   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1241
1242   PORT_START_TAG("IN6")   // IN6 - $800002(1)
1243   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
1244   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1245   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
1246   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
1247   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_G )
1248   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_C )
1249   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1250   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1251
1252   PORT_START_TAG("IN7")   // IN7 - $800002(2)
1253   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1254   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
1255   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
1256   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
1257   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
1258   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_B )
1259   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1260   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1261
1262   PORT_START_TAG("IN8")   // IN8 - $800002(3)
1263   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1264   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
1265   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
1266   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
1267   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_E )
1268   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_A )
1269   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1270   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1271INPUT_PORTS_END
1272
1273
1274/***************************************************************************
1275                         Common Quiz Inputs
1276***************************************************************************/
1277
1278static INPUT_PORTS_START( ssv_quiz )
1279   PORT_START_TAG("DSW1")   // IN0 - $210002
1280   PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0001, "DSW1:1" ) /* Manual states this dip is "Unused" */
1281   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:2" )
1282   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
1283   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1284   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
1285   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
1286   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1287   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1288   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coin_A ), "DSW1:5,6" )
1289   PORT_BIT( 0x00c0, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* Modified below */
1290
1291   PORT_START_TAG("DSW2")   // IN1 - $210004
1292   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
1293   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )      /* 15 sec */
1294   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )   /* 12 sec */
1295   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )      /* 10 sec */
1296   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )   /* 8 sec */
1297   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Modified below */
1298
1299   PORT_START_TAG("IN2")   // IN2 - $210008
1300   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1  )
1301   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1302   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
1303   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1304   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
1305   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1306   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1307   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1308
1309   PORT_START_TAG("IN3")   // IN3 - $21000a
1310   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2  )
1311   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1312   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
1313   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1314   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
1315   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1316   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1317   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1318
1319   PORT_START_TAG("IN4")   // IN4 - $21000c
1320   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1321   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1322   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1323   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
11971324   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
11981325INPUT_PORTS_END
11991326
12001327
12011328/***************************************************************************
1329                           Change Air Blade
1330***************************************************************************/
1331
1332static INPUT_PORTS_START( cairblad )
1333   PORT_INCLUDE(ssv_joystick)
1334
1335   PORT_MODIFY("DSW1")   // IN0
1336   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSW1:1,2,3" )
1337   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSW1:4,5,6" )
1338   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW1:7" ) /* Manual lists this dip as "Unused" */
1339   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW1:8" ) /* Manual lists this dip as "Unused" */
1340
1341   PORT_MODIFY("DSW2")   // IN1
1342   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
1343   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
1344   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1345   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW2:2" )
1346   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1347   PORT_DIPSETTING(      0x0002, DEF_STR( On ) )
1348   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:3,4" )
1349   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
1350   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
1351   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
1352   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
1353   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Free_Play ) )   PORT_DIPLOCATION( "DSW2:5" )
1354   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
1355   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1356   PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION( "DSW2:6,7" )
1357   PORT_DIPSETTING(      0x0040, "Every 2 Mil" )
1358   PORT_DIPSETTING(      0x0060, "2 Mil/6 Mil" )
1359   PORT_DIPSETTING(      0x0020, "4 Million" )
1360   PORT_DIPSETTING(      0x0000, DEF_STR( None ) )
1361   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
1362INPUT_PORTS_END
1363
1364
1365/***************************************************************************
12021366                                Drift Out '94
12031367***************************************************************************/
12041368
12051369static INPUT_PORTS_START( drifto94 )
1206   PORT_START   // IN0 - $210002
1370   PORT_INCLUDE(ssv_joystick)
1371
1372   PORT_MODIFY("DSW1")   // IN0 - $210002
12071373   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:1" )
12081374   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
12091375   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
12141380   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
12151381   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
12161382   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1217   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )      PORT_DIPLOCATION( "DSW1:5,6" )
1218   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
1219   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
1220   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1221   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1222   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )      PORT_DIPLOCATION( "DSW1:7,8" )
1223   PORT_DIPSETTING(      0x0040, DEF_STR( 2C_1C ) )
1224   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_1C ) )
1225   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1226   PORT_DIPSETTING(      0x0080, DEF_STR( 1C_2C ) )
1383   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coin_A ), "DSW1:5,6" )
1384   SSV_COINAGE_BASIC( 6, 0x03, DEF_STR( Coin_B ), "DSW1:7,8" )
12271385
1228   PORT_START   // IN1 - $210004
1386   PORT_MODIFY("DSW2")   // IN1 - $210004
12291387   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
12301388   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
12311389   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
r1281r1282
12431401   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
12441402   PORT_DIPSETTING(      0x0040, DEF_STR( Yes ) )
12451403   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" ) /* Manual lists this dip as "Unused" */
1404INPUT_PORTS_END
12461405
1247   PORT_START   // IN2 - $210008
1248   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1249   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
1250   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1251   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1252   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
1253   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
1254   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1255   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
12561406
1257   PORT_START   // IN3 - $21000a
1258   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
1259   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
1260   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1261   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1262   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1263   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1264   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
1265   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1407/***************************************************************************
1408                Dyna Gears
1409***************************************************************************/
12661410
1267   PORT_START   // IN4 - $21000c
1268   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1269   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1270   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1271   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1272   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1411static INPUT_PORTS_START( dynagear )
1412   PORT_INCLUDE(ssv_joystick)
1413
1414   PORT_MODIFY("DSW1")   // IN0 - $210002
1415   SSV_COINAGE_EXTENDED( 0, 0x0f, DEF_STR( Coin_A ), "DSW1:1,2,3,4" )
1416   //PORT_DIPSETTING(      0x0000, "???" ) - No values listed for all "ON"
1417   SSV_COINAGE_EXTENDED( 4, 0x0f, DEF_STR( Coin_B ), "DSW1:5,6,7,8" )
1418   //PORT_DIPSETTING(      0x0000, "???" ) - No values listed for all "ON"
1419
1420   PORT_MODIFY("DSW2")   // IN0 - $210004
1421   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
1422   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
1423   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1424   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW2:2" )
1425   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
1426   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1427   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:3,4" )
1428   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
1429   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
1430   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
1431   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
1432   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) )      PORT_DIPLOCATION( "DSW2:5,6" )
1433   PORT_DIPSETTING(      0x0010, "1" )
1434   PORT_DIPSETTING(      0x0030, "2" )
1435   PORT_DIPSETTING(      0x0020, "3" )
1436   PORT_DIPSETTING(      0x0000, "4" )
1437   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )   PORT_DIPLOCATION( "DSW2:7" )
1438   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
1439   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1440   PORT_DIPNAME( 0x0080, 0x0080, "Health" )            PORT_DIPLOCATION( "DSW2:8" )
1441   PORT_DIPSETTING(      0x0000, "3 Hearts" )
1442   PORT_DIPSETTING(      0x0080, "4 Hearts" )
12731443INPUT_PORTS_END
12741444
12751445
r1281r1282
12781448***************************************************************************/
12791449
12801450static INPUT_PORTS_START( eaglshot )
1281   PORT_START   // IN0 - $210002
1282   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) )         PORT_DIPLOCATION( "DSW1:1,2,3,4" )
1283   PORT_DIPSETTING(      0x0007, DEF_STR( 4C_1C ) )
1284   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
1285   PORT_DIPSETTING(      0x0009, DEF_STR( 2C_1C ) )
1286   PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
1287   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_3C ) )
1288   PORT_DIPSETTING(      0x000e, DEF_STR( 1C_2C ) )
1289   PORT_DIPSETTING(      0x000d, DEF_STR( 1C_3C ) )
1290   PORT_DIPSETTING(      0x000c, DEF_STR( 1C_4C ) )
1291   PORT_DIPSETTING(      0x000b, DEF_STR( 1C_5C ) )
1292   PORT_DIPSETTING(      0x000a, DEF_STR( 1C_6C ) )
1293// "** ADDED MULTIPLE COIN FEATURE **"
1294   PORT_DIPSETTING(      0x0005, "Multiple Coin Feature A" )
1295// 2c-1c, 4c-2c, 5c-3c & 6c-4c
1296   PORT_DIPSETTING(      0x0004, "Multiple Coin Feature B" )
1297// 2c-1c, 4c-3c
1298   PORT_DIPSETTING(      0x0003, "Multiple Coin Feature C" )
1299// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
1300   PORT_DIPSETTING(      0x0002, "Multiple Coin Feature D" )
1301// 1c-1c, 2c-2c, 3c-3c & 4c-5c
1302   PORT_DIPSETTING(      0x0001, "Multiple Coin Feature E" )
1303// 1c-1c, 2c-3c
1451   PORT_INCLUDE(ssv_joystick)
1452
1453   PORT_MODIFY("DSW1")   // IN0 - $210002
1454   SSV_COINAGE_EXTENDED( 0, 0x0f, DEF_STR( Coinage ), "DSW1:1,2,3,4" )
13041455   PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
13051456   PORT_DIPNAME( 0x0010, 0x0010, "Credits To Start" )         PORT_DIPLOCATION( "DSW1:5" )
13061457   PORT_DIPSETTING(      0x0010, "1" )
r1281r1282
13131464   PORT_DIPSETTING(      0x0000, "12 Counts (Japan)" )
13141465   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW1:8" )
13151466
1316   PORT_START   // IN1 - $210004
1467   PORT_MODIFY("DSW2")   // IN1 - $210004
13171468   PORT_DIPNAME( 0x0003, 0x0003, "Number Of Holes" )         PORT_DIPLOCATION( "DSW2:1,2" )
13181469   PORT_DIPSETTING(      0x0002, "2" )
13191470   PORT_DIPSETTING(      0x0003, "3" )
r1281r1282
13351486   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
13361487   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
13371488
1338   PORT_START   // IN2 - $210008
1339   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1340   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1341   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1342   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1343   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
1344   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
1345   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
1346   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
1347
1348   PORT_START   // IN3 - $21000a
1349   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
1350   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1351   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1352   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1353   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1354   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1355   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1356   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1357
1358   PORT_START   // IN4 - $21000c
1359   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1360   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1361   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1362   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1363   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
1364   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1365
13661489   PORT_START   // IN5 - trackball x ($d00000)
13671490    PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_RESET PORT_PLAYER(1)
13681491
13691492   PORT_START   // IN6 - trackball y ($d00000)
13701493    PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_RESET PORT_PLAYER(1)
1371
13721494INPUT_PORTS_END
13731495
13741496
r1281r1282
13771499***************************************************************************/
13781500
13791501static INPUT_PORTS_START( gdfs )
1380   PORT_START   // IN0 - $210002
1502   PORT_INCLUDE(ssv_joystick)
1503
1504   PORT_MODIFY("DSW1")   // IN0 - $210002
13811505   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Controls ) )
13821506   PORT_DIPSETTING(      0x0001, DEF_STR( Joystick ) )
13831507   PORT_DIPSETTING(      0x0000, DEF_STR( Light_Gun ) )
r1281r1282
14021526   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
14031527   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
14041528
1405   PORT_START   // IN1 - $210004
1529   PORT_MODIFY("DSW2")   // IN1 - $210004
14061530   PORT_DIPNAME( 0x0001, 0x0001, "Invert X Axis" )
14071531   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
14081532   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
14281552   PORT_DIPSETTING(      0x0080, "Light" )
14291553   PORT_DIPSETTING(      0x0000, "Heavy" )
14301554
1431   PORT_START   // IN2 - $210008
1432   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1  )               // press at boot for service mode
1433   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   // used in test mode
1434   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1435   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1436   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
1437   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(1)
1438   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(1)
1439   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(1)
1440
1441   PORT_START   // IN3 - $21000a
1442   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2  )
1443   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1444   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1445   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1446   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1447   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(2)
1448   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(2)
1449   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(2)
1450
1451   PORT_START   // IN4 - $21000c
1452   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1    ) PORT_IMPULSE(10)
1453   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2    ) PORT_IMPULSE(10)
1454   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1455   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1456   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1457
14581555   PORT_START   // IN5 - $540000(0)
14591556   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(1)
14601557
r1281r1282
14751572
14761573static INPUT_PORTS_START( hypreact )
14771574   PORT_START   // IN0 - $210002
1478   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )         PORT_DIPLOCATION( "DSWA:1,2,3" )
1479   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
1480   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
1481   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
1482   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
1483   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
1484   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
1485   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
1486   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1487   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )         PORT_DIPLOCATION( "DSWA:4,5,6" )
1488   PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
1489   PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
1490   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
1491   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1492   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
1493   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
1494   PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
1495   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1575   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSWA:1,2,3" )
1576   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSWA:4,5,6" )
14961577   PORT_DIPNAME( 0x0040, 0x0040, "Half Coins To Continue" )   PORT_DIPLOCATION( "DSWA:7" )
14971578   PORT_DIPSETTING(      0x0040, DEF_STR( No ) )
14981579   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
r1281r1282
15861667***************************************************************************/
15871668
15881669static INPUT_PORTS_START( hypreac2 )
1589   PORT_START   // IN0 - $210002
1590   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )         PORT_DIPLOCATION( "DSWA:1,2,3" )
1591   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
1592   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
1593   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
1594   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
1595   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
1596   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
1597   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
1598   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1599   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )         PORT_DIPLOCATION( "DSWA:4,5,6" )
1600   PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
1601   PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
1602   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
1603   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1604   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
1605   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
1606   PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
1607   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
1670   PORT_INCLUDE(ssv_joystick)
1671
1672   PORT_MODIFY("DSW1")   // IN0 - $210002
1673   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSWA:1,2,3" )
1674   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSWA:4,5,6" )
16081675   PORT_DIPNAME( 0x0040, 0x0040, "Half Coins To Continue" )   PORT_DIPLOCATION( "DSWA:7" )
16091676   PORT_DIPSETTING(      0x0040, DEF_STR( No ) )
16101677   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
r1281r1282
16121679   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
16131680   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
16141681
1615   PORT_START   // IN1 - $210004
1682   PORT_MODIFY("DSW2")   // IN1 - $210004
16161683   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION( "DSWB:1" )
16171684   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
16181685   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
16351702   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
16361703   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSWB:8" )
16371704
1638   PORT_START   // IN2 - $210008
1639   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1640   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1641   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1642   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1643   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
1644   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
1645   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
1646   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
1647
1648   PORT_START   // IN3 - $21000a
1649   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
1650   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1651   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1652   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1653   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1654   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1655   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1656   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1657
1658   PORT_START   // IN4 - $21000c
1659   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1660   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1661   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1662   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1663   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1664
16651705   PORT_START   // IN5 - $500000(0)
16661706   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
16671707   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
r1281r1282
17011741***************************************************************************/
17021742
17031743static INPUT_PORTS_START( janjans1 )
1704   PORT_START   // IN0 - $210002
1744   PORT_INCLUDE(ssv_mahjong)
1745
1746   PORT_MODIFY("DSW1")   // IN0 - $210002
17051747   PORT_DIPUNKNOWN_DIPLOC( 0x0001, 0x0001, "DSW1:1" )
17061748   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:2" )
17071749   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
r1281r1282
17101752   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
17111753   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
17121754   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1713   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coinage ) )      PORT_DIPLOCATION( "DSW1:5,6" )
1714   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
1715   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
1716   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1717   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1755   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coinage ), "DSW1:5,6" )
17181756   PORT_DIPNAME( 0x0040, 0x0040, "Voice" )               PORT_DIPLOCATION( "DSW1:7" )
17191757   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
17201758   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
17211759   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW1:8" )
17221760
1723   PORT_START   // IN1 - $210004
1761   PORT_MODIFY("DSW2")   // IN1 - $210004
17241762   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
17251763   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
17261764   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r1281r1282
17421780   PORT_DIPSETTING(      0x00c0, DEF_STR( None ) )
17431781   PORT_DIPSETTING(      0x0040, "Board 1 (Main)" )
17441782   PORT_DIPSETTING(      0x0000, "Board 2 (Sub)" )
1783INPUT_PORTS_END
17451784
1746   PORT_START   // IN2 - $210008
1747   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
17481785
1749   PORT_START   // IN3 - $21000a
1750   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1786/***************************************************************************
1787                                JangJang Shimasho 2
1788***************************************************************************/
17511789
1752   PORT_START   // IN4 - $21000c
1753   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1754   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1755   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1756   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1757   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1790static INPUT_PORTS_START( janjans2 )
1791   PORT_INCLUDE(ssv_mahjong)
17581792
1759   PORT_START   // IN5 - $800002(0)
1760   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
1761   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1762   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
1763   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
1764   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_H )
1765   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_D )
1766   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1767   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1793   PORT_MODIFY("DSW1")   // IN0 - $210002
1794   PORT_DIPUNKNOWN_DIPLOC( 0x0001, 0x0001, "DSW1:1" )
1795   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION( "DSW1:2" )
1796   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
1797   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1798   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
1799   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION( "DSW1:4" )
1800   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1801   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1802   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coinage ), "DSW1:5,6" )
1803   PORT_DIPNAME( 0x0040, 0x0040, "Nudity" )               PORT_DIPLOCATION( "DSW1:7" )
1804   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1805   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
1806   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW1:8" )
17681807
1769   PORT_START   // IN6 - $800002(1)
1770   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
1771   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1772   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
1773   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
1774   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_G )
1775   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_C )
1776   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1777   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1778
1779   PORT_START   // IN7 - $800002(2)
1780   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1781   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
1782   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
1783   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
1784   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
1785   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_B )
1786   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1787   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1788
1789   PORT_START   // IN8 - $800002(3)
1790   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1791   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
1792   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
1793   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
1794   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_E )
1795   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_A )
1796   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1797   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1808   PORT_MODIFY("DSW2")   // IN1 - $210004
1809   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )      PORT_DIPLOCATION( "DSW2:1,2" )
1810   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
1811   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
1812   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
1813   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
1814   PORT_DIPNAME( 0x000c, 0x000c, "Initial Score (vs player)")   PORT_DIPLOCATION( "DSW2:3,4" )
1815   PORT_DIPSETTING(      0x0008, "10000" )
1816   PORT_DIPSETTING(      0x0004, "15000" )
1817   PORT_DIPSETTING(      0x000c, "20000" )
1818   PORT_DIPSETTING(      0x0000, "25000" )
1819   PORT_DIPNAME( 0x0030, 0x0030, "Initial Score (vs CPU)" )   PORT_DIPLOCATION( "DSW2:5,6" )
1820   PORT_DIPSETTING(      0x0020, "1000" )
1821   PORT_DIPSETTING(      0x0030, "1500" )
1822   PORT_DIPSETTING(      0x0010, "2000" )
1823   PORT_DIPSETTING(      0x0000, "3000" )
1824   PORT_DIPNAME( 0x00c0, 0x00c0, "Communication" )            PORT_DIPLOCATION( "DSW2:7,8" )
1825//  PORT_DIPSETTING(      0x0080, "unused" )
1826   PORT_DIPSETTING(      0x00c0, DEF_STR( None ) )
1827   PORT_DIPSETTING(      0x0040, "Transmitter" )
1828   PORT_DIPSETTING(      0x0000, "Receiver" )
17981829INPUT_PORTS_END
17991830
18001831
r1281r1282
18031834***************************************************************************/
18041835
18051836static INPUT_PORTS_START( jsk )
1806   PORT_START   // IN0 - $210002
1807   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
1837   PORT_INCLUDE(ssv_joystick)
1838
1839   PORT_MODIFY("DSW1")   // IN0 - $210002
1840   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )      PORT_DIPLOCATION("DSW1:1,2,3")
18081841   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
18091842   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
18101843   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r1281r1282
18131846   PORT_DIPSETTING(      0x0006, DEF_STR( 1C_2C ) )
18141847   PORT_DIPSETTING(      0x0005, DEF_STR( 1C_3C ) )
18151848   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
1816   PORT_SERVICE( 0x0008, IP_ACTIVE_LOW )
1817   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Flip_Screen ) )
1849   PORT_SERVICE_DIPLOC( 0x0008, IP_ACTIVE_LOW, "DSW1:4" )
1850   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("DSW1:5")
18181851   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
18191852   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1820   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
1853   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("DSW1:6")
18211854   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
18221855   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
1823   PORT_DIPNAME( 0x00c0, 0x00c0, "Minutes" )
1856   PORT_DIPNAME( 0x00c0, 0x00c0, "Minutes" )            PORT_DIPLOCATION("DSW1:7,8")
18241857   PORT_DIPSETTING(      0x0080, "3" )
18251858   PORT_DIPSETTING(      0x00c0, "4" )
18261859   PORT_DIPSETTING(      0x0040, "5" )
18271860   PORT_DIPSETTING(      0x0000, "6" )
18281861
1829   PORT_START   // IN1 - $210004
1830   PORT_DIPNAME( 0x0007, 0x0007, "Difficulty A" )   // 8 fixed levels
1831   PORT_DIPSETTING(      0x0000, "1 (Novice)" )
1862   PORT_MODIFY("DSW2")   // IN1 - $210004
1863   PORT_DIPNAME( 0x0007, 0x0007, "Difficulty A" )         PORT_DIPLOCATION("DSW2:1,2,3")
1864   PORT_DIPSETTING(      0x0000, "1 (Novice)" )      // 8 fixed levels
18321865   PORT_DIPSETTING(      0x0001, "2" )
18331866   PORT_DIPSETTING(      0x0002, "3" )
18341867   PORT_DIPSETTING(      0x0003, "4" )
r1281r1282
18361869   PORT_DIPSETTING(      0x0006, "6" )
18371870   PORT_DIPSETTING(      0x0005, "7" )
18381871   PORT_DIPSETTING(      0x0004, "8 (expert)"    )
1839   PORT_DIPNAME( 0x0008, 0x0008, "Difficulty Switch" )
1872   PORT_DIPNAME( 0x0008, 0x0008, "Difficulty Switch" )      PORT_DIPLOCATION("DSW2:4")
18401873   PORT_DIPSETTING(      0x0008, "A (8 Levels)" )
18411874   PORT_DIPSETTING(      0x0000, "B (4 Levels)" )
1842   PORT_DIPNAME( 0x0030, 0x0030, "Difficulty B" )   // 4 levels, and player can select 3 levels during game
1843   PORT_DIPSETTING(      0x0020, DEF_STR( Easy )    )
1875   PORT_DIPNAME( 0x0030, 0x0030, "Difficulty B" )         PORT_DIPLOCATION("DSW2:5,6")
1876   PORT_DIPSETTING(      0x0020, DEF_STR( Easy )    )   // 4 levels, and player can select 3 levels during game
18441877   PORT_DIPSETTING(      0x0030, DEF_STR( Normal )  )
18451878   PORT_DIPSETTING(      0x0010, DEF_STR( Hard )    )
18461879   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
1847   PORT_DIPNAME( 0x0040, 0x0040, "Campaign" )
1880   PORT_DIPNAME( 0x0040, 0x0040, "Campaign" )            PORT_DIPLOCATION("DSW2:7")
18481881   PORT_DIPSETTING(      0x0040, "Available" )
18491882   PORT_DIPSETTING(      0x0000, "Finished" )
1850   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
1883   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW2:8")
18511884   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
18521885   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1853
1854   PORT_START   // IN2 - $210008
1855   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
1856   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1857   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 )
1858   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 )
1859   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
1860   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
1861   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
1862   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
1863
1864   PORT_START   // IN3 - $21000a
1865   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )   // start1+start2 enter sound test in service mode
1866   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1867   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
1868   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1869   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
1870   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
1871   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1872   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1873
1874   PORT_START   // IN4 - $21000c
1875   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1876   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1877   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1878   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1879   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
18801886INPUT_PORTS_END
18811887
18821888
r1281r1282
18851891***************************************************************************/
18861892
18871893static INPUT_PORTS_START( keithlcy )
1888   PORT_START   // IN0 - $210002
1889   PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0001, "DSW1:1" ) /* Manual lists this dip as "Unused" */
1890   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:2" )
1891   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
1892   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1893   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
1894   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
1895   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1896   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1897   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )      PORT_DIPLOCATION( "DSW1:5,6" )
1898   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
1899   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
1900   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1901   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1902   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )      PORT_DIPLOCATION( "DSW1:7,8" )
1903   PORT_DIPSETTING(      0x0040, DEF_STR( 2C_1C ) )
1904   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_1C ) )
1905   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1906   PORT_DIPSETTING(      0x0080, DEF_STR( 1C_2C ) )
1894   PORT_INCLUDE(ssv_quiz)
19071895
1908   PORT_START   // IN1 - $210004
1909   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
1910   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )      // 15 sec
1911   PORT_DIPSETTING(      0x0003, DEF_STR( Normal )   )    // 12
1912   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )      // 10
1913   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )   // 8
1896   PORT_MODIFY("DSW1")   // IN0 - $210002
1897   SSV_COINAGE_BASIC( 6, 0x03, DEF_STR( Coin_B ), "DSW1:7,8" )
1898
1899   PORT_MODIFY("DSW2")   // IN1 - $210004
19141900   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )      PORT_DIPLOCATION( "DSW2:3,4" )
19151901   PORT_DIPSETTING(      0x0008, "2" )
19161902   PORT_DIPSETTING(      0x000c, "3" )
r1281r1282
19231909   PORT_DIPSETTING(      0x0000, "Every 200k" )      //200
19241910   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW2:7" ) /* Manual lists these dips as "Unused" */
19251911   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" ) /* Manual lists these dips as "Unused" */
1926
1927   PORT_START   // IN2 - $210008
1928   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1  )
1929   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1930   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
1931   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1932   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
1933   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1934   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1935   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1936
1937   PORT_START   // IN3 - $21000a
1938   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2  )
1939   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
1940   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
1941   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
1942   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
1943   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1944   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1945   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1946
1947   PORT_START   // IN4 - $21000c
1948   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
1949   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
1950   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
1951   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
1952   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
19531912INPUT_PORTS_END
19541913
19551914
r1281r1282
19581917***************************************************************************/
19591918
19601919static INPUT_PORTS_START( koikois2 )
1961   PORT_START   // IN0 - $210002
1920   PORT_INCLUDE(ssv_mahjong)
1921
1922   PORT_MODIFY("DSW1")   // IN0 - $210002
19621923   PORT_DIPUNKNOWN_DIPLOC( 0x0001, 0x0001, "DSW1:1" )
19631924   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:2" )
19641925   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
r1281r1282
19671928   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
19681929   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
19691930   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
1970   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coinage ) )      PORT_DIPLOCATION( "DSW1:5,6" )
1971   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
1972   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
1973   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
1974   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1931   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coinage ), "DSW1:5,6" )
19751932   PORT_DIPNAME( 0x0040, 0x0040, "Voice" )               PORT_DIPLOCATION( "DSW1:7" )
19761933   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
19771934   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
r1281r1282
19791936   PORT_DIPSETTING(      0x0080, DEF_STR( Joystick ) )
19801937   PORT_DIPSETTING(      0x0000, "Keyboard" )
19811938
1982   PORT_START   // IN1 - $210004
1939   PORT_MODIFY("DSW2")   // IN1 - $210004
19831940   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
19841941   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
19851942   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r1281r1282
19961953   PORT_DIPSETTING(      0x00c0, DEF_STR( None ) )
19971954   PORT_DIPSETTING(      0x0040, "Board 1 (Main)" )
19981955   PORT_DIPSETTING(      0x0000, "Board 2 (Sub)" )
1999
2000   PORT_START   // IN2 - $210008
2001   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2002   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2003   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2004   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2005   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2006   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2007   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2008   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2009
2010   PORT_START   // IN3 - $21000a
2011   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2012   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2013   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2014   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2015   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2016   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2017   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2018   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2019
2020   PORT_START   // IN4 - $21000c
2021   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2022   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2023   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2024   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2025   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2026
2027   PORT_START   // IN5 - $800002(0)
2028   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
2029   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2030   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2031   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2032   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2033   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2034   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2035   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2036
2037   PORT_START   // IN6 - $800002(1)
2038   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
2039   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2040   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2041   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2042   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2043   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2044   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2045   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2046
2047   PORT_START   // IN7 - $800002(2)
2048   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2049   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2050   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2051   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2052   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2053   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2054   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2055   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2056
2057   PORT_START   // IN8 - $800002(3)
2058   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2059   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2060   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2061   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2062   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2063   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2064   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2065   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
20661956INPUT_PORTS_END
20671957
20681958
r1281r1282
21502040***************************************************************************/
21512041
21522042static INPUT_PORTS_START( mslider )
2153   PORT_START   // IN0 - $210002
2154   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )   PORT_DIPLOCATION( "DSW1:1,2,3" )
2155   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
2156   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
2157   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
2158   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
2159   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
2160   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
2161   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
2162   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2163   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )   PORT_DIPLOCATION( "DSW1:4,5,6" )
2164   PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
2165   PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
2166   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
2167   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
2168   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
2169   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
2170   PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
2171   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2043   PORT_INCLUDE(ssv_joystick)
2044
2045   PORT_MODIFY("DSW1")   // IN0 - $210002
2046   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSW1:1,2,3" )
2047   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSW1:4,5,6" )
21722048   PORT_SERVICE_DIPLOC( 0x0040, IP_ACTIVE_LOW, "DSW1:7" )
21732049   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW1:8" ) /* Manual lists this dip as "Unused" */
21742050
2175   PORT_START   // IN1 - $210004
2051   PORT_MODIFY("DSW2")   // IN1 - $210004
21762052   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
21772053   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
21782054   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
21912067   PORT_DIPSETTING(      0x0010, "4" )
21922068   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW2:7" ) /* Manual lists these dips as "Unused" */
21932069   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" )
2194
2195   PORT_START   // IN2 - $210008
2196   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2197   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2198   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2199   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2200   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2201   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2202   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2203   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2204
2205   PORT_START   // IN3 - $21000a
2206   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2207   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2208   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2209   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2210   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2211   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2212   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2213   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2214
2215   PORT_START   // IN4 - $21000c
2216   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2217   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2218   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2219   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2220   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
22212070INPUT_PORTS_END
22222071
22232072
r1281r1282
22262075***************************************************************************/
22272076
22282077static INPUT_PORTS_START( ryorioh )
2229   PORT_START   // IN0 - $210002
2230   PORT_DIPUNUSED_DIPLOC( 0x0001, 0x0001, "DSW1:1" ) /* Manual states this dip is "Unused" */
2231   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW1:2" )
2232   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
2233   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2234   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
2235   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW1:4" )
2236   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
2237   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
2238   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coinage ) )      PORT_DIPLOCATION( "DSW1:5,6" )
2239   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
2240   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
2241   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
2242   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
2078   PORT_INCLUDE(ssv_quiz)
2079
2080   PORT_MODIFY("DSW1")   // IN0 - $210002
22432081   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW1:7" ) /* Manual states this dip is "Unused" */
22442082   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW1:8" )
22452083
2246   PORT_START   // IN1 - $210004
2247   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2" )
2248   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
2249   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
2250   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
2251   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
2084   PORT_MODIFY("DSW2")   // IN1 - $210004
22522085   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "DSW2:3" ) /* Manual states dips 3-8 are "Unused" */
22532086   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "DSW2:4" )
22542087   PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0010, "DSW2:5" )
22552088   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "DSW2:6" )
22562089   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW2:7" )
22572090   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" )
2258
2259   PORT_START   // IN2 - $210008
2260   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1  )
2261   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2262   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
2263   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
2264   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
2265   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2266   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2267   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2268
2269   PORT_START   // IN3 - $21000a
2270   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2  )
2271   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2272   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
2273   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
2274   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
2275   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2276   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2277   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2278
2279   PORT_START   // IN4 - $21000c
2280   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2281   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2282   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2283   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2284   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
22852091INPUT_PORTS_END
22862092
22872093
r1281r1282
22902096***************************************************************************/
22912097
22922098static INPUT_PORTS_START( srmp4 )
2293   PORT_START   // IN0 - $210002
2099   PORT_INCLUDE(ssv_mahjong)
2100
2101   PORT_MODIFY("DSW1")   // IN0 - $210002
22942102   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )         PORT_DIPLOCATION( "DSW1:1,2,3" )
22952103   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
22962104   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
r1281r1282
23142122   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
23152123   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW1:8" )
23162124
2317   PORT_START   // IN1 - $210004
2125   PORT_MODIFY("DSW2")   // IN1 - $210004
23182126   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) )      PORT_DIPLOCATION( "DSW2:1,2,3" )
23192127   PORT_DIPSETTING(      0x0006, DEF_STR( Easiest ) )
23202128   PORT_DIPSETTING(      0x0005, DEF_STR( Easier ) )
r1281r1282
23352143   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
23362144   PORT_DIPSETTING(      0x0040, DEF_STR( Yes ) )
23372145   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSW2:8" )
2338
2339   PORT_START   // IN2 - $210008
2340   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
2341
2342   PORT_START   // IN3 - $21000a
2343   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
2344
2345   PORT_START   // IN4 - $21000c
2346   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2347   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2348   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2349   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2350   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2351
2352   PORT_START   // IN5 - $c0000a(0)
2353   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
2354   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2355   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2356   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2357   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2358   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2359   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2360   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2361
2362   PORT_START   // IN6 - $c0000a(1)
2363   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
2364   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2365   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2366   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2367   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2368   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2369   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2370   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2371
2372   PORT_START   // IN7 - $c0000a(2)
2373   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2374   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2375   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2376   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2377   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2378   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2379   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2380   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2381
2382   PORT_START   // IN8 - $c0000a(3)
2383   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2384   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2385   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2386   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2387   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2388   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2389   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2390   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
23912146INPUT_PORTS_END
23922147
23932148
r1281r1282
25012256***************************************************************************/
25022257
25032258static INPUT_PORTS_START( stmblade )
2504   PORT_START   // IN0 - $210002
2505   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )      PORT_DIPLOCATION( "DSW1:1,2,3" )
2506   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
2507   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
2508   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
2509   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
2510   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
2511   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
2512   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
2513   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2514   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )      PORT_DIPLOCATION( "DSW1:4,5,6" )
2515   PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
2516   PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
2517   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
2518   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
2519   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
2520   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
2521   PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
2522   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2259   PORT_INCLUDE(ssv_joystick)
2260
2261   PORT_MODIFY("DSW1")   // IN0 - $210002
2262   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSW1:1,2,3" )
2263   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSW1:4,5,6" )
25232264   PORT_DIPUNUSED_DIPLOC( 0x0040, 0x0040, "DSW1:7" )
25242265   PORT_DIPNAME( 0x0080, 0x0080, "Rapid Fire" )         PORT_DIPLOCATION( "DSW1:8" )
25252266   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
25262267   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
25272268
2528   PORT_START   // IN1 - $210004
2269   PORT_MODIFY("DSW2")   // IN1 - $210004
25292270   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
25302271   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
25312272   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
25462287   PORT_DIPSETTING(      0x0040, "600000" )
25472288   PORT_DIPSETTING(      0x0000, "800000" )
25482289   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
2549
2550   PORT_START   // IN2 - $210008
2551   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2552   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2553   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2554   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2555   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2556   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2557   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2558   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2559
2560   PORT_START   // IN3 - $21000a
2561   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2562   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2563   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2564   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2565   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2566   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2567   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2568   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2569
2570   PORT_START   // IN4 - $21000c
2571   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2572   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2573   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2574   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2575   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
25762290INPUT_PORTS_END
25772291
25782292
r1281r1282
25812295***************************************************************************/
25822296
25832297static INPUT_PORTS_START( survarts )
2584   PORT_START   // IN0 - $210002
2585   PORT_DIPNAME( 0x000f, 0x0009, DEF_STR( Coin_A ) ) // Verified Default is 2 coins 1 Credit
2586   PORT_DIPSETTING(      0x0007, DEF_STR( 4C_1C ) )
2587   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
2588   PORT_DIPSETTING(      0x0009, DEF_STR( 2C_1C ) )
2589   PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
2590   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_3C ) )
2591   PORT_DIPSETTING(      0x000e, DEF_STR( 1C_2C ) )
2592   PORT_DIPSETTING(      0x000d, DEF_STR( 1C_3C ) )
2593   PORT_DIPSETTING(      0x000c, DEF_STR( 1C_4C ) )
2594   PORT_DIPSETTING(      0x000b, DEF_STR( 1C_5C ) )
2595   PORT_DIPSETTING(      0x000a, DEF_STR( 1C_6C ) )
2298   PORT_INCLUDE(ssv_joystick)
2299
2300   PORT_MODIFY("DSW1")   // IN0 - $210002
2301   SSV_COINAGE_EXTENDED( 0, 0x09, DEF_STR( Coin_A ), "DSW1:1,2,3,4" )
25962302   PORT_DIPSETTING(      0x0000, "2 Credits Start, 1 to continue" )
2597// "** ADDED MULTIPLE COIN FEATURE **"
2598   PORT_DIPSETTING(      0x0005, "Multiple Coin Feature A" )
2599// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2600   PORT_DIPSETTING(      0x0004, "Multiple Coin Feature B" )
2601// 2c-1c, 4c-3c
2602   PORT_DIPSETTING(      0x0003, "Multiple Coin Feature C" )
2603// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2604   PORT_DIPSETTING(      0x0002, "Multiple Coin Feature D" )
2605// 1c-1c, 2c-2c, 3c-3c & 4c-5c
2606   PORT_DIPNAME( 0x00f0, 0x0090, DEF_STR( Coin_B ) ) // Verified Defualt is 2 coins 1 Credit
2607   PORT_DIPSETTING(      0x0070, DEF_STR( 4C_1C ) )
2608   PORT_DIPSETTING(      0x0080, DEF_STR( 3C_1C ) )
2609   PORT_DIPSETTING(      0x0090, DEF_STR( 2C_1C ) )
2610   PORT_DIPSETTING(      0x00f0, DEF_STR( 1C_1C ) )
2611   PORT_DIPSETTING(      0x0060, DEF_STR( 2C_3C ) )
2612   PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_2C ) )
2613   PORT_DIPSETTING(      0x00d0, DEF_STR( 1C_3C ) )
2614   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
2615   PORT_DIPSETTING(      0x00b0, DEF_STR( 1C_5C ) )
2616   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
2303   SSV_COINAGE_EXTENDED( 4, 0x09, DEF_STR( Coin_B ), "DSW1:5,6,7,8" )
26172304   PORT_DIPSETTING(      0x0000, "2 Credits Start, 1 to continue" )
2618// "** ADDED MULTIPLE COIN FEATURE **"
2619   PORT_DIPSETTING(      0x0050, "Multiple Coin Feature A" )
2620// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2621   PORT_DIPSETTING(      0x0040, "Multiple Coin Feature B" )
2622// 2c-1c, 4c-3c
2623   PORT_DIPSETTING(      0x0030, "Multiple Coin Feature C" )
2624// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2625   PORT_DIPSETTING(      0x0020, "Multiple Coin Feature D" )
2626// 1c-1c, 2c-2c, 3c-3c & 4c-5c
26272305
2628   PORT_START   // IN1 - $210004
2629   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
2306   PORT_MODIFY("DSW2")   // IN1 - $210004
2307   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION( "DSW2:1" )
26302308   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
26312309   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2632   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )
2310   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION( "DSW2:2" )
26332311   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
26342312   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2635   PORT_DIPNAME( 0x0004, 0x0004, "Timer Speed" )
2313   PORT_DIPNAME( 0x0004, 0x0004, "Timer Speed" )         PORT_DIPLOCATION( "DSW2:3" )
26362314   PORT_DIPSETTING(      0x0004, DEF_STR( Normal ) )
26372315   PORT_DIPSETTING(      0x0000, "Fast" )
2638   PORT_DIPNAME( 0x0008, 0x0008, "Damage Level" )
2316   PORT_DIPNAME( 0x0008, 0x0008, "Damage Level" )         PORT_DIPLOCATION( "DSW2:4" )
26392317   PORT_DIPSETTING(      0x0008, DEF_STR( Normal ) )
26402318   PORT_DIPSETTING(      0x0000, DEF_STR( High ) )
2641   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) )
2319   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:5,6" )
26422320   PORT_DIPSETTING(      0x0020, DEF_STR( Easy ) )
26432321   PORT_DIPSETTING(      0x0030, DEF_STR( Normal ) )
26442322   PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
26452323   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
2646   PORT_DIPNAME( 0x00c0, 0x0000, "Fatal Damage" )
2324   PORT_DIPNAME( 0x00c0, 0x0000, "Fatal Damage" )         PORT_DIPLOCATION( "DSW2:7,8" )
26472325   PORT_DIPSETTING(      0x00c0, "Light" )
26482326   PORT_DIPSETTING(      0x0040, DEF_STR( Normal ) )
26492327   PORT_DIPSETTING(      0x0080, "Heavy" )
26502328   PORT_DIPSETTING(      0x0000, "Heaviest" )
26512329
2652   PORT_START   // IN2 - $210008
2653   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2654   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2655   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2656   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2657   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2658   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2659   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2660   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2661
2662   PORT_START   // IN3 - $21000a
2663   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2664   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2665   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2666   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2667   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2668   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2669   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2670   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2671
2672   PORT_START   // IN4 - $21000c
2673   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2674   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2675   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2676   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2677   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2678
26792330   PORT_START   // IN5 - $500008
26802331   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
26812332   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
r1281r1282
26872338   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
26882339INPUT_PORTS_END
26892340
2690/***************************************************************************
2691                Dyna Gears
2692***************************************************************************/
26932341
2694static INPUT_PORTS_START( dynagear )
2695   PORT_START   // IN0 - $210002
2696   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )
2697   PORT_DIPSETTING(      0x0007, DEF_STR( 4C_1C ) )
2698   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
2699   PORT_DIPSETTING(      0x0009, DEF_STR( 2C_1C ) )
2700   PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
2701   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_3C ) )
2702   PORT_DIPSETTING(      0x000e, DEF_STR( 1C_2C ) )
2703   PORT_DIPSETTING(      0x000d, DEF_STR( 1C_3C ) )
2704   PORT_DIPSETTING(      0x000c, DEF_STR( 1C_4C ) )
2705   PORT_DIPSETTING(      0x000b, DEF_STR( 1C_5C ) )
2706   PORT_DIPSETTING(      0x000a, DEF_STR( 1C_6C ) )
2707   PORT_DIPSETTING(      0x0000, "2 Credits Start, 1 to continue" )
2708// "** ADDED MULTIPLE COIN FEATURE **"
2709   PORT_DIPSETTING(      0x0005, "Multiple Coin Feature A" )
2710// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2711   PORT_DIPSETTING(      0x0004, "Multiple Coin Feature B" )
2712// 2c-1c, 4c-3c
2713   PORT_DIPSETTING(      0x0003, "Multiple Coin Feature C" )
2714// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2715   PORT_DIPSETTING(      0x0002, "Multiple Coin Feature D" )
2716// 1c-1c, 2c-2c, 3c-3c & 4c-5c
2717   PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )
2718   PORT_DIPSETTING(      0x0070, DEF_STR( 4C_1C ) )
2719   PORT_DIPSETTING(      0x0080, DEF_STR( 3C_1C ) )
2720   PORT_DIPSETTING(      0x0090, DEF_STR( 2C_1C ) )
2721   PORT_DIPSETTING(      0x00f0, DEF_STR( 1C_1C ) )
2722   PORT_DIPSETTING(      0x0060, DEF_STR( 2C_3C ) )
2723   PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_2C ) )
2724   PORT_DIPSETTING(      0x00d0, DEF_STR( 1C_3C ) )
2725   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
2726   PORT_DIPSETTING(      0x00b0, DEF_STR( 1C_5C ) )
2727   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
2728   PORT_DIPSETTING(      0x0000, "2 Credits Start, 1 to continue" )
2729// "** ADDED MULTIPLE COIN FEATURE **"
2730   PORT_DIPSETTING(      0x0050, "Multiple Coin Feature A" )
2731// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2732   PORT_DIPSETTING(      0x0040, "Multiple Coin Feature B" )
2733// 2c-1c, 4c-3c
2734   PORT_DIPSETTING(      0x0030, "Multiple Coin Feature C" )
2735// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2736   PORT_DIPSETTING(      0x0020, "Multiple Coin Feature D" )
2737// 1c-1c, 2c-2c, 3c-3c & 4c-5c
2738
2739   PORT_START   // IN0 - $210004
2740   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
2741   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
2742   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2743   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) )
2744   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
2745   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2746   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) )
2747   PORT_DIPSETTING(      0x0008, DEF_STR( Easy ) )
2748   PORT_DIPSETTING(      0x000c, DEF_STR( Normal ) )
2749   PORT_DIPSETTING(      0x0004, DEF_STR( Hard ) )
2750   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
2751   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) )
2752   PORT_DIPSETTING(      0x0010, "1" )
2753   PORT_DIPSETTING(      0x0030, "2" )
2754   PORT_DIPSETTING(      0x0020, "3" )
2755   PORT_DIPSETTING(      0x0000, "4" )
2756   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
2757   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
2758   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
2759   PORT_DIPNAME( 0x0080, 0x0080, "Health" )
2760   PORT_DIPSETTING(      0x0000, "3 Hearts" )
2761   PORT_DIPSETTING(      0x0080, "4 Hearts" )
2762
2763   PORT_START   // IN2 - $210008
2764   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2765   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2766   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2767   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2768   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2769   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2770   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2771   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2772
2773   PORT_START   // IN3 - $21000a
2774   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2775   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2776   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2777   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2778   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2779   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2780   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2781   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2782
2783   PORT_START   // IN4 - $21000c
2784   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2785   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2786   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2787   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2788   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2789INPUT_PORTS_END
2790
27912342/***************************************************************************
27922343                            Pachinko Sexy Reaction
27932344***************************************************************************/
27942345
27952346static INPUT_PORTS_START( sxyreact )
2796   PORT_START   // IN0 - $210002
2797   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )         PORT_DIPLOCATION( "DSW1:1,2,3" )
2798   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
2799   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
2800   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
2801   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
2802   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C ) )
2803   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C ) )
2804   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C ) )
2805   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2806   PORT_BIT(     0x0038, IP_ACTIVE_LOW, IPT_UNUSED )
2347   PORT_INCLUDE(ssv_joystick)
2348
2349   PORT_MODIFY("DSW1")   // IN0 - $210002
2350   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSW1:1,2,3" )
28072351   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "DSW1:4" )
28082352   PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0010, "DSW1:5" )
28092353   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "DSW1:6" )
2810//  PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )           PORT_DIPLOCATION( "DSW1:4,5,6" )
2811//  PORT_DIPSETTING(      0x0028, DEF_STR( 3C_1C ) )
2812//  PORT_DIPSETTING(      0x0030, DEF_STR( 2C_1C ) )
2813//  PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
2814//  PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
2815//  PORT_DIPSETTING(      0x0018, DEF_STR( 1C_3C ) )
2816//  PORT_DIPSETTING(      0x0010, DEF_STR( 1C_4C ) )
2817//  PORT_DIPSETTING(      0x0008, DEF_STR( 1C_5C ) )
2818//  PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
2354   //SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSW1:4,5,6" )
28192355   PORT_DIPNAME( 0x0040, 0x0040, "Credits To Play" )         PORT_DIPLOCATION( "DSW1:7" )
28202356   PORT_DIPSETTING(      0x0040, "1" )
28212357   PORT_DIPSETTING(      0x0000, "2" )
r1281r1282
28232359   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
28242360   PORT_DIPSETTING(      0x0080, DEF_STR( On ) )
28252361
2826   PORT_START   // IN1 - $210004
2362   PORT_MODIFY("DSW2")   // IN1 - $210004
28272363   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION( "DSW2:1" )
28282364   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
28292365   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r1281r1282
28442380   PORT_SERVICE_DIPLOC( 0x0040, IP_ACTIVE_LOW, "DSW2:7" )
28452381   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" )
28462382
2847   PORT_START   // IN2 - $210008
2848   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2849   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
2850   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)   // -> ball sensor on
2851   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2852   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
2853   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
2854   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
2855   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
2856
2857   PORT_START   // IN3 - $21000a
2858   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )   // (player 2, only shown in test mode)
2859
2860   PORT_START   // IN4 - $21000c
2861   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2862   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED   )
2863   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2864   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
2865   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Advance") PORT_CODE(KEYCODE_F1)
2866   PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2867
28682383   PORT_START   // IN5 - $500002
28692384   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE2 )   // ball switch on -> handle motor off
28702385
r1281r1282
28782393***************************************************************************/
28792394
28802395static INPUT_PORTS_START( twineag2 )
2881   PORT_START   // IN0 - $210002
2882   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )   PORT_DIPLOCATION( "DSW1:1,2,3,4" )
2883   PORT_DIPSETTING(      0x0007, DEF_STR( 4C_1C ) )
2884   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
2885   PORT_DIPSETTING(      0x0009, DEF_STR( 2C_1C ) )
2886   PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
2887   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_3C ) )
2888   PORT_DIPSETTING(      0x000e, DEF_STR( 1C_2C ) )
2889   PORT_DIPSETTING(      0x000d, DEF_STR( 1C_3C ) )
2890   PORT_DIPSETTING(      0x000c, DEF_STR( 1C_4C ) )
2891   PORT_DIPSETTING(      0x000b, DEF_STR( 1C_5C ) )
2892   PORT_DIPSETTING(      0x000a, DEF_STR( 1C_6C ) )
2893// "** ADDED MULTIPLE COIN FEATURE **"
2894   PORT_DIPSETTING(      0x0005, "Multiple Coin Feature A" )
2895// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2896   PORT_DIPSETTING(      0x0004, "Multiple Coin Feature B" )
2897// 2c-1c, 4c-3c
2898   PORT_DIPSETTING(      0x0003, "Multiple Coin Feature C" )
2899// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2900   PORT_DIPSETTING(      0x0002, "Multiple Coin Feature D" )
2901// 1c-1c, 2c-2c, 3c-3c & 4c-5c
2902   PORT_DIPSETTING(      0x0001, "Multiple Coin Feature E" )
2903// 1c-1c, 2c-3c
2396   PORT_INCLUDE(ssv_joystick)
2397
2398   PORT_MODIFY("DSW1")   // IN0 - $210002
2399   SSV_COINAGE_EXTENDED( 0, 0x0f, DEF_STR( Coin_A ), "DSW1:1,2,3,4" )
29042400   //PORT_DIPSETTING(      0x0000, "???" ) - No values listed for all "ON"
2905   PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )   PORT_DIPLOCATION( "DSW1:5,6,7,8" )
2906   PORT_DIPSETTING(      0x0070, DEF_STR( 4C_1C ) )
2907   PORT_DIPSETTING(      0x0080, DEF_STR( 3C_1C ) )
2908   PORT_DIPSETTING(      0x0090, DEF_STR( 2C_1C ) )
2909   PORT_DIPSETTING(      0x00f0, DEF_STR( 1C_1C ) )
2910   PORT_DIPSETTING(      0x0060, DEF_STR( 2C_3C ) )
2911   PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_2C ) )
2912   PORT_DIPSETTING(      0x00d0, DEF_STR( 1C_3C ) )
2913   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
2914   PORT_DIPSETTING(      0x00b0, DEF_STR( 1C_5C ) )
2915   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
2916// "** ADDED MULTIPLE COIN FEATURE **"
2917   PORT_DIPSETTING(      0x0050, "Multiple Coin Feature A" )
2918// 2c-1c, 4c-2c, 5c-3c & 6c-4c
2919   PORT_DIPSETTING(      0x0040, "Multiple Coin Feature B" )
2920// 2c-1c, 4c-3c
2921   PORT_DIPSETTING(      0x0030, "Multiple Coin Feature C" )
2922// 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c
2923   PORT_DIPSETTING(      0x0020, "Multiple Coin Feature D" )
2924// 1c-1c, 2c-2c, 3c-3c & 4c-5c
2925   PORT_DIPSETTING(      0x0010, "Multiple Coin Feature E" )
2926// 1c-1c, 2c-3c
2401   SSV_COINAGE_EXTENDED( 4, 0x0f, DEF_STR( Coin_B ), "DSW1:5,6,7,8" )
29272402   //PORT_DIPSETTING(      0x0000, "???" ) - No values listed for all "ON"
29282403
2929   PORT_START   // IN1 - $210004
2404   PORT_MODIFY("DSW2")   // IN1 - $210004
29302405   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) )   PORT_DIPLOCATION( "DSW2:1,2,3" )
29312406   PORT_DIPSETTING(      0x0006, DEF_STR( Easiest ) )
29322407   PORT_DIPSETTING(      0x0005, DEF_STR( Easier ) )
r1281r1282
29502425   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
29512426   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
29522427
2953   PORT_START   // IN2 - $210008
2954   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
2955   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2956   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2957   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2958   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
2959   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
2960   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
2961   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
2962
2963   PORT_START   // IN3 - $21000a
2964   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
2965   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2966   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2967   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2968   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2969   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2970   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2971   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2972
2973   PORT_START   // IN4 - $21000c
2974   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
2975   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
2976   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
2977
2428   PORT_MODIFY("IN4")   // IN4 - $21000c
29782429   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
2979   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Advance") PORT_CODE(KEYCODE_F1)
29802430   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE4 )
29812431   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START3 )
29822432   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START4 )
r1281r1282
29882438***************************************************************************/
29892439
29902440static INPUT_PORTS_START( ultrax )
2991   PORT_START   // IN0 - $210002
2992   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )
2441   PORT_INCLUDE(ssv_joystick)
2442
2443   PORT_MODIFY("DSW1")   // IN0 - $210002
2444   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )      PORT_DIPLOCATION("DSW1:1,2,3,4")
29932445   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
29942446   PORT_DIPSETTING(      0x0009, DEF_STR( 2C_1C ) )
29952447   PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
r1281r1282
29982450   PORT_DIPSETTING(      0x000c, DEF_STR( 1C_4C ) )
29992451   PORT_DIPSETTING(      0x000b, DEF_STR( 1C_5C ) )
30002452   PORT_DIPSETTING(      0x000a, DEF_STR( 1C_6C ) )
3001   PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )
2453   PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_B ) )      PORT_DIPLOCATION("DSW1:5,6,7,8")
30022454   PORT_DIPSETTING(      0x0080, DEF_STR( 3C_1C ) )
30032455   PORT_DIPSETTING(      0x0090, DEF_STR( 2C_1C ) )
30042456   PORT_DIPSETTING(      0x00f0, DEF_STR( 1C_1C ) )
r1281r1282
30082460   PORT_DIPSETTING(      0x00b0, DEF_STR( 1C_5C ) )
30092461   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
30102462
3011   PORT_START   // IN1 - $210004
3012   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
2463   PORT_MODIFY("DSW2")   // IN1 - $210004
2464   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("DSW2:1,2")
30132465   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )      //$140
30142466   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )   //$190
30152467   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )      //$200
30162468   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )   //$300
3017   PORT_DIPNAME( 0x0014, 0x0004, "Country" )
2469   PORT_DIPNAME( 0x0014, 0x0004, "Country" )            PORT_DIPLOCATION("DSW2:3,5")
30182470   PORT_DIPSETTING(      0x0000, "China" )
30192471   PORT_DIPSETTING(      0x0014, DEF_STR( Japan ) )
30202472//  PORT_DIPSETTING(      0x0010, DEF_STR( Japan ) )
30212473   PORT_DIPSETTING(      0x0004, DEF_STR( World ) )
3022   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Free_Play ) )
2474   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Free_Play ) )   PORT_DIPLOCATION("DSW2:4")
30232475   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
30242476   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
30252477   // country            0x0010
3026   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
2478   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("DSW2:6")
30272479   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
30282480   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
3029   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
2481   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("DSW2:7")
30302482   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
30312483   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3032   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
3033
3034   PORT_START   // IN2 - $210008
3035   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
3036   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3037   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3038   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3039   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
3040   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
3041   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
3042   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
3043
3044   PORT_START   // IN3 - $21000a
3045   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
3046   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3047   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3048   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3049   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3050   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3051   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3052   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3053
3054   PORT_START   // IN4 - $21000c
3055   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
3056   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
3057   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3058   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT )
3059   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test Advance") PORT_CODE(KEYCODE_F1)
3060   PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN )
2484   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
30612485INPUT_PORTS_END
30622486
30632487
r1281r1282
30662490***************************************************************************/
30672491
30682492static INPUT_PORTS_START( vasara )
3069   PORT_START   // IN0 - $210002
3070   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Free_Play )  )
2493   PORT_INCLUDE(ssv_joystick)
2494
2495   PORT_MODIFY("DSW1")   // IN0 - $210002
2496   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Free_Play )  )   PORT_DIPLOCATION("DSW1:1")
30712497   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
30722498   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3073   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )
2499   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("DSW1:2")
30742500   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
30752501   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3076   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
3077   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )
2502   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
2503   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("DSW1:4")
30782504   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
30792505   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
3080   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )
3081   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
3082   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
3083   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
3084   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
3085   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )
3086   PORT_DIPSETTING(      0x0040, DEF_STR( 2C_1C ) )
3087   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_1C ) )
3088   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
3089   PORT_DIPSETTING(      0x0080, DEF_STR( 1C_2C ) )
2506   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coin_A ), "DSW1:5,6" )
2507   SSV_COINAGE_BASIC( 6, 0x03, DEF_STR( Coin_B ), "DSW1:7,8" )
30902508
3091   PORT_START   // IN1
3092   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
2509   PORT_MODIFY("DSW2")   // IN1
2510   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("DSW2:1,2")
30932511   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
30942512   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
30952513   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
30962514   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
3097   PORT_DIPNAME( 0x000c, 0x000c, "Bomber Stock" )
2515   PORT_DIPNAME( 0x000c, 0x000c, "Bomber Stock" )         PORT_DIPLOCATION("DSW2:3,4")
30982516   PORT_DIPSETTING(      0x0000, "0" )
30992517   PORT_DIPSETTING(      0x0004, "1" )
31002518   PORT_DIPSETTING(      0x000c, "2" )
31012519   PORT_DIPSETTING(      0x0008, "3" )
3102   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ))
2520   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ))         PORT_DIPLOCATION("DSW2:5,6")
31032521   PORT_DIPSETTING(      0x0000, "1" )
31042522   PORT_DIPSETTING(      0x0010, "2" )
31052523   PORT_DIPSETTING(      0x0030, "3" )
31062524   PORT_DIPSETTING(      0x0020, "5" )
3107   PORT_DIPNAME( 0x0040, 0x0040, "Game Voice" )
2525   PORT_DIPNAME( 0x0040, 0x0040, "Game Voice" )         PORT_DIPLOCATION("DSW2:7")
31082526   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
31092527   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
3110   PORT_DIPNAME( 0x0080, 0x0000, "English Subtitles" )
2528   PORT_DIPNAME( 0x0080, 0x0000, "English Subtitles" )      PORT_DIPLOCATION("DSW2:8")
31112529   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
31122530   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3113
3114   PORT_START   // IN2 - $210008
3115   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
3116   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
3117   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3118   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3119   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
3120   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
3121   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
3122   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
3123
3124   PORT_START   // IN3 - $21000a
3125   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
3126   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
3127   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3128   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3129   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3130   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3131   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3132   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3133
3134   PORT_START   // IN4 - $21000c
3135   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
3136   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
3137   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3138   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3139   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
31402531INPUT_PORTS_END
31412532
31422533/***************************************************************************
r1281r1282
31442535***************************************************************************/
31452536
31462537static INPUT_PORTS_START( vasara2 )
3147   PORT_START   // IN0 - $210002
3148   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Free_Play )  )
2538   PORT_INCLUDE(ssv_joystick)
2539
2540   PORT_MODIFY("DSW1")   // IN0 - $210002
2541   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Free_Play )  )   PORT_DIPLOCATION("DSW1:1")
31492542   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
31502543   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3151   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )
2544   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("DSW1:2")
31522545   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
31532546   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3154   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
3155   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )
2547   PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "DSW1:3" )
2548   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("DSW1:4")
31562549   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
31572550   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
3158   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )
3159   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
3160   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
3161   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
3162   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
3163   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )
3164   PORT_DIPSETTING(      0x0040, DEF_STR( 2C_1C ) )
3165   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_1C ) )
3166   PORT_DIPSETTING(      0x0000, DEF_STR( 2C_3C ) )
3167   PORT_DIPSETTING(      0x0080, DEF_STR( 1C_2C ) )
2551   SSV_COINAGE_BASIC( 4, 0x03, DEF_STR( Coin_A ), "DSW1:5,6" )
2552   SSV_COINAGE_BASIC( 6, 0x03, DEF_STR( Coin_B ), "DSW1:7,8" )
31682553
3169   PORT_START   // IN1
3170   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
2554   PORT_MODIFY("DSW2")   // IN1
2555   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("DSW2:1,2")
31712556   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
31722557   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
31732558   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
31742559   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
3175   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )
2560   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )      PORT_DIPLOCATION("DSW2:3,4")
31762561   PORT_DIPSETTING(      0x0000, "1" )
31772562   PORT_DIPSETTING(      0x0004, "2" )
31782563   PORT_DIPSETTING(      0x000c, "3" )
31792564   PORT_DIPSETTING(      0x0008, "5" )
3180   PORT_DIPNAME( 0x0010, 0x0010, "Game Voice" )
2565   PORT_DIPNAME( 0x0010, 0x0010, "Game Voice" )         PORT_DIPLOCATION("DSW2:5")
31812566   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
31822567   PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
3183   PORT_DIPNAME( 0x0020, 0x0020, "Vasara Stock" )
2568   PORT_DIPNAME( 0x0020, 0x0020, "Vasara Stock" )         PORT_DIPLOCATION("DSW2:6")
31842569   PORT_DIPSETTING(      0x0020, "2" )
31852570   PORT_DIPSETTING(      0x0000, "3" )
3186   PORT_DIPNAME( 0x0040, 0x0040, "English Subtitles" )
2571   PORT_DIPNAME( 0x0040, 0x0040, "English Subtitles" )      PORT_DIPLOCATION("DSW2:7")
31872572   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
31882573   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
3189   PORT_DIPNAME( 0x0080, 0x0080, "Secret Character" )
2574   PORT_DIPNAME( 0x0080, 0x0080, "Secret Character" )      PORT_DIPLOCATION("DSW2:8")
31902575   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
31912576   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
3192
3193   PORT_START   // IN2 - $210008
3194   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
3195   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
3196   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3197   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3198   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
3199   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
3200   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
3201   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
3202
3203   PORT_START   // IN3 - $21000a
3204   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
3205   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
3206   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3207   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3208   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3209   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3210   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3211   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3212
3213   PORT_START   // IN4 - $21000c
3214   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
3215   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
3216   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3217   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3218   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
32192577INPUT_PORTS_END
32202578
32212579
2580
32222581/***************************************************************************
32232582
32242583
r1281r1282
33602719}
33612720
33622721
3363DRIVER_INIT( drifto94 )      {   init_ssv();
2722static DRIVER_INIT( drifto94 )      {   init_ssv();
33642723                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xf0;
33652724                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3366DRIVER_INIT( eaglshot )      {   init_ssv_hypreac2();
2725static DRIVER_INIT( eaglshot )      {   init_ssv_hypreac2();
33672726                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xf0;
33682727                        ssv_tilemap_offsx = 0;   ssv_tilemap_offsy = -0xef; }
3369DRIVER_INIT( gdfs )         {   init_ssv();
2728static DRIVER_INIT( gdfs )         {   init_ssv();
33702729                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = 1;
33712730                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = 0;   }
3372DRIVER_INIT( hypreact )      {   init_ssv();
2731static DRIVER_INIT( hypreact )      {   init_ssv();
33732732                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xf0;
33742733                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf7;   }
3375DRIVER_INIT( hypreac2 )      {   init_ssv_hypreac2();   // different
2734static DRIVER_INIT( hypreac2 )      {   init_ssv_hypreac2();   // different
33762735                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xf0;
33772736                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf8;   }
3378DRIVER_INIT( janjans1 )      {   init_ssv();
2737static DRIVER_INIT( janjans1 )      {   init_ssv();
33792738                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
33802739                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3381DRIVER_INIT( keithlcy )      {   init_ssv();
2740static DRIVER_INIT( keithlcy )      {   init_ssv();
33822741                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xf1;
33832742                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3384DRIVER_INIT( meosism )      {   init_ssv();
2743static DRIVER_INIT( meosism )      {   init_ssv();
33852744                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
33862745                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xef;   }
3387DRIVER_INIT( mslider )      {   init_ssv();
2746static DRIVER_INIT( mslider )      {   init_ssv();
33882747                        ssv_sprites_offsx =-16;   ssv_sprites_offsy = +0xf0;
33892748                        ssv_tilemap_offsx = +8;   ssv_tilemap_offsy = -0xf1;   }
3390DRIVER_INIT( ryorioh )      {   init_ssv();
2749static DRIVER_INIT( ryorioh )      {   init_ssv();
33912750                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
33922751                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3393DRIVER_INIT( srmp4 )      {   init_ssv();
2752static DRIVER_INIT( srmp4 )      {   init_ssv();
33942753                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xf0;
33952754                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;
33962755//  ((UINT16 *)memory_region(REGION_USER1))[0x2b38/2] = 0x037a;   /* patch to see gal test mode */
33972756                     }
3398DRIVER_INIT( srmp7 )      {   init_ssv();
2757static DRIVER_INIT( srmp7 )      {   init_ssv();
33992758                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = -0xf;
34002759                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3401DRIVER_INIT( stmblade )      {   init_ssv();
2760static DRIVER_INIT( stmblade )      {   init_ssv();
34022761                        ssv_sprites_offsx = -8; ssv_sprites_offsy = +0xef;
34032762                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf0;   }
3404DRIVER_INIT( survarts )      {   init_ssv();
2763static DRIVER_INIT( survarts )      {   init_ssv();
34052764                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
34062765                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xef;   }
3407DRIVER_INIT( dynagear )      {   init_ssv();
2766static DRIVER_INIT( dynagear )      {   init_ssv();
34082767                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xec;
34092768                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xef;   }
3410DRIVER_INIT( sxyreact )      {   init_ssv_hypreac2();   // different
2769static DRIVER_INIT( sxyreact )      {   init_ssv_hypreac2();   // different
34112770                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
34122771                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xef;   }
3413DRIVER_INIT( sxyreac2 )      {   init_ssv_hypreac2();
2772static DRIVER_INIT( sxyreac2 )      {   init_ssv_hypreac2();
34142773                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xe8;
34152774                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xef;   }
3416DRIVER_INIT( twineag2 )      {   init_ssv();interrupt_ultrax=1;
2775static DRIVER_INIT( twineag2 )      {   init_ssv();interrupt_ultrax=1;
34172776                        ssv_sprites_offsx = -6; ssv_sprites_offsy = +0x01;
34182777                        ssv_tilemap_offsx = -2; ssv_tilemap_offsy = +0x00;   }
3419DRIVER_INIT( ultrax )      {   init_ssv();interrupt_ultrax=1;
2778static DRIVER_INIT( ultrax )      {   init_ssv();interrupt_ultrax=1;
34202779                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0x01;
34212780                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = +0x00;   }
3422DRIVER_INIT( vasara )      {   init_ssv();
2781static DRIVER_INIT( vasara )      {   init_ssv();
34232782                        ssv_sprites_offsx = +0;   ssv_sprites_offsy = +0xf0;
34242783                        ssv_tilemap_offsx = +0;   ssv_tilemap_offsy = -0xf8;   }
3425DRIVER_INIT( jsk )         {   init_ssv();
2784static DRIVER_INIT( jsk )         {   init_ssv();
34262785                        ssv_sprites_offsx = -8;   ssv_sprites_offsy = +0xf5;
34272786                        ssv_tilemap_offsx = 0;   ssv_tilemap_offsy = -0xf4;   }
34282787
r1281r1282
53314690GAME( 1998,  sxyreact, 0,        sxyreact, sxyreact, sxyreact, ROT0,   "Sammy",              "Pachinko Sexy Reaction (Japan)",                   GAME_NO_COCKTAIL )
53324691GAME( 1999,  sxyreac2, 0,        sxyreact, sxyreact, sxyreac2, ROT0,   "Sammy",              "Pachinko Sexy Reaction 2 (Japan)",                 GAME_NO_COCKTAIL )
53334692GAME( 1999,  cairblad, 0,        sxyreact, cairblad, sxyreact, ROT270, "Sammy",              "Change Air Blade (Japan)",                         GAME_NO_COCKTAIL )
5334GAME( 2000,  janjans2, 0,        janjans1, janjans1, janjans1, ROT0,   "Visco",              "Lovely Pop Mahjong JangJang Shimasho 2 (Japan)",   GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
4693GAME( 2000,  janjans2, 0,        janjans1, janjans2, janjans1, ROT0,   "Visco",              "Lovely Pop Mahjong JangJang Shimasho 2 (Japan)",   GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
53354694GAME( 2000,  vasara,   0,        ryorioh,  vasara,   vasara,   ROT270, "Visco",              "Vasara",                                           GAME_NO_COCKTAIL )
53364695GAME( 2001,  vasara2,  0,        ryorioh,  vasara2,  vasara,   ROT270, "Visco",              "Vasara 2 (set 1)",                                 GAME_NO_COCKTAIL )
53374696GAME( 2001,  vasara2a, vasara2,  ryorioh,  vasara2,  vasara,   ROT270, "Visco",              "Vasara 2 (set 2)",                                 GAME_NO_COCKTAIL )
src/mame/drivers/mpu4drvr.c
r0r1282
1/***************************************************************************
2Barcrest MPU4 highly preliminary driver by J.Wallace, and Anonymous.
3
4Any MAME-approved games should go here.
5
6See http://www.mameworld.net/agemame/techinfo/mpu4.php for Information.
7
8--- Board Setup ---
9For the Barcrest MPU4 Video system, the GAME CARD (cartridge) contains the MPU4 video bios in the usual ROM space (occupying 16k),
10an interface card to connect an additional Video board, and a 6850 serial IO to communicate with said board.
11This version of the game card does not have the OKI chip, or the characteriser.
12
13The VIDEO BOARD is driven by a 10mhz 68000 processor, and contains a 6840PTM, 6850 serial IO (the other end of the
14communications), an SAA1099 for stereo sound and SCN2674 gfx chip.
15
16The VIDEO CARTRIDGE plugs into the video board, and contains the program roms for the video based game. Like the MPU4 game
17card, in some cases an extra OKI sound chip is added to the video board's game card,as well as extra RAM.
18There is a protection chip similar to and replacing the MPU4 Characteriser, which is often fed question data to descramble
19(unknown how it works). In non-question cases, however, the protection chip works near identically to the original.
20
21No video card schematics ever left the PCB factory, but some decent scans of the board have been made,
22now also available for review.
23
24Additional: 68k HALT line is tied to the reset circuit of the MPU4.
25
26Everything here is preliminary...  the boards are quite fussy with regards their self tests
27and the timing may have to be perfect for them to function correctly.  (as the comms are
28timer driven, the video is capable of various raster effects etc.)
29
30Datasheets are available for the main components, The AGEMAME site mirrors a few of the harder-to-find ones.
31
32--- Preliminary MPU4 Video Interface Card Memorymap  ---
33
34   hex     |r/w| D D D D D D D D |
35 location  |   | 7 6 5 4 3 2 1 0 | function
36-----------+---+-----------------+--------------------------------------------------------------------------
37 0000-07FF |R/W| D D D D D D D D | 2k RAM
38-----------+---+-----------------+--------------------------------------------------------------------------
39 0800      |R/W|                 | ACIA 6850
40-----------+---+-----------------+--------------------------------------------------------------------------
41 0900-     |R/W| D D D D D D D D | MC6840 PTM IC2
42
43
44  Clock1 <--------------------------------------
45     |                                          |
46     V                                          |
47  Output1 ---> Clock2                           |
48                                                |
49               Output2 --+-> Clock3             |
50                         |                      |
51                         |   Output3 ---> 'to audio amp' ??
52                         |
53                         +--------> CA1 IC3 (
54
55IRQ line connected to CPU
56
57-----------+---+-----------------+--------------------------------------------------------------------------
58 0A00-0A03 |R/W| D D D D D D D D | PIA6821 IC3 port A Lamp Drives 1,2,3,4,6,7,8,9 (sic)(IC14)
59           |   |                 |
60           |   |                 |          CA1 <= output2 from PTM6840 (IC2)
61           |   |                 |          CA2 => alpha data
62           |   |                 |
63           |   |                 |          port B Lamp Drives 10,11,12,13,14,15,16,17 (sic)(IC13)
64           |   |                 |
65           |   |                 |          CB2 => alpha reset (clock on Dutch systems)
66           |   |                 |
67-----------+---+-----------------+--------------------------------------------------------------------------
68 0B00-0B03 |R/W| D D D D D D D D | PIA6821 IC4 port A = data for 7seg leds (pins 10 - 17, via IC32)
69           |   |                 |
70           |   |                 |             CA1 INPUT, 50 Hz input (used to generate IRQ)
71           |   |                 |             CA2 OUTPUT, connected to pin2 74LS138 CE for multiplexer
72           |   |                 |                        (B on LED strobe multiplexer)
73           |   |                 |             IRQA connected to IRQ of CPU
74           |   |                 |             port B
75           |   |                 |                    PB7 = INPUT, serial port Receive data (Rx)
76           |   |                 |                    PB6 = INPUT, reel A sensor
77           |   |                 |                    PB5 = INPUT, reel B sensor
78           |   |                 |                    PB4 = INPUT, reel C sensor
79           |   |                 |                    PB3 = INPUT, reel D sensor
80           |   |                 |                    PB2 = INPUT, Connected to CA1 (50Hz signal)
81           |   |                 |                    PB1 = INPUT, undercurrent sense
82           |   |                 |                    PB0 = INPUT, overcurrent  sense
83           |   |                 |
84           |   |                 |             CB1 INPUT,  used to generate IRQ on edge of serial input line
85           |   |                 |             CB2 OUTPUT, enable signal for reel optics
86           |   |                 |             IRQB connected to IRQ of CPU
87           |   |                 |
88-----------+---+-----------------+--------------------------------------------------------------------------
89 0C00-0C03 |R/W| D D D D D D D D | PIA6821 IC5 port A
90           |   |                 |
91           |   |                 |                    PA0-PA7, INPUT AUX1 connector
92           |   |                 |
93           |   |                 |             CA2  OUTPUT, serial port Transmit line
94           |   |                 |             CA1  not connected
95           |   |                 |             IRQA connected to IRQ of CPU
96           |   |                 |
97           |   |                 |             port B
98           |   |                 |
99           |   |                 |                    PB0-PB7 INPUT, AUX2 connector
100           |   |                 |
101           |   |                 |             CB1  INPUT,  connected to PB7 (Aux2 connector pin 4)
102           |   |                 |
103           |   |                 |             CB2  OUTPUT, AY8913 chip select line
104           |   |                 |             IRQB connected to IRQ of CPU
105           |   |                 |
106-----------+---+-----------------+--------------------------------------------------------------------------
107 0D00-0D03 |R/W| D D D D D D D D | PIA6821 IC6
108           |   |                 |
109           |   |                 |  port A
110           |   |                 |
111           |   |                 |        PA0 - PA7 (INPUT/OUTPUT) data port AY8913 sound chip
112           |   |                 |
113           |   |                 |        CA1 INPUT,  not connected
114           |   |                 |        CA2 OUTPUT, BC1 pin AY8913 sound chip
115           |   |                 |        IRQA , connected to IRQ CPU
116           |   |                 |
117           |   |                 |  port B
118           |   |                 |
119           |   |                 |        PB0-PB3 OUTPUT, reel A
120           |   |                 |        PB4-PB7 OUTPUT, reel B
121           |   |                 |
122           |   |                 |        CB1 INPUT,  not connected
123           |   |                 |        CB2 OUTPUT, B01R pin AY8913 sound chip
124           |   |                 |        IRQB , connected to IRQ CPU
125           |   |                 |
126-----------+---+-----------------+--------------------------------------------------------------------------
127 0E00-0E03 |R/W| D D D D D D D D | PIA6821 IC7
128           |   |                 |
129           |   |                 |  port A
130           |   |                 |
131           |   |                 |        PA0-PA3 OUTPUT, reel C
132           |   |                 |        PA4-PA7 OUTPUT, reel D
133           |   |                 |        CA1     INPUT,  not connected
134           |   |                 |        CA2     OUTPUT, A on LED strobe multiplexer
135           |   |                 |        IRQA , connected to IRQ CPU
136           |   |                 |
137           |   |                 |  port B
138           |   |                 |
139           |   |                 |        PB0-PB6 OUTPUT mech meter 1-7 or reel E + F
140           |   |                 |        PB7     Voltage drop sensor
141           |   |                 |        CB1     INPUT, not connected
142           |   |                 |        CB2     OUTPUT,mech meter 8
143           |   |                 |        IRQB , connected to IRQ CPU
144           |   |                 |
145-----------+---+-----------------+--------------------------------------------------------------------------
146 0F00-0F03 |R/W| D D D D D D D D | PIA6821 IC8
147           |   |                 |
148           |   |                 | port A
149           |   |                 |
150           |   |                 |        PA0-PA7 INPUT  multiplexed inputs data
151           |   |                 |
152           |   |                 |        CA1     INPUT, not connected
153           |   |                 |        CA2    OUTPUT, C on LED strobe multiplexer
154           |   |                 |        IRQA           connected to IRQ CPU
155           |   |                 |
156           |   |                 | port B
157           |   |                 |
158           |   |                 |        PB0-PB7 OUTPUT  triacs outputs connector PL6
159           |   |                 |        used for slides / hoppers
160           |   |                 |
161           |   |                 |        CB1     INPUT, not connected
162           |   |                 |        CB2    OUTPUT, pin1 alpha display PL7 (clock signal)
163           |   |                 |        IRQB           connected to IRQ CPU
164           |   |                 |
165-----------+---+-----------------+--------------------------------------------------------------------------
166 4000-40FF |R/W| D D D D D D D D | RAM ?
167-----------+---+-----------------+--------------------------------------------------------------------------
168 BE00-BFFF |R/W| D D D D D D D D | RAM
169-----------+---+-----------------+--------------------------------------------------------------------------
170 C000-FFFF | R | D D D D D D D D | ROM
171-----------+---+-----------------+--------------------------------------------------------------------------
172TODO: - Confirm that MC6850 emulation is sufficient.
173      - MPU4 Master clock value taken from schematic, but 68k value is not.
174
175*****************************************************************************************/
176
177//MPU4 Video
178#include "cpu/m68000/m68000.h"
179#include "machine/6850acia.h"
180#include "sound/saa1099.h"
181//Deal 'Em
182#include "video/crtc6845.h"
183
184#ifdef MAME_DEBUG
185#define LOGSTUFF(x)logerror x
186#else
187#define LOGSTUFF(x)
188#endif
189
190#define VIDEO_MASTER_CLOCK (10000000)
191
192static UINT8 m6840_irq_state;
193static UINT8 m6850_irq_state;
194static UINT8 scn2674_irq_state;
195
196/* UART source/sinks */
197static UINT8 m68k_m6809_line;
198static UINT8 m6809_m68k_line;
199static UINT8 m68k_acia_cts;
200static UINT8 m6809_acia_cts;
201static UINT8 m6809_acia_rts;
202static UINT8 m6809_acia_dcd;
203
204static int mpu4_gfx_index;
205static UINT16 * mpu4_vid_vidram;
206static UINT8 * mpu4_vid_vidram_is_dirty;
207static UINT16 * mpu4_vid_mainram;
208
209static UINT8 scn2674_IR[16];
210static UINT8 scn2675_IR_pointer;
211static UINT8 scn2674_screen1_l;
212static UINT8 scn2674_screen1_h;
213static UINT8 scn2674_cursor_l;
214static UINT8 scn2674_cursor_h;
215static UINT8 scn2674_screen2_l;
216static UINT8 scn2674_screen2_h;
217
218///////////////////////////////////////////////////////////////////////////
219
220static MACHINE_RESET( mpu4_vid )
221{
222   ROC10937_reset(0);   // reset display1
223
224//  cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
225   mpu4_stepper_reset();
226
227   lamp_strobe    = 0;
228   lamp_strobe2   = 0;
229   lamp_data      = 0;
230
231   IC23GC    = 0;
232   IC23GB    = 0;
233   IC23GA    = 0;
234   IC23G1    = 1;
235   IC23G2A   = 0;
236   IC23G2B   = 0;
237
238   prot_col  = 0;
239}
240
241/*************************************
242 *
243 *  Interrupt system
244 *
245 *************************************/
246
247/* The interrupt system consists of a 74148 priority encoder
248   with the following interrupt priorites.  A lower number
249   indicates a lower priority:
250
251    7 - Game Card
252    6 - Game Card
253    5 - Game Card
254    4 - Game Card
255    3 - 2674 AVDC
256    2 - 6850 ACIA
257    1 - 6840 PTM
258    0 - Unused
259*/
260
261static void update_mpu68_interrupts(void)
262{
263   int newstate = 0;
264
265   if (m6840_irq_state)//1
266      newstate = 1;
267   if (m6850_irq_state)//2
268      newstate = 2;
269   if (scn2674_irq_state)//3
270      newstate = 3;
271
272   /* set the new state of the IRQ lines */
273   if (newstate)
274   {
275      LOG(("68k IRQ, %x\n", newstate));
276      cpunum_set_input_line(1, newstate, ASSERT_LINE);
277   }
278   else
279   {
280      LOG(("68k IRQ Clear, %x\n", newstate));
281      cpunum_set_input_line(1, 7, CLEAR_LINE);
282   }
283}
284
285// Communications ////////////////////////////////////////////////////////
286/* Clock values are currently unknown, and are derived from the 68k board.
287It *should* be the case that the rx and tx pins are triggered solely by
288the 6840 timeout, but the ACIA core doesn't allow that.
289For now, it's fixed to the frequency set by the PTM on initialisation.*/
290static void m6809_acia_irq(int state)
291{
292   m68k_acia_cts = state;
293   cpunum_set_input_line(0, M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE);
294}
295
296static void m68k_acia_irq(int state)
297{
298   m6809_acia_cts = state;
299   m6850_irq_state = state;
300   update_mpu68_interrupts();
301}
302
303static struct acia6850_interface m6809_acia_if =
304{
305   MPU4_MASTER_CLOCK/44,//This isn't a real division, this is just to work around
306   MPU4_MASTER_CLOCK/44,//the ACIA code's hard coding
307   &m68k_m6809_line,
308   &m6809_m68k_line,
309   &m6809_acia_cts,
310   &m6809_acia_rts,
311   &m6809_acia_dcd,
312   m6809_acia_irq
313};
314
315static struct acia6850_interface m68k_acia_if =
316{
317   MPU4_MASTER_CLOCK/44,
318   MPU4_MASTER_CLOCK/44,
319   &m6809_m68k_line,
320   &m68k_m6809_line,
321   &m68k_acia_cts,
322   &m6809_acia_dcd,
323   &m6809_acia_rts,
324   m68k_acia_irq
325};
326
327static void cpu1_ptm_irq(int state)
328{
329   m6840_irq_state = state;
330   update_mpu68_interrupts();
331}
332
333static WRITE8_HANDLER( vid_o1_callback )
334{
335   ptm6840_set_c2(   1, data); // copy output value to c2
336}
337
338static WRITE8_HANDLER( vid_o2_callback )
339{
340   ptm6840_set_c3(   1, data); // copy output value to c3
341}
342
343static WRITE8_HANDLER( vid_o3_callback )
344{
345   ptm6840_set_c1(   1, data); // copy output value to c1
346}
347
348//Again, this PTM clock might be wrong, it needs tracing from the PCB
349static const ptm6840_interface ptm_vid_intf =
350{
351   VIDEO_MASTER_CLOCK/10,
352   { MPU4_MASTER_CLOCK/4,0,0 },
353   { vid_o1_callback, vid_o2_callback, vid_o3_callback },
354   cpu1_ptm_irq
355};
356
357// SCN2674 AVDC emulation
358
359/* the chip is actually more complex than this.. character aren't limited to 8 rows high... but I
360 don't *think* the MPU4 stuff needs otherwise.. yet .. */
361
362static const gfx_layout mpu4_vid_char_8x8_layout =
363{
364   8,8,
365   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
366   4,
367   { 0,8,16,24 },
368   { 0,1,2,3,4,5,6,7 },
369   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
370   8*32
371};
372
373/* double height */
374static const gfx_layout mpu4_vid_char_8x16_layout =
375{
376   8,16,
377   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
378   4,
379   { 0,8,16,24 },
380   { 0,1,2,3,4,5,6,7 },
381   { 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
382   8*32
383};
384
385/* double width */
386static const gfx_layout mpu4_vid_char_16x8_layout =
387{
388   16,8,
389   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
390   4,
391   { 0,8,16,24 },
392   { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
393   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
394   8*32
395};
396
397/* double height & width */
398static const gfx_layout mpu4_vid_char_16x16_layout =
399{
400   16,16,
401   0x1000, // 0x1000 tiles (128k of GFX Ram, 0x20 bytes per tile)
402   4,
403   { 0,8,16,24 },
404   { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
405   { 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
406   8*32
407};
408
409///////////////////////////////////////////////////////////////////////////
410
411static UINT8 IR0_scn2674_double_ht_wd;
412static UINT8 IR0_scn2674_scanline_per_char_row;
413static UINT8 IR0_scn2674_sync_select;
414static UINT8 IR0_scn2674_buffer_mode_select;
415static UINT8 IR1_scn2674_interlace_enable;
416static UINT8 IR1_scn2674_equalizing_constant;
417static UINT8 IR2_scn2674_row_table;
418static UINT8 IR2_scn2674_horz_sync_width;
419static UINT8 IR2_scn2674_horz_back_porch;
420static UINT8 IR3_scn2674_vert_front_porch;
421static UINT8 IR3_scn2674_vert_back_porch;
422static UINT8 IR4_scn2674_rows_per_screen;
423static UINT8 IR4_scn2674_character_blink_rate;
424static UINT8 IR5_scn2674_character_per_row;
425static UINT8 IR8_scn2674_display_buffer_first_address_LSB;
426static UINT8 IR9_scn2674_display_buffer_first_address_MSB;
427static UINT8 IR9_scn2674_display_buffer_last_address;
428static UINT8 IR10_scn2674_display_pointer_address_lower;
429static UINT8 IR11_scn2674_display_pointer_address_upper;
430static UINT8 IR12_scn2674_scroll_start;
431static UINT8 IR12_scn2674_split_register_1;
432static UINT8 IR13_scn2674_scroll_end;
433static UINT8 IR13_scn2674_split_register_2;
434
435VIDEO_UPDATE( mpu4_vid )
436{
437   int i;
438
439   int x,y,count = 0;
440
441   fillbitmap(bitmap,machine->pens[0],cliprect);
442
443   for (i=0; i < 0x1000; i++)
444   {
445      if (mpu4_vid_vidram_is_dirty[i]==1)
446      {
447         decodechar(machine->gfx[mpu4_gfx_index+0], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_8x8_layout);
448         decodechar(machine->gfx[mpu4_gfx_index+1], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_8x16_layout);
449         decodechar(machine->gfx[mpu4_gfx_index+2], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_16x8_layout);
450         decodechar(machine->gfx[mpu4_gfx_index+3], i, (UINT8 *)mpu4_vid_vidram, &mpu4_vid_char_16x16_layout);
451         mpu4_vid_vidram_is_dirty[i]=0;
452      }
453   }
454
455   /* this is in main ram.. i think it must transfer it out of here??? */
456   // count = 0x0018b6/2; // crmaze
457   // count = 0x004950/2; // turnover
458
459   /* we're in row table mode...thats why */
460
461   for(y=0;y<=IR4_scn2674_rows_per_screen;y++)
462   {
463      int screen2_base = (scn2674_screen2_h<<8)|(scn2674_screen2_l);
464
465      UINT16 rowbase = (mpu4_vid_mainram[1+screen2_base+(y*2)]<<8)|mpu4_vid_mainram[screen2_base+(y*2)];
466      int dbl_size;
467      int gfxregion = 0;
468
469      dbl_size = (rowbase & 0xc000)>>14;  // ONLY if double size is enabled.. otherwise it can address more chars given more RAM
470
471      if (dbl_size&2) gfxregion = 1;
472
473
474      for(x=0;x<=IR5_scn2674_character_per_row;x++)
475      {
476         UINT16 tiledat;
477         UINT16 colattr;
478
479         tiledat = mpu4_vid_mainram[(rowbase+x)&0x7fff];
480         colattr = tiledat >>12;
481         tiledat &= 0x0fff;
482
483         drawgfx(bitmap,machine->gfx[gfxregion],tiledat,colattr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0);
484
485         count++;
486      }
487
488      if (dbl_size&2) y++; // skip a row?
489
490   }
491
492   popmessage("%02x %02x %02x %02x %02x %02x",scn2674_screen1_l,scn2674_screen1_h,scn2674_cursor_l, scn2674_cursor_h,scn2674_screen2_l,scn2674_screen2_h);
493
494   for (i=0; i<8; i++)
495      mpu4_draw_led(i, led_segs[i]);
496
497   return 0;
498}
499
500READ16_HANDLER( mpu4_vid_vidram_r )
501{
502   return mpu4_vid_vidram[offset];
503}
504
505WRITE16_HANDLER( mpu4_vid_vidram_w )
506{
507   COMBINE_DATA(&mpu4_vid_vidram[offset]);
508   offset <<= 1;
509   mpu4_vid_vidram_is_dirty[offset/0x20]=1;
510}
511
512/*
513SCN2674 - Advanced Video Display Controller (AVDC)  (Video Chip)
514
51515 Initialization Registers (8-bit each)
516
517-- fill me in later ---
518
519IR0  ---- ----
520IR1  ---- ----
521IR2  ---- ----
522IR3  ---- ----
523IR4  ---- ----
524IR5  ---- ----
525IR6  ---- ----
526IR7  ---- ----
527IR8  ---- ----
528IR9  ---- ----
529IR10 ---- ----
530IR11 ---- ----
531IR12 ---- ----
532IR13 ---- ----
533IR14 ---- ----
534
535*/
536
537static void scn2674_write_init_regs(UINT8 data)
538{
539   LOGSTUFF(("scn2674_write_init_regs %02x %02x\n",scn2675_IR_pointer,data));
540
541   scn2674_IR[scn2675_IR_pointer]=data;
542
543
544   switch ( scn2675_IR_pointer) // display some debug info, set mame specific variables
545   {
546      case 0:
547         IR0_scn2674_double_ht_wd = (data & 0x80)>>7;
548         IR0_scn2674_scanline_per_char_row = (data & 0x78)>>3;
549         IR0_scn2674_sync_select = (data&0x04)>>2;
550         IR0_scn2674_buffer_mode_select = (data&0x03);
551
552            LOGSTUFF(("IR0 - Double Ht Wd %02x\n",IR0_scn2674_double_ht_wd));
553            LOGSTUFF(("IR0 - Scanlines per Character Row %02x\n",IR0_scn2674_scanline_per_char_row));
554            LOGSTUFF(("IR0 - Sync Select %02x\n",IR0_scn2674_sync_select));
555            LOGSTUFF(("IR0 - Buffer Mode Select %02x\n",IR0_scn2674_buffer_mode_select));
556         break;
557
558      case 1:
559         IR1_scn2674_interlace_enable = (data&0x80)>>7;
560         IR1_scn2674_equalizing_constant = (data&0x7f);
561
562            LOGSTUFF(("IR1 - Interlace Enable %02x\n",IR1_scn2674_interlace_enable));
563         LOGSTUFF(("IR1 - Equalizing Constant %02x\n",IR1_scn2674_equalizing_constant));
564         break;
565
566      case 2:
567         IR2_scn2674_row_table = (data&0x80)>>7;
568         IR2_scn2674_horz_sync_width = (data&0x78)>>3;
569         IR2_scn2674_horz_back_porch = (data&0x07);
570
571            LOGSTUFF(("IR2 - Row Table %02x\n",IR2_scn2674_row_table));
572         LOGSTUFF(("IR2 - Horizontal Sync Width %02x\n",IR2_scn2674_horz_sync_width));
573         LOGSTUFF(("IR2 - Horizontal Back Porch %02x\n",IR2_scn2674_horz_back_porch));
574         break;
575
576      case 3:
577         IR3_scn2674_vert_front_porch = (data&0xe0)>>5;
578         IR3_scn2674_vert_back_porch = (data&0x1f)>>0;
579
580            LOGSTUFF(("IR3 - Vertical Front Porch %02x\n",IR3_scn2674_vert_front_porch));
581            LOGSTUFF(("IR3 - Vertical Back Porch %02x\n",IR3_scn2674_vert_back_porch));
582         break;
583
584      case 4:
585            IR4_scn2674_rows_per_screen = data&0x7f;
586         IR4_scn2674_character_blink_rate = (data & 0x80)>>7;
587
588            LOGSTUFF(("IR4 - Rows Per Screen %02x\n",IR4_scn2674_rows_per_screen));
589            LOGSTUFF(("IR4 - Character Blink Rate %02x\n",IR4_scn2674_character_blink_rate));
590         break;
591
592      case 5:
593         /* IR5 - Active Characters Per Row
594             cccc cccc
595             c = Characters Per Row */
596            IR5_scn2674_character_per_row = data;
597            LOGSTUFF(("IR5 - Active Characters Per Row %02x\n",IR5_scn2674_character_per_row));
598         break;
599
600      case 6:
601         break;
602
603      case 7:
604         break;
605
606      case 8:
607         IR8_scn2674_display_buffer_first_address_LSB = data;
608            LOGSTUFF(("IR8 - Display Buffer First Address LSB %02x\n",IR8_scn2674_display_buffer_first_address_LSB));
609         break;
610
611      case 9:
612         IR9_scn2674_display_buffer_first_address_MSB = data & 0x0f;
613         IR9_scn2674_display_buffer_last_address = (data & 0xf0)>>4;
614            LOGSTUFF(("IR9 - Display Buffer First Address MSB %02x\n",IR9_scn2674_display_buffer_first_address_MSB));
615            LOGSTUFF(("IR9 - Display Buffer Last Address %02x\n",IR9_scn2674_display_buffer_last_address));
616         break;
617
618      case 10:
619         IR10_scn2674_display_pointer_address_lower = data;
620            LOGSTUFF(("IR10 - Display Pointer Address Lower %02x\n",IR10_scn2674_display_pointer_address_lower));
621         break;
622
623      case 11:
624         IR11_scn2674_display_pointer_address_upper= data&0x3f;
625            LOGSTUFF(("IR11 - Display Pointer Address Lower %02x\n",IR11_scn2674_display_pointer_address_upper));
626         break;
627
628      case 12:
629         IR12_scn2674_scroll_start = (data & 0x80)>>7;
630         IR12_scn2674_split_register_1 = (data & 0x7f);
631            LOGSTUFF(("IR12 - Scroll Start %02x\n",IR12_scn2674_scroll_start));
632            LOGSTUFF(("IR12 - Split Register 1 %02x\n",IR12_scn2674_split_register_1));
633         break;
634
635      case 13:
636         IR13_scn2674_scroll_end = (data & 0x80)>>7;
637         IR13_scn2674_split_register_2 = (data & 0x7f);
638            LOGSTUFF(("IR13 - Scroll End %02x\n",IR13_scn2674_scroll_end));
639            LOGSTUFF(("IR13 - Split Register 2 %02x\n",IR13_scn2674_split_register_2));
640         break;
641
642      case 14:
643         break;
644
645      case 15: // not valid!
646         break;
647
648
649   }
650
651   scn2675_IR_pointer++;
652   if (scn2675_IR_pointer>14)scn2675_IR_pointer=14;
653}
654
655static UINT8 scn2674_irq_register = 0;
656static UINT8 scn2674_status_register = 0;
657static UINT8 scn2674_irq_mask = 0;
658static UINT8 scn2674_gfx_enabled;
659static UINT8 scn2674_display_enabled;
660static UINT8 scn2674_cursor_enabled;
661
662static void scn2674_write_command(UINT8 data)
663{
664   UINT8 oprand;
665   int i;
666
667   LOGSTUFF(("scn2674_write_command %02x\n",data));
668
669   if (data==0x00)
670   {
671      // master reset
672      LOGSTUFF(("master reset %02x\n",data));
673   }
674
675   if ((data&0xf0)==0x10)
676   {
677      // set IR pointer
678      LOGSTUFF(("set IR pointer %02x\n",data));
679
680      oprand = data & 0x0f;
681      scn2675_IR_pointer=oprand;
682
683   }
684
685   /*** ANY COMBINATION OF THESE ARE POSSIBLE */
686
687   if ((data&0xe3)==0x22)
688   {
689      // Disable GFX
690      LOGSTUFF(("disable GFX %02x\n",data));
691      scn2674_gfx_enabled = 0;
692   }
693
694   if ((data&0xe3)==0x23)
695   {
696      // Enable GFX
697      LOGSTUFF(("enable GFX %02x\n",data));
698      scn2674_gfx_enabled = 1;
699   }
700
701   if ((data&0xe9)==0x28)
702   {
703      // Display off
704      oprand = data & 0x04;
705
706      scn2674_display_enabled = 0;
707
708      if (oprand)
709         LOGSTUFF(("display OFF - float DADD bus %02x\n",data));
710      else
711         LOGSTUFF(("display OFF - no float DADD bus %02x\n",data));
712   }
713
714   if ((data&0xe9)==0x29)
715   {
716      // Display on
717      oprand = data & 0x04;
718
719      scn2674_display_enabled = 1;
720
721      if (oprand)
722         LOGSTUFF(("display ON - next field %02x\n",data));
723      else
724         LOGSTUFF(("display ON - next scanline %02x\n",data));
725
726   }
727
728   if ((data&0xf1)==0x30)
729   {
730      // Cursor Off
731      LOGSTUFF(("cursor off %02x\n",data));
732      scn2674_cursor_enabled = 0;
733   }
734
735   if ((data&0xf1)==0x31)
736   {
737      // Cursor On
738      LOGSTUFF(("cursor on %02x\n",data));
739      scn2674_cursor_enabled = 1;
740   }
741
742   /*** END ***/
743
744   if ((data&0xe0)==0x40)
745   {
746      // Reset Interrupt / Status bit
747      oprand = data & 0x1f;
748      LOGSTUFF(("reset interrupt / status bit %02x\n",data));
749
750      LOGSTUFF(("Split 2   IRQ: %d Reset\n",(data>>0)&1));
751      LOGSTUFF(("Ready     IRQ: %d Reset\n",(data>>1)&1));
752      LOGSTUFF(("Split 1   IRQ: %d Reset\n",(data>>2)&1));
753      LOGSTUFF(("Line Zero IRQ: %d Reset\n",(data>>3)&1));
754      LOGSTUFF(("V-Blank   IRQ: %d Reset\n",(data>>4)&1));
755
756      scn2674_irq_register &= ((data & 0x1f)^0x1f);
757      scn2674_status_register &= ((data & 0x1f)^0x1f);
758
759      scn2674_irq_state = 0;
760      if (scn2674_irq_register)
761      {
762         scn2674_irq_state = 1;
763      }
764      update_mpu68_interrupts();
765   }
766   if ((data&0xe0)==0x80)
767   {
768      // Disable Interrupt
769      oprand = data & 0x1f;
770      LOGSTUFF(("disable interrupt %02x\n",data));
771      LOGSTUFF(("Split 2   IRQ: %d Disabled\n",(data>>0)&1));
772      LOGSTUFF(("Ready     IRQ: %d Disabled\n",(data>>1)&1));
773      LOGSTUFF(("Split 1   IRQ: %d Disabled\n",(data>>2)&1));
774      LOGSTUFF(("Line Zero IRQ: %d Disabled\n",(data>>3)&1));
775      LOGSTUFF(("V-Blank   IRQ: %d Disabled\n",(data>>4)&1));
776
777//      scn2674_irq_mask &= ((data & 0x1f)^0x1f); // disables.. doesn't enable?
778
779      scn2674_irq_mask &= ~(data & 0x1f);
780//New code
781      scn2674_irq_state = 0;
782
783      for (i=0; i<5; i++)
784      {
785         if ((scn2674_irq_register>>i&1)&(scn2674_irq_mask>>i&1))
786         {
787            scn2674_irq_state = 1;
788         }
789      }
790      update_mpu68_interrupts();
791// end new code
792   }
793
794   if ((data&0xe0)==0x60)
795   {
796      // Enable Interrupt
797      LOGSTUFF(("enable interrupt %02x\n",data));
798      LOGSTUFF(("Split 2   IRQ: %d Enabled\n",(data>>0)&1));
799      LOGSTUFF(("Ready     IRQ: %d Enabled\n",(data>>1)&1));
800      LOGSTUFF(("Split 1   IRQ: %d Enabled\n",(data>>2)&1));
801      LOGSTUFF(("Line Zero IRQ: %d Enabled\n",(data>>3)&1));
802      LOGSTUFF(("V-Blank   IRQ: %d Enabled\n",(data>>4)&1));
803
804      scn2674_irq_mask |= (data & 0x1f);  // enables .. doesn't disable?
805
806//New code
807      scn2674_irq_state = 0;
808
809      for (i=0; i<5; i++)
810      {
811         if ((scn2674_irq_register>>i&1)&(scn2674_irq_mask>>i&1))
812         {
813            scn2674_irq_state = 1;
814         }
815      }
816      update_mpu68_interrupts();
817// end new code
818   }
819
820   /**** Delayed Commands ****/
821
822   if (data == 0xa4)
823   {
824      // read at pointer address
825      LOGSTUFF(("read at pointer address %02x\n",data));
826   }
827
828   if (data == 0xa2)
829   {
830      // write at pointer address
831      LOGSTUFF(("write at pointer address %02x\n",data));
832   }
833
834   if (data == 0xa9)
835   {
836      // increase cursor address
837      LOGSTUFF(("increase cursor address %02x\n",data));
838   }
839
840   if (data == 0xac)
841   {
842      // read at cursor address
843      LOGSTUFF(("read at cursor address %02x\n",data));
844   }
845
846   if (data == 0xaa)
847   {
848      // write at cursor address
849      LOGSTUFF(("write at cursor address %02x\n",data));
850   }
851
852   if (data == 0xad)
853   {
854      // read at cursor address + increment
855      LOGSTUFF(("read at cursor address+increment %02x\n",data));
856   }
857
858   if (data == 0xab)
859   {
860      // write at cursor address + increment
861      LOGSTUFF(("write at cursor address+increment %02x\n",data));
862   }
863
864   if (data == 0xbb)
865   {
866      // write from cursor address to pointer address
867      LOGSTUFF(("write from cursor address to pointer address %02x\n",data));
868   }
869
870   if (data == 0xbd)
871   {
872      // read from cursor address to pointer address
873      LOGSTUFF(("read from cursor address to pointer address %02x\n",data));
874   }
875
876}
877
878READ16_HANDLER( mpu4_vid_scn2674_r )
879{
880   /*
881    Offset:  Purpose
882     0       Interrupt Register
883     1       Status Register
884     2       Screen Start 1 Lower Register
885     3       Screen Start 1 Upper Register
886     4       Cursor Address Lower Register
887     5       Cursor Address Upper Register
888     6       Screen Start 2 Lower Register
889     7       Screen Start 2 Upper Register
890    */
891
892   switch (offset)
893   {
894
895      /*  Status / Irq Register
896
897            --RV ZSRs
898
899            -- = ALWAYS 0
900            R  = RDFLG (Status Register Only)
901            V  = Vblank
902            Z  = Line Zero
903            S  = Split 1
904            R  = Ready
905            s  = Split 2
906        */
907      case 0:
908         LOGSTUFF(("Read Irq Register %06x\n",activecpu_get_pc()));
909         return scn2674_irq_register;
910
911      case 1:
912         LOGSTUFF(("Read Status Register %06x\n",activecpu_get_pc()));
913         return scn2674_status_register;
914
915      case 2: LOGSTUFF(("Read Screen1_l Register %06x\n",activecpu_get_pc()));return scn2674_screen1_l;
916      case 3: LOGSTUFF(("Read Screen1_h Register %06x\n",activecpu_get_pc()));return scn2674_screen1_h;
917      case 4: LOGSTUFF(("Read Cursor_l Register %06x\n",activecpu_get_pc()));return scn2674_cursor_l;
918      case 5: LOGSTUFF(("Read Cursor_h Register %06x\n",activecpu_get_pc()));return scn2674_cursor_h;
919      case 6:   LOGSTUFF(("Read Screen2_l Register %06x\n",activecpu_get_pc()));return scn2674_screen2_l;
920      case 7: LOGSTUFF(("Read Screen2_h Register %06x\n",activecpu_get_pc()));return scn2674_screen2_h;
921   }
922
923   return 0xffff;
924}
925
926WRITE16_HANDLER( mpu4_vid_scn2674_w )
927{
928   /*
929    Offset:  Purpose
930     0       Initialization Registers
931     1       Command Register
932     2       Screen Start 1 Lower Register
933     3       Screen Start 1 Upper Register
934     4       Cursor Address Lower Register
935     5       Cursor Address Upper Register
936     6       Screen Start 2 Lower Register
937     7       Screen Start 2 Upper Register
938    */
939
940   data &=0x00ff; // it's an 8-bit chip on a 16-bit board, feel the cheapness.
941
942   switch (offset)
943   {
944      case 0:
945         scn2674_write_init_regs(data);
946         break;
947
948      case 1:
949         scn2674_write_command(data);
950         break;
951
952      case 2: scn2674_screen1_l = data; break;
953      case 3: scn2674_screen1_h = data; break;
954      case 4: scn2674_cursor_l  = data; break;
955      case 5: scn2674_cursor_h  = data; break;
956      case 6:   scn2674_screen2_l = data; break;
957      case 7: scn2674_screen2_h = data; break;
958   }
959}
960
961VIDEO_START( mpu4_vid )
962{
963   /* if anything uses tile sizes other than 8x8 we can't really do it this way.. we'll have to draw tiles by hand.
964      maybe we will anyway, but for now we don't need to */
965
966   mpu4_vid_vidram = auto_malloc (0x20000);
967   mpu4_vid_vidram_is_dirty = auto_malloc(0x1000);
968
969   memset(mpu4_vid_vidram_is_dirty,1,0x1000);
970   memset(mpu4_vid_vidram,0,0x20000);
971
972    /* find first empty slot to decode gfx */
973   for (mpu4_gfx_index = 0; mpu4_gfx_index < MAX_GFX_ELEMENTS; mpu4_gfx_index++)
974      if (machine->gfx[mpu4_gfx_index] == 0)
975         break;
976
977   assert(mpu4_gfx_index != MAX_GFX_ELEMENTS);
978
979   /* create the char set (gfx will then be updated dynamically from RAM) */
980   machine->gfx[mpu4_gfx_index+0] = allocgfx(&mpu4_vid_char_8x8_layout);
981   machine->gfx[mpu4_gfx_index+1] = allocgfx(&mpu4_vid_char_8x16_layout);
982   machine->gfx[mpu4_gfx_index+2] = allocgfx(&mpu4_vid_char_16x8_layout);
983   machine->gfx[mpu4_gfx_index+3] = allocgfx(&mpu4_vid_char_16x16_layout);
984
985   /* set the color information */
986   machine->gfx[mpu4_gfx_index+0]->total_colors = machine->drv->total_colors / 16;
987   machine->gfx[mpu4_gfx_index+1]->total_colors = machine->drv->total_colors / 16;
988   machine->gfx[mpu4_gfx_index+2]->total_colors = machine->drv->total_colors / 16;
989   machine->gfx[mpu4_gfx_index+3]->total_colors = machine->drv->total_colors / 16;
990
991   scn2675_IR_pointer = 0;
992}
993
994/* palette support is very preliminary */
995static UINT8 ef9369_palette[32];
996static UINT8 ef9369_counter;
997
998static WRITE16_HANDLER( ef9369_data_w )
999{
1000   int color;
1001   UINT16 coldat;
1002
1003   data &=0x00ff;
1004
1005   ef9369_palette[ef9369_counter] = data;
1006
1007   color = ef9369_counter/2;
1008   coldat = (ef9369_palette[color*2+1]<<8)|ef9369_palette[color*2];
1009   palette_set_color_rgb(Machine,color,pal4bit(coldat >> 0),pal4bit(coldat >> 8),pal4bit(coldat >> 4));
1010
1011   ef9369_counter++;
1012   if (ef9369_counter>31) ef9369_counter = 31;
1013}
1014
1015static WRITE16_HANDLER( ef9369_address_w )
1016{
1017   data &=0x00ff;
1018
1019   ef9369_counter = data*2; // = 0?
1020
1021   if (ef9369_counter>30) ef9369_counter = 30;
1022}
1023
1024static INPUT_PORTS_START( crmaze )
1025   PORT_START_TAG("ORANGE1")
1026   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("00")
1027   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("01")
1028   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("02")
1029   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("03")
1030   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("04")
1031   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("05")
1032   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("06")
1033   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("07")
1034
1035   PORT_START_TAG("ORANGE2")
1036   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("08")
1037   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("09")
1038   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10")
1039   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("11")
1040   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("12")
1041   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("13")
1042   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("14")
1043   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("200p?")
1044
1045   PORT_START_TAG("BLACK1")
1046   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("16")
1047   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("17")
1048   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("18")
1049   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("19")
1050   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("20")
1051   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Switch")
1052   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
1053   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Door Switch?") PORT_TOGGLE
1054
1055   PORT_START_TAG("BLACK2")
1056   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Yellow")
1057   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Red")
1058   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("26")
1059   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Yellow")
1060   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Red")
1061   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Getout Yellow")
1062   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Getout Red")//Labelled Escape on cabinet
1063   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("100p Service?")PORT_IMPULSE(100)
1064
1065   PORT_START_TAG("DIL1")
1066   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
1067   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1068   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1069   PORT_DIPNAME( 0x02, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
1070   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1071   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1072   PORT_DIPNAME( 0x04, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
1073   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1074   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1075   PORT_DIPNAME( 0x08, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
1076   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1077   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1078   PORT_DIPNAME( 0x10, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
1079   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1080   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1081   PORT_DIPNAME( 0x20, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
1082   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1083   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1084   PORT_DIPNAME( 0x40, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
1085   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1086   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1087   PORT_DIPNAME( 0x80, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
1088   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1089   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1090
1091   PORT_START_TAG("DIL2")
1092   PORT_DIPNAME( 0x01, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
1093   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1094   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1095   PORT_DIPNAME( 0x02, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
1096   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1097   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1098   PORT_DIPNAME( 0x04, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
1099   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1100   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1101   PORT_DIPNAME( 0x08, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
1102   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1103   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1104   PORT_DIPNAME( 0x10, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
1105   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1106   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1107   PORT_DIPNAME( 0x20, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
1108   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1109   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1110   PORT_DIPNAME( 0x40, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
1111   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1112   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1113   PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
1114   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1115   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1116
1117   PORT_START_TAG("AUX1")//Presumed to be trackball, but only one phase available?
1118   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0")
1119   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1")
1120   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2")
1121   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3")
1122   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4")
1123   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5")
1124   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6")
1125   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7")
1126
1127   PORT_START_TAG("AUX2")
1128   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
1129   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
1130   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
1131   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
1132   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
1133   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
1134   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
1135   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
1136
1137INPUT_PORTS_END
1138
1139static INPUT_PORTS_START( dealem )
1140   PORT_START_TAG("ORANGE1")
1141   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Gamble")
1142   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Pontoon")
1143   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1144   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1145   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1146   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1147   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1148   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Rear Door") PORT_TOGGLE
1149
1150   PORT_START_TAG("ORANGE2")
1151   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN5) PORT_NAME("20p Token")PORT_IMPULSE(3)
1152   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1153   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1154   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1155   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1156   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1157   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1158   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1159
1160   PORT_START_TAG("BLACK1")
1161   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Collect")
1162   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) //Duplicate for Pontoon button
1163   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1164   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1165   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1166   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W)
1167   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
1168   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
1169
1170   PORT_START_TAG("BLACK2")
1171   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Hi-Lo")
1172   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1173   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Twist")
1174   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Lo")
1175   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Hi")
1176   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Stick")
1177   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1178   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Deal")
1179
1180   PORT_START_TAG("DIL1")
1181   PORT_DIPNAME( 0x0f, 0x00, "Cabinet Set Up Mode" ) PORT_DIPLOCATION("DIL1:01,02,03,04")
1182   PORT_DIPSETTING(    0x00, "Stop The Clock" )
1183   PORT_DIPSETTING(    0x01, "Hit the Top" )
1184   PORT_DIPSETTING(    0x02, "Way In" )
1185   PORT_DIPSETTING(    0x03, "Smash and Grab" )
1186   PORT_DIPSETTING(    0x04, "Ready Steady Go-1" )
1187   PORT_DIPSETTING(    0x05, "Ready Steady Go-2" )
1188   PORT_DIPSETTING(    0x06, "Top Gears-1" )
1189   PORT_DIPSETTING(    0x07, "Top Gears-2" )
1190   PORT_DIPSETTING(    0x08, "Nifty Fifty" )
1191   PORT_DIPSETTING(    0x09, "Super Tubes" )
1192   PORT_DIPNAME( 0x70, 0x00, "Target Payout Percentage" ) PORT_DIPLOCATION("DIL1:05,06,07")
1193   PORT_DIPSETTING(    0x00, "72%" )
1194   PORT_DIPSETTING(    0x10, "74%" )
1195   PORT_DIPSETTING(    0x20, "76%" )
1196   PORT_DIPSETTING(    0x30, "78%" )
1197   PORT_DIPSETTING(    0x40, "80%" )
1198   PORT_DIPSETTING(    0x50, "82%" )
1199   PORT_DIPSETTING(    0x60, "84%" )
1200   PORT_DIPSETTING(    0x70, "86%" )
1201   PORT_DIPNAME( 0x80, 0x00, "Display Switch Settings on Monitor" ) PORT_DIPLOCATION("DIL1:08")
1202   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1203   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1204
1205   PORT_START_TAG("DIL2")
1206   PORT_DIPNAME( 0x01, 0x00, "Payout Limit" ) PORT_DIPLOCATION("DIL2:01")
1207   PORT_DIPSETTING(    0x00, "200p (All Cash)")
1208   PORT_DIPSETTING(    0x01, "200p (Cash)+400p (Token)")
1209   PORT_DIPNAME( 0x02, 0x00, "10p Payout Priority" ) PORT_DIPLOCATION("DIL2:02")
1210   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1211   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1212   PORT_DIPNAME( 0x04, 0x00, "Clear Credits and bank at power on?" ) PORT_DIPLOCATION("DIL2:03")
1213   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1214   PORT_DIPSETTING(    0x04, DEF_STR( Yes  ) )
1215   PORT_DIPNAME( 0x08, 0x00, "50p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:04")
1216   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1217   PORT_DIPSETTING(    0x08, DEF_STR( Yes  ) )
1218   PORT_DIPNAME( 0x10, 0x00, "100p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:05")
1219   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1220   PORT_DIPSETTING(    0x10, DEF_STR( Yes  ) )
1221   PORT_DIPNAME( 0x20, 0x00, "Coin alarms active?" ) PORT_DIPLOCATION("DIL2:06")
1222   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
1223   PORT_DIPSETTING(    0x00, DEF_STR( Yes  ) )
1224   PORT_DIPNAME( 0x40, 0x00, "Price of Play" ) PORT_DIPLOCATION("DIL2:07")
1225   PORT_DIPSETTING(    0x00, "10p 1 Game" )
1226   PORT_DIPSETTING(    0x40, "10p 2 Games" )
1227   PORT_DIPNAME( 0x80, 0x00, "Coin Entry" ) PORT_DIPLOCATION("DIL2:08")
1228   PORT_DIPSETTING(    0x00, "Multi" )
1229   PORT_DIPSETTING(    0x80, DEF_STR(Single))
1230
1231   PORT_START_TAG("AUX1")
1232   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1233   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1234   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1235   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1236   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1237   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1238   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1239   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1240
1241   PORT_START_TAG("AUX2")
1242   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
1243   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
1244   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
1245   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
1246   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
1247   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
1248   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
1249   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
1250
1251INPUT_PORTS_END
1252
1253INTERRUPT_GEN(mpu4_vid_irq)
1254{
1255   LOGSTUFF(("scn2674_irq_mask %02x\n",scn2674_irq_mask));
1256   if (cpu_getiloops()==0) // vbl
1257   {
1258   //  if (scn2674_display_enabled) // ?
1259      {
1260         if (scn2674_irq_mask&0x10)
1261         {
1262            LOGSTUFF(("vblank irq\n"));
1263            scn2674_irq_state = 1;
1264            update_mpu68_interrupts();
1265
1266            scn2674_irq_register |= 0x10;
1267         }
1268      }
1269      scn2674_status_register |= 0x10;
1270   }
1271}
1272
1273// machine start (called only once) /////////////////////////////////////
1274
1275MACHINE_START( mpu4_vid )
1276{
1277   mpu4_config_common();
1278   pia_reset();
1279
1280   ptm6840_config(1, &ptm_vid_intf );
1281
1282// setup comms///////////////////////////////////////////////////////////
1283   serial_card_connected=1;
1284   acia6850_config(0, &m6809_acia_if);
1285   acia6850_config(1, &m68k_acia_if);
1286
1287// setup 8 mechanical meters ////////////////////////////////////////////
1288   Mechmtr_init(8);
1289
1290// setup 4 default 96 half step reels ///////////////////////////////////
1291
1292   Stepper_init(0, BARCREST_48STEP_REEL);
1293   Stepper_init(1, BARCREST_48STEP_REEL);
1294   Stepper_init(2, BARCREST_48STEP_REEL);
1295   Stepper_init(3, BARCREST_48STEP_REEL);
1296
1297// setup the standard oki MSC1937 display ///////////////////////////////
1298
1299   ROC10937_init(0, MSC1937,0);   // ?
1300}
1301
1302/*
1303Characteriser (CHR)
1304Despite the potential to radically overhaul the design, the 68k version of the chip appears to just be a
130516-bit version of the previous design, with some endian-swapping necessary. It is unclear, however, if it has any
1306capacity to affect lamp matrices in the same way as before, as no software seen makes any request for the 'lamp' row.
1307It has been left in the table, as it clearly exists, but is unused.
1308The 'quiz' games on the board did use an address-scrambling PAL for encryption, and the very last mod of this board had
1309a  characteriser capable of scrambling the ROM address lines.
1310*/
1311static WRITE16_HANDLER( characteriser16_w )
1312{
1313   int x;
1314   int call=data;
1315   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", activecpu_get_previouspc(),offset,data));
1316   for ( x = prot_col; x < 64; x++ )
1317   {
1318      if (call == 0)
1319      {
1320         prot_col = 0;
1321      }
1322      else
1323      {
1324         if   (MPU4_chr_lut[(x)] == call)
1325         {
1326            prot_col = x;
1327            LOG_CHR(("Characteriser find column %02X\n",prot_col));
1328            break;
1329         }
1330      }
1331   }
1332}
1333
1334static READ16_HANDLER( characteriser16_r )
1335{
1336   LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", activecpu_get_previouspc(),offset,MPU4_chr_data[prot_col]));
1337   LOG_CHR(("Characteriser read offset %02X \n",offset));
1338   LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col]));
1339   return MPU4_chr_data[prot_col];
1340}
1341
1342static ADDRESS_MAP_START( mpu4_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
1343   AM_RANGE(0x000000, 0x7fffff) AM_ROM
1344
1345//  AM_RANGE(0x600000, 0x63ffff) AM_RAM? In expanded games (mating)
1346
1347   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) // mainram / char address ram?
1348
1349   /* what is here, the sound chip? Assume so */
1350   AM_RANGE(0x900000, 0x900001) AM_WRITE(saa1099_control_port_0_lsb_w)
1351   AM_RANGE(0x900002, 0x900003) AM_WRITE(saa1099_write_port_0_lsb_w)
1352
1353   /* the palette chip */
1354   AM_RANGE(0xa00000, 0xa00001) AM_WRITE(ef9369_data_w)
1355   AM_RANGE(0xa00002, 0xa00003) AM_WRITE(ef9369_address_w)
1356   AM_RANGE(0xa00004, 0xa0000f) //AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w)
1357
1358   AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
1359
1360   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
1361
1362   /* comms with the MPU4 */
1363    AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(acia6850_1_stat_lsb_r, acia6850_1_ctrl_lsb_w)
1364    AM_RANGE(0xff8002, 0xff8003) AM_READWRITE(acia6850_1_data_lsb_r, acia6850_1_data_lsb_w)
1365
1366   AM_RANGE(0xff9000, 0xff900f) AM_READ(  ptm6840_1_lsb_r)
1367   AM_RANGE(0xff9000, 0xff900f) AM_WRITE( ptm6840_1_lsb_w)
1368
1369   /* characterizer */
1370   AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) // Word-based version of old CHR???
1371ADDRESS_MAP_END
1372
1373/* TODO: Fix up MPU4 map*/
1374static ADDRESS_MAP_START( mpu4_6809_map, ADDRESS_SPACE_PROGRAM, 8 )
1375   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
1376
1377   AM_RANGE(0x0800, 0x0800) AM_READWRITE(acia6850_0_stat_r, acia6850_0_ctrl_w)
1378   AM_RANGE(0x0801, 0x0801) AM_READWRITE(acia6850_0_data_r, acia6850_0_data_w)
1379
1380   //AM_RANGE(0x0880, 0x0880) AM_READ(uart1stat_r)     // Could be a UART datalogger is here.
1381   //AM_RANGE(0x0880, 0x0880) AM_WRITE(uart1ctrl_w)    // Or a PIA?
1382   //AM_RANGE(0x0881, 0x0881) AM_READ(uart1data_r)
1383   //AM_RANGE(0x0881, 0x0881) AM_WRITE(uart1data_w)
1384   AM_RANGE(0x0880, 0x0881) AM_NOP
1385
1386   AM_RANGE(0x0900, 0x0907) AM_READ( ptm6840_0_r)     // 6840PTM IC2
1387   AM_RANGE(0x0900, 0x0907) AM_WRITE(ptm6840_0_w)
1388
1389   AM_RANGE(0x0A00, 0x0A03) AM_WRITE(pia_0_w)         // PIA6821 IC3
1390   AM_RANGE(0x0A00, 0x0A03) AM_READ( pia_0_r)
1391
1392   AM_RANGE(0x0B00, 0x0B03) AM_WRITE(pia_1_w)         // PIA6821 IC4
1393   AM_RANGE(0x0B00, 0x0B03) AM_READ( pia_1_r)
1394
1395   AM_RANGE(0x0C00, 0x0C03) AM_WRITE(pia_2_w)         // PIA6821 IC5
1396   AM_RANGE(0x0C00, 0x0C03) AM_READ( pia_2_r)
1397
1398   AM_RANGE(0x0D00, 0x0D03) AM_WRITE(pia_3_w)         // PIA6821 IC6
1399   AM_RANGE(0x0D00, 0x0D03) AM_READ( pia_3_r)
1400
1401   AM_RANGE(0x0E00, 0x0E03) AM_WRITE(pia_4_w)         // PIA6821 IC7
1402   AM_RANGE(0x0E00, 0x0E03) AM_READ( pia_4_r)
1403
1404   AM_RANGE(0x0F00, 0x0F03) AM_WRITE(pia_5_w)         // PIA6821 IC8
1405   AM_RANGE(0x0F00, 0x0F03) AM_READ( pia_5_r)
1406
1407   AM_RANGE(0x4000, 0x40ff) AM_RAM // it actually runs code from here...
1408
1409   AM_RANGE(0xBE00, 0xBFFF) AM_RAM //00 written on startup
1410   AM_RANGE(0xC000, 0xFFFF) AM_ROM   AM_REGION(REGION_CPU1,0)  // 64k EPROM on board, only this region read
1411ADDRESS_MAP_END
1412
1413static ADDRESS_MAP_START( vp_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
1414   AM_RANGE(0x000000, 0x7fffff) AM_ROM
1415
1416//  AM_RANGE(0x600000, 0x63ffff) AM_RAM? In expanded games (mating)
1417
1418   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) // mainram / char address ram?
1419
1420   AM_RANGE(0x810000, 0x81ffff) AM_RAM//? In expanded games (mating)
1421
1422   /* what is here, the sound chip? Assume so */
1423   AM_RANGE(0x900000, 0x900001) AM_WRITE(saa1099_control_port_0_lsb_w)
1424   AM_RANGE(0x900002, 0x900003) AM_WRITE(saa1099_write_port_0_lsb_w)
1425
1426   /* the palette chip */
1427   AM_RANGE(0xa00000, 0xa00001) AM_WRITE(ef9369_data_w)
1428   AM_RANGE(0xa00002, 0xa00003) AM_WRITE(ef9369_address_w)
1429   AM_RANGE(0xa00004, 0xa0000f) //AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w)
1430
1431   AM_RANGE(0xb00000, 0xb0000f) AM_READWRITE(mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
1432
1433   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w)
1434
1435//  AM_RANGE(0xe05000, 0xe05001) //AM_READWRITE(adpcm_r, adpcm_w)
1436
1437   /* comms with the MPU4 */
1438    AM_RANGE(0xff8000, 0xff8001) AM_READWRITE(acia6850_1_stat_lsb_r, acia6850_1_ctrl_lsb_w)
1439    AM_RANGE(0xff8002, 0xff8003) AM_READWRITE(acia6850_1_data_lsb_r, acia6850_1_data_lsb_w)
1440
1441   AM_RANGE(0xff9000, 0xff900f) AM_READ(  ptm6840_1_lsb_r)
1442   AM_RANGE(0xff9000, 0xff900f) AM_WRITE( ptm6840_1_lsb_w)
1443
1444   /* characterizer */
1445//  AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w) // Word-based version of old CHR???
1446ADDRESS_MAP_END
1447
1448//Deal 'Em was designed as an enhanced gamecard, to fit into an existing MPU4 cabinet
1449//It's an unoffical addon, and does all its work through the existing 6809 CPU
1450
1451static const gfx_layout dealemcharlayout =
1452{
1453   8,8,
1454   RGN_FRAC(1,1),
1455   4,
1456   { 0, 1, 2, 3 },
1457   { 3*4, 2*4, 1*4, 0*4, 7*4, 6*4, 5*4, 4*4  },
1458   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
1459   32*8
1460};
1461
1462static GFXDECODE_START( dealem )
1463   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, dealemcharlayout, 0, 32 )
1464GFXDECODE_END
1465
1466UINT8 *dealem_videoram,*dealem_charram;
1467
1468/***************************************************************************
1469
1470  Convert the color PROMs into a more useable format.
1471
1472  The palette PROM is connected to the RGB output this way:
1473
1474  Red:      1K      Bit 0
1475            470R
1476            220R
1477
1478  Green:    1K      Bit 3
1479            470R
1480            220R
1481
1482  Blue:     470R
1483            220R    Bit 7
1484
1485***************************************************************************/
1486
1487PALETTE_INIT( dealem )
1488{
1489   int i;
1490   for (i = 0;i < memory_region_length(REGION_PROMS);i++)
1491   {
1492      int bit0,bit1,bit2,r,g,b;
1493
1494      /* red component */
1495      bit0 = BIT(*color_prom,0);
1496      bit1 = BIT(*color_prom,1);
1497      bit2 = BIT(*color_prom,2);
1498      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
1499      /* green component */
1500      bit0 = BIT(*color_prom,3);
1501      bit1 = BIT(*color_prom,4);
1502      bit2 = BIT(*color_prom,5);
1503      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
1504      /* blue component */
1505      bit0 = 0;
1506      bit1 = BIT(*color_prom,6);
1507      bit2 = BIT(*color_prom,7);
1508      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
1509
1510      palette_set_color(machine,i,MAKE_RGB(r,g,b));
1511      color_prom++;
1512   }
1513
1514}
1515
1516VIDEO_START(dealem)
1517{
1518}
1519
1520VIDEO_UPDATE(dealem)
1521{
1522   int x,y;
1523   int count = 0;
1524
1525   for (y=0;y<32;y++)
1526   {
1527      for (x=0;x<40;x++)
1528      {
1529         int tile = dealem_videoram[count+0x1000] | (dealem_videoram[count] << 8);
1530         count++;
1531         drawgfx(bitmap,machine->gfx[0],tile,0,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0);
1532      }
1533   }
1534
1535   return 0;
1536}
1537
1538static ADDRESS_MAP_START( dealem_memmap, ADDRESS_SPACE_PROGRAM, 8 )
1539
1540   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
1541
1542   AM_RANGE(0x0800, 0x0800) AM_WRITE(crtc6845_address_w)
1543   AM_RANGE(0x0801, 0x0801) AM_READWRITE(crtc6845_register_r, crtc6845_register_w)
1544
1545//  AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select)
1546
1547//  AM_RANGE(0x08E0, 0x08E7) AM_READ( 68681_duart_r)
1548//  AM_RANGE(0x08E0, 0x08E7) AM_WRITE( 68681_duart_w)
1549
1550   AM_RANGE(0x0900, 0x0907) AM_READ( ptm6840_0_r)  // 6840PTM
1551   AM_RANGE(0x0900, 0x0907) AM_WRITE(ptm6840_0_w)
1552
1553   AM_RANGE(0x0A00, 0x0A03) AM_WRITE(pia_0_w)      // PIA6821 IC3
1554   AM_RANGE(0x0A00, 0x0A03) AM_READ( pia_0_r)
1555
1556   AM_RANGE(0x0B00, 0x0B03) AM_WRITE(pia_1_w)      // PIA6821 IC4
1557   AM_RANGE(0x0B00, 0x0B03) AM_READ( pia_1_r)
1558
1559   AM_RANGE(0x0C00, 0x0C03) AM_WRITE(pia_2_w)      // PIA6821 IC5
1560   AM_RANGE(0x0C00, 0x0C03) AM_READ( pia_2_r)
1561
1562   AM_RANGE(0x0D00, 0x0D03) AM_WRITE(pia_3_w)      // PIA6821 IC6
1563   AM_RANGE(0x0D00, 0x0D03) AM_READ( pia_3_r)
1564
1565   AM_RANGE(0x0E00, 0x0E03) AM_WRITE(pia_4_w)      // PIA6821 IC7
1566   AM_RANGE(0x0E00, 0x0E03) AM_READ( pia_4_r)
1567
1568   AM_RANGE(0x0F00, 0x0F03) AM_WRITE(pia_5_w)      // PIA6821 IC8
1569   AM_RANGE(0x0F00, 0x0F03) AM_READ( pia_5_r)
1570
1571   AM_RANGE(0x1000, 0x2fff) AM_RAM AM_BASE(&dealem_videoram)
1572   AM_RANGE(0x8000, 0xffff) AM_ROM   AM_WRITENOP// 64k  paged ROM (4 pages)
1573
1574ADDRESS_MAP_END
1575
1576static MACHINE_DRIVER_START( mpu4_vid )
1577
1578   MDRV_CPU_ADD_TAG("main", M6809, MPU4_MASTER_CLOCK/4 )
1579   MDRV_CPU_PROGRAM_MAP(mpu4_6809_map,0)
1580   MDRV_CPU_PERIODIC_INT(gen_50hz, 50 )
1581
1582   MDRV_CPU_ADD_TAG("video", M68000, VIDEO_MASTER_CLOCK )
1583   MDRV_CPU_PROGRAM_MAP(mpu4_68k_map,0)
1584   MDRV_CPU_VBLANK_INT(mpu4_vid_irq,1)
1585
1586   MDRV_NVRAM_HANDLER(generic_0fill)            // confirm
1587
1588   MDRV_INTERLEAVE(16)
1589   /* video hardware */
1590   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
1591   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1592   MDRV_SCREEN_SIZE(64*8, 64*8)
1593   MDRV_SCREEN_VISIBLE_AREA(0*8, 63*8-1, 0*8, 37*8-1)
1594   MDRV_SCREEN_REFRESH_RATE(50)
1595   MDRV_MACHINE_START(mpu4_vid)
1596   MDRV_MACHINE_RESET(mpu4_vid)
1597   MDRV_VIDEO_START (mpu4_vid)
1598   MDRV_VIDEO_UPDATE(mpu4_vid)
1599
1600   MDRV_PALETTE_LENGTH(16)
1601
1602   MDRV_SPEAKER_STANDARD_MONO("mono")
1603   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
1604   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1605
1606   MDRV_SPEAKER_STANDARD_STEREO("left", "right")// Present on all video cards
1607   MDRV_SOUND_ADD(SAA1099, 8000000)
1608   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.00)
1609   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.00)
1610
1611MACHINE_DRIVER_END
1612
1613static MACHINE_DRIVER_START( vgpoker )
1614
1615   MDRV_IMPORT_FROM( mpu4_vid )
1616   MDRV_CPU_MODIFY("video")
1617   MDRV_CPU_PROGRAM_MAP(vp_68k_map,0)
1618
1619MACHINE_DRIVER_END
1620
1621// machine driver for zenitone dealem board /////////////////////////////////
1622
1623static MACHINE_DRIVER_START( dealem )
1624
1625   MDRV_MACHINE_START(mpu4mod2)                     // main mpu4 board initialisation
1626   MDRV_MACHINE_RESET(mpu4_vid)
1627   MDRV_CPU_ADD_TAG("main", M6809, MPU4_MASTER_CLOCK/4)   // 6809 CPU
1628   MDRV_CPU_PROGRAM_MAP(dealem_memmap,0)               // setup read and write memorymap
1629
1630   MDRV_CPU_PERIODIC_INT(gen_50hz, 100)   // generate 50 hz signal
1631
1632   MDRV_SCREEN_REFRESH_RATE(56)//Measured accurately from the flip-flop
1633   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
1634   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
1635
1636   MDRV_SPEAKER_STANDARD_MONO("mono")
1637   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
1638   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1639
1640   MDRV_NVRAM_HANDLER(generic_0fill)               // load/save nv RAM
1641   /* video hardware */
1642   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
1643   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1644   MDRV_SCREEN_SIZE((54+1)*8, (32+1)*8)                  /* Taken from MC6845 init, registers 00 & 04. Normally programmed with (value-1) */
1645   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 31*8-1)    /* Taken from MC6845 init, registers 01 & 06 */
1646   MDRV_SCREEN_REFRESH_RATE(50)
1647   MDRV_VIDEO_START( dealem)
1648   MDRV_GFXDECODE(dealem)
1649   MDRV_VIDEO_UPDATE(dealem)
1650
1651   MDRV_PALETTE_LENGTH(32)
1652   MDRV_COLORTABLE_LENGTH(32)
1653   MDRV_PALETTE_INIT(dealem)
1654
1655MACHINE_DRIVER_END
1656
1657DRIVER_INIT (crmaze)
1658{
1659   int x;
1660   static const UINT8 chr_table[72]={0x00,0x84,0x94,0x3C,0xEC,0x5C,0xEC,0x50,
1661                              0x2C,0x68,0x60,0xAC,0x74,0x00,0xAC,0x58,
1662                             0xEC,0x7C,0xEC,0x58,0xE0,0x90,0x18,0xEC,
1663                             0x54,0x28,0x68,0x44,0x84,0xB4,0x10,0x20,
1664                             0x84,0xBC,0xE8,0x70,0x24,0x84,0xB8,0xE0,
1665                             0x94,0x14,0x2C,0x64,0x8C,0x50,0x28,0x4C,
1666                             0x6C,0x60,0xA0,0xBC,0xCC,0x78,0xE8,0x50,
1667                             0x20,0xAC,0x74,0x04,0xA4,0x94,0x3C,0x00,
1668                             0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
1669
1670   for (x=0; x < 72; x++)
1671   {
1672      MPU4_chr_data[(x)] = chr_table[(x)];
1673   }
1674}
1675
1676DRIVER_INIT (mating)
1677{
1678   int x;
1679   static const UINT8 chr_table[72]={0x00,0x18,0xC8,0xA4,0x0C,0x80,0x0C,0x90,
1680                             0x34,0x30,0x00,0x58,0xC8,0x84,0x4C,0xA0,
1681                             0x4C,0xC0,0x3C,0xC8,0xA4,0x4C,0x80,0x0C,
1682                             0x80,0x0C,0xE0,0x1C,0x88,0xA4,0x0C,0xA0,
1683                             0x0C,0x80,0x4C,0xA0,0x3C,0x98,0xEC,0x84,
1684                             0x0C,0xC0,0x1C,0xA8,0x84,0x0C,0xA0,0x5C,
1685                             0xE8,0xA4,0x0C,0xD0,0x04,0x38,0xA8,0xC4,
1686                             0x2C,0x90,0x44,0x18,0xE8,0x84,0x3C,0x00,
1687                             0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
1688
1689   for (x=0; x < 72; x++)
1690   {
1691      MPU4_chr_data[(x)] = chr_table[(x)];
1692   }
1693}
1694
1695ROM_START( dealem )
1696   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
1697   ROM_LOAD( "zenndlem.u6",   0x8000, 0x8000,  CRC(571e5c05) SHA1(89b4c331407a04eae34bb187b036791e0a671533) )
1698
1699   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
1700   ROM_LOAD( "zenndlem.u24",   0x0000, 0x10000, CRC(3a1950c4) SHA1(7138346d4e8b3cffbd9751b4d7ebd367b9ad8da9) )    /* text layer */
1701
1702   ROM_REGION( 0x020, REGION_PROMS, 0 )
1703   ROM_LOAD( "zenndlem.u22",   0x000, 0x020, CRC(29988304) SHA1(42f61b8f9e1ee96b65db3b70833eb2f6e7a6ae0a) )
1704
1705   ROM_REGION( 0x200, REGION_PLDS, 0 )
1706   ROM_LOAD( "zenndlem.u10",   0x000, 0x104, CRC(e3103c05) SHA1(91b7be75c5fb37025039ab54b484e46a033969b5) )
1707ROM_END
1708
1709/*
1710   Barcrest released two different games called "The Crystal Maze".
1711   One is a non-video AWP, and uses only the MPU4 card, and the other SWP is the one we're interested in running
1712   Some of the dumps available seem to confuse the two, due to an early database not distinguishing
1713   between MPU4 and MPU4Video, as the latter had not been emulated at all at that stage. */
1714
1715#define VID_BIOS \
1716   ROM_LOAD("vid.p1",  0x00000, 0x10000,  CRC(e996bc18) SHA1(49798165640627eb31024319353da04380787b10))
1717
1718ROM_START( bctvidbs )
1719   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1720   VID_BIOS
1721ROM_END
1722
1723ROM_START( crmaze ) // this set runs in MFME, so should be OK */
1724   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1725   VID_BIOS
1726
1727   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1728   ROM_LOAD16_BYTE( "cm3.p1",  0x000000, 0x80000,  CRC(2d2edee5) SHA1(0281ec97aaaaf4c7969340bd5995ac1541dbad54) )
1729   ROM_LOAD16_BYTE( "cm3.p2",  0x000001, 0x80000,  CRC(c223d7b9) SHA1(da9d730716a30d0e93f2a02c1efa7f19457ae010) )
1730   ROM_LOAD16_BYTE( "cm3.p3",  0x100000, 0x80000,  CRC(2959c77b) SHA1(8de533bfad48ad19a635dddcafa2a0825133b4de) )
1731   ROM_LOAD16_BYTE( "cm3.p4",  0x100001, 0x80000,  CRC(b7873e9a) SHA1(a71fac883e02d5f49aee0a20f92dbdb00640ce8d) )
1732   ROM_LOAD16_BYTE( "cm3.p5",  0x200000, 0x80000,  CRC(c8375070) SHA1(da2ba6591d8765f896c40d6526da8e945d02a182) )
1733   ROM_LOAD16_BYTE( "cm3.p6",  0x200001, 0x80000,  CRC(1ea36938) SHA1(43f62935b21232d23f662e1e124663267edb1283) )
1734   ROM_LOAD16_BYTE( "cm3.p7",  0x300000, 0x80000,  CRC(9de3802e) SHA1(ec792f115a0708d68046ba0beb314b7e1f1eb422) )
1735   ROM_LOAD16_BYTE( "cm3.p8",  0x300001, 0x80000,  CRC(1e6e60b0) SHA1(5e71714747073dd89852a84585642388ee440325) )
1736   ROM_LOAD16_BYTE( "cm3.p9",  0x400000, 0x80000,  CRC(bfba55a7) SHA1(22eb9b1f9fe83d3b424fd521b68e2976a1940df9) )
1737   ROM_LOAD16_BYTE( "cm3.pa",  0x400001, 0x80000,  CRC(07edda81) SHA1(e94525be03f30e407051992925bb0d693f3d809b) )
1738ROM_END
1739
1740ROM_START( crmazea )
1741   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1742   VID_BIOS
1743
1744   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1745   ROM_LOAD16_BYTE( "am1z.p1",  0x000000, 0x80000,  CRC(d2fdda6d) SHA1(96c27dedc3cf1dd478e6169200844d418a276f14) )
1746   ROM_LOAD16_BYTE( "am1z.p2",  0x000001, 0x80000,  CRC(1637170f) SHA1(fd17a0e7794f01bf4ad7a16b185f87cb060c70ab) )
1747   ROM_LOAD16_BYTE( "am1g.p1",  0x100000, 0x80000,  CRC(e8cf8203) SHA1(e9f42e5c18b97807f51284ad2416346578ed73c4) )
1748   ROM_LOAD16_BYTE( "am1g.p2",  0x100001, 0x80000,  CRC(7b036151) SHA1(7b0040c296059b1e1798ddedf0ecb4582d67ee70) )
1749   ROM_LOAD16_BYTE( "am1g.p3",  0x200000, 0x80000,  CRC(48f17b20) SHA1(711c46fcfd86ded8ff7da883188d70560d20e42f) )
1750   ROM_LOAD16_BYTE( "am1g.p4",  0x200001, 0x80000,  CRC(2b3d9a97) SHA1(7468fffd90d840d245a70475b42308f1e48c5017) )
1751   ROM_LOAD16_BYTE( "am1g.p5",  0x300000, 0x80000,  CRC(68286bb1) SHA1(c307e3ad1e0fd92314216c8e554aafa949559452) )
1752   ROM_LOAD16_BYTE( "am1g.p6",  0x300001, 0x80000,  CRC(a6b498ad) SHA1(117e1a4ec7e2d3c7d530c5a56cbc1d24b0ddc747) )
1753   ROM_LOAD16_BYTE( "am1g.p7",  0x400000, 0x80000,  CRC(15882699) SHA1(b29a331e51a37554323b91330a7c2b62b33a943a) )
1754   ROM_LOAD16_BYTE( "am1g.p8",  0x400001, 0x80000,  CRC(6f0f855b) SHA1(ab411d1af0f88049a6c435bafd4b1fa63f5519b1) )
1755ROM_END
1756
1757ROM_START( crmazeb )
1758   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1759   VID_BIOS
1760
1761   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1762   ROM_LOAD16_BYTE( "am2z.p1",  0x000000, 0x80000,  CRC(f27e02f0) SHA1(8637904c201ece4f08ad63b4fd6d06a860fa762f) )
1763   ROM_LOAD16_BYTE( "am2z.p2",  0x000001, 0x80000,  CRC(4d24f482) SHA1(9e3687db9d0233e56999017f3ed59ec543bce303) )
1764   ROM_LOAD16_BYTE( "am2g.p1",  0x100000, 0x80000,  CRC(115402db) SHA1(250f2eded1b88a1abf82febb009eadbb90936f8a) )
1765   ROM_LOAD16_BYTE( "am2g.p2",  0x100001, 0x80000,  CRC(5d804fbb) SHA1(8dc02eb9329f9c29d4bcc9a0315ae96085625d3e) )
1766   ROM_LOAD16_BYTE( "am2g.p3",  0x200000, 0x80000,  CRC(5ead0c06) SHA1(35d9aefc60e2c391e32f8119a6dc44434d91c09e) )
1767   ROM_LOAD16_BYTE( "am2g.p4",  0x200001, 0x80000,  CRC(de4fb542) SHA1(4bf8f8f6850fd819d91827d3c474bd488e61e5ac) )
1768   ROM_LOAD16_BYTE( "am2g.p5",  0x300000, 0x80000,  CRC(80b01ce2) SHA1(4a3a4bcff4bd9affd1a5eeca5781b6af05bbcc16) )
1769   ROM_LOAD16_BYTE( "am2g.p6",  0x300001, 0x80000,  CRC(3e134ecc) SHA1(1f8cdce62e693eb07c4620b64cc467339c0563de) )
1770   ROM_LOAD16_BYTE( "am2g.p7",  0x400000, 0x80000,  CRC(6eb36f1d) SHA1(08b9ec184d64bdbdfa61d3e991a3647e74a7756f) )
1771   ROM_LOAD16_BYTE( "am2g.p8",  0x400001, 0x80000,  CRC(dda353ef) SHA1(56a5b43f0b0bd9dbf348946a5758ebe63eadb8cf) )
1772ROM_END
1773
1774ROM_START( turnover )
1775   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1776   VID_BIOS
1777
1778   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1779   ROM_LOAD16_BYTE( "tos.p1",  0x000000, 0x010000,  CRC(4044dbeb) SHA1(3aa553055c56f14564b1e33e1c1975337e639f70) )
1780   ROM_LOAD16_BYTE( "to.p2",   0x000001, 0x010000,  CRC(4bc4659a) SHA1(0e282134c4fe4e8c1cc7b16957903179e23c7abc) )
1781   ROM_LOAD16_BYTE( "to.p3",   0x020000, 0x010000,  CRC(273c7c14) SHA1(71feb555a05a0ff1ec674505cab72d93c9fbdf65) )
1782   ROM_LOAD16_BYTE( "to.p4",   0x020001, 0x010000,  CRC(83d29546) SHA1(cef90455b9d8a92424fe1aa10f20fd075d0e3091) )
1783   ROM_LOAD16_BYTE( "to.p5",   0x040000, 0x010000,  CRC(dceac511) SHA1(7a6d65464e23d832943f771c4cf580aabc6f0e44) )
1784   ROM_LOAD16_BYTE( "to.p6",   0x040001, 0x010000,  CRC(54c6afb7) SHA1(b724b87b6f4e47d220310b38c97be2fa73dcd617) )
1785   ROM_LOAD16_BYTE( "to.p7",   0x060000, 0x010000,  CRC(acf19542) SHA1(ad46ffb3c2c078a8e3712eff27aa61f0d1a7c059) )
1786   ROM_LOAD16_BYTE( "to.p8",   0x060001, 0x010000,  CRC(a5ca385d) SHA1(8df26a33ea7f5b577761c6f9d2fa4eaed74661f8) )
1787   ROM_LOAD16_BYTE( "to.p9",   0x080000, 0x010000,  CRC(6e85fde3) SHA1(14868d58829e13987e66f52e1899c4385987a87b) )
1788   ROM_LOAD16_BYTE( "to.p10",  0x080001, 0x010000,  CRC(fadd11a2) SHA1(2b2fbb0769ef6035688d495464f3ea3bc8c7c660) )
1789   ROM_LOAD16_BYTE( "to.p11",  0x0a0000, 0x010000,  CRC(2d72a61a) SHA1(ce455ab6fea452f96a3ad365178e0e5a0b437867) )
1790   ROM_LOAD16_BYTE( "to.p12",  0x0a0001, 0x010000,  CRC(a14eedb6) SHA1(219b887a334ff28a88ed2e50f0caff4b510cd549) )
1791   ROM_LOAD16_BYTE( "to.p13",  0x0c0000, 0x010000,  CRC(3f66ef6b) SHA1(60be6d3f8da1f3084db15ac1bb2470e55c0271de) )
1792   ROM_LOAD16_BYTE( "to.p14",  0x0c0001, 0x010000,  CRC(127ba65d) SHA1(e34dcd19efd31dc712daac940277bb17694ea61a) )
1793   ROM_LOAD16_BYTE( "to.p15",  0x0e0000, 0x010000,  CRC(ad787e31) SHA1(314ba312adfc71e4b3b2d52355ec692c192b74eb) )
1794   ROM_LOAD16_BYTE( "to.p16",  0x0e0001, 0x010000,  CRC(e635c942) SHA1(08f8b5fdb738647bc0b49938da05533be42a2d60) )
1795ROM_END
1796
1797ROM_START( skiltrek )
1798   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1799   VID_BIOS
1800
1801   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1802   ROM_LOAD16_BYTE( "st.p1",  0x000000, 0x010000,  CRC(d9de47a5) SHA1(625bf40780203293fc34cd8cea8278b4b4a52a75) )
1803   ROM_LOAD16_BYTE( "st.p2",  0x000001, 0x010000,  CRC(b62575c2) SHA1(06d75e8a364750663d329650720021279e195236) )
1804   ROM_LOAD16_BYTE( "st.p3",  0x020000, 0x010000,  CRC(9506da76) SHA1(6ef28ab8ec1af455be8ecfab20243f0823dca7c1) )
1805   ROM_LOAD16_BYTE( "st.p4",  0x020001, 0x010000,  CRC(6ab447bc) SHA1(d01c209dbf4d19a6a7f878fa54ff1cb51e7dcba5) )
1806   ROM_LOAD16_BYTE( "st.q1",  0x040000, 0x010000,  CRC(4faca475) SHA1(69b498c543600b8e37ab0ed1863ba57845648f3c) )
1807   ROM_LOAD16_BYTE( "st.q2",  0x040001, 0x010000,  CRC(9f2c5938) SHA1(85527c4c0b7a1e66576d56607d89750fab082580) )
1808   ROM_LOAD16_BYTE( "st.q3",  0x060000, 0x010000,  CRC(6b6cb194) SHA1(aeac5dcc0827c17e758e3e821ae8a78a3a16ddce) )
1809   ROM_LOAD16_BYTE( "st.q4",  0x060001, 0x010000,  CRC(ec57bc17) SHA1(d9f522739dbb190fb941ca654299bbedbb8fb703) )
1810   ROM_LOAD16_BYTE( "st.q5",  0x080000, 0x010000,  CRC(7740a88b) SHA1(d9a683d3e0d6c1b4b59520f90f825124b7a61168) )
1811   ROM_LOAD16_BYTE( "st.q6",  0x080001, 0x010000,  CRC(95e97796) SHA1(f1a8de0ad02aca31f79a4fe8ba5044546163e3c4) )
1812   ROM_LOAD16_BYTE( "st.q7",  0x0a0000, 0x010000,  CRC(f3b8fe7f) SHA1(52d5be3f8cab419103f4727d0fb9d30f34c8f651) )
1813   ROM_LOAD16_BYTE( "st.q8",  0x0a0001, 0x010000,  CRC(b85e75a2) SHA1(b7b03b090c0ec6d92e9a25abb7fec0507356bdfc) )
1814   ROM_LOAD16_BYTE( "st.q9",  0x0c0000, 0x010000,  CRC(835f6001) SHA1(2cd9084c102d74bcb578c8ea22bbc9ea58f0ceab) )
1815   ROM_LOAD16_BYTE( "st.qa",  0x0c0001, 0x010000,  CRC(3fc62a0e) SHA1(0628de4b962d3fcca3757cd4e89b3005c9bfd218) )
1816ROM_END
1817
1818ROM_START( timemchn )
1819   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1820   VID_BIOS
1821
1822   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1823   ROM_LOAD16_BYTE( "tm20.p1",  0x000000, 0x010000,  CRC(6919697c) SHA1(786d7b9ab218dbf54ff839d1f83580c409c725b3) )
1824   ROM_LOAD16_BYTE( "tm20.p2",  0x000001, 0x010000,  CRC(d13b56e4) SHA1(623e73995da93c07b51ce0a5843dba1f853529dd) )
1825   ROM_LOAD16_BYTE( "tm20.p3",  0x020000, 0x010000,  CRC(efd3ae64) SHA1(9d2a3b65048e04842205751c6921d2550f38bd52) )
1826   ROM_LOAD16_BYTE( "tm20.p4",  0x020001, 0x010000,  CRC(602ba3fb) SHA1(7243f58df9a26adfd1a149a1e60630b187787dd0) )
1827   ROM_LOAD16_BYTE( "q12.p5" ,  0x040000, 0x010000,  CRC(adddd8a7) SHA1(73a8dd191eda2f4b41b79d4b55723731953b8970) )
1828   ROM_LOAD16_BYTE( "q11.p6" ,  0x040001, 0x010000,  CRC(e8ed736f) SHA1(e7068c550aa39a6e8f1692a16794147e996D36b4) )
1829   ROM_LOAD16_BYTE( "q14.p7" ,  0x060000, 0x010000,  CRC(02abb026) SHA1(42224678e5913090c91c21672661beb8e27127a8) )
1830   ROM_LOAD16_BYTE( "q13.p8" ,  0x060001, 0x010000,  CRC(3de147dd) SHA1(d2111d54d1604fe2da0133102bbfee706f8f542e) )
1831   ROM_LOAD16_BYTE( "q16.p9" ,  0x080000, 0x010000,  CRC(ce2bf15e) SHA1(29c7f2e718bce415b0b8dc6d902bf74dad6b1ef4) )
1832   ROM_LOAD16_BYTE( "q15.p10",  0x080001, 0x010000,  CRC(7894ac8b) SHA1(dc46bd108ac4f67a9062bb7ace91aa51f069cbc8) )
1833   ROM_LOAD16_BYTE( "q18.p11",  0x0a0000, 0x010000,  CRC(27de90b3) SHA1(625c98e555f7b627ea96653926b8917996a2fdb7) )
1834   ROM_LOAD16_BYTE( "q17.p12",  0x0a0001, 0x010000,  CRC(5cab773e) SHA1(59a235c51a975b341bdbb88e909729507408f75b) )
1835   ROM_LOAD16_BYTE( "q20.p13",  0x0c0000, 0x010000,  CRC(083f6c65) SHA1(291ad39ee5f8eba9da293d9206b1f6a6d852f9bd) )
1836   ROM_LOAD16_BYTE( "q19.p14",  0x0c0001, 0x010000,  CRC(73747644) SHA1(ae252fc95c069a3c82e155220fbfcb74dd43bf89) )
1837ROM_END
1838
1839ROM_START( mating )
1840   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1841   VID_BIOS
1842
1843   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1844   ROM_LOAD16_BYTE( "matd.p1",  0x000000, 0x080000,  CRC(e660909f) SHA1(0acd990264fd7faf1f91a796d2438e8c2c7b83d1) )
1845   ROM_LOAD16_BYTE( "matd.p2",  0x000001, 0x080000,  CRC(a4c7e9b4) SHA1(30148c0257181bb88159e02d2b7cd79995ee84a7) )
1846   ROM_LOAD16_BYTE( "matg.p3",  0x100000, 0x080000,  CRC(571f4e8e) SHA1(51babacb5d9fb1cc9e1e56a3b2a355597d04f178) )
1847   ROM_LOAD16_BYTE( "matg.p4",  0x100001, 0x080000,  CRC(52d8657b) SHA1(e44e1db13c4abd4fedcd72df9dce1df594f74e44) )
1848   ROM_LOAD16_BYTE( "matg.p5",  0x200000, 0x080000,  CRC(9f0c9552) SHA1(8b1197f20853e18841a8f64fd5ff58cdd0bd1dbd) )
1849   ROM_LOAD16_BYTE( "matg.p6",  0x200001, 0x080000,  CRC(59f2b6a8) SHA1(4921cf1fc4c3bc50d2598b63726f61f68b41658c) )
1850   ROM_LOAD16_BYTE( "matg.p7",  0x300000, 0x080000,  CRC(64c0031a) SHA1(a519addd5d8f4696967ec84c163d28cb81ff9f32) )
1851   ROM_LOAD16_BYTE( "matg.p8",  0x300001, 0x080000,  CRC(22370dae) SHA1(72b1686b458750b5ee9dfe5599c308329d2c79d5) )
1852   ROM_LOAD16_BYTE( "matq.p9",  0x400000, 0x040000,  CRC(2d42e982) SHA1(80e476d5d65662059daa93a2fd383aecb74903c1) )
1853   ROM_LOAD16_BYTE( "matq.p10", 0x400001, 0x040000,  CRC(90364c3c) SHA1(6a4d2a3dd2cf9040887503888e6f38341578ad64) )
1854
1855   /* Mating Game has an extra OKI sound chip */
1856   ROM_REGION( 0x200000, REGION_SOUND1, 0 )
1857   ROM_LOAD( "matsnd.p1",  0x000000, 0x080000,  CRC(f16df9e3) SHA1(fd9b82d73e18e635a9ea4aabd8c0b4aa2c8c6fdb) )
1858   ROM_LOAD( "matsnd.p2",  0x080000, 0x080000,  CRC(0c041621) SHA1(9156bf17ef6652968d9fbdc0b2bde64d3a67459c) )
1859   ROM_LOAD( "matsnd.p3",  0x100000, 0x080000,  CRC(c7435af9) SHA1(bd6080afaaaecca0d65e6d4125b46849aa4d1f33) )
1860   ROM_LOAD( "matsnd.p4",  0x180000, 0x080000,  CRC(d7e65c5b) SHA1(5575fb9f948158f2e94c986bf4bca9c9ee66a489) )
1861ROM_END
1862
1863ROM_START( matinga )
1864   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1865   VID_BIOS
1866
1867   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1868   ROM_LOAD16_BYTE( "mats.p1",  0x000000, 0x080000,  CRC(ebc7ea7e) SHA1(11015489a803ba5c8dbdafd632424bbd6080aece) ) // 3 bytes changed from above set...
1869   ROM_LOAD16_BYTE( "mats.p2",  0x000001, 0x080000,  CRC(a4c7e9b4) SHA1(30148c0257181bb88159e02d2b7cd79995ee84a7) ) // Just enough to disable the data logger
1870   ROM_LOAD16_BYTE( "matg.p3",  0x100000, 0x080000,  CRC(571f4e8e) SHA1(51babacb5d9fb1cc9e1e56a3b2a355597d04f178) )
1871   ROM_LOAD16_BYTE( "matg.p4",  0x100001, 0x080000,  CRC(52d8657b) SHA1(e44e1db13c4abd4fedcd72df9dce1df594f74e44) )
1872   ROM_LOAD16_BYTE( "matg.p5",  0x200000, 0x080000,  CRC(9f0c9552) SHA1(8b1197f20853e18841a8f64fd5ff58cdd0bd1dbd) )
1873   ROM_LOAD16_BYTE( "matg.p6",  0x200001, 0x080000,  CRC(59f2b6a8) SHA1(4921cf1fc4c3bc50d2598b63726f61f68b41658c) )
1874   ROM_LOAD16_BYTE( "matg.p7",  0x300000, 0x080000,  CRC(64c0031a) SHA1(a519addd5d8f4696967ec84c163d28cb81ff9f32) )
1875   ROM_LOAD16_BYTE( "matg.p8",  0x300001, 0x080000,  CRC(22370dae) SHA1(72b1686b458750b5ee9dfe5599c308329d2c79d5) )
1876   ROM_LOAD16_BYTE( "matq.p9",  0x400000, 0x040000,  CRC(2d42e982) SHA1(80e476d5d65662059daa93a2fd383aecb74903c1) )
1877   ROM_LOAD16_BYTE( "matq.p10", 0x400001, 0x040000,  CRC(90364c3c) SHA1(6a4d2a3dd2cf9040887503888e6f38341578ad64) )
1878
1879   /* Mating Game has an extra OKI sound chip */
1880   ROM_REGION( 0x200000, REGION_SOUND1, 0 )
1881   ROM_LOAD( "matsnd.p1",  0x000000, 0x080000,  CRC(f16df9e3) SHA1(fd9b82d73e18e635a9ea4aabd8c0b4aa2c8c6fdb) )
1882   ROM_LOAD( "matsnd.p2",  0x080000, 0x080000,  CRC(0c041621) SHA1(9156bf17ef6652968d9fbdc0b2bde64d3a67459c) )
1883   ROM_LOAD( "matsnd.p3",  0x100000, 0x080000,  CRC(c7435af9) SHA1(bd6080afaaaecca0d65e6d4125b46849aa4d1f33) )
1884   ROM_LOAD( "matsnd.p4",  0x180000, 0x080000,  CRC(d7e65c5b) SHA1(5575fb9f948158f2e94c986bf4bca9c9ee66a489) )
1885ROM_END
1886
1887//Vegas Poker Protoype dumped by HIGHWAYMAN
1888ROM_START( vgpoker )
1889   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1890   ROM_LOAD("comms-v2.0.bin",  0x00000, 0x10000,  CRC(1717581f) SHA1(40f8cae39a2ab0c89d2bbfd8a37725aaae229c96))
1891
1892   ROM_REGION( 0x800000, REGION_CPU2, 0 )
1893   ROM_LOAD16_BYTE("video-1.bin",  0x000000, 0x010000,  CRC(7ba2396c) SHA1(eb24b802b984315fc2eba4f15c208e2c1925c1c8))
1894   ROM_LOAD16_BYTE("video-2.bin",  0x000001, 0x010000,  CRC(4f9e830b) SHA1(f17bebb289c3620bf4c88b2b358a9dab87ac214f))
1895   ROM_LOAD16_BYTE("video-3.bin",  0x020000, 0x010000,  CRC(607e0baa) SHA1(9f64a46ef3b9a854e939b5e7f0d1e6e925735922))
1896   ROM_LOAD16_BYTE("video-4.bin",  0x020001, 0x010000,  CRC(2019f5d3) SHA1(d183b3b92d03be9f9d57b5df1a621cbfe955ed93))
1897   ROM_LOAD16_BYTE("video-5.bin",  0x040000, 0x010000,  CRC(c029202e) SHA1(b08bb2678c2ff62a58ef67d5440c326d0fadc34e))
1898   ROM_LOAD16_BYTE("video-6.bin",  0x040001, 0x010000,  CRC(3287ae4e) SHA1(3b05a036de3ca7ec644bfbf04934e44e631d1e28))
1899   ROM_LOAD16_BYTE("video-7.bin",  0x060000, 0x010000,  CRC(231cf163) SHA1(02b28ef0e1661a82d0fba2ecc5474c79651fa9e7))
1900   ROM_LOAD16_BYTE("video-8.bin",  0x060001, 0x010000,  CRC(076efdc8) SHA1(bef0a1d8f0e7486ee5dc7407ce5c96854cefa5cf))
1901ROM_END
1902
1903ROM_START( connect4 )
1904   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
1905   ROM_LOAD( "connect4.p2",  0x8000, 0x4000,  CRC(6090633c) SHA1(0cd2725a235bf93cfe94f2ca648d5fccb87b8e5c) )
1906   ROM_LOAD( "connect4.p1",  0xC000, 0x4000,  CRC(b1af50c0) SHA1(7c9645ea378f0857b849ca24a239d9114f62da7f) )
1907ROM_END
1908
1909ROM_START( mpu4utst )
1910   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
1911   ROM_LOAD( "ut4.p1",  0xC000, 0x4000,  CRC(086dc325) SHA1(923caeb61347ac9d3e6bcec45998ddf04b2c8ffd))
1912ROM_END
1913
1914ROM_START( mpu4tst2 )
1915   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
1916   ROM_LOAD( "ut2.p1",  0xE000, 0x2000,  CRC(f7fb6575) SHA1(f7961cbd0801b9561d8cd2d23081043d733e1902))
1917ROM_END
1918
1919ROM_START( mpu4met0 )
1920   ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00  )
1921   ROM_LOAD( "meter-zero.p1",  0x8000, 0x8000,  CRC(e74297e5) SHA1(49a2cc85eda14199975ec37a794b685c839d3ab9))
1922ROM_END
1923
1924DRIVER_INIT (connect4)
1925{
1926   led_extend=1;
1927}
1928
1929//Deal 'Em was a conversion kit designed to make early MPU4 machines into video games by replacing the top glass
1930//and reel assembly with this kit and a supplied monitor.
1931//The real Deal 'Em ran on Summit Coin hardware, and was made by someone else.
1932//A further different release was made in 2000, running on the Barcrest MPU4 Video, rather than this one.
1933GAME( 1987, dealem,    0,        dealem,   dealem,   0,    ROT0,   "Zenitone",       "Deal 'Em (MPU4 Conversion Kit, v7.0)",                        GAME_IMPERFECT_GRAPHICS )
1934
1935GAME( 199?, bctvidbs,0,       mpu4mod2, mpu4,     0,    ROT0,   "Barcrest",       "MPU4 Video Firmware",                                    GAME_IS_BIOS_ROOT )
1936
1937GAME( 1994?,crmaze,  bctvidbs,mpu4_vid, crmaze,   crmaze,ROT0,   "Barcrest",       "The Crystal Maze: Team Challenge (SWP)",                     GAME_NOT_WORKING|GAME_NO_SOUND )
1938GAME( 1992?,crmazea, crmaze,  mpu4_vid, crmaze,   crmaze,ROT0,   "Barcrest",       "The Crystal Maze (AMLD version SWP)",                        GAME_NOT_WORKING|GAME_NO_SOUND )
1939GAME( 1993?,crmazeb, crmaze,  mpu4_vid, crmaze,   0,     ROT0,   "Barcrest",       "The Crystal Maze - Now Featuring Ocean Zone (AMLD Version SWP)",   GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
1940GAME( 1990, turnover,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Turnover",                                             GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
1941GAME( 1992, skiltrek,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Skill Trek",                                          GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
1942GAME( 1990, timemchn,bctvidbs,mpu4_vid, mpu4,     0,     ROT0,   "Barcrest",       "Time Machine v2.0",                                    GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected?
1943GAME( 199?, mating,  bctvidbs,mpu4_vid, mpu4,     mating,ROT0,   "Barcrest",       "The Mating Game (Datapak)",                              GAME_NOT_WORKING|GAME_NO_SOUND )
1944GAME( 199?, matinga, mating,  mpu4_vid, mpu4,     mating,ROT0,   "Barcrest",       "The Mating Game (Standard)",                              GAME_NOT_WORKING|GAME_NO_SOUND )
1945GAME( 199?, vgpoker, 0,        vgpoker,   mpu4,     0,    ROT0,   "BwB",            "Vegas Poker (Prototype)",                                 GAME_NOT_WORKING|GAME_NO_SOUND )
1946
1947GAMEL(1989?,connect4,0,       mpu4mod2, connect4, connect4, ROT0,   "Dolbeck Systems",    "Connect 4",                                          GAME_IMPERFECT_GRAPHICS,layout_connect4 )
1948GAME( 198?, mpu4utst,0,        mpu4mod2, mpu4,          0,   ROT0,   "Barcrest",       "MPU4 Unit Test (Program 4)",                              0 )
1949GAME( 198?, mpu4tst2,0,        mpu4mod2, mpu4,          0,   ROT0,   "Barcrest",       "MPU4 Unit Test (Program 2)",                              0 )
1950GAME( 198?, mpu4met0,0,        mpu4mod2, mpu4,          0, ROT0,   "Barcrest",       "MPU4 Meter Clear ROM",                                    0 )
src/mame/drivers/metro.c
r1281r1282
136136
137137static UINT16 *metro_irq_levels, *metro_irq_vectors, *metro_irq_enable;
138138
139READ16_HANDLER( metro_irq_cause_r )
139static READ16_HANDLER( metro_irq_cause_r )
140140{
141141   return   requested_int[0] * 0x01 +   // vblank
142142         requested_int[1] * 0x02 +
r1281r1282
192192   return metro_irq_vectors[int_level]&0xff;
193193}
194194
195MACHINE_RESET( metro )
195static MACHINE_RESET( metro )
196196{
197197   if (irq_line == -1)
198198      cpunum_set_irq_callback(0, metro_irq_callback);
199199}
200200
201201
202WRITE16_HANDLER( metro_irq_cause_w )
202static WRITE16_HANDLER( metro_irq_cause_w )
203203{
204204//if (data & ~0x15) logerror("CPU #0 PC %06X : unknown bits of irqcause written: %04X\n",activecpu_get_pc(),data);
205205
r1281r1282
572572
573573/* IT DOESN'T WORK PROPERLY */
574574
575WRITE16_HANDLER( metro_coin_lockout_1word_w )
575static WRITE16_HANDLER( metro_coin_lockout_1word_w )
576576{
577577   if (ACCESSING_LSB)
578578   {
r1281r1282
583583}
584584
585585
586WRITE16_HANDLER( metro_coin_lockout_4words_w )
586static WRITE16_HANDLER( metro_coin_lockout_4words_w )
587587{
588588//  coin_lockout_w( (offset >> 1) & 1, offset & 1 );
589589   if (data & ~1)   logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n",activecpu_get_pc(),data);
r1281r1282
610610
611611static UINT16 *metro_rombank;
612612
613READ16_HANDLER( metro_bankedrom_r )
613static READ16_HANDLER( metro_bankedrom_r )
614614{
615615   const int region = REGION_GFX1;
616616
r1281r1282
697697}
698698
699699
700WRITE16_HANDLER( metro_blitter_w )
700static WRITE16_HANDLER( metro_blitter_w )
701701{
702702   COMBINE_DATA( &metro_blitter_regs[offset] );
703703
r1281r1282
14191419   return 0xffff;
14201420}
14211421
1422READ16_HANDLER( gakusai_eeprom_r )
1422static READ16_HANDLER( gakusai_eeprom_r )
14231423{
14241424   return EEPROM_read_bit() & 1;
14251425}
14261426
1427WRITE16_HANDLER( gakusai_eeprom_w )
1427static WRITE16_HANDLER( gakusai_eeprom_w )
14281428{
14291429   if (ACCESSING_LSB)
14301430   {
r1281r1282
15471547                        Mahjong Doukyuusei Special
15481548***************************************************************************/
15491549
1550READ16_HANDLER( dokyusp_eeprom_r )
1550static READ16_HANDLER( dokyusp_eeprom_r )
15511551{
15521552   // clock line asserted: write latch or select next bit to read
15531553   EEPROM_set_clock_line(CLEAR_LINE);
r1281r1282
15561556   return EEPROM_read_bit() & 1;
15571557}
15581558
1559WRITE16_HANDLER( dokyusp_eeprom_bit_w )
1559static WRITE16_HANDLER( dokyusp_eeprom_bit_w )
15601560{
15611561   if (ACCESSING_LSB)
15621562   {
r1281r1282
15691569   }
15701570}
15711571
1572WRITE16_HANDLER( dokyusp_eeprom_reset_w )
1572static WRITE16_HANDLER( dokyusp_eeprom_reset_w )
15731573{
15741574   if (ACCESSING_LSB)
15751575   {
r1281r1282
40764076   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.90)
40774077MACHINE_DRIVER_END
40784078
4079NVRAM_HANDLER( dokyusp )
4079static NVRAM_HANDLER( dokyusp )
40804080{
40814081   static const UINT8 def_data[] = {0x00,0xe0};
40824082
r1281r1282
46384638}
46394639
46404640
4641DRIVER_INIT( dharmak )
4641static DRIVER_INIT( dharmak )
46424642{
46434643   UINT8 *src = memory_region( REGION_GFX1 );
46444644   int i;
src/mame/drivers/hshavoc.c
r1281r1282
208208   memory_set_bankptr(4, genesis_68k_ram );
209209}
210210
211DRIVER_INIT(hshavoc)
211static DRIVER_INIT(hshavoc)
212212{
213213
214214   int x;
src/mame/drivers/laserbas.c
r1281r1282
2121static UINT8 *vram1,*vram2;
2222static int vrambank=0;
2323
24VIDEO_START(laserbas)
24static VIDEO_START(laserbas)
2525{
2626   vram1=auto_malloc(0x8000);
2727   vram2=auto_malloc(0x8000);
2828}
2929
30VIDEO_UPDATE(laserbas)
30static VIDEO_UPDATE(laserbas)
3131{
3232   int x,y;
3333    for(y=0;y<256;y++)
src/mame/drivers/midvunit.c
r1281r1282
130130 *
131131 *************************************/
132132
133READ32_HANDLER( midvunit_adc_r )
133static READ32_HANDLER( midvunit_adc_r )
134134{
135135   if (!(control_data & 0x40))
136136      return adc_data << adc_shift;
r1281r1282
146146}
147147
148148
149WRITE32_HANDLER( midvunit_adc_w )
149static WRITE32_HANDLER( midvunit_adc_w )
150150{
151151   if (!(control_data & 0x20))
152152   {
r1281r1282
194194 *
195195 *************************************/
196196
197WRITE32_HANDLER( midvunit_control_w )
197static WRITE32_HANDLER( midvunit_control_w )
198198{
199199   UINT16 olddata = control_data;
200200   COMBINE_DATA(&control_data);
r1281r1282
214214}
215215
216216
217WRITE32_HANDLER( crusnwld_control_w )
217static WRITE32_HANDLER( crusnwld_control_w )
218218{
219219   UINT16 olddata = control_data;
220220   COMBINE_DATA(&control_data);
src/mame/drivers/kingpin.c
r1281r1282
173173*/
174174MACHINE_DRIVER_END
175175
176DRIVER_INIT( kingpin )
176static DRIVER_INIT( kingpin )
177177{
178178   static UINT8 *code_base;
179179
src/mame/drivers/pangofun.c
r1281r1282
9191
9292#include "driver.h"
9393
94VIDEO_START(pangofun)
94static VIDEO_START(pangofun)
9595{
9696}
9797
98VIDEO_UPDATE(pangofun)
98static VIDEO_UPDATE(pangofun)
9999{
100100   return 0;
101101}
src/mame/drivers/pmpoker.c
r1281r1282
382382
383383static tilemap *bg_tilemap;
384384
385WRITE8_HANDLER( pmpoker_videoram_w )
385static WRITE8_HANDLER( pmpoker_videoram_w )
386386{
387387   videoram[offset] = data;
388388   tilemap_mark_tile_dirty(bg_tilemap, offset);
389389}
390390
391WRITE8_HANDLER( pmpoker_colorram_w )
391static WRITE8_HANDLER( pmpoker_colorram_w )
392392{
393393   colorram[offset] = data;
394394   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
413413   SET_TILE_INFO(bank, code, color, 0);
414414}
415415
416VIDEO_START( pmpoker )
416static VIDEO_START( pmpoker )
417417{
418418   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
419419      TILEMAP_TYPE_PEN, 8, 8, 32, 29);
420420}
421421
422VIDEO_UPDATE( pmpoker )
422static VIDEO_UPDATE( pmpoker )
423423{
424424   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
425425   return 0;
426426}
427427
428PALETTE_INIT( pottnpkr )
428static PALETTE_INIT( pottnpkr )
429429{
430430/*  prom bits
431431    7654 3210
src/mame/drivers/suna16.c
r1281r1282
4343
4444***************************************************************************/
4545
46WRITE16_HANDLER( suna16_soundlatch_w )
46static WRITE16_HANDLER( suna16_soundlatch_w )
4747{
4848   if (ACCESSING_LSB)
4949   {
r1281r1282
5353}
5454
5555
56WRITE16_HANDLER( bssoccer_leds_w )
56static WRITE16_HANDLER( bssoccer_leds_w )
5757{
5858   if (ACCESSING_LSB)
5959   {
r1281r1282
6767}
6868
6969
70WRITE16_HANDLER( uballoon_leds_w )
70static WRITE16_HANDLER( uballoon_leds_w )
7171{
7272   if (ACCESSING_LSB)
7373   {
r1281r1282
115115                                Ultra Balloon
116116***************************************************************************/
117117
118WRITE16_HANDLER( uballoon_spriteram16_w )
118static WRITE16_HANDLER( uballoon_spriteram16_w )
119119{
120120   COMBINE_DATA( &spriteram16[offset] );
121121}
r1281r1282
931931ROM_END
932932
933933
934DRIVER_INIT( uballoon )
934static DRIVER_INIT( uballoon )
935935{
936936   UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1);
937937
src/mame/drivers/shadfrce.c
r1281r1282
9696WRITE16_HANDLER( shadfrce_bg1videoram_w );
9797
9898
99WRITE16_HANDLER( shadfrce_flip_screen )
99static WRITE16_HANDLER( shadfrce_flip_screen )
100100{
101101   flip_screen_set(data & 0x01);
102102}
src/mame/drivers/yumefuda.c
r1281r1282
7171}
7272
7373
74VIDEO_START( yumefuda )
74static VIDEO_START( yumefuda )
7575{
7676   bg_tilemap = tilemap_create(y_get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
7777}
7878
79VIDEO_UPDATE( yumefuda )
79static VIDEO_UPDATE( yumefuda )
8080{
8181   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
8282   return 0;
src/mame/drivers/jongkyo.c
r1281r1282
3737static int rom_bank;
3838static UINT8* videoram2;
3939
40VIDEO_START(jongkyo)
40static VIDEO_START(jongkyo)
4141{
4242
4343}
4444
45VIDEO_UPDATE(jongkyo)
45static VIDEO_UPDATE(jongkyo)
4646{
4747   int y;
4848
r1281r1282
563563INPUT_PORTS_END
564564
565565
566PALETTE_INIT(jongkyo)
566static PALETTE_INIT(jongkyo)
567567{
568568   int i;
569569   UINT8* proms = memory_region(REGION_PROMS);
r1281r1282
633633ROM_END
634634
635635
636DRIVER_INIT( jongkyo )
636static DRIVER_INIT( jongkyo )
637637{
638638   int i;
639639   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/littlerb.c
r1281r1282
138138   littlerb_write_address = littlerb_vdp_address_low | littlerb_vdp_address_high<<16;
139139}
140140
141READ16_HANDLER( littlerb_vdp_r )
141static READ16_HANDLER( littlerb_vdp_r )
142142{
143143   switch (offset)
144144   {
r1281r1282
158158   return -1;
159159}
160160
161WRITE16_HANDLER( littlerb_vdp_w )
161static WRITE16_HANDLER( littlerb_vdp_w )
162162{
163163   switch (offset)
164164   {
r1281r1282
333333   }
334334}
335335
336VIDEO_UPDATE(littlerb)
336static VIDEO_UPDATE(littlerb)
337337{
338338   int x,y,offs, code;
339339   int xsize,ysize;
src/mame/drivers/bigevglf.c
r1281r1282
461461   GFXDECODE_ENTRY( REGION_GFX1, 0, gfxlayout,   0x20*16, 16 )
462462GFXDECODE_END
463463
464MACHINE_RESET( bigevglf )
464static MACHINE_RESET( bigevglf )
465465{
466466   beg13_ls74[0] = 0;
467467   beg13_ls74[1] = 0;
src/mame/drivers/bagman.c
r1281r1282
939939   ROM_LOAD( "bota_3a.3a",    0x0020, 0x0020, CRC(edf88f34) SHA1(b9c342d51303d552f87df2543a34e38c30acd07c) )
940940ROM_END
941941
942DRIVER_INIT( bagnarda )
942static DRIVER_INIT( bagnarda )
943943{
944944   /* initialize video enable because it's not done in the code */
945945   *bagman_video_enable = 1;
src/mame/drivers/namcos23.c
r1281r1282
355355   }
356356} /* TextTilemapGetInfo */
357357
358READ32_HANDLER( namcos23_textram_r )
358static READ32_HANDLER( namcos23_textram_r )
359359{
360360   return namcos23_textram[offset];
361361}
362362
363WRITE32_HANDLER( namcos23_textram_w )
363static WRITE32_HANDLER( namcos23_textram_w )
364364{
365365   COMBINE_DATA( &namcos23_textram[offset] );
366366//  tilemap_mark_tile_dirty( bgtilemap, offset*2 );
367367//  tilemap_mark_tile_dirty( bgtilemap, offset*2+1 );
368368}
369369
370VIDEO_START( ss23 )
370static VIDEO_START( ss23 )
371371{
372372   bgtilemap = tilemap_create( TextTilemapGetInfo,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64 );
373373   tilemap_set_transparent_pen( bgtilemap, 0xf );
r1281r1282
465465}
466466#endif
467467
468VIDEO_UPDATE( ss23 )
468static VIDEO_UPDATE( ss23 )
469469{
470470   fillbitmap(bitmap, get_black_pen(machine), cliprect);
471471   fillbitmap(priority_bitmap, 0, cliprect);
r1281r1282
571571   }
572572}
573573
574READ32_HANDLER( namcos23_paletteram_r )
574static READ32_HANDLER( namcos23_paletteram_r )
575575{
576576   return paletteram32[offset];
577577}
578578
579579/* each LONGWORD is 2 colors.  each OFFSET is 2 colors */
580580
581WRITE32_HANDLER( namcos23_paletteram_w )
581static WRITE32_HANDLER( namcos23_paletteram_w )
582582{
583583   COMBINE_DATA( &paletteram32[offset] );
584584
r1281r1282
793793INPUT_PORTS_END
794794
795795
796DRIVER_INIT(ss23)
796static DRIVER_INIT(ss23)
797797{
798798    }
799799
src/mame/drivers/tattack.c
r1281r1282
4040      0);
4141}
4242
43VIDEO_UPDATE( tattack )
43static VIDEO_UPDATE( tattack )
4444{
4545   tilemap_mark_all_tiles_dirty(tmap);
4646   tilemap_draw(bitmap,cliprect,tmap, 0,0);
4747   return 0;
4848}
4949
50VIDEO_START( tattack )
50static VIDEO_START( tattack )
5151{
5252      tmap = tilemap_create( get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 );
5353}
src/mame/drivers/ninjakd2.c
r1281r1282
260260   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xd7);   /* RST 10h */
261261}
262262
263#ifdef UNUSED_FUNCTION
263264READ8_HANDLER( ninjakd2_bankselect_r )
264265{
265266   return ninjakd2_bank_latch;
266267}
268#endif
267269
268WRITE8_HANDLER( ninjakd2_bankselect_w )
270static WRITE8_HANDLER( ninjakd2_bankselect_w )
269271{
270272   UINT8 *ROM = memory_region(REGION_CPU1);
271273   int bankaddress;
r1281r1282
279281   }
280282}
281283
282WRITE8_HANDLER( ninjakd2_pcm_play_w )
284static WRITE8_HANDLER( ninjakd2_pcm_play_w )
283285{
284286   int i;
285287   static const int sample_no[9] = { 0x00,0x0A,0x27,0x3E,0x53,0x5E,0x68,0x76,0xF0 };
src/mame/drivers/yunsung8.c
r1281r1282
5353
5454
5555
56MACHINE_RESET( yunsung8 )
56static MACHINE_RESET( yunsung8 )
5757{
5858   UINT8 *RAM = memory_region(REGION_CPU1) + 0x24000;
5959
r1281r1282
7272***************************************************************************/
7373
7474
75WRITE8_HANDLER( yunsung8_bankswitch_w )
75static WRITE8_HANDLER( yunsung8_bankswitch_w )
7676{
7777   UINT8 *RAM = memory_region(REGION_CPU1);
7878
r1281r1282
143143
144144static int adpcm;
145145
146WRITE8_HANDLER( yunsung8_sound_bankswitch_w )
146static WRITE8_HANDLER( yunsung8_sound_bankswitch_w )
147147{
148148   UINT8 *RAM = memory_region(REGION_CPU2);
149149   int bank = data & 7;
r1281r1282
158158   MSM5205_reset_w(0,data & 0x20);
159159}
160160
161WRITE8_HANDLER( yunsung8_adpcm_w )
161static WRITE8_HANDLER( yunsung8_adpcm_w )
162162{
163163   /* Swap the nibbles */
164164   adpcm = ((data&0xf)<<4) | ((data >>4)&0xf);
src/mame/drivers/warpwarp.c
r1281r1282
141141
142142static int handle_joystick;
143143
144READ8_HANDLER( geebee_in_r )
144static READ8_HANDLER( geebee_in_r )
145145{
146146   int res;
147147
r1281r1282
161161   return res;
162162}
163163
164WRITE8_HANDLER( geebee_out6_w )
164static WRITE8_HANDLER( geebee_out6_w )
165165{
166166   switch (offset & 3)
167167   {
r1281r1282
180180   }
181181}
182182
183WRITE8_HANDLER( geebee_out7_w )
183static WRITE8_HANDLER( geebee_out7_w )
184184{
185185   switch (offset & 7)
186186   {
src/mame/drivers/wheelfir.c
r1281r1282
5151#include "driver.h"
5252static int toggle_bit;
5353
54READ16_HANDLER( wheelfir_rand1 )
54static READ16_HANDLER( wheelfir_rand1 )
5555{
5656
5757
r1281r1282
6060   return readinputport(0)^toggle_bit;// mame_rand(Machine);
6161}
6262
63READ16_HANDLER( wheelfir_rand2 )
63static READ16_HANDLER( wheelfir_rand2 )
6464{
6565   return readinputport(1);// mame_rand(Machine);
6666}
6767
6868
69READ16_HANDLER( wheelfir_rand4 )
69static READ16_HANDLER( wheelfir_rand4 )
7070{
7171   return mame_rand(Machine);
7272}
r1281r1282
270270
271271}
272272
273VIDEO_START(wheelfir)
273static VIDEO_START(wheelfir)
274274{
275275
276276   wheelfir_tmp_bitmap[0] = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
r1281r1282
284284static UINT8 wheelfir_palette[8192];
285285static int wheelfir_palpos = 0;
286286/* Press R to show a page of gfx, Q / E to move between pages, and W to clear the framebuffer */
287VIDEO_UPDATE(wheelfir)
287static VIDEO_UPDATE(wheelfir)
288288{
289289   /*
290290    int x,y;
src/mame/drivers/steaser.c
r1281r1282
3636
3737#include "driver.h"
3838
39VIDEO_START(steaser)
39static VIDEO_START(steaser)
4040{
4141}
4242
43VIDEO_UPDATE(steaser)
43static VIDEO_UPDATE(steaser)
4444{
4545   return 0;
4646}
src/mame/drivers/cbuster.c
r1281r1282
8383   logerror("Warning %04x- %02x written to control %02x\n",activecpu_get_pc(),data,offset);
8484}
8585
86READ16_HANDLER( twocrude_control_r )
86static READ16_HANDLER( twocrude_control_r )
8787{
8888   switch (offset<<1)
8989   {
src/mame/drivers/ghosteo.c
r1281r1282
379379
380380static int irq_en = 0;
381381
382VIDEO_START( bballoon )
382static VIDEO_START( bballoon )
383383{
384384
385385}
386386static int b=0;
387VIDEO_UPDATE( bballoon )
387static VIDEO_UPDATE( bballoon )
388388{
389389   if(input_code_pressed_once(KEYCODE_Q))
390390   {
r1281r1282
551551   ROM_LOAD( "b1.u16",       0x000000, 0x100000, CRC(c42c1c85) SHA1(e1f49d556ffd6bc27142a7784c3bb8e37999857d) )
552552ROM_END
553553
554DRIVER_INIT( bballoon )
554static DRIVER_INIT( bballoon )
555555{
556556   UINT8 *flash = (UINT8 *)memory_region(REGION_USER1);
557557
src/mame/drivers/dunhuang.c
r1281r1282
8989   SET_TILE_INFO(1, code, color, 0);
9090}
9191
92VIDEO_START(dunhuang)
92static VIDEO_START(dunhuang)
9393{
9494   tmap = tilemap_create(   get_tile_info, tilemap_scan_rows,
9595                     TILEMAP_TYPE_PEN, 8,8, 0x40,0x20   );
r1281r1282
109109   dunhuang_paldata  = (UINT8*)auto_malloc(sizeof(UINT8) * 3 * 256);
110110}
111111
112VIDEO_UPDATE( dunhuang )
112static VIDEO_UPDATE( dunhuang )
113113{
114114   int layers_ctrl = -1;
115115
src/mame/drivers/onetwo.c
r1281r1282
239239   GFXDECODE_ENTRY( REGION_GFX1, 0, tiles8x8x6_layout, 0, 2 )
240240GFXDECODE_END
241241
242VIDEO_START( onetwo )
242static VIDEO_START( onetwo )
243243{
244244   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32);
245245}
246246
247VIDEO_UPDATE( onetwo )
247static VIDEO_UPDATE( onetwo )
248248{
249249   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
250250   return 0;
src/mame/drivers/cvs.c
r1281r1282
148148    speech_rom_bit     = 0x0;
149149}
150150
151WRITE8_HANDLER( control_port_w )
151static WRITE8_HANDLER( control_port_w )
152152{
153153   /* Controls both Speech and Effects */
154154
r1281r1282
201201   return bit;
202202}
203203
204WRITE8_HANDLER( cvs_DAC2_w )
204static WRITE8_HANDLER( cvs_DAC2_w )
205205{
206206    /* 4 Bit DAC - 4 memory locations used */
207207
src/mame/drivers/seta.c
r1281r1282
14721472 Sprites Buffering
14731473
14741474*/
1475VIDEO_EOF( seta_buffer_sprites )
1475static VIDEO_EOF( seta_buffer_sprites )
14761476{
14771477   int ctrl2   =   spriteram16[ 0x602/2 ];
14781478   if (~ctrl2 & 0x20)
r1281r1282
15801580                                Caliber 50
15811581***************************************************************************/
15821582
1583READ16_HANDLER ( calibr50_ip_r )
1583static READ16_HANDLER ( calibr50_ip_r )
15841584{
15851585   int dir1 = readinputportbytag("IN4") & 0xfff;   // analog port
15861586   int dir2 = readinputportbytag("IN5") & 0xfff;   // analog port
r1281r1282
16031603   }
16041604}
16051605
1606WRITE16_HANDLER( calibr50_soundlatch_w )
1606static WRITE16_HANDLER( calibr50_soundlatch_w )
16071607{
16081608   if (ACCESSING_LSB)
16091609   {
r1281r1282
16531653                                U.S. Classic
16541654***************************************************************************/
16551655
1656READ16_HANDLER( usclssic_dsw_r )
1656static READ16_HANDLER( usclssic_dsw_r )
16571657{
16581658   switch (offset)
16591659   {
r1281r1282
16651665   return 0;
16661666}
16671667
1668READ16_HANDLER( usclssic_trackball_x_r )
1668static READ16_HANDLER( usclssic_trackball_x_r )
16691669{
16701670   switch (offset)
16711671   {
r1281r1282
16751675   return 0;
16761676}
16771677
1678READ16_HANDLER( usclssic_trackball_y_r )
1678static READ16_HANDLER( usclssic_trackball_y_r )
16791679{
16801680   switch (offset)
16811681   {
r1281r1282
16861686}
16871687
16881688
1689WRITE16_HANDLER( usclssic_lockout_w )
1689static WRITE16_HANDLER( usclssic_lockout_w )
16901690{
16911691   static int old_tiles_offset = 0;
16921692
r1281r1282
17081708   else palette_set_color_rgb(Machine,color+0x200,pal5bit(data >> 10),pal5bit(data >> 5),pal5bit(data >> 0));
17091709}
17101710
1711WRITE16_HANDLER( usclssic_paletteram16_xRRRRRGGGGGBBBBB_word_w )
1711static WRITE16_HANDLER( usclssic_paletteram16_xRRRRRGGGGGBBBBB_word_w )
17121712{
17131713   COMBINE_DATA(&paletteram16[offset]);
17141714   usc_changecolor_xRRRRRGGGGGBBBBB(offset,paletteram16[offset]);
r1281r1282
23382338                            Mobile Suit Gundam
23392339***************************************************************************/
23402340
2341WRITE16_HANDLER( msgundam_vregs_w )
2341static WRITE16_HANDLER( msgundam_vregs_w )
23422342{
23432343   // swap $500002 with $500004
23442344   switch( offset )
r1281r1282
24912491
24922492UINT16 *kiwame_nvram;
24932493
2494READ16_HANDLER( kiwame_nvram_r )
2494static READ16_HANDLER( kiwame_nvram_r )
24952495{
24962496   return kiwame_nvram[offset] & 0xff;
24972497}
24982498
2499WRITE16_HANDLER( kiwame_nvram_w )
2499static WRITE16_HANDLER( kiwame_nvram_w )
25002500{
25012501   if (ACCESSING_LSB)   COMBINE_DATA( &kiwame_nvram[offset] );
25022502}
25032503
2504READ16_HANDLER( kiwame_input_r )
2504static READ16_HANDLER( kiwame_input_r )
25052505{
25062506   int row_select = kiwame_nvram_r( 0x10a/2,0 ) & 0x1f;
25072507   int i;
r1281r1282
26052605
26062606static int wiggie_soundlatch;
26072607
2608READ8_HANDLER( wiggie_soundlatch_r )
2608static READ8_HANDLER( wiggie_soundlatch_r )
26092609{
26102610   return wiggie_soundlatch;
26112611}
r1281r1282
27922792                                DownTown
27932793***************************************************************************/
27942794
2795READ8_HANDLER( downtown_ip_r )
2795static READ8_HANDLER( downtown_ip_r )
27962796{
27972797   int dir1 = readinputport(4);   // analog port
27982798   int dir2 = readinputport(5);   // analog port
r1281r1282
28372837                        Caliber 50 / U.S. Classic
28382838***************************************************************************/
28392839
2840WRITE8_HANDLER( calibr50_soundlatch2_w )
2840static WRITE8_HANDLER( calibr50_soundlatch2_w )
28412841{
28422842   soundlatch2_w(0,data);
28432843   cpu_spinuntil_time(MAME_TIME_IN_USEC(50));   // Allow the other cpu to reply
r1281r1282
29192919static UINT16 pairslove_protram[0x200];
29202920static UINT16 pairslove_protram_old[0x200];
29212921
2922READ16_HANDLER( pairlove_prot_r )
2922static READ16_HANDLER( pairlove_prot_r )
29232923{
29242924   int retdata;
29252925   retdata = pairslove_protram[offset];
r1281r1282
29282928   return retdata;
29292929}
29302930
2931WRITE16_HANDLER( pairlove_prot_w )
2931static WRITE16_HANDLER( pairlove_prot_w )
29322932{
29332933//  mame_printf_debug("pairs love protection? write %06x %04x %04x\n",activecpu_get_pc(), offset,data);
29342934   pairslove_protram_old[offset]=pairslove_protram[offset];
r1281r1282
70167016   cpunum_set_input_line( 0, 2, HOLD_LINE );
70177017}
70187018
7019MACHINE_RESET( wrofaero ) { uPD71054_timer_init(); }
7019static MACHINE_RESET( wrofaero ) { uPD71054_timer_init(); }
70207020#endif   // __uPD71054_TIMER
70217021
70227022
r1281r1282
88018801ROM_END
88028802
88038803
8804READ16_HANDLER( twineagl_debug_r )
8804static READ16_HANDLER( twineagl_debug_r )
88058805{
88068806   /*  At several points in the code, the program checks if four
88078807        consecutive bytes in this range are equal to a string, and if they
r1281r1282
88348834/* Extra RAM ? Check code at 0x00ba90 */
88358835/* 2000F8 = A3 enables it, 2000F8 = 00 disables? see downtown too */
88368836static UINT8 xram[8];
8837READ16_HANDLER( twineagl_200100_r )
8837static READ16_HANDLER( twineagl_200100_r )
88388838{
88398839logerror("%04x: twineagl_200100_r %d\n",activecpu_get_pc(),offset);
88408840   return xram[offset];
88418841}
8842WRITE16_HANDLER( twineagl_200100_w )
8842static WRITE16_HANDLER( twineagl_200100_w )
88438843{
88448844logerror("%04x: twineagl_200100_w %d = %02x\n",activecpu_get_pc(),offset,data);
88458845   if (ACCESSING_LSB)
88468846      xram[offset] = data & 0xff;
88478847}
88488848
8849DRIVER_INIT( twineagl )
8849static DRIVER_INIT( twineagl )
88508850{
88518851   /* debug? */
88528852   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x800000, 0x8000ff, 0, 0, twineagl_debug_r);
r1281r1282
88818881   COMBINE_DATA(&downtown_protection[offset]);
88828882}
88838883
8884DRIVER_INIT( downtown )
8884static DRIVER_INIT( downtown )
88858885{
88868886   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2001ff, 0, 0, downtown_protection_r);
88878887   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2001ff, 0, 0, downtown_protection_w);
88888888}
88898889
88908890
8891READ16_HANDLER( arbalest_debug_r )
8891static READ16_HANDLER( arbalest_debug_r )
88928892{
88938893   /*  At some points in the code, the program checks if four
88948894        consecutive bytes in this range are equal to a string, and if they
r1281r1282
89028902   return 0;
89038903}
89048904
8905DRIVER_INIT( arbalest )
8905static DRIVER_INIT( arbalest )
89068906{
89078907   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x8000f, 0, 0, arbalest_debug_r);
89088908}
89098909
89108910
8911DRIVER_INIT( metafox )
8911static DRIVER_INIT( metafox )
89128912{
89138913   UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1);
89148914
r1281r1282
89228922}
89238923
89248924
8925DRIVER_INIT ( blandia )
8925static DRIVER_INIT ( blandia )
89268926{
89278927   /* rearrange the gfx data so it can be decoded in the same way as the other set */
89288928
r1281r1282
89568956}
89578957
89588958
8959DRIVER_INIT( eightfrc )
8959static DRIVER_INIT( eightfrc )
89608960{
89618961   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x500004, 0x500005, 0, 0, MRA16_NOP);   // watchdog??
89628962}
89638963
89648964
8965DRIVER_INIT( zombraid )
8965static DRIVER_INIT( zombraid )
89668966{
89678967   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00002, 0xf00003, 0, 0, zombraid_gun_r);
89688968   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf00001, 0, 0, zombraid_gun_w);
89698969}
89708970
89718971
8972DRIVER_INIT( kiwame )
8972static DRIVER_INIT( kiwame )
89738973{
89748974   UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1);
89758975
r1281r1282
89818981}
89828982
89838983
8984DRIVER_INIT( rezon )
8984static DRIVER_INIT( rezon )
89858985{
89868986   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x500006, 0x500007, 0, 0, MRA16_NOP);   // irq ack?
89878987}
r1281r1282
90229022
90239023}
90249024
9025DRIVER_INIT( crazyfgt )
9025static DRIVER_INIT( crazyfgt )
90269026{
90279027   // protection check at boot
90289028   UINT16 *RAM = (UINT16 *) memory_region(REGION_CPU1);
src/mame/drivers/laserbat.c
r1281r1282
526526   SET_TILE_INFO(0, videoram[tile_index], colorram[tile_index], 0);
527527}
528528
529VIDEO_START( laserbat )
529static VIDEO_START( laserbat )
530530{
531531   bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
532532
r1281r1282
538538   s2636_x_offset = -19;
539539}
540540
541VIDEO_UPDATE( laserbat )
541static VIDEO_UPDATE( laserbat )
542542{
543543   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
544544
src/mame/drivers/ssf2md.c
r1281r1282
1010   ROM_LOAD16_BYTE( "rom_d", 0x400001, 0x080000,  CRC(b99f6a5b) SHA1(adbe28a7522024bc66328ac86fecf9ded3310e8e) )
1111ROM_END
1212
13READ16_HANDLER( ssf2ghw_dsw_r )
13static READ16_HANDLER( ssf2ghw_dsw_r )
1414{
1515   static const char *dswname[3] = { "DSWA", "DSWB", "DSWC" };
1616   return readinputportbytag(dswname[offset]);
1717}
1818
19DRIVER_INIT( ssf2ghw )
19static DRIVER_INIT( ssf2ghw )
2020{
2121   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, MWA16_NOP); // custom banking is disabled (!)
2222   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x5fffff, 0, 0, MRA16_BANK5);
src/mame/drivers/tnzs.c
r1281r1282
15991599   ROM_REGION( 0x30000, REGION_CPU1, 0 )            /* Region 0 - main cpu */
16001600   ROM_LOAD( "b06-20.11c", 0x00000, 0x08000, CRC(04e3fc1f) SHA1(b1cf2f79f43fa33d6175368c897f84ec6aa6e746) )
16011601   ROM_CONTINUE(           0x18000, 0x08000 )            /* banked at 8000-bfff */
1602   ROM_LOAD( "b06-21.9c", 0x20000, 0x10000, CRC(1614d6a2) SHA1(f23d465af231ab5653c55748f686d8f25f52394b) )   /* banked at 8000-bfff */
1602   ROM_LOAD( "b06-21.9c", 0x20000, 0x10000, CRC(1614d6a2) SHA1(f23d465af231ab5653c55748f686d8f25f52394b) )   /* banked at 8000-bfff */
16031603
16041604   ROM_REGION( 0x18000, REGION_CPU2, 0 )            /* Region 2 - sound cpu */
1605   ROM_LOAD( "b06-06.4e", 0x00000, 0x08000, CRC(744f2c84) SHA1(7565c1594c2a3bae1ae45afcbf93363fe2b12d58) )
1606   ROM_CONTINUE(           0x10000, 0x08000 )   /* banked at 8000-9fff */
1605   ROM_LOAD( "b06-06.4e", 0x00000, 0x08000, CRC(744f2c84) SHA1(7565c1594c2a3bae1ae45afcbf93363fe2b12d58) ) /* This is likely the wrong rom ID # */
1606   ROM_CONTINUE(          0x10000, 0x08000 )   /* banked at 8000-9fff */
16071607
16081608   ROM_REGION( 0x10000, REGION_CPU3, 0 )   /* M-Chip (i8742 internal ROM) */
16091609   ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */
r1281r1282
16111611   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )
16121612   ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) )
16131613   ROM_LOAD( "b06-02.10a", 0x20000, 0x20000, CRC(e0c2757a) SHA1(3c89044caa28b10b4d1bef1515881810c23d312a) )
1614   ROM_LOAD( "b06-03.7a", 0x40000, 0x20000, CRC(ee80ab9d) SHA1(f4e4833cadff7d856b5a8075a61d902427653e16) )
1615   ROM_LOAD( "b06-04.4a", 0x60000, 0x20000, CRC(3697ace4) SHA1(6d6e4e64147365bcfcf74a84eb7ae84dffedd304) )
1614   ROM_LOAD( "b06-03.7a",  0x40000, 0x20000, CRC(ee80ab9d) SHA1(f4e4833cadff7d856b5a8075a61d902427653e16) )
1615   ROM_LOAD( "b06-04.4a",  0x60000, 0x20000, CRC(3697ace4) SHA1(6d6e4e64147365bcfcf74a84eb7ae84dffedd304) )
16161616
16171617   ROM_REGION( 0x0400, REGION_PROMS, 0 )
16181618   ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) )   /* hi bytes, AM27S29 or compatible like MB7124 */
r1281r1282
16231623   ROM_REGION( 0x30000, REGION_CPU1, 0 )            /* Region 0 - main cpu */
16241624   ROM_LOAD( "b06-05.11c", 0x00000, 0x08000, CRC(918e1fe3) SHA1(1aa69e7ae393f275d440b3d5bf817475e443045d) )
16251625   ROM_CONTINUE(           0x18000, 0x08000 )            /* banked at 8000-bfff */
1626   ROM_LOAD( "b06-06.9c", 0x20000, 0x10000, CRC(8842e105) SHA1(68675e77801504c5f67f82fae42f55152ffadebe) )   /* banked at 8000-bfff */
1626   ROM_LOAD( "b06-06.9c", 0x20000, 0x10000, CRC(8842e105) SHA1(68675e77801504c5f67f82fae42f55152ffadebe) )   /* banked at 8000-bfff */
16271627
16281628   ROM_REGION( 0x18000, REGION_CPU2, 0 )            /* Region 2 - sound cpu */
16291629   ROM_LOAD( "b06-07.4e", 0x00000, 0x08000, CRC(b37fb8b3) SHA1(10696914b9e39d34d56069a69b9d641339ea2309) )
1630   ROM_CONTINUE(          0x10000, 0x08000 )   /* banked at 8000-9fff */
1630   ROM_CONTINUE(          0x10000, 0x08000 )   /* banked at 8000-9fff */
16311631
16321632   ROM_REGION( 0x10000, REGION_CPU3, 0 )   /* M-Chip (i8742 internal ROM) */
16331633   ROM_LOAD( "extr8742.4f", 0x0000, 0x0800, NO_DUMP ) /* Labeled B06-14 */
r1281r1282
16351635   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )
16361636   ROM_LOAD( "b06-01.13a", 0x00000, 0x20000, CRC(d2afbf7e) SHA1(28b4cf94798f049a9f8375464741dbef208d7290) )
16371637   ROM_LOAD( "b06-02.10a", 0x20000, 0x20000, CRC(e0c2757a) SHA1(3c89044caa28b10b4d1bef1515881810c23d312a) )
1638   ROM_LOAD( "b06-03.7a", 0x40000, 0x20000, CRC(ee80ab9d) SHA1(f4e4833cadff7d856b5a8075a61d902427653e16) )
1639   ROM_LOAD( "b06-04.4a", 0x60000, 0x20000, CRC(3697ace4) SHA1(6d6e4e64147365bcfcf74a84eb7ae84dffedd304) )
1638   ROM_LOAD( "b06-03.7a",  0x40000, 0x20000, CRC(ee80ab9d) SHA1(f4e4833cadff7d856b5a8075a61d902427653e16) )
1639   ROM_LOAD( "b06-04.4a",  0x60000, 0x20000, CRC(3697ace4) SHA1(6d6e4e64147365bcfcf74a84eb7ae84dffedd304) )
16401640
16411641   ROM_REGION( 0x0400, REGION_PROMS, 0 )
16421642   ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) )   /* hi bytes, AM27S29 or compatible like MB7124 */
r1281r1282
21212121/*  ( YEAR  NAME      PARENT    MACHINE   INPUT     INIT      MONITOR COMPANY    FULLNAME     FLAGS ) */
21222122GAME( 1987, plumppop, 0,        drtoppel, plumppop, plumpop,  ROT0,   "Taito Corporation", "Plump Pop (Japan)", 0 )
21232123GAME( 1987, extrmatn, 0,        arknoid2, extrmatn, extrmatn, ROT270, "[Taito] World Games", "Extermination (US)", 0 )
2124GAME( 1987, extrmatj, 0,        arknoid2, extrmatn, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", 0 )
2124GAME( 1987, extrmatj, extrmatn, arknoid2, extrmatn, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", 0 )
21252125GAME( 1987, arknoid2, 0,        arknoid2, arknoid2, arknoid2, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", 0 )
21262126GAME( 1987, arknid2u, arknoid2, arknoid2, arknid2u, arknoid2, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", 0 )
21272127GAME( 1987, arknid2j, arknoid2, arknoid2, arknid2u, arknoid2, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", 0 )
src/mame/drivers/vball.c
r1281r1282
191191   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
192192ADDRESS_MAP_END
193193
194WRITE8_HANDLER(vb_scrollx_lo_w)
194static WRITE8_HANDLER(vb_scrollx_lo_w)
195195{
196196   vb_scrollx_lo = data;
197197   //logerror("%04x: vb_scrollx_lo =%d\n",activecpu_get_previouspc(), vb_scrollx_lo);
src/mame/drivers/afega.c
r1281r1282
8181
8282***************************************************************************/
8383
84READ16_HANDLER( afega_unknown_r )
84static READ16_HANDLER( afega_unknown_r )
8585{
8686   /* This fixes the text in Service Mode. */
8787   return 0x0100;
8888}
8989
90WRITE16_HANDLER( afega_soundlatch_w )
90static WRITE16_HANDLER( afega_soundlatch_w )
9191{
9292   if (ACCESSING_LSB)
9393   {
src/mame/drivers/nemesis.c
r1281r1282
6565VIDEO_UPDATE( nemesis );
6666VIDEO_START( nemesis );
6767VIDEO_UPDATE( salamand );
68MACHINE_RESET( nemesis );
68static MACHINE_RESET( nemesis );
6969
7070WRITE16_HANDLER( nemesis_gfx_flipx_w );
7171WRITE16_HANDLER( nemesis_gfx_flipy_w );
r1281r1282
8181static int irq4_on = 0;
8282
8383
84MACHINE_RESET( nemesis )
84static MACHINE_RESET( nemesis )
8585{
8686   irq_on = 0;
8787   irq1_on = 0;
r1281r1282
9898}
9999
100100
101WRITE16_HANDLER( salamand_soundlatch_word_w )
101static WRITE16_HANDLER( salamand_soundlatch_word_w )
102102{
103103   if(ACCESSING_LSB) {
104104      soundlatch_w(offset,data & 0xff);
r1281r1282
138138   }
139139}
140140
141WRITE16_HANDLER( gx400_irq1_enable_word_w )
141static WRITE16_HANDLER( gx400_irq1_enable_word_w )
142142{
143143   if (ACCESSING_LSB)
144144      irq1_on = data & 0x0001;
r1281r1282
146146logerror("irq1en = %08x\n",data);*/
147147}
148148
149WRITE16_HANDLER( gx400_irq2_enable_word_w )
149static WRITE16_HANDLER( gx400_irq2_enable_word_w )
150150{
151151   if (ACCESSING_LSB)
152152      irq2_on = data & 0x0001;
r1281r1282
154154logerror("irq2en = %08x\n",data);*/
155155}
156156
157WRITE16_HANDLER( gx400_irq4_enable_word_w )
157static WRITE16_HANDLER( gx400_irq4_enable_word_w )
158158{
159159   if (ACCESSING_MSB)
160160      irq4_on = data & 0x0100;
r1281r1282
164164
165165static UINT8 *gx400_shared_ram;
166166
167READ16_HANDLER( gx400_sharedram_word_r )
167static READ16_HANDLER( gx400_sharedram_word_r )
168168{
169169   return gx400_shared_ram[offset];
170170}
171171
172WRITE16_HANDLER( gx400_sharedram_word_w )
172static WRITE16_HANDLER( gx400_sharedram_word_w )
173173{
174174   if(ACCESSING_LSB)
175175      gx400_shared_ram[offset] = data;
r1281r1282
189189      cpunum_set_input_line(0, 2, HOLD_LINE);
190190}
191191
192WRITE16_HANDLER( nemesis_irq_enable_word_w )
192static WRITE16_HANDLER( nemesis_irq_enable_word_w )
193193{
194194   if(ACCESSING_LSB)
195195      irq_on = data & 0xff;
196196}
197197
198WRITE16_HANDLER( konamigt_irq_enable_word_w )
198static WRITE16_HANDLER( konamigt_irq_enable_word_w )
199199{
200200   if(ACCESSING_LSB)
201201      irq_on = data & 0xff;
202202}
203203
204WRITE16_HANDLER( konamigt_irq2_enable_word_w )
204static WRITE16_HANDLER( konamigt_irq2_enable_word_w )
205205{
206206   if(ACCESSING_LSB)
207207      irq2_on = data & 0xff;
208208}
209209
210READ16_HANDLER( konamigt_input_word_r )
210static READ16_HANDLER( konamigt_input_word_r )
211211{
212212/*
213213    bit 0-7:   steering
r1281r1282
253253   }
254254}
255255
256WRITE16_HANDLER( nemesis_soundlatch_word_w )
256static WRITE16_HANDLER( nemesis_soundlatch_word_w )
257257{
258258   if(ACCESSING_LSB) {
259259      soundlatch_w(offset,data & 0xff);
r1281r1282
314314   AM_RANGE(0x060000, 0x067fff) AM_WRITE(MWA16_RAM) AM_BASE(&ram)   /* WORK RAM */
315315ADDRESS_MAP_END
316316
317WRITE8_HANDLER( salamand_speech_start_w )
317static WRITE8_HANDLER( salamand_speech_start_w )
318318{
319319        VLM5030_ST ( 1 );
320320        VLM5030_ST ( 0 );
321321}
322322
323WRITE8_HANDLER( gx400_speech_start_w )
323static WRITE8_HANDLER( gx400_speech_start_w )
324324{
325325   /* the voice data is not in a rom but in sound RAM at $8000 */
326326   VLM5030_set_rom (gx400_shared_ram + 0x4000);
src/mame/drivers/progolf.c
r1281r1282
281281ROM_END
282282
283283
284DRIVER_INIT( progolf )
284static DRIVER_INIT( progolf )
285285{
286286   int A;
287287   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/powerbal.c
r1281r1282
362362   }
363363}
364364
365VIDEO_START( powerbal )
365static VIDEO_START( powerbal )
366366{
367367   bg_tilemap = tilemap_create(powerbal_get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
368368
r1281r1282
371371   tilemap_set_scrolly(bg_tilemap, 0, bg_yoffset);
372372}
373373
374VIDEO_UPDATE( powerbal )
374static VIDEO_UPDATE( powerbal )
375375{
376376   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
377377   draw_sprites(machine,bitmap,cliprect);
r1281r1282
577577   ROM_LOAD( "gal22v10b.bin", 0x0400, 0x02e5, NO_DUMP ) /* GAL is soldered */
578578ROM_END
579579
580DRIVER_INIT( powerbal )
580static DRIVER_INIT( powerbal )
581581{
582582   bg_yoffset = 16;
583583   yoffset = -8;
584584}
585585
586DRIVER_INIT( magicstk )
586static DRIVER_INIT( magicstk )
587587{
588588   bg_yoffset = 0;
589589   yoffset = -5;
src/mame/drivers/stv.c
r1281r1282
943943#define HI_WORD_ACCESS (mem_mask & 0x00ff0000) == 0
944944#define LO_WORD_ACCESS (mem_mask & 0x000000ff) == 0
945945
946READ32_HANDLER ( stv_io_r32 )
946static READ32_HANDLER ( stv_io_r32 )
947947{
948948   static int i= -1;
949949   //if(LOG_IOGA) logerror("(PC=%08X): I/O r %08X & %08X\n", activecpu_get_pc(), offset*4, mem_mask);
r1281r1282
10421042   }
10431043}
10441044
1045WRITE32_HANDLER ( stv_io_w32 )
1045static WRITE32_HANDLER ( stv_io_w32 )
10461046{
10471047   //if(LOG_IOGA) logerror("(PC=%08X): I/O w %08X = %08X & %08X\n", activecpu_get_pc(), offset*4, data, mem_mask);
10481048
r1281r1282
12071207#define WORK_RAM_H(_lv_) ((scu_##_lv_ & 0x07ffffff) >= 0x06000000) && ((scu_##_lv_ & 0x07ffffff) <= 0x060fffff)
12081208#define SOUND_RAM(_lv_)  ((scu_##_lv_ & 0x07ffffff) >= 0x05a00000) && ((scu_##_lv_ & 0x07ffffff) <= 0x05afffff)
12091209
1210READ32_HANDLER( stv_scu_r32 )
1210static READ32_HANDLER( stv_scu_r32 )
12111211{
12121212   /*TODO: write only registers must return 0...*/
12131213   //popmessage("%02x",DMA_STATUS);
r1281r1282
12431243      }
12441244}
12451245
1246WRITE32_HANDLER( stv_scu_w32 )
1246static WRITE32_HANDLER( stv_scu_w32 )
12471247{
12481248   COMBINE_DATA(&stv_scu[offset]);
12491249
r1281r1282
20182018
20192019/**************************************************************************************/
20202020
2021WRITE32_HANDLER( stv_sh2_soundram_w )
2021static WRITE32_HANDLER( stv_sh2_soundram_w )
20222022{
20232023   COMBINE_DATA(sound_ram+offset*2+1);
20242024   data >>= 16;
r1281r1282
20262026   COMBINE_DATA(sound_ram+offset*2);
20272027}
20282028
2029READ32_HANDLER( stv_sh2_soundram_r )
2029static READ32_HANDLER( stv_sh2_soundram_r )
20302030{
20312031   return (sound_ram[offset*2]<<16)|sound_ram[offset*2+1];
20322032}
r1281r1282
24702470   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
24712471INPUT_PORTS_END
24722472
2473WRITE32_HANDLER ( w60ffc44_write )
2473static WRITE32_HANDLER ( w60ffc44_write )
24742474{
24752475   COMBINE_DATA(&stv_workram_h[0xffc44/4]);
24762476
r1281r1282
24782478   //sinit_w(offset,data,mem_mask);
24792479}
24802480
2481WRITE32_HANDLER ( w60ffc48_write )
2481static WRITE32_HANDLER ( w60ffc48_write )
24822482{
24832483   COMBINE_DATA(&stv_workram_h[0xffc48/4]);
24842484
r1281r1282
26772677   scsp_irq
26782678};
26792679
2680MACHINE_START( stv )
2680static MACHINE_START( stv )
26812681{
26822682   SCSP_set_ram_base(0, sound_ram);
26832683
r1281r1282
27062706   stv_register_protection_savestates(); // machine/stvprot.c
27072707}
27082708
2709MACHINE_RESET( stv )
2709static MACHINE_RESET( stv )
27102710{
27112711   // don't let the slave cpu and the 68k go anywhere
27122712   cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
src/mame/drivers/megatech.c
r1281r1282
272272UINT8* sms_rom;
273273
274274
275WRITE8_HANDLER( mt_sms_standard_rom_bank_w )
275static WRITE8_HANDLER( mt_sms_standard_rom_bank_w )
276276{
277277   int bank = data&0x1f;
278278   //logerror("bank w %02x %02x\n", offset, data);
r1281r1282
300300   }
301301}
302302
303#ifdef UNUSED_FUNCTION
303304READ8_HANDLER( md_sms_ioport_dc_r )
304305{
305306   return 0xff;//mame_rand(Machine);
r1281r1282
309310{
310311   return 0xff;//mame_rand(Machine);
311312}
313#endif
312314
313315
314316
r1281r1282
497499}
498500
499501
500READ8_HANDLER( megaplay_r0) { return readinputportbytag("BIOS_IN0") ; }
501READ8_HANDLER( megaplay_r1) { return readinputportbytag("BIOS_IN1") ; }
502READ8_HANDLER( megaplay_r2) { return readinputportbytag("BIOS_DSW0") ; }
503READ8_HANDLER( megaplay_r3) { return readinputportbytag("BIOS_DSW1") ; }
502static READ8_HANDLER( megaplay_r0) { return readinputportbytag("BIOS_IN0") ; }
503static READ8_HANDLER( megaplay_r1) { return readinputportbytag("BIOS_IN1") ; }
504static READ8_HANDLER( megaplay_r2) { return readinputportbytag("BIOS_DSW0") ; }
505static READ8_HANDLER( megaplay_r3) { return readinputportbytag("BIOS_DSW1") ; }
504506
505507static int mt_bank_bank_pos = 0;
506508static int mt_bank_partial = 0;
r1281r1282
508510
509511/* this sets 0x300000 which may indicate that the 68k can see the instruction rom
510512   there, this limiting the max game rom capacity to 3meg. */
511WRITE8_HANDLER (mt_z80_bank_w)
513static WRITE8_HANDLER (mt_z80_bank_w)
512514{
513515   mt_bank_partial |= (data & 0x01)<<23; // add new bit to partial address
514516   mt_bank_bank_pos++;
r1281r1282
527529   }
528530}
529531
530READ8_HANDLER( megatech_banked_ram_r )
532static READ8_HANDLER( megatech_banked_ram_r )
531533{
532534   return megatech_banked_ram[offset + 0x1000 * (mt_cart_select_reg&0x7) ];
533535}
534536
535WRITE8_HANDLER( megatech_banked_ram_w )
537static WRITE8_HANDLER( megatech_banked_ram_w )
536538{
537539   megatech_banked_ram[offset + 0x1000 * (mt_cart_select_reg&0x7) ] = data;
538540}
r1281r1282
589591
590592
591593
592DRIVER_INIT(mtnew)
594static DRIVER_INIT(mtnew)
593595{
594596   megatech_banked_ram = auto_malloc(0x1000*8);
595597   driver_init_megadriv(Machine);
596598   driver_init_megatech_bios(Machine);
597599}
598600
599VIDEO_START(mtnew)
601static VIDEO_START(mtnew)
600602{
601603   init_for_megadrive(); // create an sms vdp too, for comptibility mode
602604   video_start_megadriv(Machine);
603605}
604606//time_never
605VIDEO_UPDATE(mtnew)
607static VIDEO_UPDATE(mtnew)
606608{
607609   if (screen ==0)
608610   {
r1281r1282
614616   return 0;
615617}
616618
617VIDEO_EOF(mtnew)
619static VIDEO_EOF(mtnew)
618620{
619621   if (!current_game_is_sms) video_eof_megadriv(Machine);
620622   else video_eof_megatech_md_sms(Machine);
621623   video_eof_megatech_bios(Machine);
622624}
623625
624MACHINE_RESET(mtnew)
626static MACHINE_RESET(mtnew)
625627{
626628   machine_reset_megadriv(Machine);
627629   machine_reset_megatech_bios(Machine);
src/mame/drivers/talbot.c
r1281r1282
152152   SET_TILE_INFO(0, code, color + 0x20, 0);
153153}
154154
155VIDEO_START( talbot )
155static VIDEO_START( talbot )
156156{
157157   bg_tilemap = tilemap_create(get_tile_info_bg, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
158158}
r1281r1282
180180   }
181181}
182182
183VIDEO_UPDATE( talbot )
183static VIDEO_UPDATE( talbot )
184184{
185185   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
186186   draw_sprites(machine, bitmap, cliprect);
187187   return 0;
188188}
189189
190PALETTE_INIT( talbot )
190static PALETTE_INIT( talbot )
191191{
192192   int i;
193193
src/mame/drivers/warriorb.c
r1281r1282
152152#include "sound/2610intf.h"
153153#include "sound/flt_vol.h"
154154
155MACHINE_START( warriorb );
156MACHINE_RESET( taito_dualscreen );
155static MACHINE_START( warriorb );
156static MACHINE_RESET( taito_dualscreen );
157157
158158VIDEO_START( darius2d );
159159VIDEO_START( warriorb );
r1281r1282
195195
196196static int ninjaw_pandata[4];      /**** sound pan control ****/
197197
198WRITE8_HANDLER( warriorb_pancontrol )
198static WRITE8_HANDLER( warriorb_pancontrol )
199199{
200200   offset = offset&3;
201201   ninjaw_pandata[offset] = (data<<1) + data;   /* original volume*3 */
r1281r1282
737737ROM_END
738738
739739
740MACHINE_START( warriorb )
740static MACHINE_START( warriorb )
741741{
742742   state_save_register_global(banknum);
743743   state_save_register_func_postload(reset_sound_region);
744744}
745745
746MACHINE_RESET( taito_dualscreen )
746static MACHINE_RESET( taito_dualscreen )
747747{
748748   /**** mixer control enable ****/
749749   sound_global_enable( 1 );   /* mixer enabled */
src/mame/drivers/igs_blit.c
r1281r1282
7373}
7474
7575
76VIDEO_START(igs)
76static VIDEO_START(igs)
7777{
7878   int i;
7979
r1281r1282
8585   chmplst2_pen_hi = 0;
8686}
8787
88VIDEO_UPDATE(igs)
88static VIDEO_UPDATE(igs)
8989{
9090#ifdef MAME_DEBUG
9191   int layer_enable = -1;
r1281r1282
26332633
26342634
26352635
2636DRIVER_INIT( vbowl )
2636static DRIVER_INIT( vbowl )
26372637{
26382638   UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1);
26392639   UINT8  *gfx = (UINT8 *)  memory_region(REGION_GFX1);
r1281r1282
26512651   rom[0x3764/2] = 0x4e75;   // 003764: 4E56 0000 link    A6, #$0
26522652}
26532653
2654DRIVER_INIT( vbowlj )
2654static DRIVER_INIT( vbowlj )
26552655{
26562656   UINT16 *rom = (UINT16 *) memory_region(REGION_CPU1);
26572657   UINT8  *gfx = (UINT8 *)  memory_region(REGION_GFX1);
src/mame/drivers/vamphalf.c
r1281r1282
554554   }
555555}
556556
557NVRAM_HANDLER( finalgdr )
557static NVRAM_HANDLER( finalgdr )
558558{
559559   if (read_or_write)
560560   {
r1281r1282
12881288}
12891289
12901290
1291DRIVER_INIT( vamphalf )
1291static DRIVER_INIT( vamphalf )
12921292{
12931293   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0004a6d0, 0x0004a6d3, 0, 0, vamphalf_speedup_r );
12941294
r1281r1282
12961296   flip_bit = 0x80;
12971297}
12981298
1299DRIVER_INIT( misncrft )
1299static DRIVER_INIT( misncrft )
13001300{
13011301   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x00072eb4, 0x00072eb7, 0, 0, misncrft_speedup_r );
13021302
r1281r1282
13041304   flip_bit = 1;
13051305}
13061306
1307DRIVER_INIT( coolmini )
1307static DRIVER_INIT( coolmini )
13081308{
13091309   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000d2e80, 0x000d2e83, 0, 0, coolmini_speedup_r );
13101310
r1281r1282
13121312   flip_bit = 1;
13131313}
13141314
1315DRIVER_INIT( suplup )
1315static DRIVER_INIT( suplup )
13161316{
13171317   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x0011605c, 0x0011605f, 0, 0, suplup_speedup_r );
13181318
r1281r1282
13201320   /* no flipscreen */
13211321}
13221322
1323DRIVER_INIT( luplup )
1323static DRIVER_INIT( luplup )
13241324{
13251325   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x00115e84, 0x00115e87, 0, 0, luplup_speedup_r );
13261326
r1281r1282
13281328   /* no flipscreen */
13291329}
13301330
1331DRIVER_INIT( luplup29 )
1331static DRIVER_INIT( luplup29 )
13321332{
13331333   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x00113f08, 0x00113f0b, 0, 0, luplup29_speedup_r );
13341334
r1281r1282
13361336   /* no flipscreen */
13371337}
13381338
1339DRIVER_INIT( puzlbang )
1339static DRIVER_INIT( puzlbang )
13401340{
13411341   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x00113ecc, 0x00113ecf, 0, 0, puzlbang_speedup_r );
13421342
r1281r1282
13441344   /* no flipscreen */
13451345}
13461346
1347DRIVER_INIT( wyvernwg )
1347static DRIVER_INIT( wyvernwg )
13481348{
13491349   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x00b56fc, 0x00b56ff, 0, 0, wyvernwg_speedup_r );
13501350
r1281r1282
13551355   semicom_prot_data[1] = 1;
13561356}
13571357
1358DRIVER_INIT( finalgdr )
1358static DRIVER_INIT( finalgdr )
13591359{
13601360   finalgdr_backupram = auto_malloc(0x80*0x100);
13611361   memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0x005e874, 0x005e877, 0, 0, finalgdr_speedup_r );
r1281r1282
13671367   semicom_prot_data[1] = 3;
13681368}
13691369
1370DRIVER_INIT( dquizgo2 )
1370static DRIVER_INIT( dquizgo2 )
13711371{
13721372   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x00cde70, 0x00cde73, 0, 0, dquizgo2_speedup_r );
13731373
src/mame/drivers/1942.c
r1281r1282
430430ROM_END
431431
432432
433DRIVER_INIT( 1942 )
433static DRIVER_INIT( 1942 )
434434{
435435   UINT8 *ROM = memory_region(REGION_CPU1);
436436   memory_configure_bank(1, 0, 3, &ROM[0x10000], 0x4000);
src/mame/drivers/galaxia.c
r1281r1282
2727
2828UINT8 *galaxia_video;
2929
30VIDEO_START( galaxia )
30static VIDEO_START( galaxia )
3131{
3232}
3333
34VIDEO_UPDATE( galaxia )
34static VIDEO_UPDATE( galaxia )
3535{
3636   int x,y, count;
3737
src/mame/drivers/vegaeo.c
r1281r1282
7373}
7474
7575
76READ32_HANDLER( vegaeo_custom_read )
76static READ32_HANDLER( vegaeo_custom_read )
7777{
7878   eolith_speedup_read();
7979   return readinputport(0);
r1281r1282
125125INPUT_PORTS_END
126126
127127
128VIDEO_START( vega )
128static VIDEO_START( vega )
129129{
130130   vega_vram = auto_malloc(0x14000*2);
131131}
132132
133VIDEO_UPDATE( vega )
133static VIDEO_UPDATE( vega )
134134{
135135   int x,y,count;
136136   int color;
r1281r1282
262262   ROM_LOAD( "qs1001a.u86",  0x000000, 0x80000, CRC(d13c6407) SHA1(57b14f97c7d4f9b5d9745d3571a0b7115fbe3176) )
263263ROM_END
264264
265DRIVER_INIT( vegaeo )
265static DRIVER_INIT( vegaeo )
266266{
267267   init_eolith_speedup(machine);
268268}
src/mame/drivers/bombjack.c
r1281r1282
118118   latch = param;
119119}
120120
121WRITE8_HANDLER( bombjack_soundlatch_w )
121static WRITE8_HANDLER( bombjack_soundlatch_w )
122122{
123123   /* make all the CPUs synchronize, and only AFTER that write the new command to the latch */
124124   timer_call_after_resynch(data,soundlatch_callback);
125125}
126126
127READ8_HANDLER( bombjack_soundlatch_r )
127static READ8_HANDLER( bombjack_soundlatch_r )
128128{
129129   int res;
130130
src/mame/drivers/igs_m68.c
r1281r1282
1818#include "driver.h"
1919#include "sound/okim6295.h"
2020
21VIDEO_START(igs_m68)
21static VIDEO_START(igs_m68)
2222{
2323}
2424
25VIDEO_UPDATE(igs_m68)
25static VIDEO_UPDATE(igs_m68)
2626{
2727   return 0;
2828}
src/mame/drivers/bnstars.c
r1281r1282
464464}
465465
466466
467VIDEO_START(bnstars)
467static VIDEO_START(bnstars)
468468{
469469   ms32_tx_tilemap[0] = tilemap_create(get_ms32_tx0_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,64);
470470   ms32_tx_tilemap[1] = tilemap_create(get_ms32_tx1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,64);
r1281r1282
488488
489489
490490
491VIDEO_UPDATE(bnstars)
491static VIDEO_UPDATE(bnstars)
492492{
493493
494494   fillbitmap(priority_bitmap,0,cliprect);
src/mame/drivers/unico.c
r1281r1282
3737
3838***************************************************************************/
3939
40READ16_HANDLER ( YM3812_status_port_0_msb_r )   {   return YM3812_status_port_0_r(0) << 8;   }
41WRITE16_HANDLER( YM3812_register_port_0_msb_w )   {   if (ACCESSING_MSB)   YM3812_control_port_0_w(0,data >> 8);   }
42WRITE16_HANDLER( YM3812_data_port_0_msb_w )      {   if (ACCESSING_MSB)   YM3812_write_port_0_w(0,data >> 8);      }
40static READ16_HANDLER ( YM3812_status_port_0_msb_r )   {   return YM3812_status_port_0_r(0) << 8;   }
41static WRITE16_HANDLER( YM3812_register_port_0_msb_w )   {   if (ACCESSING_MSB)   YM3812_control_port_0_w(0,data >> 8);   }
42static WRITE16_HANDLER( YM3812_data_port_0_msb_w )      {   if (ACCESSING_MSB)   YM3812_write_port_0_w(0,data >> 8);      }
4343
4444
4545/*
r1281r1282
637637
638638***************************************************************************/
639639
640MACHINE_RESET( unico )
640static MACHINE_RESET( unico )
641641{
642642}
643643
r1281r1282
655655//  "*10010xxxx"    // erase all    1 00 10xxxx
656656};
657657
658NVRAM_HANDLER( zeropnt2 )
658static NVRAM_HANDLER( zeropnt2 )
659659{
660660   if (read_or_write)
661661      EEPROM_save(file);
r1281r1282
713713                                Zero Point
714714***************************************************************************/
715715
716MACHINE_RESET( zeropt )
716static MACHINE_RESET( zeropt )
717717{
718718   machine_reset_unico(machine);
719719}
src/mame/drivers/blockhl.c
r1281r1282
5858      ram[offset] = data;
5959}
6060
61WRITE8_HANDLER( blockhl_sh_irqtrigger_w )
61static WRITE8_HANDLER( blockhl_sh_irqtrigger_w )
6262{
6363   cpunum_set_input_line_and_vector(1, 0, HOLD_LINE, 0xff);
6464}
src/mame/drivers/arcadia.c
r1281r1282
6969 *
7070 *************************************/
7171
72WRITE16_HANDLER( arcadia_multibios_change_game )
72static WRITE16_HANDLER( arcadia_multibios_change_game )
7373{
7474   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x800000, 0x97ffff, 0, 0, (data == 0) ? MRA16_BANK2 : MRA16_NOP);
7575}
r1281r1282
698698 *************************************/
699699
700700static DRIVER_INIT( none )  {                                                arcadia_init(); }
701DRIVER_INIT( airh )  { generic_decode(REGION_USER3, 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(); }
702DRIVER_INIT( bowl )  { generic_decode(REGION_USER3, 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(); }
703DRIVER_INIT( dart )  { generic_decode(REGION_USER3, 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(); }
704DRIVER_INIT( ldrba ) { generic_decode(REGION_USER3, 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(); }
705DRIVER_INIT( ninj )  { generic_decode(REGION_USER3, 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(); }
706DRIVER_INIT( rdwr )  { generic_decode(REGION_USER3, 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(); }
707DRIVER_INIT( sdwr )  { generic_decode(REGION_USER3, 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(); }
708DRIVER_INIT( socc )  { generic_decode(REGION_USER3, 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(); }
709DRIVER_INIT( sprg )  { generic_decode(REGION_USER3, 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(); }
710DRIVER_INIT( xeon )  { generic_decode(REGION_USER3, 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(); }
701static DRIVER_INIT( airh )  { generic_decode(REGION_USER3, 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(); }
702static DRIVER_INIT( bowl )  { generic_decode(REGION_USER3, 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(); }
703static DRIVER_INIT( dart )  { generic_decode(REGION_USER3, 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(); }
704static DRIVER_INIT( ldrba ) { generic_decode(REGION_USER3, 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(); }
705static DRIVER_INIT( ninj )  { generic_decode(REGION_USER3, 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(); }
706static DRIVER_INIT( rdwr )  { generic_decode(REGION_USER3, 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(); }
707static DRIVER_INIT( sdwr )  { generic_decode(REGION_USER3, 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(); }
708static DRIVER_INIT( socc )  { generic_decode(REGION_USER3, 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(); }
709static DRIVER_INIT( sprg )  { generic_decode(REGION_USER3, 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(); }
710static DRIVER_INIT( xeon )  { generic_decode(REGION_USER3, 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(); }
711711
712712
713713
src/mame/drivers/segag80v.c
r1281r1282
13381338 *
13391339 *************************************/
13401340
1341DRIVER_INIT( elim2 )
1341static DRIVER_INIT( elim2 )
13421342{
13431343   /* configure security */
13441344   sega_security(70);
r1281r1282
13501350}
13511351
13521352
1353DRIVER_INIT( elim4 )
1353static DRIVER_INIT( elim4 )
13541354{
13551355   /* configure security */
13561356   sega_security(76);
r1281r1282
13661366}
13671367
13681368
1369DRIVER_INIT( spacfury )
1369static DRIVER_INIT( spacfury )
13701370{
13711371   /* configure security */
13721372   sega_security(64);
r1281r1282
13801380}
13811381
13821382
1383DRIVER_INIT( zektor )
1383static DRIVER_INIT( zektor )
13841384{
13851385   /* configure security */
13861386   sega_security(82);
r1281r1282
14001400}
14011401
14021402
1403DRIVER_INIT( tacscan )
1403static DRIVER_INIT( tacscan )
14041404{
14051405   /* configure security */
14061406   sega_security(76);
r1281r1282
14181418}
14191419
14201420
1421DRIVER_INIT( startrek )
1421static DRIVER_INIT( startrek )
14221422{
14231423   /* configure security */
14241424   sega_security(64);
src/mame/drivers/ace.c
r1281r1282
5959}
6060#endif
6161
62VIDEO_UPDATE( ace )
62static VIDEO_UPDATE( ace )
6363{
6464   int offs;
6565
src/mame/drivers/vmetal.c
r1281r1282
9595void metro_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
9696WRITE16_HANDLER( metro_paletteram_w );
9797
98READ16_HANDLER ( varia_crom_read )
98static READ16_HANDLER ( varia_crom_read )
9999{
100100   /* game reads the cgrom, result is 7772, verified to be correct on the real board */
101101
r1281r1282
110110}
111111
112112
113READ16_HANDLER ( varia_random )
113static READ16_HANDLER ( varia_random )
114114{
115115//  return mame_rand(Machine);  // dips etc.. weird
116116   return 0xffff;
r1281r1282
127127}
128128
129129
130WRITE16_HANDLER( vmetal_texttileram_w )
130static WRITE16_HANDLER( vmetal_texttileram_w )
131131{
132132   COMBINE_DATA(&vmetal_texttileram[offset]);
133133   tilemap_mark_tile_dirty(vmetal_texttilemap,offset);
134134}
135135
136WRITE16_HANDLER( vmetal_mid1tileram_w )
136static WRITE16_HANDLER( vmetal_mid1tileram_w )
137137{
138138   COMBINE_DATA(&vmetal_mid1tileram[offset]);
139139   tilemap_mark_tile_dirty(vmetal_mid1tilemap,offset);
140140}
141WRITE16_HANDLER( vmetal_mid2tileram_w )
141static WRITE16_HANDLER( vmetal_mid2tileram_w )
142142{
143143   COMBINE_DATA(&vmetal_mid2tileram[offset]);
144144   tilemap_mark_tile_dirty(vmetal_mid2tilemap,offset);
r1281r1282
395395   SET_TILE_INFO(0, tile, color^0xf, TILE_FLIPYX(0x0));
396396}
397397
398VIDEO_START(varia)
398static VIDEO_START(varia)
399399{
400400   vmetal_texttilemap = tilemap_create(get_vmetal_texttilemap_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,      8, 8, 256,256);
401401   vmetal_mid1tilemap = tilemap_create(get_vmetal_mid1tilemap_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,      16,16, 256,256);
r1281r1282
405405   tilemap_set_transparent_pen(vmetal_mid2tilemap,0);
406406}
407407
408VIDEO_UPDATE(varia)
408static VIDEO_UPDATE(varia)
409409{
410410   fillbitmap(bitmap, get_black_pen(machine), cliprect);
411411   fillbitmap(priority_bitmap,0,cliprect);
src/mame/drivers/dreamwld.c
r1281r1282
106106}
107107
108108
109WRITE32_HANDLER( dreamwld_bg_videoram_w )
109static WRITE32_HANDLER( dreamwld_bg_videoram_w )
110110{
111111   COMBINE_DATA(&dreamwld_bg_videoram[offset]);
112112   tilemap_mark_tile_dirty(dreamwld_bg_tilemap,offset*2);
r1281r1282
124124}
125125
126126
127WRITE32_HANDLER( dreamwld_bg2_videoram_w )
127static WRITE32_HANDLER( dreamwld_bg2_videoram_w )
128128{
129129   COMBINE_DATA(&dreamwld_bg2_videoram[offset]);
130130   tilemap_mark_tile_dirty(dreamwld_bg2_tilemap,offset*2);
r1281r1282
140140   SET_TILE_INFO(1,tileno+dreamwld_tilebank[1]*0x2000,0xc0+colour,0);
141141}
142142
143VIDEO_START(dreamwld)
143static VIDEO_START(dreamwld)
144144{
145145   dreamwld_bg_tilemap = tilemap_create(get_dreamwld_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,      16, 16, 64,32);
146146   dreamwld_bg2_tilemap = tilemap_create(get_dreamwld_bg2_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,      16, 16, 64,32);
r1281r1282
149149   dreamwld_tilebank[0] = dreamwld_tilebank[1] = 0;
150150}
151151
152VIDEO_UPDATE(dreamwld)
152static VIDEO_UPDATE(dreamwld)
153153{
154154   tilemap_set_scrolly( dreamwld_bg_tilemap,0, dreamwld_bg_scroll[(0x400/4)]+32 );
155155   tilemap_set_scrolly( dreamwld_bg2_tilemap,0, dreamwld_bg_scroll[(0x400/4)+2]+32 );
r1281r1282
202202   return x|(x<<16);
203203}
204204
205WRITE32_HANDLER( dreamwld_palette_w )
205static WRITE32_HANDLER( dreamwld_palette_w )
206206{
207207   UINT16 dat;
208208   int color;
src/mame/drivers/xain.c
r1281r1282
692692
693693
694694
695DRIVER_INIT( xsleena )
695static DRIVER_INIT( xsleena )
696696{
697697   UINT8 *RAM = memory_region(REGION_CPU1);
698698
r1281r1282
705705   RAM[0xd48d] = 0x12;
706706}
707707
708DRIVER_INIT( solarwar )
708static DRIVER_INIT( solarwar )
709709{
710710   UINT8 *RAM = memory_region(REGION_CPU1);
711711
src/mame/drivers/mrdo.c
r1281r1282
3131
3232/* this looks like some kind of protection. The game doesn't clear the screen */
3333/* if a read from this address doesn't return the value it expects. */
34READ8_HANDLER( mrdo_SECRE_r )
34static READ8_HANDLER( mrdo_SECRE_r )
3535{
3636   UINT8 *RAM = memory_region(REGION_CPU1);
3737   return RAM[ activecpu_get_reg(Z80_HL) ];
src/mame/drivers/mainevt.c
r1281r1282
5656}
5757
5858
59WRITE8_HANDLER( mainevt_bankswitch_w )
59static WRITE8_HANDLER( mainevt_bankswitch_w )
6060{
6161   UINT8 *RAM = memory_region(REGION_CPU1);
6262   int bankaddress;
r1281r1282
7676   /* other bits unused */
7777}
7878
79WRITE8_HANDLER( mainevt_coin_w )
79static WRITE8_HANDLER( mainevt_coin_w )
8080{
8181   coin_counter_w(0,data & 0x10);
8282   coin_counter_w(1,data & 0x20);
r1281r1282
8686   set_led_status(3,data & 0x08);
8787}
8888
89WRITE8_HANDLER( mainevt_sh_irqtrigger_w )
89static WRITE8_HANDLER( mainevt_sh_irqtrigger_w )
9090{
9191   cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff);
9292}
9393
94WRITE8_HANDLER( mainevt_sh_irqcontrol_w )
94static WRITE8_HANDLER( mainevt_sh_irqcontrol_w )
9595{
9696   upd7759_reset_w(0, data & 2);
9797   upd7759_start_w(0, data & 1);
r1281r1282
9999   interrupt_enable_w(0,data & 4);
100100}
101101
102WRITE8_HANDLER( devstor_sh_irqcontrol_w )
102static WRITE8_HANDLER( devstor_sh_irqcontrol_w )
103103{
104104interrupt_enable_w(0,data & 4);
105105}
106106
107WRITE8_HANDLER( mainevt_sh_bankswitch_w )
107static WRITE8_HANDLER( mainevt_sh_bankswitch_w )
108108{
109109   int bank_A,bank_B;
110110
src/mame/drivers/m62.c
r1281r1282
128128/* service mode to test the ROMs. */
129129static int ldrun2_bankswap;
130130
131READ8_HANDLER( ldrun2_bankswitch_r )
131static READ8_HANDLER( ldrun2_bankswitch_r )
132132{
133133   if (ldrun2_bankswap)
134134   {
r1281r1282
141141   return 0;
142142}
143143
144WRITE8_HANDLER( ldrun2_bankswitch_w )
144static WRITE8_HANDLER( ldrun2_bankswitch_w )
145145{
146146   static int bankcontrol[2];
147147   static const int banks[30] =
r1281r1282
175175/* Lode Runner 3 has, it seems, a poor man's protection consisting of a PAL */
176176/* (I think; it's included in the ROM set) which is read at certain times, */
177177/* and the game crashes if it doesn't match the expected values. */
178READ8_HANDLER( ldrun3_prot_5_r )
178static READ8_HANDLER( ldrun3_prot_5_r )
179179{
180180   return 5;
181181}
182182
183READ8_HANDLER( ldrun3_prot_7_r )
183static READ8_HANDLER( ldrun3_prot_7_r )
184184{
185185   return 7;
186186}
187187
188188
189WRITE8_HANDLER( ldrun4_bankswitch_w )
189static WRITE8_HANDLER( ldrun4_bankswitch_w )
190190{
191191   memory_set_bank(1, data & 0x01);
192192}
src/mame/drivers/megazone.c
r1281r1282
3737
3838
3939
40READ8_HANDLER( megazone_portA_r )
40static READ8_HANDLER( megazone_portA_r )
4141{
4242   int clock,timer;
4343
r1281r1282
7575   }
7676}
7777
78WRITE8_HANDLER( megazone_videoram2_w )
78static WRITE8_HANDLER( megazone_videoram2_w )
7979{
8080   if (megazone_videoram2[offset] != data)
8181   {
r1281r1282
8383   }
8484}
8585
86WRITE8_HANDLER( megazone_colorram2_w )
86static WRITE8_HANDLER( megazone_colorram2_w )
8787{
8888   if (megazone_colorram2[offset] != data)
8989   {
r1281r1282
9191   }
9292}
9393
94READ8_HANDLER( megazone_sharedram_r )
94static READ8_HANDLER( megazone_sharedram_r )
9595{
9696   return(megazone_sharedram[offset]);
9797}
9898
99WRITE8_HANDLER( megazone_sharedram_w )
99static WRITE8_HANDLER( megazone_sharedram_w )
100100{
101101   megazone_sharedram[offset] = data;
102102}
src/mame/drivers/deco156.c
r1281r1282
3333}
3434
3535
36VIDEO_START( wcvol95 )
36static VIDEO_START( wcvol95 )
3737{
3838   /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
3939   deco16_pf1_data = auto_malloc(0x2000);
r1281r1282
135135
136136
137137
138VIDEO_UPDATE( wcvol95 )
138static VIDEO_UPDATE( wcvol95 )
139139{
140140   fillbitmap(priority_bitmap,0,NULL);
141141   fillbitmap(bitmap,0,NULL);
r1281r1282
228228}
229229
230230/***************************************************************************/
231READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
232READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { return deco16_pf2_rowscroll[offset]^0xffff0000; }
233WRITE32_HANDLER( wcvol95_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf1_rowscroll[offset]); }
234WRITE32_HANDLER( wcvol95_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf2_rowscroll[offset]); }
235READ32_HANDLER ( wcvol95_pf12_control_r ) { return deco16_pf12_control[offset]^0xffff0000; }
236WRITE32_HANDLER( wcvol95_pf12_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf12_control[offset]); }
237READ32_HANDLER( wcvol95_pf1_data_r ) {   return deco16_pf1_data[offset]^0xffff0000; }
238READ32_HANDLER( wcvol95_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
239WRITE32_HANDLER( wcvol95_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
240WRITE32_HANDLER( wcvol95_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
231static READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
232static READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { return deco16_pf2_rowscroll[offset]^0xffff0000; }
233static WRITE32_HANDLER( wcvol95_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf1_rowscroll[offset]); }
234static WRITE32_HANDLER( wcvol95_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf2_rowscroll[offset]); }
235static READ32_HANDLER ( wcvol95_pf12_control_r ) { return deco16_pf12_control[offset]^0xffff0000; }
236static WRITE32_HANDLER( wcvol95_pf12_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf12_control[offset]); }
237static READ32_HANDLER( wcvol95_pf1_data_r ) {   return deco16_pf1_data[offset]^0xffff0000; }
238static READ32_HANDLER( wcvol95_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
239static WRITE32_HANDLER( wcvol95_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
240static WRITE32_HANDLER( wcvol95_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
241241
242242
243243static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/toki.c
r1281r1282
718718}
719719
720720
721DRIVER_INIT( tokib )
721static DRIVER_INIT( tokib )
722722{
723723   UINT8 *temp = malloc_or_die(65536 * 2);
724724   int i, offs;
r1281r1282
756756      free (temp);
757757}
758758
759DRIVER_INIT(jujub)
759static DRIVER_INIT(jujub)
760760{
761761   /* Program ROMs are bitswapped */
762762   {
src/mame/drivers/dwarfd.c
r1281r1282
141141int i8275CursorFormat;
142142int i8275HorizontalRetrace;
143143
144WRITE8_HANDLER (i8275_preg_w) //param reg
144static WRITE8_HANDLER (i8275_preg_w) //param reg
145145{
146146   switch(i8275Command)
147147   {
r1281r1282
255255
256256}
257257
258READ8_HANDLER (i8275_preg_r) //param reg
258static READ8_HANDLER (i8275_preg_r) //param reg
259259{
260260
261261
262262   return 0;
263263}
264264
265WRITE8_HANDLER (i8275_creg_w) //comand reg
265static WRITE8_HANDLER (i8275_creg_w) //comand reg
266266{
267267   switch(data>>5)
268268   {
r1281r1282
300300   }
301301}
302302
303READ8_HANDLER (i8275_sreg_r) //status
303static READ8_HANDLER (i8275_sreg_r) //status
304304{
305305   return 0;
306306}
r1281r1282
457457
458458
459459
460VIDEO_START(dwarfd)
460static VIDEO_START(dwarfd)
461461{
462462}
463463
r1281r1282
527527}
528528
529529
530VIDEO_UPDATE( dwarfd )
530static VIDEO_UPDATE( dwarfd )
531531{
532532   fillbitmap(bitmap, get_black_pen(machine), cliprect);
533533   drawCrt(machine,bitmap,cliprect);
r1281r1282
655655   GFXDECODE_ENTRY( REGION_GFX2, 0, tiles8x8_layout3, 0, 16 )
656656GFXDECODE_END
657657
658PALETTE_INIT(dwarfd)
658static PALETTE_INIT(dwarfd)
659659{
660660   int i;
661661
src/mame/drivers/renegade.c
r1281r1282
253253   state_save_register_func_postload(setbank);
254254}
255255
256DRIVER_INIT( kuniokun )
256static DRIVER_INIT( kuniokun )
257257{
258258   mcu_type = 0x85;
259259   mcu_encrypt_table = kuniokun_xor_table;
260260   mcu_encrypt_table_len = 0x2a;
261261}
262262
263DRIVER_INIT( renegade )
263static DRIVER_INIT( renegade )
264264{
265265   mcu_type = 0xda;
266266   mcu_encrypt_table = renegade_xor_table;
src/mame/drivers/sg1000a.c
r1281r1282
316316 *
317317 *************************************/
318318
319DRIVER_INIT( sg1000a )
319static DRIVER_INIT( sg1000a )
320320{
321321   TMS9928A_configure(&tms9928a_interface);
322322}
323323
324DRIVER_INIT(chwrestl)
324static DRIVER_INIT(chwrestl)
325325{
326326   driver_init_sg1000a(machine);
327327   regulus_decode();
src/mame/drivers/panicr.c
r1281r1282
6666static UINT8 *scrollram;
6767static UINT8 *mainram;
6868
69PALETTE_INIT( panicr )
69static PALETTE_INIT( panicr )
7070{
7171   int i;
7272
r1281r1282
164164   AM_RANGE(0xf0000, 0xfffff) AM_ROM
165165ADDRESS_MAP_END
166166
167VIDEO_START( panicr )
167static VIDEO_START( panicr )
168168{
169169   bgtilemap = tilemap_create( get_bgtile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,1024,16 );
170170   txttilemap = tilemap_create( get_txttile_info,tilemap_scan_rows,TILEMAP_TYPE_COLORTABLE,8,8,32,32 );
r1281r1282
194194   }
195195}
196196
197VIDEO_UPDATE( panicr)
197static VIDEO_UPDATE( panicr)
198198{
199199   fillbitmap(bitmap,get_black_pen(machine),cliprect);
200200   tilemap_mark_all_tiles_dirty( txttilemap );
src/mame/drivers/istellar.c
r1281r1282
4242static UINT8 z80_2_nmi_enable;
4343
4444/* VIDEO GOODS */
45VIDEO_UPDATE( istellar )
45static VIDEO_UPDATE( istellar )
4646{
4747   int charx, chary;
4848
r1281r1282
8686
8787/* MEMORY HANDLERS */
8888/* Z80 0 R/W */
89READ8_HANDLER(z80_0_latch1_read)
89static READ8_HANDLER(z80_0_latch1_read)
9090{
9191   /*logerror("CPU0 : reading LDP status latch (%x)\n", ldp_latch1);*/
9292   return ldp_latch1;
9393}
9494
95WRITE8_HANDLER(z80_0_latch2_write)
95static WRITE8_HANDLER(z80_0_latch2_write)
9696{
9797   /*logerror("CPU0 : writing cpu_latch2 (%x).  Potentially followed by an IRQ.\n", data);*/
9898   ldp_latch2 = data;
r1281r1282
111111
112112
113113/* Z80 2 R/W */
114READ8_HANDLER(z80_2_ldp_read)
114static READ8_HANDLER(z80_2_ldp_read)
115115{
116116   UINT8 readResult = laserdisc_data_r(discinfo);
117117   logerror("CPU2 : reading LDP : %x\n", readResult);
118118   return readResult;
119119}
120120
121READ8_HANDLER(z80_2_latch2_read)
121static READ8_HANDLER(z80_2_latch2_read)
122122{
123123   logerror("CPU2 : reading latch2 (%x)\n", ldp_latch2);
124124   return ldp_latch2;
125125}
126126
127READ8_HANDLER(z80_2_nmienable)
127static READ8_HANDLER(z80_2_nmienable)
128128{
129129   logerror("CPU2 : ENABLING NMI\n");
130130   z80_2_nmi_enable = 1;
131131   return 0x00;
132132}
133133
134READ8_HANDLER(z80_2_unknown_read)
134static READ8_HANDLER(z80_2_unknown_read)
135135{
136136   logerror("CPU2 : c000!\n");
137137   return 0x00;
138138}
139139
140WRITE8_HANDLER(z80_2_latch1_write)
140static WRITE8_HANDLER(z80_2_latch1_write)
141141{
142142   logerror("CPU2 : writing latch1 (%x)\n", data);
143143   ldp_latch1 = data;
144144}
145145
146WRITE8_HANDLER(z80_2_ldp_write)
146static WRITE8_HANDLER(z80_2_ldp_write)
147147{
148148   logerror("CPU2 : writing LDP : 0x%x\n", data);
149149   laserdisc_data_w(discinfo,data);
r1281r1282
254254   /* SERVICE might be hanging out back here */
255255INPUT_PORTS_END
256256
257PALETTE_INIT( istellar )
257static PALETTE_INIT( istellar )
258258{
259259   int i;
260260
src/mame/drivers/sbowling.c
r1281r1282
9191   }
9292}
9393
94VIDEO_UPDATE(sbowling)
94static VIDEO_UPDATE(sbowling)
9595{
9696   fillbitmap(bitmap,machine->pens[0x18],cliprect);
9797   tilemap_draw(bitmap,cliprect,sb_tilemap,0,0);
r1281r1282
9999   return 0;
100100}
101101
102VIDEO_START(sbowling)
102static VIDEO_START(sbowling)
103103{
104104   tmpbitmap = auto_bitmap_alloc(32*8,32*8,machine->screen[0].format);
105105   sb_tilemap = tilemap_create(get_sb_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
src/mame/drivers/psychic5.c
r1281r1282
328328static int psychic5_bank_latch = 0x0;
329329
330330
331READ8_HANDLER( psychic5_bankselect_r )
331static READ8_HANDLER( psychic5_bankselect_r )
332332{
333333   return psychic5_bank_latch;
334334}
335335
336WRITE8_HANDLER( psychic5_bankselect_w )
336static WRITE8_HANDLER( psychic5_bankselect_w )
337337{
338338   UINT8 *RAM = memory_region(REGION_CPU1);
339339   int bankaddress;
r1281r1282
346346   }
347347}
348348
349WRITE8_HANDLER( psychic5_coin_counter_w )
349static WRITE8_HANDLER( psychic5_coin_counter_w )
350350{
351351   coin_counter_w(0, data & 0x01);
352352   coin_counter_w(1, data & 0x02);
src/mame/drivers/good.c
r1281r1282
6868
6969
7070
71VIDEO_START( good )
71static VIDEO_START( good )
7272{
7373   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 16, 16, 32,32);
7474   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 16, 16, 32,32);
7575   tilemap_set_transparent_pen(fg_tilemap,0xf);
7676}
7777
78VIDEO_UPDATE( good )
78static VIDEO_UPDATE( good )
7979{
8080   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
8181   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
src/mame/drivers/ginganin.c
r1281r1282
461461
462462
463463
464DRIVER_INIT( ginganin )
464static DRIVER_INIT( ginganin )
465465{
466466   UINT16 *rom;
467467
src/mame/drivers/quasar.c
r1281r1282
169169   return ans;
170170}
171171
172WRITE8_HANDLER( quasar_bullet_w )
172static WRITE8_HANDLER( quasar_bullet_w )
173173{
174174   cvs_bullet_ram[offset] = (data ^ 0xff);
175175}
r1281r1282
178178static int Quasar_Command=0;
179179//static int sh_page=0;
180180
181WRITE8_HANDLER( quasar_sh_command_w )
181static WRITE8_HANDLER( quasar_sh_command_w )
182182{
183183   // bit 4 = Sound Invader : Linked to an NE555V circuit
184184   // Not handled yet
r1281r1282
190190   Quasar_T1      = (Quasar_Command != 15);
191191}
192192
193READ8_HANDLER( quasar_sh_command_r )
193static READ8_HANDLER( quasar_sh_command_r )
194194{
195195   // Clear T1 signal
196196   Quasar_T1 = 0;
r1281r1282
202202   return (Quasar_Command) + (input_port_5_r(0) & 0x30);
203203}
204204
205READ8_HANDLER( Quasar_T1_r )
205static READ8_HANDLER( Quasar_T1_r )
206206{
207207   return Quasar_T1;
208208}
209209
210WRITE8_HANDLER( Quasar_DAC_w )
210static WRITE8_HANDLER( Quasar_DAC_w )
211211{
212212   DAC_0_signed_data_w(0,data);
213213}
src/mame/drivers/meritm.c
r1281r1282
3131
3232#include "driver.h"
3333
34VIDEO_START(meritm)
34static VIDEO_START(meritm)
3535{
3636}
3737
38VIDEO_UPDATE(meritm)
38static VIDEO_UPDATE(meritm)
3939{
4040   return 0;
4141}
src/mame/drivers/ertictac.c
r1281r1282
359359   }
360360}
361361
362PALETTE_INIT(ertictac)
362static PALETTE_INIT(ertictac)
363363{
364364   int c;
365365
src/mame/drivers/xyonix.c
r1281r1282
8080}
8181
8282
83READ8_HANDLER ( xyonix_io_r )
83static READ8_HANDLER ( xyonix_io_r )
8484{
8585   int regPC = activecpu_get_pc();
8686
r1281r1282
140140   return 0xff;
141141}
142142
143WRITE8_HANDLER ( xyonix_io_w )
143static WRITE8_HANDLER ( xyonix_io_w )
144144{
145145//  logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, activecpu_get_pc());
146146   e0_data = data;
src/mame/drivers/mirage.c
r1281r1282
107107   return ((bank>>4)&0x7) * 0x1000;
108108}
109109
110VIDEO_START(mirage)
110static VIDEO_START(mirage)
111111{
112112   deco16_1_video_init();
113113
r1281r1282
115115   deco16_set_tilemap_bank_callback(1, mirage_bank_callback);
116116}
117117
118VIDEO_UPDATE(mirage)
118static VIDEO_UPDATE(mirage)
119119{
120120   flip_screen_set( deco16_pf12_control[0]&0x80 );
121121   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
r1281r1282
135135   return readinputportbytag("SYSTEM_IN");
136136}
137137
138READ16_HANDLER( random_readers )
138static READ16_HANDLER( random_readers )
139139{
140140   return mame_rand(Machine);
141141}
142142
143READ16_HANDLER( mirage_input_r )
143static READ16_HANDLER( mirage_input_r )
144144{
145145   UINT16 port = readinputportbytag("MIRAGE0");
146146   return port;
src/mame/drivers/missile.c
r1281r1282
531531 *
532532 *************************************/
533533
534VIDEO_UPDATE( missile )
534static VIDEO_UPDATE( missile )
535535{
536536   int x, y;
537537
src/mame/drivers/go2000.c
r1281r1282
127127   8*32
128128};
129129
130VIDEO_START(go2000)
130static VIDEO_START(go2000)
131131{
132132}
133133
134VIDEO_UPDATE(go2000)
134static VIDEO_UPDATE(go2000)
135135{
136136   int x,y;
137137   int count = 0;
src/mame/drivers/djboy.c
r1281r1282
645645/******************************************************************************/
646646static int bankxor;
647647
648DRIVER_INIT( djboy )
648static DRIVER_INIT( djboy )
649649{
650650   bankxor = 0x00;
651651}
652DRIVER_INIT( djboyj )
652static DRIVER_INIT( djboyj )
653653{
654654   bankxor = 0x1f;
655655}
src/mame/drivers/taito_x.c
r1281r1282
995995};
996996
997997
998MACHINE_START( taitox )
998static MACHINE_START( taitox )
999999{
10001000   state_save_register_global(banknum);
10011001   state_save_register_func_postload(reset_sound_region);
r1281r1282
13451345ROM_END
13461346
13471347
1348DRIVER_INIT( kyustrkr )
1348static DRIVER_INIT( kyustrkr )
13491349{
13501350   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x900000, 0x90000f, 0, 0, kyustrkr_input_w);
13511351}
src/mame/drivers/vigilant.c
r1281r1282
3131VIDEO_UPDATE( kikcubic );
3232
3333
34WRITE8_HANDLER( vigilant_bank_select_w )
34static WRITE8_HANDLER( vigilant_bank_select_w )
3535{
3636   int bankaddress;
3737   UINT8 *RAM = memory_region(REGION_CPU1);
r1281r1282
4343/***************************************************************************
4444 vigilant_out2_w
4545 **************************************************************************/
46WRITE8_HANDLER( vigilant_out2_w )
46static WRITE8_HANDLER( vigilant_out2_w )
4747{
4848   /* D0 = FILP = Flip screen? */
4949   /* D1 = COA1 = Coin Counter A? */
r1281r1282
5656//  data & 0x01 cocktail mode
5757}
5858
59WRITE8_HANDLER( kikcubic_coin_w )
59static WRITE8_HANDLER( kikcubic_coin_w )
6060{
6161   /* bits 0 is flip screen */
6262
src/mame/drivers/galivan.c
r1281r1282
988988ROM_END
989989
990990
991WRITE8_HANDLER( youmab_extra_bank_w )
991static WRITE8_HANDLER( youmab_extra_bank_w )
992992{
993993   if (data==0xff)
994994   {
r1281r1282
10041004   }
10051005}
10061006
1007READ8_HANDLER( youmab_8a_r )
1007static READ8_HANDLER( youmab_8a_r )
10081008{
10091009   return mame_rand(Machine);
10101010}
10111011
1012WRITE8_HANDLER( youmab_81_w )
1012static WRITE8_HANDLER( youmab_81_w )
10131013{
10141014   // ??
10151015}
10161016
1017WRITE8_HANDLER( youmab_84_w )
1017static WRITE8_HANDLER( youmab_84_w )
10181018{
10191019   // ??
10201020}
10211021
1022DRIVER_INIT( youmab )
1022static DRIVER_INIT( youmab )
10231023{
10241024   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x82, 0x82, 0, 0, youmab_extra_bank_w); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
10251025   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, MRA8_BANK2);
src/mame/drivers/igs_m027.c
r1281r1282
7979
8080
8181/* TX Layer */
82WRITE32_HANDLER( igs_tx_videoram_w )
82static WRITE32_HANDLER( igs_tx_videoram_w )
8383{
8484   COMBINE_DATA(&igs_tx_videoram[offset]);
8585   tilemap_mark_tile_dirty(igs_tx_tilemap,offset);
r1281r1282
9898}
9999
100100/* BG Layer */
101WRITE32_HANDLER( igs_bg_videoram_w )
101static WRITE32_HANDLER( igs_bg_videoram_w )
102102{
103103   COMBINE_DATA(&igs_bg_videoram[offset]);
104104   tilemap_mark_tile_dirty(igs_bg_tilemap,offset);
r1281r1282
118118
119119
120120/* Pallete Layer */
121WRITE32_HANDLER( igs_pallete32_w )
121static WRITE32_HANDLER( igs_pallete32_w )
122122{
123123   paletteram16=(UINT16 *)igs_pallete32;
124124   COMBINE_DATA(&igs_pallete32[offset]);
r1281r1282
130130
131131
132132
133VIDEO_START(igs_majhong)
133static VIDEO_START(igs_majhong)
134134{
135135   igs_tx_tilemap= tilemap_create(get_tx_tilemap_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
136136   tilemap_set_transparent_pen(igs_tx_tilemap,15);
r1281r1282
140140   logerror("Video START OK!\n");
141141}
142142
143VIDEO_UPDATE(igs_majhong)
143static VIDEO_UPDATE(igs_majhong)
144144{
145145   //??????????
146146   fillbitmap(bitmap,get_black_pen(machine),&machine->screen[0].visarea);
r1281r1282
389389
390390
391391
392DRIVER_INIT( sdwx )
392static DRIVER_INIT( sdwx )
393393{
394394   sdwx_decrypt();
395395   sdwx_gfx_decrypt();
src/mame/drivers/ettrivia.c
r1281r1282
185185   get_tile_info(machine, tileinfo, tile_index, fg_videoram, 1);
186186}
187187
188VIDEO_START( ettrivia )
188static VIDEO_START( ettrivia )
189189{
190190   bg_tilemap = tilemap_create( get_tile_info_bg,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32 );
191191   fg_tilemap = tilemap_create( get_tile_info_fg,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32 );
r1281r1282
193193   tilemap_set_transparent_pen(fg_tilemap,0);
194194}
195195
196VIDEO_UPDATE( ettrivia )
196static VIDEO_UPDATE( ettrivia )
197197{
198198   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
199199   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
src/mame/drivers/splash.c
r1281r1282
9999   AM_RANGE(0xffc000, 0xffffff) AM_READ(MRA16_RAM)         /* Work RAM */
100100ADDRESS_MAP_END
101101
102WRITE16_HANDLER( splash_coin_w )
102static WRITE16_HANDLER( splash_coin_w )
103103{
104104   if (ACCESSING_MSB){
105105      switch ((offset >> 3)){
r1281r1282
877877
878878/* DRIVER INITs */
879879
880DRIVER_INIT( splash )
880static DRIVER_INIT( splash )
881881{
882882   splash_bitmap_type = 0;
883883   splash_sprite_attr2_shift = 8;
884884}
885885
886DRIVER_INIT( splash10 )
886static DRIVER_INIT( splash10 )
887887{
888888   splash_bitmap_type = 0;
889889   splash_sprite_attr2_shift = 0;
890890}
891891
892DRIVER_INIT( roldfrog )
892static DRIVER_INIT( roldfrog )
893893{
894894   splash_bitmap_type = 1;
895895   splash_sprite_attr2_shift = 8;
896896}
897897
898DRIVER_INIT( rebus )
898static DRIVER_INIT( rebus )
899899{
900900   UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1);
901901   splash_bitmap_type = 1;
r1281r1282
923923
924924
925925
926DRIVER_INIT( funystrp )
926static DRIVER_INIT( funystrp )
927927{
928928   UINT16 *ROM = (UINT16 *)memory_region(REGION_CPU1);
929929
src/mame/drivers/jalmah.c
r1281r1282
178178         0);
179179}
180180
181VIDEO_START( jalmah )
181static VIDEO_START( jalmah )
182182{
183183   sc0_tilemap = tilemap_create(get_sc0_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
184184   sc1_tilemap = tilemap_create(get_sc1_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,32);
r1281r1282
330330   tilemap_draw(bitmap,cliprect,_tilemap_,(opaque & 1) ? 0 : TILEMAP_DRAW_OPAQUE,0); \
331331   if(!opaque) { opaque = 1; }
332332
333VIDEO_UPDATE( jalmah )
333static VIDEO_UPDATE( jalmah )
334334{
335335   int opaque = 0;
336336   #ifdef MAME_DEBUG
r1281r1282
434434   tilemap_mark_tile_dirty(sc2_tilemap,offset);
435435}
436436
437WRITE16_HANDLER( jalmah_tilebank_w )
437static WRITE16_HANDLER( jalmah_tilebank_w )
438438{
439439   /*
440440     xxxx ---- fg bank (used by suchipi)
r1281r1282
489489
490490static UINT8 oki_rom,oki_bank;
491491
492WRITE16_HANDLER( jalmah_okirom_w )
492static WRITE16_HANDLER( jalmah_okirom_w )
493493{
494494   if(ACCESSING_LSB)
495495   {
r1281r1282
513513   }
514514}
515515
516WRITE16_HANDLER( jalmah_flip_screen_w )
516static WRITE16_HANDLER( jalmah_flip_screen_w )
517517{
518518   /*---- ----x flip screen*/
519519   flip_screen_set(data & 1);
src/mame/drivers/supdrapo.c
r1281r1282
2929static tilemap *fg_tilemap;
3030static UINT8 *char_bank;
3131
32WRITE8_HANDLER( supdrapo_videoram_w )
32static WRITE8_HANDLER( supdrapo_videoram_w )
3333{
3434   videoram[offset] = data;
3535   tilemap_mark_tile_dirty(fg_tilemap, offset);
3636}
3737
38#ifdef UNUSED_FUNCTION
3839WRITE8_HANDLER( supdrapo_char_bank_w )
3940{
4041   char_bank[offset] = data;
4142   tilemap_mark_tile_dirty(fg_tilemap, offset);
4243}
44#endif
4345
4446static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
4547   AM_RANGE(0x0000, 0x4fff) AM_READ(MRA8_ROM)
r1281r1282
247249   SET_TILE_INFO( 0, code, 0, 0);
248250}
249251
250VIDEO_START( supdrapo )
252static VIDEO_START( supdrapo )
251253{
252254   fg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
253255}
254256
255VIDEO_UPDATE( supdrapo )
257static VIDEO_UPDATE( supdrapo )
256258{
257259   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
258260
src/mame/drivers/namcos2.c
r1281r1282
45094509ROM_END
45104510
45114511
4512DRIVER_INIT( assault ){
4512static DRIVER_INIT( assault ){
45134513   namcos2_gametype=NAMCOS2_ASSAULT;
45144514}
45154515
4516DRIVER_INIT( assaultj ){
4516static DRIVER_INIT( assaultj ){
45174517   namcos2_gametype=NAMCOS2_ASSAULT_JP;
45184518}
45194519
4520DRIVER_INIT( assaultp ){
4520static DRIVER_INIT( assaultp ){
45214521   namcos2_gametype=NAMCOS2_ASSAULT_PLUS;
45224522}
45234523
4524DRIVER_INIT( burnforc ){
4524static DRIVER_INIT( burnforc ){
45254525    namcos2_gametype=NAMCOS2_BURNING_FORCE;
45264526}
45274527
4528DRIVER_INIT( cosmogng ){
4528static DRIVER_INIT( cosmogng ){
45294529   namcos2_gametype=NAMCOS2_COSMO_GANG;
45304530}
45314531
4532DRIVER_INIT( dsaber ){
4532static DRIVER_INIT( dsaber ){
45334533   namcos2_gametype=NAMCOS2_DRAGON_SABER;
45344534}
45354535
4536DRIVER_INIT( dsaberj ){
4536static DRIVER_INIT( dsaberj ){
45374537   namcos2_gametype=NAMCOS2_DRAGON_SABER;
45384538}
45394539
4540DRIVER_INIT( dirtfoxj ){
4540static DRIVER_INIT( dirtfoxj ){
45414541   namcos2_gametype=NAMCOS2_DIRT_FOX_JP;
45424542}
45434543
4544DRIVER_INIT( finallap ){
4544static DRIVER_INIT( finallap ){
45454545   namcos2_gametype=NAMCOS2_FINAL_LAP;
45464546}
45474547
4548DRIVER_INIT( finalap2 ){
4548static DRIVER_INIT( finalap2 ){
45494549   namcos2_gametype=NAMCOS2_FINAL_LAP_2;
45504550}
45514551
4552DRIVER_INIT( finalap3 ){
4552static DRIVER_INIT( finalap3 ){
45534553   namcos2_gametype=NAMCOS2_FINAL_LAP_3;
45544554}
45554555
4556DRIVER_INIT( finehour ){
4556static DRIVER_INIT( finehour ){
45574557   namcos2_gametype=NAMCOS2_FINEST_HOUR;
45584558}
45594559
4560DRIVER_INIT( fourtrax ){
4560static DRIVER_INIT( fourtrax ){
45614561   namcos2_gametype=NAMCOS2_FOUR_TRAX;
45624562}
45634563
4564DRIVER_INIT( kyukaidk ){
4564static DRIVER_INIT( kyukaidk ){
45654565   namcos2_gametype=NAMCOS2_KYUUKAI_DOUCHUUKI;
45664566}
45674567
4568DRIVER_INIT( marvlanj ){
4568static DRIVER_INIT( marvlanj ){
45694569   namcos2_gametype=NAMCOS2_MARVEL_LAND;
45704570}
45714571
4572DRIVER_INIT( marvland ){
4572static DRIVER_INIT( marvland ){
45734573   namcos2_gametype=NAMCOS2_MARVEL_LAND;
45744574}
45754575
4576DRIVER_INIT( metlhawk )
4576static DRIVER_INIT( metlhawk )
45774577{
45784578   /* unscramble sprites */
45794579   int i, j, k, l;
r1281r1282
46314631   namcos2_gametype=NAMCOS2_METAL_HAWK;
46324632} /* metlhawk */
46334633
4634DRIVER_INIT( mirninja ){
4634static DRIVER_INIT( mirninja ){
46354635   namcos2_gametype=NAMCOS2_MIRAI_NINJA;
46364636}
46374637
4638DRIVER_INIT( ordyne ){
4638static DRIVER_INIT( ordyne ){
46394639   namcos2_gametype=NAMCOS2_ORDYNE;
46404640}
46414641
4642DRIVER_INIT( phelios ){
4642static DRIVER_INIT( phelios ){
46434643   namcos2_gametype=NAMCOS2_PHELIOS;
46444644}
46454645
4646DRIVER_INIT( rthun2 ){
4646static DRIVER_INIT( rthun2 ){
46474647   namcos2_gametype=NAMCOS2_ROLLING_THUNDER_2;
46484648}
46494649
4650DRIVER_INIT( rthun2j ){
4650static DRIVER_INIT( rthun2j ){
46514651   namcos2_gametype=NAMCOS2_ROLLING_THUNDER_2;
46524652}
46534653
4654DRIVER_INIT( sgunner2 ){
4654static DRIVER_INIT( sgunner2 ){
46554655   namcos2_gametype=NAMCOS2_STEEL_GUNNER_2;
46564656}
46574657
4658DRIVER_INIT( sws ){
4658static DRIVER_INIT( sws ){
46594659   namcos2_gametype=NAMCOS2_SUPER_WSTADIUM;
46604660}
46614661
4662DRIVER_INIT( sws92 ){
4662static DRIVER_INIT( sws92 ){
46634663   namcos2_gametype=NAMCOS2_SUPER_WSTADIUM_92;
46644664}
46654665
4666DRIVER_INIT( sws92g ){
4666static DRIVER_INIT( sws92g ){
46674667   namcos2_gametype=NAMCOS2_SUPER_WSTADIUM_92T;
46684668}
46694669
4670DRIVER_INIT( sws93 ){
4670static DRIVER_INIT( sws93 ){
46714671   namcos2_gametype=NAMCOS2_SUPER_WSTADIUM_93;
46724672}
46734673
4674DRIVER_INIT( suzuka8h ){
4674static DRIVER_INIT( suzuka8h ){
46754675        namcos2_gametype=NAMCOS2_SUZUKA_8_HOURS;
46764676}
46774677
4678DRIVER_INIT( suzuk8h2 ){
4678static DRIVER_INIT( suzuk8h2 ){
46794679   namcos2_gametype=NAMCOS2_SUZUKA_8_HOURS_2;
46804680}
46814681
4682DRIVER_INIT( valkyrie ){
4682static DRIVER_INIT( valkyrie ){
46834683   namcos2_gametype=NAMCOS2_VALKYRIE;
46844684}
46854685
4686DRIVER_INIT( gollygho ){
4686static DRIVER_INIT( gollygho ){
46874687   namcos2_gametype=NAMCOS2_GOLLY_GHOST;
46884688}
46894689
4690DRIVER_INIT( bubbletr ){
4690static DRIVER_INIT( bubbletr ){
46914691   namcos2_gametype=NAMCOS2_BUBBLE_TROUBLE;
46924692}
46934693
46944694
46954695
4696DRIVER_INIT( luckywld ){
4696static DRIVER_INIT( luckywld ){
46974697   UINT8 *pData = (UINT8 *)memory_region( REGION_GFX5 );
46984698   int i;
46994699   for( i=0; i<32*0x4000; i++ )
src/mame/drivers/tecmosys.c
r1281r1282
398398
399399
400400
401VIDEO_START(deroon)
401static VIDEO_START(deroon)
402402{
403403   txt_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32*2,32*2);
404404   tilemap_set_transparent_pen(txt_tilemap,0);
r1281r1282
407407
408408
409409
410VIDEO_UPDATE(deroon)
410static VIDEO_UPDATE(deroon)
411411{
412412
413413
src/mame/drivers/exidy440.c
r1281r1282
289289}
290290
291291
292MACHINE_RESET( exidy440 )
292static MACHINE_RESET( exidy440 )
293293{
294294   exidy440_bank = 0xff;
295295   exidy440_bank_select(0);
src/mame/drivers/thayers.c
r1281r1282
6767
6868
6969/* VIDEO GOODS */
70VIDEO_UPDATE( thayers )
70static VIDEO_UPDATE( thayers )
7171{
7272   /* display disc information */
7373   if (discinfo != NULL)
src/mame/drivers/topshoot.c
r1281r1282
296296   return mame_rand(Machine);
297297}
298298
299DRIVER_INIT(topshoot)
299static DRIVER_INIT(topshoot)
300300{
301301   /* hack -- fix vdp emulation instead */
302302   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xC00004, 0xC00005, 0, 0, vdp_fake_r);
src/mame/drivers/merit.c
r1281r1282
113113   question_address = (question_address & 0x00ffff) | (offset << 16);
114114}
115115
116WRITE8_HANDLER( phrcraze_attr_w )
116static WRITE8_HANDLER( phrcraze_attr_w )
117117{
118118   phrcraze_attr[offset] = data;
119119   tilemap_mark_tile_dirty(bg_tilemap,offset);
120120}
121121
122WRITE8_HANDLER( phrcraze_bg_w )
122static WRITE8_HANDLER( phrcraze_bg_w )
123123{
124124   videoram[offset] = data;
125125   tilemap_mark_tile_dirty(bg_tilemap,offset);
r1281r1282
729729}
730730
731731
732VIDEO_START( merit )
732static VIDEO_START( merit )
733733{
734734   bg_tilemap = tilemap_create(get_tile_info_bg,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32);
735735}
736736
737VIDEO_UPDATE( merit )
737static VIDEO_UPDATE( merit )
738738{
739739   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
740740   return 0;
r1281r1282
11891189ROM_END
11901190
11911191
1192DRIVER_INIT( key_0 )
1192static DRIVER_INIT( key_0 )
11931193{
11941194   decryption_key = 0;
11951195}
11961196
1197DRIVER_INIT( key_2 )
1197static DRIVER_INIT( key_2 )
11981198{
11991199   decryption_key = 2;
12001200}
12011201
1202DRIVER_INIT( key_4 )
1202static DRIVER_INIT( key_4 )
12031203{
12041204   decryption_key = 4;
12051205}
12061206
1207DRIVER_INIT( key_5 )
1207static DRIVER_INIT( key_5 )
12081208{
12091209   decryption_key = 5;
12101210}
12111211
1212DRIVER_INIT( key_7 )
1212static DRIVER_INIT( key_7 )
12131213{
12141214   decryption_key = 7;
12151215}
src/mame/drivers/dambustr.c
r1281r1282
2323static int noise_data = 0;
2424
2525
26WRITE8_HANDLER( dambustr_noise_enable_w )
26static WRITE8_HANDLER( dambustr_noise_enable_w )
2727{
2828   if (data != noise_data) {
2929      noise_data = data;
r1281r1282
143143GFXDECODE_END
144144
145145
146DRIVER_INIT(dambustr)
146static DRIVER_INIT(dambustr)
147147{
148148   int i, j, tmp;
149149   int tmpram[16];
src/mame/drivers/pingpong.c
r1281r1282
567567   ROM_LOAD( "pingpong.5h",  0x0120, 0x0100, CRC(8456046a) SHA1(8226f1325c14eb8aed5cd3c3d6bad9f9fd88c5fa) ) /* characters */
568568ROM_END
569569
570DRIVER_INIT( merlinmm )
570static DRIVER_INIT( merlinmm )
571571{
572572   UINT8 *ROM = memory_region(REGION_CPU1);
573573   int i;
r1281r1282
577577      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
578578}
579579
580DRIVER_INIT( cashquiz )
580static DRIVER_INIT( cashquiz )
581581{
582582   UINT8 *ROM;
583583   int i;
src/mame/drivers/ssrj.c
r1281r1282
4747
4848static int oldport=0x80;
4949
50MACHINE_RESET(ssrj)
50static MACHINE_RESET(ssrj)
5151{
5252   UINT8 *rom = memory_region(REGION_CPU1);
5353   memset(&rom[0xc000],0,0x3fff); /* req for some control types */
src/mame/drivers/blmbycar.c
r1281r1282
5252
5353/* The top 64k of samples are banked (16 banks total) */
5454
55WRITE16_HANDLER( blmbycar_okibank_w )
55static WRITE16_HANDLER( blmbycar_okibank_w )
5656{
5757   if (ACCESSING_LSB)
5858   {
r1281r1282
154154   AM_RANGE(0x70007a, 0x70007b) AM_WRITE(blmbycar_pot_wheel_shift_w         )   //
155155ADDRESS_MAP_END
156156
157READ16_HANDLER( waterball_unk_r )
157static READ16_HANDLER( waterball_unk_r )
158158{
159159   static int retvalue = 0;
160160
r1281r1282
542542ROM_END
543543
544544
545DRIVER_INIT( blmbycar )
545static DRIVER_INIT( blmbycar )
546546{
547547   UINT16 *RAM  = (UINT16 *) memory_region(REGION_CPU1);
548548   size_t    size = memory_region_length(REGION_CPU1) / 2;
src/mame/drivers/gbusters.c
r1281r1282
9898}
9999}
100100
101WRITE8_HANDLER( gbusters_sh_irqtrigger_w )
101static WRITE8_HANDLER( gbusters_sh_irqtrigger_w )
102102{
103103   cpunum_set_input_line_and_vector(1,0,HOLD_LINE,0xff);
104104}
src/mame/drivers/megaplay.c
r1281r1282
624624void segae_vdp_ctrl_w ( UINT8 chip, UINT8 data );
625625void segae_vdp_data_w ( UINT8 chip, UINT8 data );
626626
627READ8_HANDLER (megaplay_bios_port_be_bf_r)
627static READ8_HANDLER (megaplay_bios_port_be_bf_r)
628628{
629629   UINT8 temp = 0;
630630
r1281r1282
638638   return temp;
639639}
640640
641WRITE8_HANDLER (megaplay_bios_port_be_bf_w)
641static WRITE8_HANDLER (megaplay_bios_port_be_bf_w)
642642{
643643   switch (offset)
644644   {
r1281r1282
672672extern UINT32 video_update_megadriv(running_machine *machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect);
673673extern void video_start_megadriv(running_machine *machine);
674674
675VIDEO_START(megplay)
675static VIDEO_START(megplay)
676676{
677677   //printf("megplay vs\n");
678678   video_start_megadriv(Machine);
679679   megaplay_start_video_normal(Machine);
680680}
681681
682VIDEO_UPDATE(megplay)
682static VIDEO_UPDATE(megplay)
683683{
684684   //printf("megplay vu\n");
685685   video_update_megadriv(machine,0,bitmap,cliprect);
r1281r1282
981981}
982982
983983
984READ16_HANDLER( megadriv_68k_read_z80_extra_ram )
984static READ16_HANDLER( megadriv_68k_read_z80_extra_ram )
985985{
986986   return ic36_ram[(offset<<1)^1] | (ic36_ram[(offset<<1)]<<8);
987987}
988988
989WRITE16_HANDLER( megadriv_68k_write_z80_extra_ram )
989static WRITE16_HANDLER( megadriv_68k_write_z80_extra_ram )
990990{
991991   if (!ACCESSING_LSB) // byte (MSB) access
992992   {
src/mame/drivers/harddriv.c
r1281r1282
36673667
36683668UINT32 *rddsp32_speedup;
36693669offs_t rddsp32_speedup_pc;
3670READ32_HANDLER( rddsp32_speedup_r )
3670static READ32_HANDLER( rddsp32_speedup_r )
36713671{
36723672   if (activecpu_get_pc() == rddsp32_speedup_pc && (*rddsp32_speedup >> 16) == 0)
36733673   {
src/mame/drivers/m72.c
r1281r1282
472472   memset(m72_videoram2,0,0x4000);
473473}
474474
475READ16_HANDLER( m72_main_mcu_r)
475static READ16_HANDLER( m72_main_mcu_r)
476476{
477477   return protection_ram[offset];
478478}
479479
480WRITE16_HANDLER( m72_main_mcu_w)
480static WRITE16_HANDLER( m72_main_mcu_w)
481481{
482482   COMBINE_DATA(&protection_ram[offset]);
483483}
src/mame/drivers/ohmygod.c
r1281r1282
3939   nosound_kludge_step = 0;
4040}
4141
42WRITE16_HANDLER( ohmygod_ctrl_w )
42static WRITE16_HANDLER( ohmygod_ctrl_w )
4343{
4444   if (ACCESSING_LSB)
4545   {
src/mame/drivers/pokechmp.c
r1281r1282
105105}
106106
107107
108WRITE8_HANDLER( pokechmp_paletteram_w )
108static WRITE8_HANDLER( pokechmp_paletteram_w )
109109{
110110   paletteram[offset] = data;
111111   pokechmp_set_color(offset &0x3ff, 0, 5, 10, (paletteram[offset&0x3ff]<<8) | ( paletteram[ (offset&0x3ff)+0x400 ] )  );
src/mame/drivers/igs_180.c
r1281r1282
1515   SET_TILE_INFO(1, code, 0, 0);
1616}
1717
18VIDEO_START(igs_180)
18static VIDEO_START(igs_180)
1919{
2020   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,32);
2121}
2222
23VIDEO_UPDATE(igs_180)
23static VIDEO_UPDATE(igs_180)
2424{
2525   tilemap_mark_all_tiles_dirty(fg_tilemap);
2626   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
src/mame/drivers/mastboy.c
r1281r1282
457457
458458/* VIDEO EMULATION */
459459
460VIDEO_START(mastboy)
460static VIDEO_START(mastboy)
461461{
462462}
463463
464VIDEO_UPDATE(mastboy)
464static VIDEO_UPDATE(mastboy)
465465{
466466   int y,x,i;
467467   int count = 0x000;
r1281r1282
571571   }
572572}
573573
574WRITE8_HANDLER( mastboy_bank_w )
574static WRITE8_HANDLER( mastboy_bank_w )
575575{
576576   // controls access to banked ram / rom
577577   mastboy_bank = data;
r1281r1282
579579
580580/* Backup RAM access */
581581
582READ8_HANDLER( mastboy_backupram_r )
582static READ8_HANDLER( mastboy_backupram_r )
583583{
584584   return generic_nvram[offset];
585585}
586586
587WRITE8_HANDLER( mastboy_backupram_w )
587static WRITE8_HANDLER( mastboy_backupram_w )
588588{
589589//  if (mastboy_backupram_enabled)
590590//  {
r1281r1282
628628   MSM5205_reset_w(0,data&1);
629629}
630630
631WRITE8_HANDLER( mastboy_msm5205_data_w )
631static WRITE8_HANDLER( mastboy_msm5205_data_w )
632632{
633633   mastboy_m5205_next = data;
634634}
r1281r1282
652652
653653/* Interrupt Handling */
654654
655WRITE8_HANDLER( mastboy_irq0_ack_w )
655static WRITE8_HANDLER( mastboy_irq0_ack_w )
656656{
657657   mastboy_irq0_ack = data;
658658   if ((data&1)==1) cpunum_set_input_line(0,0, CLEAR_LINE);
r1281r1282
708708
709709/* Ports */
710710
711READ8_HANDLER( mastboy_port_38_read )
711static READ8_HANDLER( mastboy_port_38_read )
712712{
713713   return 0x00;
714714}
715715
716READ8_HANDLER( mastboy_nmi_read )
716static READ8_HANDLER( mastboy_nmi_read )
717717{
718718   // this is read in the NMI, it's related to the Z180 MMU I think, must return right value or game jumps to 0000
719719   return 0x00;
r1281r1282
842842
843843/* Machine Functions / Driver */
844844
845MACHINE_RESET( mastboy )
845static MACHINE_RESET( mastboy )
846846{
847847   /* clear some ram */
848848   memset( mastboy_workram,   0x00, 0x01000);
r1281r1282
970970   /*                  0x1c0000 to 0x1fffff EMPTY */
971971ROM_END
972972
973DRIVER_INIT( mastboy )
973static DRIVER_INIT( mastboy )
974974{
975975   mastboy_vram = memory_region( REGION_GFX1 ); // makes decoding the RAM based tiles easier this way
976976}
src/mame/drivers/thedeep.c
r1281r1282
3636
3737static int nmi_enable;
3838
39WRITE8_HANDLER( thedeep_nmi_w )
39static WRITE8_HANDLER( thedeep_nmi_w )
4040{
4141   nmi_enable = data;
4242}
src/mame/drivers/stlforce.c
r1281r1282
405405   ROM_COPY( REGION_USER1, 0x060000, 0x0e0000, 0x020000)
406406ROM_END
407407
408DRIVER_INIT(stlforce)
408static DRIVER_INIT(stlforce)
409409{
410410   stlforce_sprxoffs = 0;
411411   default_eeprom = stlforce_default_eeprom;
412412}
413413
414DRIVER_INIT(twinbrat)
414static DRIVER_INIT(twinbrat)
415415{
416416   stlforce_sprxoffs = 9;
417417   default_eeprom = twinbrat_default_eeprom;
src/mame/drivers/rmhaihai.c
r1281r1282
3535static int gfxbank;
3636static tilemap *bg_tilemap;
3737
38WRITE8_HANDLER( rmhaihai_videoram_w )
38static WRITE8_HANDLER( rmhaihai_videoram_w )
3939{
4040   videoram[offset] = data;
4141   tilemap_mark_tile_dirty(bg_tilemap, offset);
4242}
4343
44WRITE8_HANDLER( rmhaihai_colorram_w )
44static WRITE8_HANDLER( rmhaihai_colorram_w )
4545{
4646   colorram[offset] = data;
4747   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
5656   SET_TILE_INFO(0, code, color, 0);
5757}
5858
59VIDEO_START( rmhaihai )
59static VIDEO_START( rmhaihai )
6060{
6161   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
6262      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
6363}
6464
65VIDEO_UPDATE( rmhaihai )
65static VIDEO_UPDATE( rmhaihai )
6666{
6767   tilemap_draw(bitmap, &machine->screen[0].visarea, bg_tilemap, 0, 0);
6868   return 0;
src/mame/drivers/topspeed.c
r1281r1282
866866ROM_END
867867
868868
869DRIVER_INIT( topspeed )
869static DRIVER_INIT( topspeed )
870870{
871871//  taitosnd_setz80_soundcpu( 2 );
872872
src/mame/drivers/zr107.c
r1281r1282
8181
8282
8383
84VIDEO_START( jetwave )
84static VIDEO_START( jetwave )
8585{
8686   K001005_init();
8787   K001604_vh_start(machine, 0);
8888}
8989
9090
91VIDEO_UPDATE( jetwave )
91static VIDEO_UPDATE( jetwave )
9292{
9393   fillbitmap(bitmap, machine->remapped_colortable[0], cliprect);
9494
r1281r1282
124124   *color += layer * 0x40;
125125}
126126
127VIDEO_START( zr107 )
127static VIDEO_START( zr107 )
128128{
129129   static int scrolld[NUM_LAYERS][4][2] = {
130130       {{ 0, 0}, {0, 0}, {0, 0}, {0, 0}},
r1281r1282
135135   K001005_init();
136136}
137137
138VIDEO_UPDATE( zr107 )
138static VIDEO_UPDATE( zr107 )
139139{
140140   fillbitmap(bitmap, machine->remapped_colortable[0], cliprect);
141141
src/mame/drivers/amspdwy.c
r1281r1282
6060AMSPDWY_WHEEL_R( 1 )
6161
6262
63READ8_HANDLER( amspdwy_sound_r )
63static READ8_HANDLER( amspdwy_sound_r )
6464{
6565   return (YM2151_status_port_0_r(0) & ~ 0x30) | readinputport(4);
6666}
6767
68WRITE8_HANDLER( amspdwy_sound_w )
68static WRITE8_HANDLER( amspdwy_sound_w )
6969{
7070   soundlatch_w(0,data);
7171   cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE);
r1281r1282
103103ADDRESS_MAP_END
104104
105105
106READ8_HANDLER( amspdwy_port_r )
106static READ8_HANDLER( amspdwy_port_r )
107107{
108108   UINT8 *Tracks = memory_region(REGION_CPU1)+0x10000;
109109   return Tracks[offset];
src/mame/drivers/segae.c
r1281r1282
14721472   mame_timer_adjust_ptr(chip->sms_scanline_timer, time_zero, time_zero);
14731473}
14741474
1475#ifdef UNUSED_FUNCTION
14751476VIDEO_EOF(sms)
14761477{
14771478   end_of_frame(vdp1);
14781479   //if (SMS_PAUSE_BUTTON) cpunum_set_input_line(0,INPUT_LINE_NMI,PULSE_LINE); // not on systeme!!!
14791480}
1481#endif
14801482
1481VIDEO_START(sms)
1483static VIDEO_START(sms)
14821484{
14831485
14841486//  vdp->is_pal = 1;
r1281r1282
14861488//  vdp->sms_framerate = 50;
14871489}
14881490
1489
1491#ifdef UNUSED_FUNCTION
14901492MACHINE_RESET(sms)
14911493{
14921494   mame_timer_adjust_ptr(vdp1->sms_scanline_timer, time_zero, time_zero);
14931495}
1496#endif
14941497
14951498/* Sega System E */
14961499
r1281r1282
19441947static UINT8* vdp1_vram_bank1;
19451948static UINT8 f7_bank_value;
19461949
1947MACHINE_RESET(systeme)
1950static MACHINE_RESET(systeme)
19481951{
19491952   mame_timer_adjust_ptr(vdp1->sms_scanline_timer, time_zero, time_zero);
19501953   mame_timer_adjust_ptr(vdp2->sms_scanline_timer, time_zero, time_zero);
r1281r1282
19601963   mame_timer_adjust_ptr(vdp1->sms_scanline_timer, time_zero, time_zero);
19611964}
19621965
1963VIDEO_EOF(systeme)
1966static VIDEO_EOF(systeme)
19641967{
19651968   end_of_frame(vdp1);
19661969   end_of_frame(vdp2);
r1281r1282
20142017   return 0;
20152018}
20162019
2017VIDEO_UPDATE(systeme)
2020static VIDEO_UPDATE(systeme)
20182021{
20192022//  show_tiles();
20202023   int x,y;
r1281r1282
20832086MACHINE_DRIVER_END
20842087
20852088
2086READ8_HANDLER( sms_vdp_2_data_r )
2089static READ8_HANDLER( sms_vdp_2_data_r )
20872090{
20882091   return vdp_data_r(vdp2);
20892092}
20902093
2091WRITE8_HANDLER( sms_vdp_2_data_w )
2094static WRITE8_HANDLER( sms_vdp_2_data_w )
20922095{
20932096   vdp_data_w(data, vdp2);
20942097}
20952098
2096READ8_HANDLER( sms_vdp_2_ctrl_r )
2099static READ8_HANDLER( sms_vdp_2_ctrl_r )
20972100{
20982101   return vdp_ctrl_r(vdp2);
20992102}
21002103
2101WRITE8_HANDLER( sms_vdp_2_ctrl_w )
2104static WRITE8_HANDLER( sms_vdp_2_ctrl_w )
21022105{
21032106   vdp_ctrl_w(data, vdp2);
21042107}
src/mame/drivers/dominob.c
r1281r1282
3333#include "cpu/z80/z80.h"
3434#include "sound/ay8910.h"
3535
36VIDEO_START( dominob )
36static VIDEO_START( dominob )
3737{
3838   machine->gfx[0]->color_granularity=8;
3939}
r1281r1282
7171}
7272
7373
74VIDEO_UPDATE( dominob )
74static VIDEO_UPDATE( dominob )
7575{
7676   /* Convert to tilemaps? */
7777   {
r1281r1282
117117//UINT8 dominob_paddle_select;
118118//UINT8 dominob_paddle_value;
119119
120WRITE8_HANDLER( dominob_d008_w )
120static WRITE8_HANDLER( dominob_d008_w )
121121{
122122   /* is there a purpose on this ? always set to 0x00 (read from 0xc47b in RAM) */
123123}
124124
125READ8_HANDLER( dominob_input_2_r )
125static READ8_HANDLER( dominob_input_2_r )
126126{
127127   return input_port_2_r(offset);
128128}
r1281r1282
149149ADDRESS_MAP_END
150150
151151/* I don't know if this has a purpose - also read in 'arkatayt' but not handled */
152READ8_HANDLER( dominob_unk_port02_r )
152static READ8_HANDLER( dominob_unk_port02_r )
153153{
154154   return 0xff;//mame_rand(Machine);
155155}
src/mame/drivers/bwidow.c
r1281r1282
300300 *
301301 *************************************/
302302
303WRITE8_HANDLER( bwidow_misc_w )
303static WRITE8_HANDLER( bwidow_misc_w )
304304{
305305   /*
306306        0x10 = p1 led
src/mame/drivers/midas.c
r1281r1282
5151
5252static UINT16 *livequiz_gfxram, *livequiz_gfxregs;
5353
54VIDEO_START( livequiz );
55VIDEO_UPDATE( livequiz );
54static VIDEO_START( livequiz );
55static VIDEO_UPDATE( livequiz );
5656
5757static tilemap *tmap;
5858
r1281r1282
6262   SET_TILE_INFO(1, code & 0xfff, (code >> 12) & 0xf, TILE_FLIPXY( 0 ));
6363}
6464
65VIDEO_START( livequiz )
65static VIDEO_START( livequiz )
6666{
6767   tmap = tilemap_create(   get_tile_info, tilemap_scan_cols,
6868                     TILEMAP_TYPE_PEN, 8,8, 0x80,0x20   );
r1281r1282
154154   }
155155}
156156
157VIDEO_UPDATE( livequiz )
157static VIDEO_UPDATE( livequiz )
158158{
159159   int layers_ctrl = -1;
160160
src/mame/drivers/ampoker.c
r1281r1282
1/*
1/********************************************************************************
2
3
4    AMERICAN POKER 2
5    ----------------
6
7    Company:    Novomatic.
8    Year:       1990.
9
10    Original preliminary driver:   Curt Coder.
11    Rewrite and additional work:   Roberto Fresca, with a lot of help of Grull Osgo.
12
13
14    --- Supported Sets ---
15
16    Old name | New name | Relation | Description
17    --------------------------------------------
18    ampokr2b   ampoker2   parent     American Poker II.
19      ----     ampkr2b1   clone      American Poker II (bootleg, set 1).
20    ampokr2a   ampkr2b2   clone      American Poker II (bootleg, set 2).
21    ampoker2   ampkr2b3   clone      American Poker II (bootleg, set 3).
22    ampokr2c   pkrdewin   clone      Poker De Win.
23      ----     ampkr95    clone      American Poker 95.
24      ----     sigmapkr   parent     Sigma Poker.
25      ----     sigma2k    parent     Sigma Poker 2000.
26
27
28*********************************************************************************
29
30
31    Game Notes...
32    -------------
33
34    American Poker II uses a standard deck of 52 cards plus 1 Joker card.
35    The Joker card substitutes for any card. The player places a bet for
36    the 1st hand deal and can then choose to buy a 2nd draw.
37
38    The win combination Jacks or Better is only paid if a 2nd draw is bought.
39
40
41    Operation...
42
43    To 'init' (boot) the machine:
44    1) Turn ON the Operator Key (9).
45    2) Keep pressed the DOOR key (W). You are entering the Operator Mode.
46    3) Turn OFF the Operator Key (9).
47    4) Reset the machine. (you must reset manually the machine due to watchdog issues).
48
49    The set ampkr2b3 has a special init code/key:
50
51    1) Turn ON the Supervisor Key (0).
52    2) Enter the following sequence: HOLD1, HOLD5, HOLD4, HOLD3, HOLD2 and HOLD3.
53    3) Wait till the Supervisor Mode appear, and turn OFF the Supervisor Key (0).
54    4) Reset the machine. (you must reset manually the machine due to watchdog issues).
55
56    ...The key is produced taking 6 bytes at offset 0x5d40 XORed with their respective pairs
57    at offset 0x5d50, resulting the sequence of HOLD keys to init the machine.
58
59
60    Operator Mode:
61    Press '9' once to turn ON the Operator Key. You can find the interim meters (Page 1).
62    Press HOLD3 to clear the meters. Press '9' again to turn OFF the Operator Key.
63    Reset the machine to enter the Game Mode.
64
65    Supervisor Mode:
66    Press '0' once to turn ON the Supervisor Key. You can find the permanent meters (Page 1 to 5).
67    HOLD1, HOLD3 and HOLD5 are the valid keys to navigate through the mode. Press '0' again to turn
68    OFF the Operator Key.
69    Reset the machine to enter the Game Mode.
70
71    To access both modes, no credits should be placed in the machine.
72
73
74    From Novomatic web site:
75
76    "1990 - American Poker II kommt auf den Markt und wird als
77    'The Legend' in die Geschichte des Gl?cksspiels eingehen."
78
79    "1990 - American Poker II comes on the market and is known as
80    'The Legend' in the history of gaming."
81
82
83    ----
84
85
86    Sigma Poker:
87
88    This poker game was also sold as "upgrade kit" for American Poker II taiwanese boards.
89    The game has a lot of improvements. New graphics, sounds, bonus, and a totally new
90    'double-up' feature. Very addictive, in fact.
91
92    Sigma only released 2 games for this hardware: Sigma Poker and Sigma Poker 2000.
93    Both games need some modifications to the original board to be installed.
94    The rest of Sigma poker games (2001 onwards) were developed for B-52 mainboards.
95    (2x 6809; HD63484 video controller).
96
97    Sigma 2000 has better graphics and use 4 times more tiles than other games running
98    on this hardware. To manage this, the game use 2 extra bits from the color RAM.
99
100
101
102*********************************************************************************
103
104
105    --- Technical Notes (in progress) ---
106
107
108
109    DIP Switches
110    ------------
111
112    DIP1       Remote Credits
113    OFF        x100
114    ON         x50
115
116    DIP2       Auto Hold
117    OFF        Off
118    ON         On
119
120    DIP3 DIP4  Rate Tables (*)
121    OFF  OFF   RATE: 1 2 3 4 5 10 20 30 40 50
122    OFF  ON    RATE: 5 10 15 20 25 30 35 40 50 100
123    ON   OFF   RATE: 5 10 15 20 25 30 35 40 45 50
124    ON   ON    RATE: 10 20 30 40 50 60 70 80 90 100
125
126    DIP6       Take Winnings (On Double Up)
127    OFF        Take Part (10 Credits steps)
128    ON         Take All
129
130    DIP8       Jackpot
131    OFF        Off
132    ON         On
133
134
135    (*) Working only in ampkr95.
136
137
138
139    Hardware Notes:
140    --------------
141
142
143    - CPU:            1x Z80@4MHZ or compatible.
144    - Video:          TTL Logic Raster - 6 Mhz Dot Clock
145    - Osc:            6.000 Mhz Xtal.
146    - RAM:            1x 6116 (4Kx8) Static RAM.
147    - VRAM            2x 2016 (4Kx8) Static RAM.
148    - I/O:            8x 74251 ; 8x 74259 (Multiplex 8 Ports > 1 Bit).
149    - PRG ROMs:       1x 27c512 (64Kx8) EPROM or similar.
150    - GFX ROMs:       1x 27c128 (16Kx8) EPROM or similar.
151    - Color PROM:     1x 82S147AN.
152    - Sound:          1x AY-3-8910.
153    - Backup Battery: 1x 3.6 Volt Ni-CD.
154    - DIP Switches:   1x 8 Positions.
155    - Watchdog:       1x TL7705 (Texas Instruments) Refresh: 200 Ms.
156
157
158    Taiwanese PCB Layout:
159     ________________________________________________________________________________
160    |                                                                                |
161    |  ______   _________    _________    ______________    _________   __________   |
162    | | XTAL | | 74LS04  |  | 74LS138 |  |              |  | 74LS163 | |PALCE16V8H|  |
163    | | 6MHz | |_________|  |_________|  |  UM6116-2    |  |_________| |__________|  |
164    | |______|  _________    _________   |______________|   _________   ________  __ |
165    |          | 74LS74A |  | DM7407N |  _______________   | 74LS163 | | 74LS00 ||74||
166    |          |_________|  |_________| |               |  |_________| |________||LS||
167    |  ___________________   _________  |    27C512     |   _________   ________ |08||
168    | |                   | | MC14020 | |_______________|  | 74LS163 | | 74LS157||__||
169    | |BATTERY NI-CD 3.6V | |_________|                    |_________| |________|    |
170    | |___________________|  ___________   _____________    _________   ________     |
171    |____                   | 74LS244   | |   74LS245   |  | 74LS163 | | 74LS157|    |
172         |                  |___________| |_____________|  |_________| |________|    |
173     ____|                                                                           |
174    |_28_                         ______________________    _________   ________     |
175    |____                        |       - Z80A -       |  | 74LS74  | | 74LS157|    |
176    |____                        |     TMPZ84C00AP-6    |  |_________| |________|    |
177    |____                        |______________________|   __________  __________   |
178    |____                     ___________    ____________  |PALCE16V8H||D4016CX-20|  |
179    |____                    | 74LS244N  |  |  74LS259N  | |__________||__________|  |
180    |____                    |___________|  |____________|  ________    __________   |
181    |____                     ___________     __________   | 74LS02 |  |D4016CX-20|  |
182    |____                    | TD62003AP |   | 74LS251P |  |________|  |__________|  |
183    |____                    |___________|   |__________|   __________________       |
184    |____                     ___________     __________   | AY-3-8910        |      |
185    |____                    | 74LS259N  |   | 74LS251P |  | KC89C72 / YM2149F|      |
186    |____                    |___________|   |__________|  |__________________|      |
187    |____                     ___________     __________    _________   __________   |
188    |____                    | 74LS259N  |   | 74LS251P |  | 82S147AN| | 74LS245  |  |
189    |____                    |___________|   |__________|  |_________| |__________|  |
190    |____                     ___________     __________    _________                |
191    |____                    | 74LS259N  |   | 74LS251P |  | 74LS377 |               |
192    |____                    |___________|   |__________|  |_________|               |
193    |____                     ___________     __________    _________                |
194    |____        ________    | TD62003AP |   | 74LS251P |  | 74LS377 |               |
195    |____       |12345678|   |___________|   |__________|  |_________|               |
196    |____       |________|                    __________    _________   _________    |
197    |____          DSW1                      | 74LS194  |  | 74LS194 | | 74LS245 |   |
198    |____                                    |__________|  |_________| |_________|   |
199    |____                                                                            |
200    |____         ______        ________________         _____________   _________   |
201    |_01_        |TL7705|      |01 oooooooooo 10|       |   27C128    | | 74LS377 |  |
202         |       |______|      |________________|       |   D27128D   | |_________|  |
203     ____|                         CONNECTOR1           |_____________|              |
204    |                                                                                |
205    |________________________________________________________________________________|
206
207
208
209
210*********************************************************************************
211
212
213    Dumper Notes (old)
214    ------------------
215
2216    American Poker
3
4217    WB 5300 IS SAME AS Winbond WF19054 and YM2149F (AY891X?)
5
6218    CPU TMPZ84C00AP OR LH0080A
7
8219    XTAL 6.000
9
10220    1 DIP x 8
11
12221    RAM 6116
13
14222    LH 5116D X2
15223
16    ---
224    ---------------------------------------------
17225
18226    Crystal 6.000 MHz
19227    CPU         Sharp LH0080B Z80B-CPU 9241 1 B
r1281r1282
27235
28236    7 unmarked chips
29237
30    ---
238*********************************************************************************
31239
32    AGEMAME driver by Curt Coder
33240
34Any fixes for this driver should be forwarded to the AGEMAME forum at (http://www.mameworld.info)
35*/
241    --- DRIVER UPDATES ---
36242
243
244    [2007-11-15]
245
246    ******** REWRITE ********
247
248    - Crystal documented via #define.
249    - CPU and sound clocks derived from #defined crystal value.
250    - Reworked TILE_GET_INFO to handle the proper tiles/color codes.
251    - Added the correct GFX dump to sigma2k.
252    - Added proper TILE_GET_INFO, VIDEO_START, GFX_LAYOUT, GFXDECODE and MACHINE to sigma2k.
253    - Fixed interrupts (NMI).
254    - Corrected AY8910 frequency to 1.5 MHz to match the real thing.
255    - Arranged the AY8910 volume in all games avoiding clips.
256    - Corrected the screen visible area.
257    - Added NVRAM support.
258    - Reworked the memory map, mapping all the hardware I/O ports.
259    - Reworked the Inputs for all sets.
260    - Added implementation of Operator and Supervisor Keys.
261    - Fixed some timing troubles.
262    - Mapped the input buttons in the same way I mapped them in other poker games.
263    - Added partial DIP switch support with diplocations to all sets.
264
265    - Removed the hack in DRIVER_INIT.
266    - Hooked write handlers for output ports.
267    - Added watchdog routines.
268    - Dumped, hooked, wired and decoded the color PROM in all sets. Colors are perfect.
269    - Modified the refresh rate to 60 fps according to hardware measurements.
270    - Cleaned up and renamed all sets, defining parent-clone relationship.
271    - Wired the lamps for all sets. Created their respective layouts.
272    - Updated flags in game drivers.
273    - Splitted the driver to driver/video.
274    - Other minor fixes.
275
276    - New set dumped/added: American Poker 95.
277    - New set dumped/added: American Poker 2 (bootleg, set 1).
278    - New set dumped/added: Sigma Poker.
279    - New set dumped/added: Sigma Poker 2000.
280
281    - Rewritten the technical notes from the scratch (still in progress).
282    - Added a PCB layout to the technical notes.
283
284
285
286    *** TO DO ***
287
288    - Find why the watchdog sometimes stop to work.
289    - Analyze the write to port 0x21 after reset.
290
291
292
293*********************************************************************************/
294
295
296#define MASTER_CLOCK   6000000    /* 6 Mhz */
297
37298#include "driver.h"
38299#include "sound/ay8910.h"
300#include "ampoker.lh"
301#include "sigmapkr.lh"
39302
40static tilemap *bg_tilemap;
303/* from video */
304extern WRITE8_HANDLER( ampoker2_videoram_w );
305extern PALETTE_INIT( ampoker2 );
306extern VIDEO_START( ampoker2 );
307extern VIDEO_START( sigma2k );
308extern VIDEO_UPDATE( ampoker2 );
41309
42WRITE8_HANDLER( ampoker2_videoram_w )
310
311/**********************
312* Read/Write Handlers *
313*  - Output Ports -   *
314***********************
315
316
317  There are only five bits wired for each Port
318
319  PORT   ADDRESS    BIT0      BIT1      BIT2      BIT3      BIT4
320  -------------------------------------------------------------------
321
322  0x30 - 0xc000     ----      ----      ----      ----      ----
323  0x31 - 0xc001     ----    L.Bet/Red  L.Hold4   L.Hold2   Twr.Yell
324  0x32 - 0xc002     ----      ----      ----     L.Hold3    ----
325  0x33 - 0xc003     ----      ----      ----      ----      ----
326  0x34 - 0xc004     ----      ----      ----      ----     L.Black
327  0x35 - 0xc005     ----      ----      ----      ----      ----
328  0x36 - 0xc006   Twr.Grn.   L.Hold5   L.Deal    L.Hold1    ----
329  0x37 - 0xc007     ----      ----      ----     WatchDog   ----
330
331
332  --- Lamps wiring (done) ---
333
334    L0 = DEAL / TAKE
335    L1 = RED / BET
336    L2 = BLACK
337    L3 = HOLD 1
338    L4 = HOLD 2
339    L5 = HOLD 3
340    L6 = HOLD 4
341    L7 = HOLD 5
342    L8 = TOWER YELLOW (not in lay)
343    L9 = TOWER GREEN  (not in lay)
344
345
346  --- Counters wiring ---
347
348    C0 = METER 1 - REMOTE IN
349    C1 = METER 2 - TOTAL OUT
350    C2 = METER 3 - TOTAL IN
351    C3 = METER 4 - BILLS
352    C4 = METER 5 - JACKPOT
353    C5 = METER 6 - CASH BOX
354    C6 = METER 7 - GAMES
355    C7 = METER 8 - ?
356
357
358  --- Devices wiring ---
359
360    D0 = Enable Coin to Hopper / Diverter
361    D1 = Enable Coin 1 / Acceptor
362    D2 = Enable Coin 2
363    D3 = Enable Coin 3
364    D4 = Enable Coin 4 / Bill Reader
365    D5 = Hopper 1 Enable
366    D6 = Hopper 2 Enable (Optional)
367    D7 = Hopper 1 2 Enable
368
369
370  --- Unused wiring ---
371
372    U0 = Pin 15A (ULN2064)
373    U1 = Pin 17C (ULN2064)
374    U2 = Pin 19A (ULN2064)
375    U3 = Pin  6C (ULN2064)
376    U4 = Pin 13C
377    U5 = Pin 14A
378
379*/
380
381static WRITE8_HANDLER( ampoker2_port30_w )
382/*-------------------------------------------------
383    PORT_30 C000H         ;OUTPUT PORT 30H
384---------------------------------------------------
385    BIT 0 =
386    BIT 1 =
387    BIT 2 =
388    BIT 3 =
389    BIT 4 =
390--------------------------------------------------*/
43391{
44   videoram[offset] = data;
45   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
46392}
47393
48static TILE_GET_INFO( get_bg_tile_info )
394
395static WRITE8_HANDLER( ampoker2_port31_w )
396/*-------------------------------------------------
397    PORT_31 C001H         ;OUTPUT PORT 31H
398---------------------------------------------------
399    BIT 0 =
400    BIT 1 = LAMP_1        ;Lamp 1  (RED)
401    BIT 2 = LAMP_6        ;Lamp 6  (HOLD4)
402    BIT 3 = LAMP_4        ;Lamp 4  (HOLD2)
403    BIT 4 = TWL_YELL      ;Tower Light YELLOW
404--------------------------------------------------*/
49405{
50   int offs = tile_index * 2;
51   int attr = videoram[offs + 1];
52   int code = videoram[offs];
53   int color = attr;
54   color=0;
406   output_set_lamp_value(1, ((data >> 1) & 1));   /* Lamp 1 - BET/RED */
407   output_set_lamp_value(6, ((data >> 2) & 1));   /* Lamp 6 - HOLD 4 */
408   output_set_lamp_value(4, ((data >> 3) & 1));   /* Lamp 4 - HOLD 2 */
409   output_set_lamp_value(8, ((data >> 4) & 1));   /* Lamp 8 - TWR.YELLOW */
410}
55411
56   SET_TILE_INFO(0, code, color, 0);
412
413static WRITE8_HANDLER( ampoker2_port32_w )
414/*-------------------------------------------------
415    PORT_32 C002H         ;OUTPUT PORT 32H
416---------------------------------------------------
417    BIT 0 =
418    BIT 1 =
419    BIT 2 =
420    BIT 3 = LAMP_5        ;Lamp 5  (HOLD3)
421    BIT 4 =
422--------------------------------------------------*/
423{
424   output_set_lamp_value(5, ((data >> 3) & 1));   /* Lamp 5 - HOLD 3 */
57425}
58426
59VIDEO_START(ampoker2)
427
428static WRITE8_HANDLER( ampoker2_port33_w )
429/*-------------------------------------------------
430    PORT_33 C003H         ;OUTPUT PORT 33H
431---------------------------------------------------
432    BIT 0 =
433    BIT 1 =
434    BIT 2 =
435    BIT 3 =
436    BIT 4 =
437--------------------------------------------------*/
60438{
61   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
62      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
63439}
64440
65VIDEO_UPDATE(ampoker2)
441
442static WRITE8_HANDLER( ampoker2_port34_w )
443/*-------------------------------------------------
444    PORT_34 C004H         ;OUTPUT PORT 34H
445---------------------------------------------------
446    BIT 0 =
447    BIT 1 =
448    BIT 2 =
449    BIT 3 =
450    BIT 4 = LAMP_2        ;Lamp 3  (BLACK)
451--------------------------------------------------*/
66452{
67   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
68   return 0;
453   output_set_lamp_value(2, ((data >> 4) & 1));   /* Lamp 2 - BLACK */
69454}
70455
456
457static WRITE8_HANDLER( ampoker2_port35_w )
458/*-------------------------------------------------
459    PORT_35 C005H         ;OUTPUT PORT 35H
460---------------------------------------------------
461    BIT 0 =
462    BIT 1 =
463    BIT 2 =
464    BIT 3 =
465    BIT 4 =
466--------------------------------------------------*/
467{
468}
469
470
471static WRITE8_HANDLER( ampoker2_port36_w )
472/*-------------------------------------------------
473    PORT_36 C006H         ;OUTPUT PORT 36H
474---------------------------------------------------
475    BIT 0 = TWL_GREEN     ;Tower Light GREEN
476    BIT 1 =
477    BIT 2 = LAMP_9        ;Lamp 9  (HOLD5)
478    BIT 3 = LAMP_0        ;Lamp 0  (DEAL)
479    BIT 4 = LAMP_3        ;Lamp 3  (HOLD1)
480--------------------------------------------------*/
481{
482   output_set_lamp_value(9, (data & 1));         /* Lamp 9 - TWR.GREEN */
483   output_set_lamp_value(7, ((data >> 2) & 1));   /* Lamp 7 - HOLD 5 */
484   output_set_lamp_value(0, ((data >> 3) & 1));   /* Lamp 0 - DEAL */
485   output_set_lamp_value(3, ((data >> 4) & 1));   /* Lamp 3 - HOLD 1 */
486}
487
488
489static WRITE8_HANDLER( ampoker2_watchdog_reset_w )
490/*-------------------------------------------------
491    PORT_37 C007H         ;OUTPUT PORT 37H
492---------------------------------------------------
493    BIT 3 = W_DOG         ;WATCHDOG.
494--------------------------------------------------*/
495{
496   /* watchdog sometimes stop to work */
497   if (( (data >> 3) & 0x01) == 0)      /* check for refresh value (0x08h) */
498   {
499      watchdog_reset_w(0,0);
500//      fprintf(stdout,"Watchdog\n");
501   }
502}
503
504
505/*************************
506* Memory map information *
507*************************/
508
71509static ADDRESS_MAP_START( ampoker2_map, ADDRESS_SPACE_PROGRAM, 8 )
72510   AM_RANGE(0x0000, 0xbfff) AM_ROM
73   AM_RANGE(0xc000, 0xc7ff) AM_RAM
511   AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
74512   AM_RANGE(0xe000, 0xefff) AM_RAM AM_WRITE(ampoker2_videoram_w) AM_BASE(&videoram)
75513ADDRESS_MAP_END
76514
77515static ADDRESS_MAP_START( ampoker2_io_map, ADDRESS_SPACE_IO, 8 )
78516   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
79//  AM_RANGE(0x00, 0x1f) AM_WRITENOP
517   AM_RANGE(0x08, 0x0f) AM_WRITENOP            /* inexistent in the real hardware */
80518   AM_RANGE(0x10, 0x10) AM_READ(input_port_0_r)
81519   AM_RANGE(0x11, 0x11) AM_READ(input_port_1_r)
82520   AM_RANGE(0x12, 0x12) AM_READ(input_port_2_r)
r1281r1282
85523   AM_RANGE(0x15, 0x15) AM_READ(input_port_5_r)
86524   AM_RANGE(0x16, 0x16) AM_READ(input_port_6_r)
87525   AM_RANGE(0x17, 0x17) AM_READ(input_port_7_r)
88//  AM_RANGE(0x21, 0x21) AM_WRITENOP
89//  AM_RANGE(0x30, 0x39) AM_WRITENOP
526//  AM_RANGE(0x21, 0x21) AM_WRITENOP                    /* undocumented, write 0x1a after each reset */
527   AM_RANGE(0x30, 0x30) AM_WRITE (ampoker2_port30_w)   /* see write handlers */
528   AM_RANGE(0x31, 0x31) AM_WRITE (ampoker2_port31_w)   /* see write handlers */
529   AM_RANGE(0x32, 0x32) AM_WRITE (ampoker2_port32_w)   /* see write handlers */
530   AM_RANGE(0x33, 0x33) AM_WRITE (ampoker2_port33_w)   /* see write handlers */
531   AM_RANGE(0x34, 0x34) AM_WRITE (ampoker2_port34_w)   /* see write handlers */
532   AM_RANGE(0x35, 0x35) AM_WRITE (ampoker2_port35_w)   /* see write handlers */
533   AM_RANGE(0x36, 0x36) AM_WRITE (ampoker2_port36_w)   /* see write handlers */
534   AM_RANGE(0x37, 0x37) AM_WRITE(ampoker2_watchdog_reset_w)
535   AM_RANGE(0x38, 0x38) AM_WRITE(AY8910_control_port_0_w)
536   AM_RANGE(0x39, 0x39) AM_WRITE(AY8910_write_port_0_w)
537   AM_RANGE(0x3A, 0x3A) AM_READ(AY8910_read_port_0_r)
90538ADDRESS_MAP_END
91539
92static INPUT_PORTS_START( ampoker2 )
93   PORT_START_TAG("IN0")
94   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 0") PORT_CODE(KEYCODE_Q)
95   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 1") PORT_CODE(KEYCODE_W)
96   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 2") PORT_CODE(KEYCODE_E)
97   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_R)
98   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_T)
99   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_Y)
100   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 6") PORT_CODE(KEYCODE_U)
101   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 7") PORT_CODE(KEYCODE_I)
102540
103   PORT_START_TAG("IN1")
104   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 0") PORT_CODE(KEYCODE_A)
105   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 1") PORT_CODE(KEYCODE_S)
106   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 2") PORT_CODE(KEYCODE_D)
107   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_F)
108   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_G)
109   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_H)
110   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 6") PORT_CODE(KEYCODE_J)
111   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 7") PORT_CODE(KEYCODE_K)
112541
113   PORT_START_TAG("IN2")
114   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 0") PORT_CODE(KEYCODE_Z)
115   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 1") PORT_CODE(KEYCODE_X)
116   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 2") PORT_CODE(KEYCODE_C)
117   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 3") PORT_CODE(KEYCODE_V)
118   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 4") PORT_CODE(KEYCODE_B)
119   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 5") PORT_CODE(KEYCODE_N)
120   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 6") PORT_CODE(KEYCODE_M)
121   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bit 7") PORT_CODE(KEYCODE_L)
542/*************************
543*      Input ports       *
544*************************/
122545
123   PORT_START_TAG("DSW1")
546INPUT_PORTS_START( ampoker2 )
547   PORT_START_TAG("IN0")
124548   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
125549   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
126550   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
127   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
128   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
130   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
131   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
132   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
133553   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
134554   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
135555   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
136   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
137   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
556   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
557
558   PORT_START_TAG("IN1")
559   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
560   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
138561   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
139   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
140   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
562   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
563   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
564   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
565   PORT_DIPSETTING(    0x08, "Mode 1" )
566   PORT_DIPSETTING(    0x00, "Mode 2" )
567   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
568
569   PORT_START_TAG("IN2")
570   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
571   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
141572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
142   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
143   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
573   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
574   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
575   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
576   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
144577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
145   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
146   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
578   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
579
580   PORT_START_TAG("IN3")
581   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
582   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
583   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
584   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
585   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
586   PORT_DIPSETTING(    0x08, "Cred x  20" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
587   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
588   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Black Card") PORT_CODE(KEYCODE_S)
589
590   PORT_START_TAG("IN4")
591   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
592   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
593   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
594   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
595   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
147596   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
597   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
148598
149   PORT_START_TAG("DSW2")
599   PORT_START_TAG("IN5")
150600   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
151601   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
152602   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
153   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
154   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
603   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
604   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
605   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
606   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
155607   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
156   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
157   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
608   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
609
610   PORT_START_TAG("IN6")
611   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
612   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
158613   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
614   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet / Red Card") PORT_CODE(KEYCODE_A)
615   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
159616   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
160617   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
161618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
162   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
163   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
619   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
620
621   PORT_START_TAG("IN7")
622   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
623   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
624   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
625   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
626   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
164627   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
165   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
166   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
628   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
629INPUT_PORTS_END
630
631INPUT_PORTS_START( ampkr95 )
632   PORT_START_TAG("IN0")
633   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
634   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
167635   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
168   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
169   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
636   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
637   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
638   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
639   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
170640   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
171   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
172   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
641   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
642
643   PORT_START_TAG("IN1")
644   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
645   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
173646   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
647   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
648   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
649   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
650   PORT_DIPSETTING(    0x08, "Mode 1" )
651   PORT_DIPSETTING(    0x00, "Mode 2" )
652   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
174653
175   PORT_START_TAG("DSW3")
654   PORT_START_TAG("IN2")
176655   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
177656   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
178657   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
179   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
180   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
181   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
182   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
183   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
184   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
658   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
659   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
185660   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
186661   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
187662   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
188   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
189   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
663   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
664
665   PORT_START_TAG("IN3")
666   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
667   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
668   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
669   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
670   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
671   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
672   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
673   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Black Card") PORT_CODE(KEYCODE_S)
674
675   PORT_START_TAG("IN4")
676   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
677   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
678   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
679   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
680   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
190681   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
191   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
192   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
682   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
683
684   PORT_START_TAG("IN5")
685   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
686   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
193687   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
195   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
688   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
689   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
690   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW1" ) PORT_DIPLOCATION("SW1:3") /* DSW3 (should be arranged with DSW4) */
691   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
196692   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
197   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
198   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
199   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
693   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
200694
201   PORT_START_TAG("DSW4")
695   PORT_START_TAG("IN6")
202696   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
203697   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
204698   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
205   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
206   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
699   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet / Red") PORT_CODE(KEYCODE_A)
700   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
701   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW2" ) PORT_DIPLOCATION("SW1:4") /* DSW4 (should be arranged with DSW3) */
702   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
207703   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
208   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
209   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
704   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
705
706   PORT_START_TAG("IN7")
707   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
708   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
709   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
710   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
711   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
210712   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
713   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
714INPUT_PORTS_END
715
716INPUT_PORTS_START( sigmapkr )
717   PORT_START_TAG("IN0")
718   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
719   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
720   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
721   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
722   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
211723   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
212724   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
213725   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
214   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
215   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
726   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
727
728   PORT_START_TAG("IN1")
729   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
730   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
216731   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
217   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
218   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
732   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
733   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
734   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
735   PORT_DIPSETTING(    0x08, "Mode 1" )
736   PORT_DIPSETTING(    0x00, "Mode 2" )
737   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
738
739   PORT_START_TAG("IN2")
740   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
741   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
219742   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
220   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
221   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
743   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
744   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
745   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
746   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
222747   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
223   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
224   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
748   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
749
750   PORT_START_TAG("IN3")
751   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
752   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
753   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
754   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
755   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
756   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
757   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
758   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Double") PORT_CODE(KEYCODE_S)
759
760   PORT_START_TAG("IN4")
761   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
762   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
763   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
764   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
765   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
225766   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
767   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
226768
227   PORT_START_TAG("DSW5")
228   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK )
229   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
230   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
769   PORT_START_TAG("IN5")
770   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
771   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
231772   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
233   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
234   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
773   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
774   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
775   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW1" ) PORT_DIPLOCATION("SW1:3") /* DSW3 (should be arranged with DSW4) */
236776   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
237777   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
238   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
239   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
778   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
779
780   PORT_START_TAG("IN6")
781   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
782   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
240783   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
241   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
242   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
784   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_A)
785   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
786   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW2" ) PORT_DIPLOCATION("SW1:4") /* DSW4 (should be arranged with DSW3) */
787   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
243788   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
244   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
245   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
789   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
790
791   PORT_START_TAG("IN7")
792   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
793   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
794   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
795   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
796   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
246797   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
247   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
248   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
249   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
798   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
250799INPUT_PORTS_END
251800
801
802/*************************
803*    Graphics Layouts    *
804*************************/
805
252806static const gfx_layout charlayout =
253807{
254808   8, 8,
r1281r1282
260814   16*8
261815};
262816
263static GFXDECODE_START( ampoker )
264   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout,      0, 16 )
817static const gfx_layout s2k_charlayout =
818{
819   8, 8,
820   4096,
821   2,
822   { 0, 4 },
823   { 0, 1, 2, 3, 8, 9, 10, 11 },
824   { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
825   16*8
826};
827
828
829/******************************
830* Graphics Decode Information *
831******************************/
832
833static GFXDECODE_START( ampoker2 )
834   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 16 )
265835GFXDECODE_END
266836
837static GFXDECODE_START( sigma2k )
838   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2k_charlayout, 0, 16 )
839GFXDECODE_END
840
841
842/*******************
843* AY8910 Interfase *
844*******************/
845
267846static struct AY8910interface ay8910_interface =
268847{
269input_port_3_r,   //
270input_port_4_r,   //
2710,
2720
8480, 0, 0, 0   /* no ports used */
273849};
274850
851
852/*************************
853*     Machine Driver     *
854*************************/
855
275856static MACHINE_DRIVER_START( ampoker2 )
276   // basic machine hardware
277   MDRV_CPU_ADD(Z80, 6000000/2)   //???
857
858   /* basic machine hardware */
859   MDRV_CPU_ADD(Z80, MASTER_CLOCK/2)      /* 3 MHz */
278860   MDRV_CPU_PROGRAM_MAP(ampoker2_map, 0)
279861   MDRV_CPU_IO_MAP(ampoker2_io_map, 0)
280   //MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
281   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 1)
862   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1536)
863   MDRV_WATCHDOG_TIME_INIT(MAME_TIME_IN_HZ( 5 ))   /* 200 ms, measured */
864   //MDRV_WATCHDOG_VBLANK_INIT(8)
865   MDRV_SCREEN_REFRESH_RATE(60)
866   /*  if VBLANK is used, the watchdog timer stop to work.
867    MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
868    */
869   MDRV_NVRAM_HANDLER(generic_0fill)
282870
283   MDRV_SCREEN_REFRESH_RATE(50)
284   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
285
286   // video hardware
871   /* video hardware */
287872   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
288873   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
289874   MDRV_SCREEN_SIZE(64*8, 32*8)
290   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
875   MDRV_SCREEN_VISIBLE_AREA(20*8, 56*8-1, 2*8, 32*8-1)
291876
292   MDRV_GFXDECODE(ampoker)
293   MDRV_PALETTE_LENGTH(32)
294   MDRV_COLORTABLE_LENGTH(32)
877   MDRV_GFXDECODE(ampoker2)
878   MDRV_PALETTE_LENGTH(512)
879   MDRV_COLORTABLE_LENGTH(512)
295880
881   MDRV_PALETTE_INIT(ampoker2)
296882   MDRV_VIDEO_START(ampoker2)
297883   MDRV_VIDEO_UPDATE(ampoker2)
298884
299   // sound hardware
885   /* sound hardware */
300886   MDRV_SPEAKER_STANDARD_MONO("mono")
301   MDRV_SOUND_ADD(AY8910,12000000/12)
887   MDRV_SOUND_ADD(AY8910,MASTER_CLOCK/4)   /* 1.5 MHz, verified against the real thing */
302888   MDRV_SOUND_CONFIG(ay8910_interface)
303   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
889   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
304890MACHINE_DRIVER_END
305891
892static MACHINE_DRIVER_START( sigma2k )
893   /* basic machine hardware */
894   MDRV_IMPORT_FROM(ampoker2)
895
896   /* video hardware */
897   MDRV_GFXDECODE(sigma2k)
898   MDRV_VIDEO_START(sigma2k)
899MACHINE_DRIVER_END
900
901
902/*************************
903*        Rom Load        *
904*************************/
905
306906ROM_START( ampoker2 )
307907   ROM_REGION( 0x10000, REGION_CPU1, 0 )
308   ROM_LOAD( "ampoker.u6", 0x0000, 0x10000, CRC(d7b055bd) SHA1(f5231d2ec80f740eabedaba07547ccbb977accc1) )
908   ROM_LOAD( "poker9.003", 0x4000, 0x8000, CRC(a31221fc) SHA1(4a8bdd8ce8d5bff7e7cfc4ae91e27c1d366dc54d) )
909   ROM_COPY( REGION_CPU1, 0x8000, 0x0000, 0x4000 ) /* poker9.003 contains the 16K halves swapped around */
910   ROM_LOAD( "poker9.002", 0x8000, 0x4000, CRC(bfde5bce) SHA1(c7c7ca2268694015e8ec673e8fa5c48043086d3f) )
309911
310912   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
913   ROM_LOAD( "poker9.028", 0x0000, 0x4000, CRC(65bccb40) SHA1(75f154a2aaf9f9be62e0e1dd8cbe630b9ea0145c) )
914
915   ROM_REGION( 0x200, REGION_PROMS, 0 )
916   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
917ROM_END
918
919ROM_START( ampkr2b1 )
920   ROM_REGION( 0x10000, REGION_CPU1, 0 )
921   ROM_LOAD( "airl-v00.512", 0x0000, 0x10000, CRC(e5953bf4) SHA1(291367431e3b21b57704228c63e4da853e6d25b7) )
922
923   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
311924   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
312925
313926   ROM_REGION( 0x200, REGION_PROMS, 0 )
314   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, NO_DUMP )
927   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
315928ROM_END
316929
317ROM_START( ampokr2a )
930ROM_START( ampkr2b2 )
318931   ROM_REGION( 0x10000, REGION_CPU1, 0 )
319932   ROM_LOAD( "rom9.u6", 0x0000, 0x10000, CRC(820a491d) SHA1(36654aacac010e7c086dd18d4e0ca5d959b9044f) )
320933
r1281r1282
322935   ROM_LOAD( "rom0.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
323936
324937   ROM_REGION( 0x200, REGION_PROMS, 0 )
325   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, NO_DUMP )
938   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
326939ROM_END
327940
328ROM_START( ampokr2b )
941ROM_START( ampkr2b3 )
329942   ROM_REGION( 0x10000, REGION_CPU1, 0 )
330   ROM_LOAD( "poker9.003", 0x4000, 0x8000, CRC(a31221fc) SHA1(4a8bdd8ce8d5bff7e7cfc4ae91e27c1d366dc54d) )
331   ROM_COPY( REGION_CPU1, 0x8000, 0x0000, 0x4000 ) // poker9.003 contains the 16K halves swapped around
332   ROM_LOAD( "poker9.002", 0x8000, 0x4000, CRC(bfde5bce) SHA1(c7c7ca2268694015e8ec673e8fa5c48043086d3f) )
943   ROM_LOAD( "ampoker.u6", 0x0000, 0x10000, CRC(d7b055bd) SHA1(f5231d2ec80f740eabedaba07547ccbb977accc1) )
333944
334945   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
335   ROM_LOAD( "poker9.028", 0x0000, 0x4000, CRC(65bccb40) SHA1(75f154a2aaf9f9be62e0e1dd8cbe630b9ea0145c) )
946   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
947
948   ROM_REGION( 0x200, REGION_PROMS, 0 )
949   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
336950ROM_END
337951
338ROM_START( ampokr2c )
952ROM_START( ampkr95 )
953   ROM_REGION( 0x10000, REGION_CPU1, 0 )
954   ROM_LOAD( "amp95rus.u6", 0x0000, 0x10000, CRC(6ec74b2b) SHA1(2dca05bc111071f1407dd524b67b5a3dc5848c70) )
955
956   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
957   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
958
959   ROM_REGION( 0x200, REGION_PROMS, 0 )
960   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
961ROM_END
962
963ROM_START( pkrdewin )
339964   ROM_REGION( 0x14000, REGION_CPU1, 0 )
340   ROM_LOAD( "poker7.001", 0x0000, 0x10000, CRC(eca16b9e) SHA1(5063d733721457ab3b08caafbe8d33b2cbe4f88b) )
341   ROM_COPY( REGION_CPU1, 0x4000, 0x0000, 0x4000 ) // poker7.001 contains the 1st and 2nd 16K quarters swapped
342   ROM_COPY( REGION_CPU1, 0x0000, 0x4000, 0x4000 ) // poker7.001 contains the 1st and 2nd 16K quarters swapped
965   ROM_LOAD( "poker7.001", 0x4000, 0x10000, CRC(eca16b9e) SHA1(5063d733721457ab3b08caafbe8d33b2cbe4f88b) )
966   ROM_COPY( REGION_CPU1,   0x8000, 0x0000, 0x4000 ) /* poker7.001 contains the 1st and 2nd 16K quarters swapped */
967   ROM_COPY( REGION_CPU1, 0x10000, 0x8000, 0x4000 ) /* poker7.001 contains the 1st and 2nd 16K quarters swapped */
343968
344969   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
345970   ROM_LOAD( "poker7.002", 0x0000, 0x4000, CRC(65bccb40) SHA1(75f154a2aaf9f9be62e0e1dd8cbe630b9ea0145c) )
971
972   ROM_REGION( 0x200, REGION_PROMS, 0 )
973   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
346974ROM_END
347975
348static DRIVER_INIT( ampoker2 )
349{
350   UINT8 *ROM = memory_region(REGION_CPU1);
351   ROM[0x009f] = 0xc9;
352   ROM[0x139c] = 0x00;
353   ROM[0x139d] = 0x00;
354   ROM[0x139e] = 0x00;
355/*  ROM[0x0094] = 0x00;
356    ROM[0x0095] = 0x00;
357    ROM[0x0096] = 0x00;*/
358}
976ROM_START( sigmapkr )
977   ROM_REGION( 0x10000, REGION_CPU1, 0 )
978   ROM_LOAD( "sigmapkr.u6", 0x0000, 0x10000, CRC(aa3f429a) SHA1(8c82e86de7280590ba157860cbf9783f893f8554) )
359979
360GAME( 198?, ampoker2, 0,        ampoker2, ampoker2, ampoker2, ROT0, "Novomatic", "American Poker II (set 1)", GAME_NOT_WORKING )
361GAME( 198?, ampokr2a, ampoker2, ampoker2, ampoker2, ampoker2, ROT0, "Novomatic", "American Poker II (set 2)", GAME_NOT_WORKING )
362GAME( 198?, ampokr2b, ampoker2, ampoker2, ampoker2, ampoker2, ROT0, "Novomatic", "American Poker II (set 3)", GAME_NOT_WORKING )
363GAME( 198?, ampokr2c, ampoker2, ampoker2, ampoker2, ampoker2, ROT0, "Novomatic", "American Poker II (set 4)", GAME_NOT_WORKING )
980   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
981   ROM_LOAD( "sigmapkr.u47", 0x0000, 0x4000, CRC(49eb69a8) SHA1(22be5870d501d229aa56fb18146ec0d8f8eea72e) )
982
983   ROM_REGION( 0x200, REGION_PROMS, 0 )
984   ROM_LOAD( "82s147an_spkr.u48", 0x0000, 0x0200, CRC(3d8683d0) )
985ROM_END
986
987ROM_START( sigma2k )
988   ROM_REGION( 0x10000, REGION_CPU1, 0 )
989   ROM_LOAD( "sigma2k.u6", 0x0000, 0x10000, CRC(608d1771) SHA1(0ec94d780565472c7e68da7e3ce19aea3f1ab4a5) )
990
991   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
992   ROM_LOAD( "sigma2k.u47", 0x0000, 0x10000, CRC(3ed7b9df) SHA1(788a90ffa6cb0bfebf607815a695a5afe930945c) )
993
994   ROM_REGION( 0x200, REGION_PROMS, 0 )
995   ROM_LOAD( "82s147an_s2k.u48", 0x0000, 0x0200, CRC(715361cc) )
996ROM_END
997
998
999/*************************
1000*      Game Drivers      *
1001*************************/
1002
1003/*     YEAR  NAME      PARENT    MACHINE   INPUT     INIT  ROT    COMPANY       FULLNAME                             FLAGS             LAYOUT      */
1004GAMEL( 1990, ampoker2, 0,        ampoker2, ampoker2, 0,    ROT0, "Novomatic",  "American Poker II",                  0,                layout_ampoker )
1005GAMEL( 1990, ampkr2b1, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 1)", 0,                layout_ampoker )
1006GAMEL( 1990, ampkr2b2, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 2)", 0,                layout_ampoker )
1007GAMEL( 1994, ampkr2b3, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 3)", 0,                layout_ampoker )
1008GAMEL( 1995, ampkr95,  ampoker2, ampoker2, ampkr95,  0,    ROT0, "Bootleg",    "American Poker 95",                  0,                layout_ampoker )
1009GAMEL( 1990, pkrdewin, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "Poker De Win",                       0,                layout_ampoker )
1010GAMEL( 1995, sigmapkr, 0,        ampoker2, sigmapkr, 0,    ROT0, "Sigma Inc.", "Sigma Poker",                        0,                layout_sigmapkr )
1011GAMEL( 1998, sigma2k,  0,        sigma2k,  sigmapkr, 0,    ROT0, "Sigma Inc.", "Sigma Poker 2000",                   GAME_NOT_WORKING, layout_sigmapkr )
src/mame/drivers/funworld.c
r1281r1282
773773* Read/Write Handlers *
774774**********************/
775775
776WRITE8_HANDLER(funworld_lamp_a_w)
776static WRITE8_HANDLER(funworld_lamp_a_w)
777777{
778778   coin_counter_w(0, data & 0x01);      // credit in counter
779779
r1281r1282
787787   output_set_lamp_value(3, (data >> 7) & 1);      // button hold4/high
788788}
789789
790WRITE8_HANDLER(funworld_lamp_b_w)
790static WRITE8_HANDLER(funworld_lamp_b_w)
791791{
792792   output_set_lamp_value(4, (data >> 0) & 1);      // button hold5/bet
793793   output_set_lamp_value(6, (data >> 1) & 1);      // button 7 (start/play)
src/mame/drivers/thunderx.c
r1281r1282
314314   thunderx_1f98_data = data;
315315}
316316
317WRITE8_HANDLER( scontra_bankswitch_w )
317static WRITE8_HANDLER( scontra_bankswitch_w )
318318{
319319   UINT8 *RAM = memory_region(REGION_CPU1);
320320   int offs;
src/mame/drivers/jackpool.c
r1281r1282
3030   SET_TILE_INFO(0,tileno,attr,0);
3131}
3232
33WRITE16_HANDLER( jackpool_layer0_videoram_w )
33static WRITE16_HANDLER( jackpool_layer0_videoram_w )
3434{
3535   COMBINE_DATA(&jackpool_layer0_videoram[offset]);
3636
r1281r1282
4747   SET_TILE_INFO(0,tileno,attr,0);
4848}
4949
50WRITE16_HANDLER( jackpool_layer1_videoram_w )
50static WRITE16_HANDLER( jackpool_layer1_videoram_w )
5151{
5252   COMBINE_DATA(&jackpool_layer1_videoram[offset]);
5353
r1281r1282
6464   SET_TILE_INFO(0,tileno,attr,0);
6565}
6666
67WRITE16_HANDLER( jackpool_layer2_videoram_w )
67static WRITE16_HANDLER( jackpool_layer2_videoram_w )
6868{
6969   COMBINE_DATA(&jackpool_layer2_videoram[offset]);
7070
r1281r1282
140140
141141
142142
143VIDEO_START(jackpool)
143static VIDEO_START(jackpool)
144144{
145145   jackpool_layer0_tilemap = tilemap_create(get_jackpool_layer0_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
146146   jackpool_layer1_tilemap = tilemap_create(get_jackpool_layer1_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
r1281r1282
150150   tilemap_set_transparent_pen(jackpool_layer2_tilemap,0);
151151}
152152
153VIDEO_UPDATE(jackpool)
153static VIDEO_UPDATE(jackpool)
154154{
155155   tilemap_draw(bitmap,cliprect,jackpool_layer1_tilemap,0,0);
156156   tilemap_draw(bitmap,cliprect,jackpool_layer0_tilemap,0,0);
src/mame/drivers/gsword.c
r1281r1282
250250   { input_port_7_r,input_port_6_r,gsword_8741_2_r,gsword_8741_3_r }    /* port handler */
251251};
252252
253MACHINE_RESET( gsword )
253static MACHINE_RESET( gsword )
254254{
255255   int i;
256256
r1281r1282
264264   TAITO8741_start(&gsword_8741interface);
265265}
266266
267MACHINE_RESET( josvolly )
267static MACHINE_RESET( josvolly )
268268{
269269   josvolly_8741_reset();
270270}
r1281r1282
348348   return fake8910_1+1;
349349}
350350
351WRITE8_HANDLER( gsword_adpcm_data_w )
351static WRITE8_HANDLER( gsword_adpcm_data_w )
352352{
353353   MSM5205_data_w (0,data & 0x0f); /* bit 0..3 */
354354   MSM5205_reset_w(0,(data>>5)&1); /* bit 5    */
355355   MSM5205_vclk_w(0,(data>>4)&1);  /* bit 4    */
356356}
357357
358WRITE8_HANDLER( adpcm_soundcommand_w )
358static WRITE8_HANDLER( adpcm_soundcommand_w )
359359{
360360   soundlatch_w(0,data);
361361   cpunum_set_input_line(2, INPUT_LINE_NMI, PULSE_LINE);
src/mame/drivers/nmg5.c
r1281r1282
796796static TILE_GET_INFO( fg_get_tile_info ) { get_tile_info(machine,tileinfo,tile_index,fg_videoram, 0); }
797797static TILE_GET_INFO( bg_get_tile_info ) { get_tile_info(machine,tileinfo,tile_index,bg_videoram, 1); }
798798
799VIDEO_START( nmg5 )
799static VIDEO_START( nmg5 )
800800{
801801   bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,     8,8,64,64);
802802   fg_tilemap = tilemap_create(fg_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64,64);
r1281r1282
869869}
870870
871871
872VIDEO_UPDATE( nmg5 )
872static VIDEO_UPDATE( nmg5 )
873873{
874874   tilemap_set_scrolly(bg_tilemap,0,scroll_ram[3]+9);
875875   tilemap_set_scrollx(bg_tilemap,0,scroll_ram[2]+3);
r1281r1282
14721472   ROM_RELOAD(0x60000,0x20000)
14731473ROM_END
14741474
1475DRIVER_INIT( prot_val_00 )
1475static DRIVER_INIT( prot_val_00 )
14761476{
14771477   prot_val = 0x00;
14781478}
14791479
1480DRIVER_INIT( prot_val_10 )
1480static DRIVER_INIT( prot_val_10 )
14811481{
14821482   prot_val = 0x10;
14831483}
14841484
1485DRIVER_INIT( prot_val_20 )
1485static DRIVER_INIT( prot_val_20 )
14861486{
14871487   prot_val = 0x20;
14881488}
14891489
1490DRIVER_INIT( prot_val_40 )
1490static DRIVER_INIT( prot_val_40 )
14911491{
14921492   prot_val = 0x40;
14931493}
src/mame/drivers/mario.c
r1281r1282
110110#define ACTIVEHIGH_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | (D << A))
111111
112112
113WRITE8_HANDLER( mario_sh_getcoin_w )    { t[0] = data; }
114WRITE8_HANDLER( mario_sh_crab_w )       { p[1] = ACTIVEHIGH_PORT_BIT(p[1],0,data); }
115WRITE8_HANDLER( mario_sh_turtle_w )     { p[1] = ACTIVEHIGH_PORT_BIT(p[1],1,data); }
116WRITE8_HANDLER( mario_sh_fly_w )        { p[1] = ACTIVEHIGH_PORT_BIT(p[1],2,data); }
113static WRITE8_HANDLER( mario_sh_getcoin_w )    { t[0] = data; }
114static WRITE8_HANDLER( mario_sh_crab_w )       { p[1] = ACTIVEHIGH_PORT_BIT(p[1],0,data); }
115static WRITE8_HANDLER( mario_sh_turtle_w )     { p[1] = ACTIVEHIGH_PORT_BIT(p[1],1,data); }
116static WRITE8_HANDLER( mario_sh_fly_w )        { p[1] = ACTIVEHIGH_PORT_BIT(p[1],2,data); }
117117static WRITE8_HANDLER( mario_sh_tuneselect_w ) { soundlatch_w(offset,data); }
118118
119119static READ8_HANDLER( mario_sh_p1_r )   { return p[1]; }
r1281r1282
134134{
135135   p[2] = data;
136136}
137WRITE8_HANDLER( masao_sh_irqtrigger_w )
137static WRITE8_HANDLER( masao_sh_irqtrigger_w )
138138{
139139   if (last == 1 && data == 0)
140140   {
src/mame/drivers/silkroad.c
r1281r1282
412412  Game driver(s)
413413
414414***************************************************************************/
415DRIVER_INIT( silkroad )
415static DRIVER_INIT( silkroad )
416416{
417417
418418   /* why? rom04.bin looks like a bad dump, but it seems not since it was
src/mame/drivers/wink.c
r1281r1282
267267   SET_TILE_INFO(0, code, 0, 0);
268268}
269269
270VIDEO_START( wink )
270static VIDEO_START( wink )
271271{
272272   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
273273}
274274
275VIDEO_UPDATE( wink )
275static VIDEO_UPDATE( wink )
276276{
277277   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
278278   return 0;
src/mame/drivers/2mindril.c
r1281r1282
7676                }   \
7777         }
7878
79VIDEO_UPDATE( drill )
79static VIDEO_UPDATE( drill )
8080{
8181   int i;
8282   fillbitmap(bitmap,0,NULL);
r1281r1282
111111   return 0;
112112}
113113
114VIDEO_START( drill )
114static VIDEO_START( drill )
115115{
116116   machine->gfx[0]->color_granularity=16;
117117}
118118
119READ16_HANDLER( drill_unk_r )
119static READ16_HANDLER( drill_unk_r )
120120{
121121   return 0xffff;
122122}
r1281r1282
234234   ROM_LOAD32_WORD( "d58-10.ic29", 0x000000, 0x200000, CRC(74c87e08) SHA1(f39b3a64f8338ccf5ca6eb76cee92a10fe0aad8f) )
235235ROM_END
236236
237DRIVER_INIT( drill )
237static DRIVER_INIT( drill )
238238{
239239   // rearrange gfx roms to something we can decode, two of the roms form 4bpp of the graphics, the third forms another 2bpp but is in a different format
240240   UINT32 *src    = (UINT32*)memory_region       ( REGION_GFX2 );
src/mame/drivers/naughtyb.c
r1281r1282
141141
142142//static int popflame_prot_count = 0;
143143
144READ8_HANDLER( popflame_protection_r ) /* Not used by bootleg/hack */
144static READ8_HANDLER( popflame_protection_r ) /* Not used by bootleg/hack */
145145{
146146   static int values[4] = { 0x78, 0x68, 0x48, 0x38|0x80 };
147147   static int count;
r1281r1282
740740ROM_END
741741
742742
743DRIVER_INIT( popflame )
743static DRIVER_INIT( popflame )
744744{
745745   /* install a handler to catch protection checks */
746746   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x9000, 0x9000, 0, 0, popflame_protection_r);
r1281r1282
769769   }
770770}
771771
772DRIVER_INIT( trvmstr )
772static DRIVER_INIT( trvmstr )
773773{
774774   /* install questions' handlers  */
775775   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc000, 0, 0, trvmstr_questions_r);
src/mame/drivers/toypop.c
r1281r1282
128128static UINT8 *toypop_m68000_sharedram;
129129
130130
131READ8_HANDLER( toypop_sound_sharedram_r )
131static READ8_HANDLER( toypop_sound_sharedram_r )
132132{
133133   return namco_soundregs[offset];
134134}
135135
136WRITE8_HANDLER( toypop_sound_sharedram_w )
136static WRITE8_HANDLER( toypop_sound_sharedram_w )
137137{
138138   if (offset < 0x40)
139139      namco_15xx_w(offset,data);
r1281r1282
141141      namco_soundregs[offset] = data;
142142}
143143
144READ16_HANDLER( toypop_m68000_sharedram_r )
144static READ16_HANDLER( toypop_m68000_sharedram_r )
145145{
146146   return toypop_m68000_sharedram[offset];
147147}
148148
149WRITE16_HANDLER( toypop_m68000_sharedram_w )
149static WRITE16_HANDLER( toypop_m68000_sharedram_w )
150150{
151151   if (ACCESSING_LSB)
152152      toypop_m68000_sharedram[offset] = data & 0xff;
153153}
154154
155READ8_HANDLER( toypop_main_interrupt_enable_r )
155static READ8_HANDLER( toypop_main_interrupt_enable_r )
156156{
157157   cpu_interrupt_enable(0,1);
158158   return 0;
159159}
160160
161WRITE8_HANDLER( toypop_main_interrupt_enable_w )
161static WRITE8_HANDLER( toypop_main_interrupt_enable_w )
162162{
163163   cpu_interrupt_enable(0,1);
164164   cpunum_set_input_line(0, 0, CLEAR_LINE);
165165}
166166
167WRITE8_HANDLER( toypop_main_interrupt_disable_w )
167static WRITE8_HANDLER( toypop_main_interrupt_disable_w )
168168{
169169   cpu_interrupt_enable(0,0);
170170}
171171
172WRITE8_HANDLER( toypop_sound_interrupt_enable_acknowledge_w )
172static WRITE8_HANDLER( toypop_sound_interrupt_enable_acknowledge_w )
173173{
174174   cpu_interrupt_enable(1,1);
175175   cpunum_set_input_line(1, 0, CLEAR_LINE);
176176}
177177
178WRITE8_HANDLER( toypop_sound_interrupt_disable_w )
178static WRITE8_HANDLER( toypop_sound_interrupt_disable_w )
179179{
180180   cpu_interrupt_enable(1,0);
181181}
r1281r1282
190190   namcoio_set_irq_line(2,PULSE_LINE);
191191}
192192
193WRITE8_HANDLER( toypop_sound_clear_w )
193static WRITE8_HANDLER( toypop_sound_clear_w )
194194{
195195   cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE);
196196}
197197
198WRITE8_HANDLER( toypop_sound_assert_w )
198static WRITE8_HANDLER( toypop_sound_assert_w )
199199{
200200   cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
201201}
202202
203WRITE8_HANDLER( toypop_m68000_clear_w )
203static WRITE8_HANDLER( toypop_m68000_clear_w )
204204{
205205   cpunum_set_input_line(2, INPUT_LINE_RESET, CLEAR_LINE);
206206}
207207
208WRITE8_HANDLER( toypop_m68000_assert_w )
208static WRITE8_HANDLER( toypop_m68000_assert_w )
209209{
210210   cpunum_set_input_line(2, INPUT_LINE_RESET, ASSERT_LINE);
211211}
r1281r1282
219219   interrupt_enable_68k = 0;
220220}
221221
222MACHINE_RESET( toypop )
222static MACHINE_RESET( toypop )
223223{
224224   /* we must do this on a timer in order to have it take effect */
225225   /* otherwise, the reset process will override our changes */
r1281r1282
232232      cpunum_set_input_line(2, 6, HOLD_LINE);
233233}
234234
235WRITE16_HANDLER( toypop_m68000_interrupt_enable_w )
235static WRITE16_HANDLER( toypop_m68000_interrupt_enable_w )
236236{
237237   interrupt_enable_68k = 1;
238238}
239239
240WRITE16_HANDLER( toypop_m68000_interrupt_disable_w )
240static WRITE16_HANDLER( toypop_m68000_interrupt_disable_w )
241241{
242242   interrupt_enable_68k = 0;
243243}
src/mame/drivers/tumbleb.c
r1281r1282
624624}
625625
626626
627WRITE16_HANDLER(tumbleb2_soundmcu_w)
627static WRITE16_HANDLER(tumbleb2_soundmcu_w)
628628{
629629   int sound;
630630
r1281r1282
718718ADDRESS_MAP_END
719719
720720
721READ16_HANDLER( semibase_unknown_r )
721static READ16_HANDLER( semibase_unknown_r )
722722{
723723   return mame_rand(Machine);
724724}
r1281r1282
939939   AM_RANGE(0x342400, 0x34247f) AM_WRITE(MWA16_NOP)
940940ADDRESS_MAP_END
941941
942WRITE8_HANDLER( jumpkids_oki_bank_w )
942static WRITE8_HANDLER( jumpkids_oki_bank_w )
943943{
944944   UINT8* sound1 = memory_region(REGION_SOUND1);
945945   UINT8* sound2 = memory_region(REGION_SOUND2);
r1281r1282
21642164   semicom_irqhandler
21652165};
21662166
2167MACHINE_RESET (htchctch)
2167static MACHINE_RESET (htchctch)
21682168{
21692169   /* copy protection data every reset */
21702170
r1281r1282
36603660      free(buf);
36613661}
36623662
3663DRIVER_INIT( suprtrio )
3663static DRIVER_INIT( suprtrio )
36643664{
36653665   suprtrio_decrypt_code();
36663666   suprtrio_decrypt_gfx();
36673667}
36683668
3669DRIVER_INIT( chokchok )
3669static DRIVER_INIT( chokchok )
36703670{
36713671   driver_init_htchctch(machine);
36723672
r1281r1282
36773677   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x100002, 0x100003, 0, 0, chokchok_tilebank_w);
36783678}
36793679
3680DRIVER_INIT( wlstar )
3680static DRIVER_INIT( wlstar )
36813681{
36823682   driver_init_htchctch(machine);
36833683
src/mame/drivers/momoko.c
r1281r1282
3535WRITE8_HANDLER( momoko_bg_select_w);
3636WRITE8_HANDLER( momoko_bg_priority_w);
3737
38WRITE8_HANDLER( momoko_bg_read_bank_w )
38static WRITE8_HANDLER( momoko_bg_read_bank_w )
3939{
4040   UINT8 *BG_MAP = memory_region(REGION_USER1);
4141   int bank_address = (data & 0x1f) * 0x1000;
src/mame/drivers/olibochu.c
r1281r1282
1515
1616static tilemap *bg_tilemap;
1717
18PALETTE_INIT( olibochu )
18static PALETTE_INIT( olibochu )
1919{
2020   int i;
2121   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
r1281r1282
5858      COLOR(1,i) = (*(color_prom++) & 0x0f);
5959}
6060
61WRITE8_HANDLER( olibochu_videoram_w )
61static WRITE8_HANDLER( olibochu_videoram_w )
6262{
6363   videoram[offset] = data;
6464   tilemap_mark_tile_dirty(bg_tilemap, offset);
6565}
6666
67WRITE8_HANDLER( olibochu_colorram_w )
67static WRITE8_HANDLER( olibochu_colorram_w )
6868{
6969   colorram[offset] = data;
7070   tilemap_mark_tile_dirty(bg_tilemap, offset);
7171}
7272
73WRITE8_HANDLER( olibochu_flipscreen_w )
73static WRITE8_HANDLER( olibochu_flipscreen_w )
7474{
7575   if (flip_screen != (data & 0x80))
7676   {
r1281r1282
9191   SET_TILE_INFO(0, code, color, flags);
9292}
9393
94VIDEO_START( olibochu )
94static VIDEO_START( olibochu )
9595{
9696   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
9797      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
r1281r1282
158158   }
159159}
160160
161VIDEO_UPDATE( olibochu )
161static VIDEO_UPDATE( olibochu )
162162{
163163   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
164164   draw_sprites(machine, bitmap, cliprect);
src/mame/drivers/tugboat.c
r1281r1282
3434
3535/*  there isn't the usual resistor array anywhere near the color prom,
3636    just four 1k resistors. */
37PALETTE_INIT( tugboat )
37static PALETTE_INIT( tugboat )
3838{
3939   int i;
4040
r1281r1282
112112   }
113113}
114114
115VIDEO_UPDATE( tugboat )
115static VIDEO_UPDATE( tugboat )
116116{
117117   int startaddr0 = hd46505_0_reg[0x0c]*256 + hd46505_0_reg[0x0d];
118118   int startaddr1 = hd46505_1_reg[0x0c]*256 + hd46505_1_reg[0x0d];
r1281r1282
170170   mame_timer_set(video_screen_get_frame_period(0), 0, interrupt_gen);
171171}
172172
173MACHINE_START( tugboat )
173static MACHINE_START( tugboat )
174174{
175175   pia_config(0, &pia0_intf);
176176   pia_config(1, &pia1_intf);
177177}
178178
179MACHINE_RESET( tugboat )
179static MACHINE_RESET( tugboat )
180180{
181181   pia_reset();
182182   mame_timer_set(video_screen_get_time_until_pos(0, 30*8+4, 0), 0, interrupt_gen);
src/mame/drivers/markham.c
r1281r1282
2424/****************************************************************************/
2525
2626
27WRITE8_HANDLER( markham_sharedram_w )
27static WRITE8_HANDLER( markham_sharedram_w )
2828{
2929   markham_sharedram[offset] = data;
3030}
3131
32READ8_HANDLER( markham_sharedram_r )
32static READ8_HANDLER( markham_sharedram_r )
3333{
3434   return markham_sharedram[offset];
3535}
3636
37READ8_HANDLER( markham_e004_r )
37static READ8_HANDLER( markham_e004_r )
3838{
3939   return 0;
4040}
src/mame/drivers/superqix.c
r1281r1282
375375
376376static UINT8 portA_in, portB_out, portC;
377377
378READ8_HANDLER( hotsmash_68705_portA_r )
378static READ8_HANDLER( hotsmash_68705_portA_r )
379379{
380380//logerror("%04x: 68705 reads port A = %02x\n",activecpu_get_pc(),portA_in);
381381   return portA_in;
382382}
383383
384WRITE8_HANDLER( hotsmash_68705_portB_w )
384static WRITE8_HANDLER( hotsmash_68705_portB_w )
385385{
386386   portB_out = data;
387387}
388388
389READ8_HANDLER( hotsmash_68705_portC_r )
389static READ8_HANDLER( hotsmash_68705_portC_r )
390390{
391391   return portC;
392392}
393393
394WRITE8_HANDLER( hotsmash_68705_portC_w )
394static WRITE8_HANDLER( hotsmash_68705_portC_w )
395395{
396396   portC = data;
397397
src/mame/drivers/lockon.c
r1281r1282
129129}
130130
131131/* Characters */
132WRITE16_HANDLER( lockon_vram_0_w )
132static WRITE16_HANDLER( lockon_vram_0_w )
133133{
134134    COMBINE_DATA(&lockon_vram0[offset]);
135135      tilemap_mark_tile_dirty(lockon_tilemap0,offset);
136136}
137137
138138/* Scene */
139WRITE16_HANDLER( lockon_vram_1_w )
139static WRITE16_HANDLER( lockon_vram_1_w )
140140{
141141   COMBINE_DATA(&lockon_vram1[offset]);
142142   tilemap_mark_tile_dirty(lockon_tilemap1,offset);
143143}
144144
145145/* HUD */
146WRITE16_HANDLER( lockon_vram_2_w )
146static WRITE16_HANDLER( lockon_vram_2_w )
147147{
148148   COMBINE_DATA(&lockon_vram2[offset]);
149149   tilemap_mark_tile_dirty(lockon_tilemap2,offset);
r1281r1282
180180}
181181
182182
183VIDEO_START( lockon )
183static VIDEO_START( lockon )
184184{
185185   lockon_tilemap0 = tilemap_create(get_lockon_tile_info0,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8,8,64,32);
186186   lockon_tilemap1 = tilemap_create(get_lockon_tile_info1,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8,8,64,32);
r1281r1282
188188   tilemap_set_transparent_pen(lockon_tilemap0,0x00);
189189}
190190
191VIDEO_UPDATE( lockon )
191static VIDEO_UPDATE( lockon )
192192{
193193   tilemap_draw(bitmap,cliprect,lockon_tilemap1,0,0);       // Scene
194194   tilemap_draw(bitmap,cliprect,lockon_tilemap0,0,0);       // Characters
src/mame/drivers/pntnpuzl.c
r1281r1282
158158
159159static UINT16 pntnpuzl_eeprom;
160160
161READ16_HANDLER( pntnpuzl_eeprom_r )
161static READ16_HANDLER( pntnpuzl_eeprom_r )
162162{
163163   /* bit 11 is EEPROM data */
164164   return (pntnpuzl_eeprom & 0xf4ff) | (EEPROM_read_bit()<<11) | (readinputport(3) & 0x0300);
165165}
166166
167WRITE16_HANDLER( pntnpuzl_eeprom_w )
167static WRITE16_HANDLER( pntnpuzl_eeprom_w )
168168{
169169   pntnpuzl_eeprom = data;
170170
r1281r1282
183183UINT16* pntnpuzl_3a0000ram;
184184UINT16* pntnpuzl_bank;
185185/* vid */
186VIDEO_START( pntnpuzl )
186static VIDEO_START( pntnpuzl )
187187{
188188   pntnpuzl_3a0000ram=auto_malloc(0x100000);
189189}
190190
191VIDEO_UPDATE( pntnpuzl )
191static VIDEO_UPDATE( pntnpuzl )
192192{
193193   int x,y;
194194   int count;
r1281r1282
248248   return 0;
249249}
250250
251WRITE16_HANDLER( pntnpuzl_palette_w )
251static WRITE16_HANDLER( pntnpuzl_palette_w )
252252{
253253   static int indx,sub,rgb[3];
254254
r1281r1282
271271
272272
273273
274#ifdef UNUSED_FUNCTION
274275READ16_HANDLER ( pntnpuzl_random_r )
275276{
276277   return mame_rand(Machine);
277278}
279#endif
278280
279READ16_HANDLER( pntnpuzl_vid_r )
281static READ16_HANDLER( pntnpuzl_vid_r )
280282{
281283//  logerror("read_videoram: pc = %06x : offset %04x reg %04x\n",activecpu_get_pc(),offset*2, pntnpuzl_bank[0]);
282284   return pntnpuzl_3a0000ram[offset+ (pntnpuzl_bank[0]&0x0001)*0x8000 ];
283285}
284286
285WRITE16_HANDLER( pntnpuzl_vid_w )
287static WRITE16_HANDLER( pntnpuzl_vid_w )
286288{
287289//  logerror("write_to_videoram: pc = %06x : offset %04x data %04x reg %04x\n",activecpu_get_pc(),offset*2, data, pntnpuzl_bank[0]);
288290   COMBINE_DATA(&pntnpuzl_3a0000ram[offset+ (pntnpuzl_bank[0]&0x0001)*0x8000 ]);
289291}
290292
291READ16_HANDLER( pntnpuzl_vblank_r )
293static READ16_HANDLER( pntnpuzl_vblank_r )
292294{
293295   return (readinputport(0) & 1) << 11;
294296}
r1281r1282
318320*/
319321static UINT16 pntpzl_200000, serial, serial_out,read_count;
320322
321WRITE16_HANDLER( pntnpuzl_200000_w )
323static WRITE16_HANDLER( pntnpuzl_200000_w )
322324{
323325// logerror("200000: %04x\n",data);
324326   // bit 12: set to 1 when going to serial output to 280018
r1281r1282
332334   pntpzl_200000 = data;
333335}
334336
335WRITE16_HANDLER( pntnpuzl_280018_w )
337static WRITE16_HANDLER( pntnpuzl_280018_w )
336338{
337339// logerror("%04x: 280018: %04x\n",activecpu_get_pc(),data);
338340   serial >>= 1;
r1281r1282
340342      serial |= 0x400;
341343}
342344
343READ16_HANDLER( pntnpuzl_280014_r )
345static READ16_HANDLER( pntnpuzl_280014_r )
344346{
345347   static int startup[3] = { 0x80, 0x0c, 0x00 };
346348   int res;
r1281r1282
371373   return res << 8;
372374}
373375
374READ16_HANDLER( pntnpuzl_28001a_r )
376static READ16_HANDLER( pntnpuzl_28001a_r )
375377{
376378   return 0x4c00;
377379}
src/mame/drivers/tigeroad.c
r1281r1282
788788
789789
790790
791DRIVER_INIT( tigeroad )
791static DRIVER_INIT( tigeroad )
792792{
793793   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xfe4002, 0xfe4003, 0, 0, tigeroad_soundcmd_w);
794794}
795795
796DRIVER_INIT( f1dream )
796static DRIVER_INIT( f1dream )
797797{
798798   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xfe4002, 0xfe4003, 0, 0, f1dream_control_w);
799799}
src/mame/drivers/wilytowr.c
r1281r1282
3636static tilemap *bg_tilemap, *fg_tilemap;
3737
3838
39PALETTE_INIT( wilytowr )
39static PALETTE_INIT( wilytowr )
4040{
4141   int i;
4242
r1281r1282
119119   }
120120}
121121
122WRITE8_HANDLER( wilytwr_flipscreen_w )
122static WRITE8_HANDLER( wilytwr_flipscreen_w )
123123{
124124   if (flip_screen != (~data & 0x01))
125125   {
r1281r1282
128128   }
129129}
130130
131WRITE8_HANDLER( fghtbskt_flipscreen_w )
131static WRITE8_HANDLER( fghtbskt_flipscreen_w )
132132{
133133   flip_screen_set(data);
134134   fg_flag = flip_screen ? TILE_FLIPX : 0;
r1281r1282
151151   SET_TILE_INFO(0, code, 0, fg_flag);
152152}
153153
154VIDEO_START( wilytowr )
154static VIDEO_START( wilytowr )
155155{
156156   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
157157      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
r1281r1282
195195   }
196196}
197197
198VIDEO_UPDATE( wilytowr )
198static VIDEO_UPDATE( wilytowr )
199199{
200200   int col;
201201
r1281r1282
716716   ROM_LOAD( "fb_b.11e",     0x0200, 0x0100, CRC(fca5bf0e) SHA1(5846f43aa2906cac58e300fdab197b99f896e3ef) )
717717ROM_END
718718
719DRIVER_INIT( wilytowr )
719static DRIVER_INIT( wilytowr )
720720{
721721   sy_offset = 238;
722722}
723723
724DRIVER_INIT( fghtbskt )
724static DRIVER_INIT( fghtbskt )
725725{
726726   sy_offset = 240;
727727}
src/mame/drivers/spaceg.c
r1281r1282
174174static int io9400;
175175static int io9401;
176176
177VIDEO_UPDATE( spaceg )
177static VIDEO_UPDATE( spaceg )
178178{
179179   copybitmap(bitmap,tmpbitmap,0,0,0,0,cliprect,TRANSPARENCY_NONE,0);
180180
src/mame/drivers/looping.c
r1281r1282
115115 *
116116 *************************************/
117117
118PALETTE_INIT( looping )
118static PALETTE_INIT( looping )
119119{
120120   static const int resistances[3] = { 1000, 470, 220 };
121121   double rweights[3], gweights[3], bweights[2];
r1281r1282
170170}
171171
172172
173VIDEO_START( looping )
173static VIDEO_START( looping )
174174{
175175   looping_state *state = machine->driver_data;
176176
r1281r1282
203203}
204204
205205
206WRITE8_HANDLER( looping_videoram_w )
206static WRITE8_HANDLER( looping_videoram_w )
207207{
208208   looping_state *state = Machine->driver_data;
209209   state->videoram[offset] = data;
r1281r1282
211211}
212212
213213
214WRITE8_HANDLER( looping_colorram_w )
214static WRITE8_HANDLER( looping_colorram_w )
215215{
216216   looping_state *state = Machine->driver_data;
217217   int i;
r1281r1282
271271}
272272
273273
274VIDEO_UPDATE( looping )
274static VIDEO_UPDATE( looping )
275275{
276276   looping_state *state = machine->driver_data;
277277   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
r1281r1282
322322}
323323
324324
325WRITE8_HANDLER( looping_souint_clr )
325static WRITE8_HANDLER( looping_souint_clr )
326326{
327327   if (data == 0)
328328      cpunum_set_input_line(1, 0, CLEAR_LINE);
r1281r1282
349349 *
350350 *************************************/
351351
352WRITE8_HANDLER( looping_sound_sw )
352static WRITE8_HANDLER( looping_sound_sw )
353353{
354354   /* this can be improved by adding the missing signals for decay etc. (see schematics)
355355
r1281r1282
768768 *
769769 *************************************/
770770
771DRIVER_INIT( looping )
771static DRIVER_INIT( looping )
772772{
773773   int length = memory_region_length(REGION_CPU1);
774774   UINT8 *rom = memory_region(REGION_CPU1);
src/mame/drivers/segas32.c
r1281r1282
1010
1111****************************************************************************
1212
13Slip Stream (950515 HISPANIC)
14Sega, 1995
15
16This game runs on Sega System 32 hardware.
17
18PCB Layout
19----------
20837-7428  171-5964E (C) SEGA 1990
21|-------------------------------------------------------------------------------------------|
22| TDA1518                                                               8464      8464      |
23|             HM65256                                                   8464      8464      |
24|  TL064      HM65256             |---------|                             |---------|       |
25|   LC7881  |-----|               |SEGA     |                             |SEGA     |       |
26|           |ASSP |               |315-5385 |                             |315-5388 |       |
27|CND        |5C105|               |         |                             |         |       |
28|           |1FD07|               |         |             |---------|     |         |       |
29|           |-----|               |---------|        CNF  |SEGA     |     |---------|       |
30|                                                         |315-5242 |                       |
31|-|  TL062   TL064                  84256                 |         |                       |
32  |                                 84256                 |         |                    CNI|
33|-|                                                       |---------|      |---------|      |
34|             YM3438                                                       |SEGA     |      |
35|                             |-----------|                                |315-5387 |      |
36|             YM3438          |NEC        |       315-5441                 |         |      |
37|                             |D70616R-16 |                                |         |      |
38|J              BAT_5.5V      |9105M9 V60 |                                |---------|      |
39|A   BAT_3.3V                 |(C)NEC 1986|                                                 |
40|M                            |           |                                  D42264         |
41|M            8464            |-----------|                                  D42264         |
42|A                                                                           D42264         |
43|             Z80                                                            D42264         |
44|                            HM53461ZP-12   HM53461ZP-12                                    |
45|                            HM53461ZP-12   HM53461ZP-12                                    |
46|                            HM53461ZP-12   HM53461ZP-12                                    |
47|                            HM53461ZP-12   HM53461ZP-12                |-----------|       |
48|-|                          HM53461ZP-12   HM53461ZP-12                | SEGA      |    CNE|
49  |      |-------|           HM53461ZP-12   HM53461ZP-12                | 315-5386A |       |
50|-|      |SEGA   |           HM53461ZP-12   HM53461ZP-12                |           |       |
51|        |315-   |           HM53461ZP-12   HM53461ZP-12                |           |       |
52|        |5296   |                                                      |           |       |
53|        |-------|        3771   3771                                   |-----------|       |
54|         93C46                                                              D42264         |
55|CNB                         SW2                                             D42264         |
56|                            SW1                                             D42264         |
57|       CNA                  DSW1    32MHz  50MHz                            D42264         |
58|-------------------------------------------------------------------------------------------|
59
60Notes:
61      V60 CPU running at 16.00MHz [32/2]
62      Z80 CPU running at 8.000MHz [32/4]
63      YM3438 running at 8.000MHz [32/4]
64      CNE/F/I - Multi-pin connectors for connection of ROM Board
65      CND     - 4 pin connector for 2nd Speaker for Stereo Output
66      CNA     - 30 pin connector for extra controls PCB
67      CNB     - 26 pin connector (purpose unknown)
68      SW1     - push-button TEST switch
69      SW2     - push button SERVICE switch
70      DSW1    - 4-position DIP Switch
71      HM53461 - Hitachi 256k Dual Port RAM
72      D42264  - NEC 256k Dual Port RAM
73
74      SEGA Custom ICs:
75                      315-5441  Lattice GAL16V8A (DIP20)
76                      315-5386A (QFP184)
77                      315-5388  (QFP160)
78                      315-5387  (QFP160)
79                      315-5242  (custom ceramic DIP32 containing a small QFP IC and some capacitors/resistors etc)
80                      315-5296  (QFP100)
81                      ASSP 5C105 (QFP80)
82                      315-5385  (QFP128)
83
84
85ROM Board
86---------
87837-7429-01
88|-------------------------------------------------------------------------------------------|
89|JP10-JP27                     CNJ                    CNH                      JP1-JP9      |
90|              IC6                                                                          |
91| IC7                                                                                       |
92|              IC13                                                                         |
93| IC14                                                                                      |
94|            315-5442                                                                       |
95| IC22                                 IC25                IC24               IC23          |
96|                                                                                           |
97| IC26                                 IC29                IC28               IC27          |
98|                                                                                           |
99| IC31            CNK                  IC34                IC23               IC32          |
100|                                                                                           |
101| IC35                                 IC38                IC37               IC36          |
102|             CNG       JP28-JP32                                                           |
103|-------------------------------------------------------------------------------------------|
104
105Notes:
106CNG/H/J  - Multi-pin connectors (below PCB) for connection of ROM Board to Main Board
107CNK      - Custom Sega connector for connection of protection daughterboard (not used)
108315-5442 - MMI PAL16L8ACN (DIP20)
109
110Jumpers: (to configure ROM sizes used on Slip Stream. Other games)
111         (may vary depending on ROM types used)
112JP1: 2-3           JP17: 1-2
113JP2: 2-3           JP18: 2-3
114JP3: 2-3           JP19: 1-2
115JP4: 1-2           JP20: 2-3
116JP5: 2-3           JP21: 1-2
117JP6: 2-3           JP22: 2-3
118JP7: 1-2           JP23: 1-2
119JP8: 2-3           JP24: 1-2
120JP9: 1-2           JP25: 2-3
121JP10: 2-3          JP26: 1-2
122JP11: 1-2          JP27: 1-2
123JP12: 1-2          JP28: 2-3
124JP13: 1-2          JP29: 1-2
125JP14: 2-3          JP30: 2-3
126JP15: 2-3          JP31: 1-2
127JP16: 2-3          JP32: 1-2
128
129ROM Locations
130-------------
131PCB Label  CPU P0 CPU P1    CPU D0   CPU D1   SND0     SND1     SND2 SND3 SCR0     SCR1     SCR2     SCR3     OBJ0     OBJ1     OBJ2     OBJ3     OBJ4     OBJ5     OBJ6     OBJ7
132IC#        IC13   IC6       IC7      IC14     IC35     IC31     -    -    IC38     IC34     IC29     IC25     IC36     IC32     IC27     IC23     IC37     IC33     IC28     IC24
133IC Type    -      27C4002   27C4000  27C4000  27C010   27C4000  -    -    27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000  27C4000
134ROM Label  -      S32HPRG01 S32DAT00 S32DAT01 S32SND00 S32SND01 -    -    S32SCR00 S32SCR01 S32SCR02 S32SCR03 S32OBJ00 S32OBJ01 S32OBJ02 S32OBJ03 S32OBJ04 S32OBJ05 S32OBJ06 S32OBJ07
135
136
137Extra Controls PCB
138------------------
139837-7536
140837-7536-91 (sticker)
141|------------------------|
142|                        |
143|                 74HC74 |
144|         OKI_M6253      |
145|  74HC4053              |
146| DAP601          74HC139|
147| DAN601                 |
148|CN2              CN1    |
149|------------------------|
150Notes:
151CN2 - Multi-pin connector for controls
152CN1 - Connector joining to CNA on main PCB
153
154
155*********************************************************************************************
156
157
13158Title Fight (Export Revision)
14159Sega, 1992
15160
r1281r1282
31753320 **************************************************************************************************************************
31763321 **************************************************************************************************************************
31773322    Slipstream
3323
3324    GAME BD NO. 833-7429-01
3325     1. ROM BD. 837-7429-01
3326     2. MAIN BD. 837-7428
3327    A/D BD NO. 837-7536
31783328*/
31793329ROM_START( slipstrm )
31803330   ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code + data */
3181   ROM_LOAD_x2( "slipstrm.u6",     0x000000, 0x080000, CRC(7d066307) SHA1(d87e04167263b435b77830db02ed58651ccc020c) )
3182   ROM_LOAD16_BYTE( "slipstrm.u14",0x100000, 0x080000, CRC(c3ff6309) SHA1(dcc857736fe0f15aa7909c3ee88a7e239c8f0228) )
3183   ROM_LOAD16_BYTE( "slipstrm.u7", 0x100001, 0x080000, CRC(0e605c81) SHA1(47c64195cab9a07b234d5a375d26168e53ffaa17) )
3331   ROM_LOAD_x2( "s32b_prg01.ic6",    0x000000, 0x080000, CRC(7d066307) SHA1(d87e04167263b435b77830db02ed58651ccc020c) )
3332   ROM_LOAD16_BYTE( "s32_dat00.ic14",0x100000, 0x080000, CRC(c3ff6309) SHA1(dcc857736fe0f15aa7909c3ee88a7e239c8f0228) )
3333   ROM_LOAD16_BYTE( "s32_dat01.ic7", 0x100001, 0x080000, CRC(0e605c81) SHA1(47c64195cab9a07b234d5a375d26168e53ffaa17) )
31843334
31853335   ROM_REGION( 0x500000, REGION_CPU2, 0 ) /* sound CPU */
3186   ROM_LOAD_x8( "slipstrm.u35", 0x100000, 0x020000, CRC(0fee2278) SHA1(7533a03c3fc46d65dfdd07bddf1e6e0bbc368752) )
3187   ROM_LOAD_x2( "slipstrm.u31", 0x200000, 0x080000, CRC(ae7be5f2) SHA1(ba089355e64864435bcc3b0c208e4bce1ea66295) )
3336   ROM_LOAD_x8( "s32_snd00.ic35", 0x100000, 0x020000, CRC(0fee2278) SHA1(7533a03c3fc46d65dfdd07bddf1e6e0bbc368752) )
3337   ROM_LOAD_x2( "s32_snd01.ic31", 0x200000, 0x080000, CRC(ae7be5f2) SHA1(ba089355e64864435bcc3b0c208e4bce1ea66295) )
31883338
31893339   ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
3190   ROM_LOAD32_BYTE( "slipstrm.u38", 0x000000, 0x080000, CRC(3cbb2d0b) SHA1(b94006347b72cd60a889b0e279f62f677cedfd2e) )
3191   ROM_LOAD32_BYTE( "slipstrm.u34", 0x000002, 0x080000, CRC(4167be55) SHA1(96b34d311b318c00c3fad917e341589a70ba0a15) )
3192   ROM_LOAD32_BYTE( "slipstrm.u29", 0x000001, 0x080000, CRC(52c4bb85) SHA1(4fbee1072a19c75c25b5fd269acc75640923d69c) )
3193   ROM_LOAD32_BYTE( "slipstrm.u25", 0x000003, 0x080000, CRC(4948604a) SHA1(d5a1b9781fef7976a59a0af9b755a04fcacf9381) )
3340   ROM_LOAD32_BYTE( "s32_scr00.ic38", 0x000000, 0x080000, CRC(3cbb2d0b) SHA1(b94006347b72cd60a889b0e279f62f677cedfd2e) )
3341   ROM_LOAD32_BYTE( "s32_scr01.ic34", 0x000002, 0x080000, CRC(4167be55) SHA1(96b34d311b318c00c3fad917e341589a70ba0a15) )
3342   ROM_LOAD32_BYTE( "s32_scr02.ic29", 0x000001, 0x080000, CRC(52c4bb85) SHA1(4fbee1072a19c75c25b5fd269acc75640923d69c) )
3343   ROM_LOAD32_BYTE( "s32_scr03.ic25", 0x000003, 0x080000, CRC(4948604a) SHA1(d5a1b9781fef7976a59a0af9b755a04fcacf9381) )
31943344
31953345   ROM_REGION32_BE( 0x400000, REGION_GFX2, 0 ) /* sprites */
3196   ROMX_LOAD( "slipstrm.u36", 0x000000, 0x80000, CRC(cffe9e0d) SHA1(5272d54ff142de927a9abd61f3646e963c7d22c4) , ROM_SKIP(7) )
3197   ROMX_LOAD( "slipstrm.u32", 0x000001, 0x80000, CRC(4ebd1383) SHA1(ce35f4d15e7904bfde55e58cdde925cba8002763) , ROM_SKIP(7) )
3198   ROMX_LOAD( "slipstrm.u27", 0x000002, 0x80000, CRC(b3cf4fe2) SHA1(e13199522e1e3e8b9cfe72cc29b33f25dad542ef) , ROM_SKIP(7) )
3199   ROMX_LOAD( "slipstrm.u23", 0x000003, 0x80000, CRC(c6345391) SHA1(155758097911ffca0c5c0b2a24a8033339dcfcbb) , ROM_SKIP(7) )
3200   ROMX_LOAD( "slipstrm.u37", 0x000004, 0x80000, CRC(2de4288e) SHA1(8e794f79f506293edb7609187a7908516ce76849) , ROM_SKIP(7) )
3201   ROMX_LOAD( "slipstrm.u33", 0x000005, 0x80000, CRC(6cfb74fb) SHA1(b74c886959910cd069427418525b23300a9b7b18) , ROM_SKIP(7) )
3202   ROMX_LOAD( "slipstrm.u28", 0x000006, 0x80000, CRC(53234bf4) SHA1(1eca538dcb86e44c31310ab1ab42a2b66b69c8fe) , ROM_SKIP(7) )
3203   ROMX_LOAD( "slipstrm.u24", 0x000007, 0x80000, CRC(22c129cf) SHA1(0f64680511a357038f6a556253c13fbb5417dd1a) , ROM_SKIP(7) )
3346   ROMX_LOAD( "s32_obj00.ic36", 0x000000, 0x80000, CRC(cffe9e0d) SHA1(5272d54ff142de927a9abd61f3646e963c7d22c4) , ROM_SKIP(7) )
3347   ROMX_LOAD( "s32_obj01.ic32", 0x000001, 0x80000, CRC(4ebd1383) SHA1(ce35f4d15e7904bfde55e58cdde925cba8002763) , ROM_SKIP(7) )
3348   ROMX_LOAD( "s32_obj02.ic27", 0x000002, 0x80000, CRC(b3cf4fe2) SHA1(e13199522e1e3e8b9cfe72cc29b33f25dad542ef) , ROM_SKIP(7) )
3349   ROMX_LOAD( "s32_obj03.ic23", 0x000003, 0x80000, CRC(c6345391) SHA1(155758097911ffca0c5c0b2a24a8033339dcfcbb) , ROM_SKIP(7) )
3350   ROMX_LOAD( "s32_obj04.ic37", 0x000004, 0x80000, CRC(2de4288e) SHA1(8e794f79f506293edb7609187a7908516ce76849) , ROM_SKIP(7) )
3351   ROMX_LOAD( "s32_obj05.ic33", 0x000005, 0x80000, CRC(6cfb74fb) SHA1(b74c886959910cd069427418525b23300a9b7b18) , ROM_SKIP(7) )
3352   ROMX_LOAD( "s32_obj06.ic28", 0x000006, 0x80000, CRC(53234bf4) SHA1(1eca538dcb86e44c31310ab1ab42a2b66b69c8fe) , ROM_SKIP(7) )
3353   ROMX_LOAD( "s32_obj07.ic24", 0x000007, 0x80000, CRC(22c129cf) SHA1(0f64680511a357038f6a556253c13fbb5417dd1a) , ROM_SKIP(7) )
32043354ROM_END
32053355
3356ROM_START( slipstrh )
3357   ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code + data */
3358   ROM_LOAD_x2( "s32h_prg01.ic6",    0x000000, 0x080000, CRC(ab778297) SHA1(e440d44b20f2f7478ef7d86af90af5eb7b9a545a) )
3359   ROM_LOAD16_BYTE( "s32_dat00.ic14",0x100000, 0x080000, CRC(c3ff6309) SHA1(dcc857736fe0f15aa7909c3ee88a7e239c8f0228) )
3360   ROM_LOAD16_BYTE( "s32_dat01.ic7", 0x100001, 0x080000, CRC(0e605c81) SHA1(47c64195cab9a07b234d5a375d26168e53ffaa17) )
32063361
3362   ROM_REGION( 0x500000, REGION_CPU2, 0 ) /* sound CPU */
3363   ROM_LOAD_x8( "s32_snd00.ic35", 0x100000, 0x020000, CRC(0fee2278) SHA1(7533a03c3fc46d65dfdd07bddf1e6e0bbc368752) )
3364   ROM_LOAD_x2( "s32_snd01.ic31", 0x200000, 0x080000, CRC(ae7be5f2) SHA1(ba089355e64864435bcc3b0c208e4bce1ea66295) )
3365
3366   ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
3367   ROM_LOAD32_BYTE( "s32_scr00.ic38", 0x000000, 0x080000, CRC(3cbb2d0b) SHA1(b94006347b72cd60a889b0e279f62f677cedfd2e) )
3368   ROM_LOAD32_BYTE( "s32_scr01.ic34", 0x000002, 0x080000, CRC(4167be55) SHA1(96b34d311b318c00c3fad917e341589a70ba0a15) )
3369   ROM_LOAD32_BYTE( "s32_scr02.ic29", 0x000001, 0x080000, CRC(52c4bb85) SHA1(4fbee1072a19c75c25b5fd269acc75640923d69c) )
3370   ROM_LOAD32_BYTE( "s32_scr03.ic25", 0x000003, 0x080000, CRC(4948604a) SHA1(d5a1b9781fef7976a59a0af9b755a04fcacf9381) )
3371
3372   ROM_REGION32_BE( 0x400000, REGION_GFX2, 0 ) /* sprites */
3373   ROMX_LOAD( "s32_obj00.ic36", 0x000000, 0x80000, CRC(cffe9e0d) SHA1(5272d54ff142de927a9abd61f3646e963c7d22c4) , ROM_SKIP(7) )
3374   ROMX_LOAD( "s32_obj01.ic32", 0x000001, 0x80000, CRC(4ebd1383) SHA1(ce35f4d15e7904bfde55e58cdde925cba8002763) , ROM_SKIP(7) )
3375   ROMX_LOAD( "s32_obj02.ic27", 0x000002, 0x80000, CRC(b3cf4fe2) SHA1(e13199522e1e3e8b9cfe72cc29b33f25dad542ef) , ROM_SKIP(7) )
3376   ROMX_LOAD( "s32_obj03.ic23", 0x000003, 0x80000, CRC(c6345391) SHA1(155758097911ffca0c5c0b2a24a8033339dcfcbb) , ROM_SKIP(7) )
3377   ROMX_LOAD( "s32_obj04.ic37", 0x000004, 0x80000, CRC(2de4288e) SHA1(8e794f79f506293edb7609187a7908516ce76849) , ROM_SKIP(7) )
3378   ROMX_LOAD( "s32_obj05.ic33", 0x000005, 0x80000, CRC(6cfb74fb) SHA1(b74c886959910cd069427418525b23300a9b7b18) , ROM_SKIP(7) )
3379   ROMX_LOAD( "s32_obj06.ic28", 0x000006, 0x80000, CRC(53234bf4) SHA1(1eca538dcb86e44c31310ab1ab42a2b66b69c8fe) , ROM_SKIP(7) )
3380   ROMX_LOAD( "s32_obj07.ic24", 0x000007, 0x80000, CRC(22c129cf) SHA1(0f64680511a357038f6a556253c13fbb5417dd1a) , ROM_SKIP(7) )
3381ROM_END
3382
3383
32073384/**************************************************************************************************************************
32083385 **************************************************************************************************************************
32093386 **************************************************************************************************************************
r1281r1282
38534030GAME( 1991, radmu,    radm,     system32,     radm,     radm,     ROT0, "Sega",   "Rad Mobile (US)", GAME_IMPERFECT_GRAPHICS )
38544031GAME( 1991, radr,     0,        system32,     radr,     radr,     ROT0, "Sega",   "Rad Rally (World)", GAME_IMPERFECT_GRAPHICS )
38554032GAME( 1991, radru,    radr,     system32,     radr,     radr,     ROT0, "Sega",   "Rad Rally (US)", GAME_IMPERFECT_GRAPHICS )
3856GAME( 1995, slipstrm, 0,        system32,     slipstrm, slipstrm, ROT0, "Capcom", "Slipstream (Brazil 950515)", GAME_IMPERFECT_GRAPHICS )
4033GAME( 1995, slipstrm, 0,        system32,     slipstrm, slipstrm, ROT0, "Capcom", "Slipstream (950515 BRAZIL)", GAME_IMPERFECT_GRAPHICS )
4034GAME( 1995, slipstrh, slipstrm, system32,     slipstrm, slipstrm, ROT0, "Capcom", "Slipstream (950515 HISPANIC)", GAME_IMPERFECT_GRAPHICS )
38574035GAME( 1992, sonic,    0,        system32,     sonic,    sonic,    ROT0, "Sega",   "SegaSonic The Hedgehog (Japan, rev. C)", GAME_IMPERFECT_GRAPHICS )
38584036GAME( 1992, sonicp,   sonic,    system32,     sonic,    sonicp,   ROT0, "Sega",   "SegaSonic The Hedgehog (Japan, prototype)", GAME_IMPERFECT_GRAPHICS )
38594037GAME( 1991, spidman,  0,        system32,     spidman,  spidman,  ROT0, "Sega",   "Spider-Man: The Videogame (World)", GAME_IMPERFECT_GRAPHICS )
38604038GAME( 1991, spidmanu, spidman,  system32,     spidmanu, spidman,  ROT0, "Sega",   "Spider-Man: The Videogame (US)", GAME_IMPERFECT_GRAPHICS )
38614039GAME( 1994, svf,      0,        system32,     svf,      svf,      ROT0, "Sega",   "Super Visual Football: European Sega Cup", GAME_IMPERFECT_GRAPHICS )
3862GAME( 1994, svs,     svf,      system32,     svf,       svf,      ROT0, "Sega",   "Super Visual Soccer: Sega Cup (US)", GAME_IMPERFECT_GRAPHICS )
3863GAME( 1994, jleague,  svf,      system32,     svf,      jleague,  ROT0, "Sega",   "The J.League 1994 (Japan)", GAME_IMPERFECT_GRAPHICS )
4040GAME( 1994, svs,      svf,      system32,     svf,      svf,      ROT0, "Sega",   "Super Visual Soccer: Sega Cup (US)", GAME_IMPERFECT_GRAPHICS )
4041GAME( 1994, jleague,  svf,      system32,     svf,      jleague,  ROT0, "Sega",   "The J.League 1994 (Japan)", GAME_IMPERFECT_GRAPHICS )
38644042
38654043GAME( 1994, harddunk, 0,        multi32,      harddunk, harddunk, ROT0, "Sega",   "Hard Dunk (World)", GAME_IMPERFECT_GRAPHICS )
38664044GAME( 1994, harddunj, harddunk, multi32,      harddunk, harddunk, ROT0, "Sega",   "Hard Dunk (Japan)", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/1945kiii.c
r1281r1282
7474   SET_TILE_INFO(1,tileno,0,0);
7575}
7676
77VIDEO_START(k3)
77static VIDEO_START(k3)
7878{
7979   k3_bg_tilemap = tilemap_create(get_k3_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,      16, 16, 32,64);
8080}
r1281r1282
103103   }
104104}
105105
106VIDEO_UPDATE(k3)
106static VIDEO_UPDATE(k3)
107107{
108108   tilemap_draw(bitmap,cliprect,k3_bg_tilemap,0,0);
109109   draw_sprites(machine,bitmap,cliprect);
r1281r1282
111111}
112112
113113
114WRITE16_HANDLER( k3_scrollx_w )
114static WRITE16_HANDLER( k3_scrollx_w )
115115{
116116   tilemap_set_scrollx( k3_bg_tilemap,0, data);
117117}
118118
119WRITE16_HANDLER( k3_scrolly_w )
119static WRITE16_HANDLER( k3_scrolly_w )
120120{
121121   tilemap_set_scrolly( k3_bg_tilemap,0, data);
122122}
123123
124WRITE16_HANDLER( k3_soundbanks_w )
124static WRITE16_HANDLER( k3_soundbanks_w )
125125{
126126   OKIM6295_set_bank_base(0, (data & 4) ? 0x40000 : 0);
127127   OKIM6295_set_bank_base(1, (data & 2) ? 0x40000 : 0);
src/mame/drivers/slapfght.c
r1281r1282
15971597
15981598}
15991599
1600READ8_HANDLER( getstar_mcu_r )
1600static READ8_HANDLER( getstar_mcu_r )
16011601{
16021602   /* pass the first check only */
16031603   return 0x76;
r1281r1282
16141614   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_e803_r );
16151615}
16161616
1617READ8_HANDLER( gtstarba_port_0_read )
1617static READ8_HANDLER( gtstarba_port_0_read )
16181618{
16191619   /* the bootleg has it's own 'protection' on startup? */
16201620   if (activecpu_get_pc()==0x6d1e) return 0;
r1281r1282
16271627   return 0;
16281628}
16291629
1630READ8_HANDLER( gtstarba_dpram_r )
1630static READ8_HANDLER( gtstarba_dpram_r )
16311631{
16321632   /* requires this or it gets stuck with 'rom test' on screen */
16331633   /* it is possible the program roms are slighly corrupt like the gfx roms, or
r1281r1282
16461646
16471647static int slapfigh_prot_pos;
16481648
1649READ8_HANDLER( slapfigh_mcu_r )
1649static READ8_HANDLER( slapfigh_mcu_r )
16501650{
16511651   /* pass initial checks */
16521652   int protvalues[] = { 0xc7, 0x55, -1 };
src/mame/drivers/darkhors.c
r1281r1282
6666
6767***************************************************************************/
6868
69VIDEO_START( darkhors );
70VIDEO_UPDATE( darkhors );
69static VIDEO_START( darkhors );
70static VIDEO_UPDATE( darkhors );
7171
7272static tilemap *darkhors_tmap, *darkhors_tmap2;
7373UINT32 *darkhors_tmapram,  *darkhors_tmapscroll;
r1281r1282
8787   SET_TILE_INFO(0, tile/2, (color & 0x200) ? (color & 0x1ff) : ((color & 0x0ff) * 4) , 0);
8888}
8989
90WRITE32_HANDLER( darkhors_tmapram_w )
90static WRITE32_HANDLER( darkhors_tmapram_w )
9191{
9292   COMBINE_DATA(&darkhors_tmapram[offset]);
9393   tilemap_mark_tile_dirty(darkhors_tmap, offset);
9494}
95WRITE32_HANDLER( darkhors_tmapram2_w )
95static WRITE32_HANDLER( darkhors_tmapram2_w )
9696{
9797   COMBINE_DATA(&darkhors_tmapram2[offset]);
9898   tilemap_mark_tile_dirty(darkhors_tmap2, offset);
r1281r1282
133133   }
134134}
135135
136VIDEO_START( darkhors )
136static VIDEO_START( darkhors )
137137{
138138   darkhors_tmap         =   tilemap_create(   get_tile_info_0, tilemap_scan_rows,
139139                                    TILEMAP_TYPE_PEN, 16,16, 0x40,0x40   );
r1281r1282
147147   machine->gfx[0]->color_granularity = 64; /* 256 colour sprites with palette selectable on 64 colour boundaries */
148148}
149149
150VIDEO_UPDATE( darkhors )
150static VIDEO_UPDATE( darkhors )
151151{
152152   int layers_ctrl = -1;
153153
r1281r1282
211211//  "*10010xxxx"    // erase all    1 00 10xxxx
212212};
213213
214NVRAM_HANDLER( darkhors )
214static NVRAM_HANDLER( darkhors )
215215{
216216   if (read_or_write)
217217      EEPROM_save(file);
r1281r1282
228228   }
229229}
230230
231READ32_HANDLER( darkhors_eeprom_r )
231static READ32_HANDLER( darkhors_eeprom_r )
232232{
233233   // bit 31?
234234   return readinputport(4) | ((EEPROM_read_bit() & 1) << (7+16));
235235}
236236
237WRITE32_HANDLER( darkhors_eeprom_w )
237static WRITE32_HANDLER( darkhors_eeprom_w )
238238{
239239   if (data & ~0xff000000)
240240      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %08X\n",activecpu_get_pc(),data);
src/mame/drivers/bishjan.c
r1281r1282
6262static TILE_GET_INFO( get_tile_info1 )   {   SET_TILE_INFO(0, bishjan_videoram1[ tile_index ], 0, 0);   }
6363static TILE_GET_INFO( get_tile_info2 )   {   SET_TILE_INFO(0, bishjan_videoram2[ tile_index ], 0, 0);   }
6464
65VIDEO_START(bishjan)
65static VIDEO_START(bishjan)
6666{
6767   tmap1 = tilemap_create(   get_tile_info1, tilemap_scan_rows,
6868                     TILEMAP_TYPE_PEN, 8,8, 0x80,0x40   );
r1281r1282
7979   colorram = auto_malloc(256*3);
8080}
8181
82VIDEO_UPDATE( bishjan )
82static VIDEO_UPDATE( bishjan )
8383{
8484   int layers_ctrl = ~bishjan_layers[0];
8585
src/mame/drivers/mpatrol.c
r1281r1282
6666}
6767
6868
69READ8_HANDLER( mpatrol_input_port_3_r )
69static READ8_HANDLER( mpatrol_input_port_3_r )
7070{
7171   int ret = input_port_3_r(0);
7272
src/mame/drivers/upscope.c
r1281r1282
358358 *
359359 *************************************/
360360
361DRIVER_INIT( upscope )
361static DRIVER_INIT( upscope )
362362{
363363   static const amiga_machine_interface upscope_intf =
364364   {
src/mame/drivers/esh.c
r1281r1282
210210   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
211211INPUT_PORTS_END
212212
213PALETTE_INIT( esh )
213static PALETTE_INIT( esh )
214214{
215215   int i;
216216
src/mame/drivers/mirax.c
r1281r1282
6666static int nSndNum=0x10;
6767static int nAyCtrl, nAyData;
6868
69VIDEO_START(mirax)
69static VIDEO_START(mirax)
7070{
7171}
7272
7373
74VIDEO_UPDATE(mirax)
74static VIDEO_UPDATE(mirax)
7575{
7676#ifdef MAME_DEBUG
7777   //audio tester
src/mame/drivers/gradius3.c
r1281r1282
2727extern int gradius3_priority;
2828VIDEO_START( gradius3 );
2929READ16_HANDLER( gradius3_gfxrom_r );
30READ16_HANDLER( gradius3_gfxram_r );
3130WRITE16_HANDLER( gradius3_gfxram_w );
3231VIDEO_UPDATE( gradius3 );
3332
r1281r1282
8483   irqBmask = 0;
8584}
8685
87static UINT16 *sharedram;
88
89static READ16_HANDLER( sharedram_r )
90{
91   return sharedram[offset];
92}
93
94static WRITE16_HANDLER( sharedram_w )
95{
96   COMBINE_DATA(&sharedram[offset]);
97}
98
9986static WRITE16_HANDLER( cpuA_ctrl_w )
10087{
10188   if (ACCESSING_MSB)
r1281r1282
180167
181168
182169
183static ADDRESS_MAP_START( gradius3_readmem, ADDRESS_SPACE_PROGRAM, 16 )
184   AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
185   AM_RANGE(0x040000, 0x043fff) AM_READ(MRA16_RAM)
186   AM_RANGE(0x080000, 0x080fff) AM_READ(MRA16_RAM)
170static ADDRESS_MAP_START( gradius3_map, ADDRESS_SPACE_PROGRAM, 16 )
171   AM_RANGE(0x000000, 0x03ffff) AM_ROM
172   AM_RANGE(0x040000, 0x043fff) AM_RAM
173   AM_RANGE(0x080000, 0x080fff) AM_READWRITE(MRA16_RAM, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
174   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(cpuA_ctrl_w)   /* halt cpu B, irq enable, priority, coin counters, other? */
187175   AM_RANGE(0x0c8000, 0x0c8001) AM_READ(input_port_0_word_r)
188176   AM_RANGE(0x0c8002, 0x0c8003) AM_READ(input_port_1_word_r)
189177   AM_RANGE(0x0c8004, 0x0c8005) AM_READ(input_port_2_word_r)
190178   AM_RANGE(0x0c8006, 0x0c8007) AM_READ(input_port_5_word_r)
191179   AM_RANGE(0x0d0000, 0x0d0001) AM_READ(input_port_3_word_r)
192180   AM_RANGE(0x0d0002, 0x0d0003) AM_READ(input_port_4_word_r)
193   AM_RANGE(0x100000, 0x103fff) AM_READ(sharedram_r)
194   AM_RANGE(0x14c000, 0x153fff) AM_READ(K052109_halfword_r)
195   AM_RANGE(0x180000, 0x19ffff) AM_READ(gradius3_gfxram_r)
196ADDRESS_MAP_END
197
198static ADDRESS_MAP_START( gradius3_writemem, ADDRESS_SPACE_PROGRAM, 16 )
199   AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
200   AM_RANGE(0x040000, 0x043fff) AM_WRITE(MWA16_RAM)
201   AM_RANGE(0x080000, 0x080fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
202   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(cpuA_ctrl_w)   /* halt cpu B, irq enable, priority, coin counters, other? */
203181   AM_RANGE(0x0d8000, 0x0d8001) AM_WRITE(cpuB_irqtrigger_w)
204182   AM_RANGE(0x0e0000, 0x0e0001) AM_WRITE(watchdog_reset16_w)
205183   AM_RANGE(0x0e8000, 0x0e8001) AM_WRITE(sound_command_w)
206184   AM_RANGE(0x0f0000, 0x0f0001) AM_WRITE(sound_irq_w)
207   AM_RANGE(0x100000, 0x103fff) AM_WRITE(sharedram_w) AM_BASE(&sharedram)
208   AM_RANGE(0x14c000, 0x153fff) AM_WRITE(K052109_halfword_w)
209   AM_RANGE(0x180000, 0x19ffff) AM_WRITE(gradius3_gfxram_w) AM_BASE(&gradius3_gfxram)
185   AM_RANGE(0x100000, 0x103fff) AM_RAM AM_SHARE(1)
186   AM_RANGE(0x14c000, 0x153fff) AM_READWRITE(K052109_halfword_r, K052109_halfword_w)
187   AM_RANGE(0x180000, 0x19ffff) AM_READWRITE(MRA16_RAM, gradius3_gfxram_w) AM_BASE(&gradius3_gfxram)
210188ADDRESS_MAP_END
211189
212190
213static ADDRESS_MAP_START( gradius3_readmem2, ADDRESS_SPACE_PROGRAM, 16 )
214   AM_RANGE(0x000000, 0x0fffff) AM_READ(MRA16_ROM)
215   AM_RANGE(0x100000, 0x103fff) AM_READ(MRA16_RAM)
216   AM_RANGE(0x200000, 0x203fff) AM_READ(sharedram_r)
217   AM_RANGE(0x24c000, 0x253fff) AM_READ(K052109_halfword_r)
218   AM_RANGE(0x280000, 0x29ffff) AM_READ(gradius3_gfxram_r)
219   AM_RANGE(0x2c0000, 0x2c000f) AM_READ(K051937_halfword_r)
220   AM_RANGE(0x2c0800, 0x2c0fff) AM_READ(K051960_halfword_r)
191static ADDRESS_MAP_START( gradius3_map2, ADDRESS_SPACE_PROGRAM, 16 )
192   AM_RANGE(0x000000, 0x0fffff) AM_ROM
193   AM_RANGE(0x100000, 0x103fff) AM_RAM
194   AM_RANGE(0x140000, 0x140001) AM_WRITE(cpuB_irqenable_w)
195   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE(1)
196   AM_RANGE(0x24c000, 0x253fff) AM_READWRITE(K052109_halfword_r, K052109_halfword_w)
197   AM_RANGE(0x280000, 0x29ffff) AM_READWRITE(MRA16_RAM, gradius3_gfxram_w)
198   AM_RANGE(0x2c0000, 0x2c000f) AM_READWRITE(K051937_halfword_r, K051937_halfword_w)
199   AM_RANGE(0x2c0800, 0x2c0fff) AM_READWRITE(K051960_halfword_r, K051960_halfword_w)
221200   AM_RANGE(0x400000, 0x5fffff) AM_READ(gradius3_gfxrom_r)      /* gfx ROMs are mapped here, and copied to RAM */
222201ADDRESS_MAP_END
223202
224static ADDRESS_MAP_START( gradius3_writemem2, ADDRESS_SPACE_PROGRAM, 16 )
225   AM_RANGE(0x000000, 0x0fffff) AM_WRITE(MWA16_ROM)
226   AM_RANGE(0x100000, 0x103fff) AM_WRITE(MWA16_RAM)
227   AM_RANGE(0x140000, 0x140001) AM_WRITE(cpuB_irqenable_w)
228   AM_RANGE(0x200000, 0x203fff) AM_WRITE(sharedram_w)
229   AM_RANGE(0x24c000, 0x253fff) AM_WRITE(K052109_halfword_w)
230   AM_RANGE(0x280000, 0x29ffff) AM_WRITE(gradius3_gfxram_w)
231   AM_RANGE(0x2c0000, 0x2c000f) AM_WRITE(K051937_halfword_w)
232   AM_RANGE(0x2c0800, 0x2c0fff) AM_WRITE(K051960_halfword_w)
233ADDRESS_MAP_END
234203
235
236static ADDRESS_MAP_START( gradius3_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
237   AM_RANGE(0x0000, 0xefff) AM_READ(MRA8_ROM)
238   AM_RANGE(0xf010, 0xf010) AM_READ(soundlatch_r)
239   AM_RANGE(0xf020, 0xf02d) AM_READ(K007232_read_port_0_r)
240   AM_RANGE(0xf031, 0xf031) AM_READ(YM2151_status_port_0_r)
241   AM_RANGE(0xf800, 0xffff) AM_READ(MRA8_RAM)
242ADDRESS_MAP_END
243
244static ADDRESS_MAP_START( gradius3_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
245   AM_RANGE(0x0000, 0xefff) AM_WRITE(MWA8_ROM)
204static ADDRESS_MAP_START( gradius3_s_map, ADDRESS_SPACE_PROGRAM, 8 )
205   AM_RANGE(0x0000, 0xefff) AM_ROM
246206   AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_bank_w)            /* 007232 bankswitch */
247   AM_RANGE(0xf020, 0xf02d) AM_WRITE(K007232_write_port_0_w)
207   AM_RANGE(0xf010, 0xf010) AM_READ(soundlatch_r)
208   AM_RANGE(0xf020, 0xf02d) AM_READWRITE(K007232_read_port_0_r, K007232_write_port_0_w)
248209   AM_RANGE(0xf030, 0xf030) AM_WRITE(YM2151_register_port_0_w)
249   AM_RANGE(0xf031, 0xf031) AM_WRITE(YM2151_data_port_0_w)
250   AM_RANGE(0xf800, 0xffff) AM_WRITE(MWA8_RAM)
210   AM_RANGE(0xf031, 0xf031) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
211   AM_RANGE(0xf800, 0xffff) AM_RAM
251212ADDRESS_MAP_END
252213
253214
r1281r1282
376337
377338   /* basic machine hardware */
378339   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
379   MDRV_CPU_PROGRAM_MAP(gradius3_readmem,gradius3_writemem)
340   MDRV_CPU_PROGRAM_MAP(gradius3_map,0)
380341   MDRV_CPU_VBLANK_INT(cpuA_interrupt,1)
381342
382343   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
383   MDRV_CPU_PROGRAM_MAP(gradius3_readmem2,gradius3_writemem2)
344   MDRV_CPU_PROGRAM_MAP(gradius3_map2,0)
384345   MDRV_CPU_VBLANK_INT(cpuB_interrupt,2)   /* has three interrupt vectors, 1 2 and 4 */
385346                        /* 4 is triggered by cpu A, the others are unknown but */
386347                        /* required for the game to run. */
387348   MDRV_CPU_ADD(Z80, 3579545)
388   /* audio CPU */   /* 3.579545 MHz */
389   MDRV_CPU_PROGRAM_MAP(gradius3_s_readmem,gradius3_s_writemem)
349   MDRV_CPU_PROGRAM_MAP(gradius3_s_map,0)
390350
391351   MDRV_SCREEN_REFRESH_RATE(60)
392352   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
src/mame/drivers/cardline.c
r1281r1282
3232               cliprect,\
3333               transparency?TRANSPARENCY_PEN:TRANSPARENCY_NONE,transparency);
3434
35VIDEO_UPDATE( cardline )
35static VIDEO_UPDATE( cardline )
3636{
3737   int x,y;
3838   fillbitmap(bitmap,machine->pens[0],cliprect);
r1281r1282
165165   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,     0, 2 )
166166GFXDECODE_END
167167
168PALETTE_INIT(cardline)
168static PALETTE_INIT(cardline)
169169{
170170   int i,r,g,b,data;
171171   int bit0,bit1,bit2;
src/mame/drivers/omegrace.c
r1281r1282
290290};
291291
292292
293READ8_HANDLER( omegrace_spinner1_r )
293static READ8_HANDLER( omegrace_spinner1_r )
294294{
295295   return (spinnerTable[readinputport(4) & 0x3f]);
296296}
r1281r1282
303303 *
304304 *************************************/
305305
306WRITE8_HANDLER( omegrace_leds_w )
306static WRITE8_HANDLER( omegrace_leds_w )
307307{
308308   /* bits 0 and 1 are coin counters */
309309   coin_counter_w(0,data & 0x01);
r1281r1282
319319}
320320
321321
322WRITE8_HANDLER( omegrace_soundlatch_w )
322static WRITE8_HANDLER( omegrace_soundlatch_w )
323323{
324324   soundlatch_w (offset, data);
325325   cpunum_set_input_line(1, 0, HOLD_LINE);
src/mame/drivers/dlair.c
r1281r1282
161161}
162162
163163
164VIDEO_START( dlair )
164static VIDEO_START( dlair )
165165{
166166   mame_bitmap *vidbitmap;
167167
r1281r1282
175175}
176176
177177
178PALETTE_INIT( dleuro )
178static PALETTE_INIT( dleuro )
179179{
180180   int i;
181181
r1281r1282
189189}
190190
191191
192VIDEO_START( dleuro )
192static VIDEO_START( dleuro )
193193{
194194   video_start_dlair(machine);
195195
r1281r1282
206206 *
207207 *************************************/
208208
209VIDEO_UPDATE( dlair )
209static VIDEO_UPDATE( dlair )
210210{
211211   mame_bitmap *vidbitmap;
212212   UINT32 seqid;
r1281r1282
228228}
229229
230230
231VIDEO_UPDATE( dleuro )
231static VIDEO_UPDATE( dleuro )
232232{
233233   mame_bitmap *vidbitmap;
234234   UINT32 seqid;
src/mame/drivers/jollyjgr.c
r1281r1282
271271   SET_TILE_INFO(0, videoram[tile_index], color, 0);
272272}
273273
274VIDEO_START( jollyjgr )
274static VIDEO_START( jollyjgr )
275275{
276276   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
277277
r1281r1282
315315   }
316316}
317317
318VIDEO_UPDATE( jollyjgr )
318static VIDEO_UPDATE( jollyjgr )
319319{
320320   int offs;
321321
src/mame/drivers/irobot.c
r1281r1282
8787 *
8888 *************************************/
8989
90WRITE8_HANDLER( irobot_nvram_w )
90static WRITE8_HANDLER( irobot_nvram_w )
9191{
9292   generic_nvram[offset] = data & 0x0f;
9393}
src/mame/drivers/tarzan.c
r1281r1282
6969#endif
7070
7171
72VIDEO_START(tarzan)
72static VIDEO_START(tarzan)
7373{
7474}
7575
76VIDEO_UPDATE(tarzan)
76static VIDEO_UPDATE(tarzan)
7777{
7878
7979   return 0;
src/mame/drivers/ssfindo.c
r1281r1282
220220static mame_timer *PS7500timer1;
221221
222222
223VIDEO_UPDATE(ssfindo)
223static VIDEO_UPDATE(ssfindo)
224224{
225225   int s,x,y;
226226
src/mame/drivers/peplus.c
r1281r1282
55
66    Driver by Jim Stolis.
77
8    Special thanks to smf for I2C EEPROM support.
9
810    --- Technical Notes ---
911
1012    Name:    Player's Edge Plus (PP0516) Double Bonus Draw Poker.
r1281r1282
4042#include "driver.h"
4143#include "sound/ay8910.h"
4244#include "cpu/i8051/i8051.h"
45#include "machine/i2cmem.h"
4346
4447#include "peplus.lh"
48#include "pepp0158.lh"
4549#include "pepp0188.lh"
4650#include "peset038.lh"
4751
r1281r1282
5054/* Pointers to External RAM */
5155static UINT8 *program_ram;
5256static UINT8 *cmos_ram;
57static UINT8 *s1000_ram;
58static UINT8 *s3000_ram;
59static UINT8 *s5000_ram;
60static UINT8 *s7000_ram;
61static UINT8 *sb000_ram;
62static UINT8 *sd000_ram;
63static UINT8 *sf000_ram;
5364
5465/* Variables used instead of CRTC6845 system */
5566static UINT8 vid_register = 0;
r1281r1282
6273/* IO Ports */
6374static UINT8 *io_port;
6475
76/* Coin, Door, Hopper and EEPROM States */
77static UINT32 last_cycles;
78static UINT8 coin_state = 0;
79static UINT32 last_door;
80static UINT8 door_open = 0;
81static UINT32 last_coin_out;
82static UINT8 coin_out_state = 0;
83static int sda_dir = 0;
6584
85/* Static Variables */
86#define CMOS_NVRAM_SIZE     0x1000
87#define EEPROM_NVRAM_SIZE   0x200 // 4k Bit
88
89
6690/*****************
91* NVRAM Handlers *
92******************/
93
94NVRAM_HANDLER( peplus )
95{
96   if (read_or_write)
97   {
98      mame_fwrite(file, cmos_ram, CMOS_NVRAM_SIZE);
99   }
100   else
101   {
102      if (file)
103      {
104         mame_fread(file, cmos_ram, CMOS_NVRAM_SIZE);
105      }
106      else
107      {
108         memset(cmos_ram, 0, CMOS_NVRAM_SIZE);
109      }
110   }
111
112   nvram_handler_i2cmem_0( machine, file, read_or_write );
113}
114
115/*****************
67116* Write Handlers *
68117******************/
69118
70WRITE8_HANDLER( peplus_bgcolor_w )
119static WRITE8_HANDLER( peplus_bgcolor_w )
71120{
72    int i;
121   int i;
73122
74123   for (i = 0; i < 16; i++)
75124   {
r1281r1282
79128      bit0 = (~data >> 0) & 0x01;
80129      bit1 = (~data >> 1) & 0x01;
81130      bit2 = (~data >> 2) & 0x01;
82       r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
131      r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
83132
84133      /* green component */
85134      bit0 = (~data >> 3) & 0x01;
r1281r1282
90139      /* blue component */
91140      bit0 = (~data >> 6) & 0x01;
92141      bit1 = (~data >> 7) & 0x01;
93        bit2 = 0;
142      bit2 = 0;
94143      b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
95144
96145      palette_set_color(Machine, (15 + (i*16)), MAKE_RGB(r, g, b));
r1281r1282
102151    The current CRTC6845 driver does not support these
103152    additional registers (R18, R19, R31)
104153*/
105WRITE8_HANDLER( peplus_crtc_mode_w )
154static WRITE8_HANDLER( peplus_crtc_mode_w )
106155{
107    /* Mode Control - Register 8 */
108    /* Sets CRT to Transparent Memory Addressing Mode */
156   /* Mode Control - Register 8 */
157   /* Sets CRT to Transparent Memory Addressing Mode */
109158}
110159
111WRITE8_HANDLER( peplus_crtc_register_w )
160static WRITE8_HANDLER( peplus_crtc_register_w )
112161{
113    switch(data) {
114        case 0x12:  /* Update Address High */
115        case 0x13:  /* Update Address Low */
116        case 0x1f:  /* Dummy Location */
117            vid_register = data;
118            break;
119    }
162    vid_register = data;
120163}
121164
122WRITE8_HANDLER( peplus_crtc_address_w )
165static WRITE8_HANDLER( peplus_crtc_address_w )
123166{
124    switch(vid_register) {
125        case 0x12:  /* Update Address High */
126            vid_high = data;
127            break;
128        case 0x13:  /* Update Address Low */
129            vid_low = data;
130            break;
131    }
167   switch(vid_register) {
168      case 0x12:  /* Update Address High */
169         vid_high = data & 0x3f;
170         break;
171      case 0x13:  /* Update Address Low */
172         vid_low = data;
173         break;
174   }
132175}
133176
134WRITE8_HANDLER( peplus_crtc_display_w )
177static WRITE8_HANDLER( peplus_crtc_display_w )
135178{
136    UINT16 vid_address = (vid_high<<8) | vid_low;
179   UINT16 vid_address = (vid_high<<8) | vid_low;
137180
138    videoram[vid_address] = data;
181   videoram[vid_address] = data;
139182   palette_ram[vid_address] = io_port[1];
183   tilemap_mark_tile_dirty(bg_tilemap, vid_address);
140184
141    tilemap_mark_tile_dirty(bg_tilemap, vid_address);
185   /* Transparent Memory Addressing increments the update address register */
186   if (vid_low == 0xff) {
187      vid_high++;
188   }
189   vid_low++;
190}
142191
143    /* Transparent Memory Addressing increments the update address register */
144    if (vid_low == 0xff) {
145        vid_high++;
146    }
147    vid_low++;
192static WRITE8_HANDLER( peplus_io_w )
193{
194   io_port[offset] = data;
148195}
149196
150WRITE8_HANDLER( peplus_eeprom_w )
197static WRITE8_HANDLER( peplus_duart_w )
151198{
152    // EEPROM is a X2404P 4K-bit Serial I2C Bus
199   // Used for Slot Accounting System Communication
153200}
154201
155WRITE8_HANDLER( peplus_io_w )
202static WRITE8_HANDLER( peplus_cmos_w )
156203{
157    io_port[offset] = data;
204   cmos_ram[offset] = data;
158205}
159206
160WRITE8_HANDLER( peplus_duart_w )
207static WRITE8_HANDLER( peplus_s1000_w )
161208{
162    // Used for Progressive Jackpot Communication
209   s1000_ram[offset] = data;
163210}
164211
165WRITE8_HANDLER( peplus_cmos_w )
212static WRITE8_HANDLER( peplus_s3000_w )
166213{
167    cmos_ram[offset] = data;
214   s3000_ram[offset] = data;
168215}
169216
170WRITE8_HANDLER( peplus_output_bank_a_w )
217static WRITE8_HANDLER( peplus_s5000_w )
171218{
172    output_set_value("coinlockout",(data >> 0) & 1); /* Coin Lockout */
173    output_set_value("diverter",(data >> 1) & 1); /* Diverter */
174    output_set_value("bell",(data >> 2) & 1); /* Bell */
175    output_set_value("na1",(data >> 3) & 1); /* N/A */
176    output_set_value("hopper1",(data >> 4) & 1); /* Hopper 1 */
177    output_set_value("hopper2",(data >> 5) & 1); /* Hopper 2 */
178    output_set_value("na2",(data >> 6) & 1); /* N/A */
179    output_set_value("na3",(data >> 7) & 1); /* N/A */
219   s5000_ram[offset] = data;
180220}
181221
182WRITE8_HANDLER( peplus_output_bank_b_w )
222static WRITE8_HANDLER( peplus_s7000_w )
183223{
184    output_set_lamp_value(0,(data >> 0) & 1); /* Hold 2 3 4 Lt */
185    output_set_lamp_value(1,(data >> 1) & 1); /* Deal Draw Lt */
186    output_set_lamp_value(2,(data >> 2) & 1); /* Cash Out Lt */
187    output_set_lamp_value(3,(data >> 3) & 1); /* Hold 1 Lt */
188    output_set_lamp_value(4,(data >> 4) & 1); /* Bet Credits Lt */
189    output_set_lamp_value(5,(data >> 5) & 1); /* Change Request Lt */
190    output_set_lamp_value(6,(data >> 6) & 1); /* Door Open Lt */
191    output_set_lamp_value(7,(data >> 7) & 1); /* Hold 5 Lt */
224   s7000_ram[offset] = data;
192225}
193226
194WRITE8_HANDLER( peplus_output_bank_c_w )
227static WRITE8_HANDLER( peplus_sb000_w )
195228{
196    output_set_value("coininmeter",(data >> 0) & 1); /* Coin In Meter */
197    output_set_value("coinoutmeter",(data >> 1) & 1); /* Coin Out Meter */
198    output_set_value("coindropmeter",(data >> 2) & 1); /* Coin Drop Meter */
199    output_set_value("jackpotmeter",(data >> 3) & 1); /* Jackpot Meter */
200    output_set_value("billacceptor",(data >> 4) & 1); /* Bill Acceptor Enabled */
201    output_set_value("sdsout",(data >> 5) & 1); /* SDS Out */
202    output_set_value("na4",(data >> 6) & 1); /* N/A */
203    output_set_value("gamemeter",(data >> 7) & 1); /* Game Meter */
229   sb000_ram[offset] = data;
204230}
205231
232static WRITE8_HANDLER( peplus_sd000_w )
233{
234   sd000_ram[offset] = data;
235}
206236
237static WRITE8_HANDLER( peplus_sf000_w )
238{
239   sf000_ram[offset] = data;
240}
241
242static WRITE8_HANDLER( peplus_output_bank_a_w )
243{
244   output_set_value("coinlockout",(data >> 0) & 1); /* Coin Lockout */
245   output_set_value("diverter",(data >> 1) & 1); /* Diverter */
246   output_set_value("bell",(data >> 2) & 1); /* Bell */
247   output_set_value("na1",(data >> 3) & 1); /* N/A */
248   output_set_value("hopper1",(data >> 4) & 1); /* Hopper 1 */
249   output_set_value("hopper2",(data >> 5) & 1); /* Hopper 2 */
250   output_set_value("na2",(data >> 6) & 1); /* N/A */
251   output_set_value("na3",(data >> 7) & 1); /* N/A */
252
253    coin_out_state = 0;
254    if((data >> 4) & 1)
255        coin_out_state = 1;
256}
257
258static WRITE8_HANDLER( peplus_output_bank_b_w )
259{
260   output_set_lamp_value(0,(data >> 0) & 1); /* Hold 2 3 4 Lt */
261   output_set_lamp_value(1,(data >> 1) & 1); /* Deal Draw Lt */
262   output_set_lamp_value(2,(data >> 2) & 1); /* Cash Out Lt */
263   output_set_lamp_value(3,(data >> 3) & 1); /* Hold 1 Lt */
264   output_set_lamp_value(4,(data >> 4) & 1); /* Bet Credits Lt */
265   output_set_lamp_value(5,(data >> 5) & 1); /* Change Request Lt */
266   output_set_lamp_value(6,(data >> 6) & 1); /* Door Open Lt */
267   output_set_lamp_value(7,(data >> 7) & 1); /* Hold 5 Lt */
268}
269
270static WRITE8_HANDLER( peplus_output_bank_c_w )
271{
272   output_set_value("coininmeter",(data >> 0) & 1); /* Coin In Meter */
273   output_set_value("coinoutmeter",(data >> 1) & 1); /* Coin Out Meter */
274   output_set_value("coindropmeter",(data >> 2) & 1); /* Coin Drop Meter */
275   output_set_value("jackpotmeter",(data >> 3) & 1); /* Jackpot Meter */
276   output_set_value("billacceptor",(data >> 4) & 1); /* Bill Acceptor Enabled */
277   output_set_value("sdsout",(data >> 5) & 1); /* SDS Out */
278   output_set_value("na4",(data >> 6) & 1); /* N/A */
279   output_set_value("gamemeter",(data >> 7) & 1); /* Game Meter */
280}
281
282static WRITE8_HANDLER(i2c_nvram_w)
283{
284   i2cmem_write(0, I2CMEM_SCL, BIT(data, 2));
285   sda_dir = BIT(data, 1);
286   i2cmem_write(0, I2CMEM_SDA, BIT(data, 0));
287}
288
289
207290/****************
208291* Read Handlers *
209292****************/
210293
211READ8_HANDLER( peplus_duart_r )
294static READ8_HANDLER( peplus_crtc_display_r )
212295{
213    // Used for Progressive Jackpot Communication
296   UINT16 vid_address = ((vid_high<<8) | vid_low) + 1;
297    vid_high = (vid_address>>8) & 0x3f;
298    vid_low = vid_address& 0xff;
299
214300    return 0x00;
215301}
216302
217READ8_HANDLER( peplus_cmos_r )
303static READ8_HANDLER( peplus_crtc_lpen1_r )
218304{
219    switch (offset)
220    {
221        case 0x0db:
222            if ((readinputportbytag("DOOR") & 0x01) == 1) {
223                cmos_ram[offset] = 0x01;
224            }
225        case 0xb8d:
226            if ((readinputportbytag("DOOR") & 0x02) == 1)
227                cmos_ram[offset] = 0x01;
228    }
305    return 0x40;
306}
229307
230    // Fake A Bunch of Coins In Hack
231    if ((readinputportbytag("SENSOR") & 0x01) == 1) {
232        cmos_ram[0x01E] = 0x01;
233    }
308static READ8_HANDLER( peplus_crtc_lpen2_r )
309{
310    UINT8 ret_val = 0x00;
311    UINT8 x_val = readinputportbytag("TOUCH_X");
312    UINT8 y_val = (0x19 - readinputportbytag("TOUCH_Y"));
313    UINT16 t_val = y_val * 0x28 + (x_val+1);
234314
235    return cmos_ram[offset];
315   switch(vid_register) {
316      case 0x10:  /* Light Pen Address High */
317         ret_val = (t_val >> 8) & 0x3f;
318         break;
319      case 0x11:  /* Light Pen Address Low */
320         ret_val = t_val & 0xff;
321         break;
322   }
323
324    return ret_val;
236325}
237326
327static READ8_HANDLER( peplus_io_r )
328{
329    return io_port[offset];
330}
331
332static READ8_HANDLER( peplus_duart_r )
333{
334   // Used for Slot Accounting System Communication
335   return 0x00;
336}
337
338static READ8_HANDLER( peplus_cmos_r )
339{
340   switch (offset)
341   {
342      case 0x00db:
343         if ((readinputportbytag("DOOR") & 0x01) == 0) {
344            cmos_ram[offset] = 0x00;
345         }
346         break;
347      case 0x0b8d:
348         if ((readinputportbytag("DOOR") & 0x02) == 1) {
349            cmos_ram[offset] = 0x01;
350         }
351         break;
352   }
353
354   return cmos_ram[offset];
355}
356
357static READ8_HANDLER( peplus_s1000_r )
358{
359   return s1000_ram[offset];
360}
361
362static READ8_HANDLER( peplus_s3000_r )
363{
364   return s3000_ram[offset];
365}
366
367static READ8_HANDLER( peplus_s5000_r )
368{
369   return s5000_ram[offset];
370}
371
372static READ8_HANDLER( peplus_s7000_r )
373{
374   return s7000_ram[offset];
375}
376
377static READ8_HANDLER( peplus_sb000_r )
378{
379   return sb000_ram[offset];
380}
381
382static READ8_HANDLER( peplus_sd000_r )
383{
384   return sd000_ram[offset];
385}
386
387static READ8_HANDLER( peplus_sf000_r )
388{
389   return sf000_ram[offset];
390}
391
238392/* External RAM Callback for I8052 */
239READ32_HANDLER( peplus_external_ram_iaddr )
393static READ32_HANDLER( peplus_external_ram_iaddr )
240394{
241    if (mem_mask == 0xff) {
242        return (io_port[2] << 8) | offset;
243    } else {
244        return offset;
245    }
395   if (mem_mask == 0xff) {
396      return (io_port[2] << 8) | offset;
397   } else {
398      return offset;
399   }
246400}
247401
248402/* Last Color in Every Palette is bgcolor */
249READ8_HANDLER( peplus_bgcolor_r )
403static READ8_HANDLER( peplus_bgcolor_r )
250404{
251    return palette_get_color(Machine, 15); /* Return bgcolor from First Palette */
405   return palette_get_color(Machine, 15); // Return bgcolor from First Palette
252406}
253407
254READ8_HANDLER( peplus_dropdoor_r )
408static READ8_HANDLER( peplus_dropdoor_r )
255409{
256    return 0x00; /* Drop Door 0x00=Closed 0x02=Open */
410   return 0x00; // Drop Door 0x00=Closed 0x02=Open
257411}
258412
259READ8_HANDLER( peplus_c000_r )
413static READ8_HANDLER( peplus_watchdog_r )
260414{
261    return 0xff; /* Unknown */
415   return 0x00; // Watchdog
262416}
263417
264/* Insufficient Code, will need more to handle cmos and coin pulses */
265READ8_HANDLER( peplus_input_bank_a_r )
418static READ8_HANDLER( peplus_input_bank_a_r )
266419{
267    /*
420/*
268421        Bit 0 = COIN DETECTOR A
269422        Bit 1 = COIN DETECTOR B
270423        Bit 2 = COIN DETECTOR C
r1281r1282
272425        Bit 4 = HOPPER FULL
273426        Bit 5 = DOOR OPEN
274427        Bit 6 = LOW BATTERY
275        Bit 7 = CMOS ACK (0=ACK)
276    */
277    UINT8 tempbank = 0x00;
278    UINT8 coindetect = 0x00;
279    if ((readinputportbytag("SENSOR") & 0x01) == 0x01) {
280        coindetect = 0x07;
281    }
428        Bit 7 = I2C EEPROM SDA
429*/
430   UINT8 bank_a = 0x50; // Turn Off Low Battery and Hopper Full Statuses
431   UINT8 coin_optics = 0x00;
432    UINT8 coin_out = 0x00;
433   UINT32 curr_cycles = activecpu_gettotalcycles();
282434
283    tempbank = (0x57 | (!(readinputportbytag("DOOR") & 0x01)<<5)) ^ (coindetect);
284    return tempbank;
435   UINT8 sda = 0;
436   if(!sda_dir)
437   {
438      sda = i2cmem_read(0, I2CMEM_SDA);
439   }
440
441   if ((readinputportbytag("SENSOR") & 0x01) == 0x01 && coin_state == 0) {
442      coin_state = 1; // Start Coin Cycle
443      last_cycles = activecpu_gettotalcycles();
444   } else {
445      /* Process Next Coin Optic State */
446      if (curr_cycles - last_cycles > 20000 && coin_state != 0) {
447         coin_state++;
448         if (coin_state > 5)
449            coin_state = 0;
450         last_cycles = activecpu_gettotalcycles();
451      }
452   }
453
454   switch (coin_state)
455   {
456      case 0x00: // No Coin
457         coin_optics = 0x00;
458         break;
459      case 0x01: // Optic A
460         coin_optics = 0x01;
461         break;
462      case 0x02: // Optic AB
463         coin_optics = 0x03;
464         break;
465      case 0x03: // Optic ABC
466         coin_optics = 0x07;
467         break;
468      case 0x04: // Optic BC
469         coin_optics = 0x06;
470         break;
471      case 0x05: // Optic C
472         coin_optics = 0x04;
473         break;
474   }
475
476   if (curr_cycles - last_door > 6000) { // Guessing with 6000
477      if ((readinputportbytag("DOOR") & 0x01) == 0x01) {
478         door_open = (!door_open & 0x01);
479      } else {
480         door_open = 1;
481      }
482      last_door = activecpu_gettotalcycles();
483   }
484
485   if (curr_cycles - last_coin_out > 60000) { // Guessing with 60000
486      if (coin_out_state == 1) {
487            coin_out = 0x08;
488      }
489        coin_out_state = 0;
490      last_coin_out = activecpu_gettotalcycles();
491   }
492
493   bank_a = (sda<<7) | bank_a | (door_open<<5) | coin_optics | coin_out;
494
495   return bank_a;
285496}
286497
287498
r1281r1282
292503static TILE_GET_INFO( get_bg_tile_info )
293504{
294505   int pr = palette_ram[tile_index];
295    int vr = videoram[tile_index];
506   int vr = videoram[tile_index];
296507
297508   int code = ((pr & 0x0f)*256) | vr;
298    int color = (pr>>4) & 0x0f;
509   int color = (pr>>4) & 0x0f;
299510
300511   SET_TILE_INFO(0, code, color, 0);
301512}
302513
303VIDEO_START( peplus )
514static VIDEO_START( peplus )
304515{
305516   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 40, 25);
306    palette_ram = auto_malloc(0x3000);
307    memset(palette_ram, 0, 0x3000);
517   palette_ram = auto_malloc(0x3000);
518   memset(palette_ram, 0, 0x3000);
308519}
309520
310VIDEO_UPDATE( peplus )
521static VIDEO_UPDATE( peplus )
311522{
312    tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
523   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
313524
314525   return 0;
315526}
316527
317PALETTE_INIT( peplus )
528static PALETTE_INIT( peplus )
318529{
319530/*  prom bits
320531    7654 3210
r1281r1282
332543      bit0 = (~color_prom[i] >> 0) & 0x01;
333544      bit1 = (~color_prom[i] >> 1) & 0x01;
334545      bit2 = (~color_prom[i] >> 2) & 0x01;
335       r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
546      r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
336547
337548      /* green component */
338549      bit0 = (~color_prom[i] >> 3) & 0x01;
r1281r1282
343554      /* blue component */
344555      bit0 = (~color_prom[i] >> 6) & 0x01;
345556      bit1 = (~color_prom[i] >> 7) & 0x01;
346        bit2 = 0;
557      bit2 = 0;
347558      b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
348559
349560      palette_set_color(machine, i, MAKE_RGB(r, g, b));
r1281r1282
358569static const gfx_layout charlayout =
359570{
360571   8,8,    /* 8x8 characters */
361    0x1000, /* 4096 characters */
572   0x1000, /* 4096 characters */
362573   4,  /* 4 bitplanes */
363    { 0x1000*8*8*3, 0x1000*8*8*2, 0x1000*8*8*1, 0x1000*8*8*0 }, /* bitplane offsets */
574   { 0x1000*8*8*3, 0x1000*8*8*2, 0x1000*8*8*1, 0x1000*8*8*0 }, /* bitplane offsets */
364575   { 0, 1, 2, 3, 4, 5, 6, 7 },
365576   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
366577   8*8
r1281r1282
382593
383594static DRIVER_INIT( peplus )
384595{
385    /* External RAM callback */
386    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
596   /* External RAM callback */
597   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
387598
388    // For testing only, cannot stay in final driver
389    program_ram[0x990e] = 0xd3; /* SETB C - disable game test */
390    program_ram[0x990f] = 0x22; /* RET - disable game test */
599    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
600   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
391601
392    program_ram[0xaf91] = 0x79; /* MOV R1, - disable I2C random read */
393    program_ram[0xaf92] = 0x00; /* #000H - disable I2C random read */
394    program_ram[0xaf93] = 0x22; /* RET - disable I2C random read */
602   // For testing only, cannot stay in final driver
603   //program_ram[0x5e7e] = 0x01; // Enable Autohold Feature
604   program_ram[0x9a24] = 0x22; // RET - Disable Memory Test
605   program_ram[0xd61d] = 0x22; // RET - Disable Program Checksum
606}
395607
396    program_ram[0xd61d] = 0x22; /* RET - disable program checksum */
608static DRIVER_INIT( pepp0158 )
609{
610   /* External RAM callback */
611   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
397612
398    program_ram[0x5e7e] = 0x01; /* Allow Autohold Feature */
613    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
614   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
399615
400    /* TODO: Machine settings and coin counts need to be loaded using eeprom data */
401    /* below are some hardcoded examples of memory to patch */
616   // For testing only, cannot stay in final driver
617   //program_ram[0x5ffe] = 0x01; // Enable Autohold Feature
618   program_ram[0xa19f] = 0x22; // RET - Disable Memory Test
619   program_ram[0xddea] = 0x22; // RET - Disable Program Checksum
620}
402621
403    cmos_ram[0x129] = 0x08; /* Additional Operator Screens Enabled */
404    cmos_ram[0x130] = 0x05; /* Maximum Coins In */
405    cmos_ram[0x148] = 0xff; /* Maximum Payout Low Byte */
406    cmos_ram[0x149] = 0xff; /* Maximum Payout High Byte */
407    cmos_ram[0x14a] = 0xff; /* Maximum Cashout Low Byte */
408    cmos_ram[0x14b] = 0xff; /* Maximum Cashout High Byte */
409    cmos_ram[0x16b] = 0x03; /* Current Denomination = 25c */
410    cmos_ram[0x16e] = 0x40; /* Background Color */
411    cmos_ram[0x183] = 0x01; /* 0=Tones, 1=Music */
412    cmos_ram[0x188] = 0x7d; /* Game Type */
413    cmos_ram[0x248] = 0x01; /* SAS Mini System Address */
414    cmos_ram[0x284] = 0x55; /* 0=Disabled, 0x55=Drop Door */
415    cmos_ram[0x297] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */
416    cmos_ram[0xb8f] = 0x01; /* 0=No Double Up, 1=Double Up */
417    cmos_ram[0xb90] = 0x01; /* 0=No Animation, 1=Animation */
418    cmos_ram[0xb91] = 0x00; /* 0=No Paytable, 1=Paytable */
419    cmos_ram[0xb93] = 0x01; /* 0=Disabled, 1=Autohold */
420    cmos_ram[0xb94] = 0x04; /* 0-9=Deal Speed */
421    cmos_ram[0xbd8] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */
622static DRIVER_INIT( pepp0188 )
623{
624   /* External RAM callback */
625   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
422626
423    /* Mirrored in cmos scratch area to eeprom */
424    cmos_ram[0xe01] = cmos_ram[0x188]; /* Game Type */
425    cmos_ram[0xe2a] = cmos_ram[0x16b]; /* Current Denomination */
426    cmos_ram[0xe2b] = cmos_ram[0x297]; /* Bill Acceptor */
427    cmos_ram[0xe60] = cmos_ram[0x130]; /* Maximum Coins In */
428    cmos_ram[0xe64] = cmos_ram[0x16e]; /* Background Color */
627    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
628   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
629
630   // For testing only, cannot stay in final driver
631   //program_ram[0x742f] = 0x01; // Enable Autohold Feature
632   program_ram[0x9a8d] = 0x22; // RET - Disable Memory Test
633   program_ram[0xf429] = 0x22; // RET - Disable Program Checksum
429634}
430635
431static DRIVER_INIT( pepp0188 )
636static DRIVER_INIT( peset038 )
432637{
433    /* External RAM callback */
434    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
638   /* External RAM callback */
639   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
435640
436    // For testing only, cannot stay in final driver
437    program_ram[0x994b] = 0xd3; /* SETB C - disable game test */
438    program_ram[0x994c] = 0x22; /* RET - disable game test */
641    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
642   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
439643
440    program_ram[0x9b3e] = 0x79; /* MOV R1, - disable I2C random read */
441    program_ram[0x9b3f] = 0x00; /* #000H - disable I2C random read */
442    program_ram[0x9b40] = 0x22; /* RET - disable I2C random read */
644   // For testing only, cannot stay in final driver
645   program_ram[0x302] = 0x22;  // RET - Disable Memory Test
646   program_ram[0x289f] = 0x22; // RET - Disable Program Checksum
647}
443648
444    program_ram[0xf429] = 0x22; /* RET - disable program checksum */
649static DRIVER_INIT( pebe0014 )
650{
651   /* External RAM callback */
652   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
445653
446    program_ram[0x742f] = 0x01; /* Allow Autohold Feature */
654    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
655   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
447656
448    /* TODO: Machine settings and coin counts need to be loaded using eeprom data */
449    /* below are some hardcoded examples of memory to patch */
657   // For testing only, cannot stay in final driver
658   program_ram[0x75e7] = 0x22; // RET - Disable Memory Test
659   program_ram[0xc3ab] = 0x22; // RET - Disable Program Checksum
660}
450661
451    cmos_ram[0x12d] = 0x08; /* Additional Operator Screens Enabled */
452    cmos_ram[0x134] = 0x05; /* Maximum Coins In */
453    cmos_ram[0x14c] = 0xff; /* Maximum Payout Low Byte */
454    cmos_ram[0x14d] = 0xff; /* Maximum Payout High Byte */
455    cmos_ram[0x14e] = 0xff; /* Maximum Cashout Low Byte */
456    cmos_ram[0x14f] = 0xff; /* Maximum Cashout High Byte */
457    cmos_ram[0x16f] = 0x03; /* Current Denomination = 25c */
458    cmos_ram[0x172] = 0x40; /* Background Color */
459    cmos_ram[0x187] = 0x01; /* 0=Tones, 1=Music */
460    cmos_ram[0x18c] = 0x85; /* Game Type */
461    cmos_ram[0x22e] = 0x01; /* SAS Mini System Address */
462    cmos_ram[0xb3a] = 0x55; /* 0=Disabled, 0x55=Drop Door */
463    cmos_ram[0x289] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */
464    cmos_ram[0xaf6] = 0x01; /* 0=No Double Up, 1=Double Up */
465    cmos_ram[0xaf7] = 0x01; /* 0=No Animation, 1=Animation */
466    cmos_ram[0xaf8] = 0x00; /* 0=No Paytable, 1=Paytable */
467    cmos_ram[0xafa] = 0x01; /* 0=Disabled, 1=Autohold */
468    cmos_ram[0xafb] = 0x04; /* 0-9=Deal Speed */
469    cmos_ram[0xb51] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */
470    cmos_ram[0xbf5] = cmos_ram[0x134]; /* Maximum Coins In */
662static DRIVER_INIT( peke1012 )
663{
664   /* External RAM callback */
665   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
471666
472    /* Mirrored in cmos scratch area to eeprom */
473    cmos_ram[0xe01] = cmos_ram[0x18c]; /* Game Type */
474    cmos_ram[0xe2a] = cmos_ram[0x16f]; /* Current Denomination */
475    cmos_ram[0xe2b] = cmos_ram[0x289]; /* Bill Acceptor */
476    cmos_ram[0xe60] = cmos_ram[0x134]; /* Maximum Coins In */
477    cmos_ram[0xe64] = cmos_ram[0x172]; /* Background Color */
667    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
668   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
669
670   // For testing only, cannot stay in final driver
671   program_ram[0x59e7] = 0x22; // RET - Disable Memory Test
672   program_ram[0xbe01] = 0x22; // RET - Disable Program Checksum
478673}
479674
480static DRIVER_INIT( peset038 )
675static DRIVER_INIT( peps0615 )
481676{
482    /* External RAM callback */
483    i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
677   /* External RAM callback */
678   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
484679
485    // For testing only, cannot stay in final driver
486    program_ram[0x302] = 0x22;  /* RET - disable memory test */
487    program_ram[0x3b5] = 0x22;  /* RET - disable I2C random read */
488    program_ram[0x289f] = 0x22; /* RET - disable program checksum */
680    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
681   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
489682
490    cmos_ram[0xe01] = 0x7d; /* Game Type */
683   // For testing only, cannot stay in final driver
684   program_ram[0x84be] = 0x22; // RET - Disable Memory Test
685   program_ram[0xbfd8] = 0x22; // RET - Disable Program Checksum
491686}
492687
688static DRIVER_INIT( peps0716 )
689{
690   /* External RAM callback */
691   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
692
693    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
694   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
695
696   // For testing only, cannot stay in final driver
697   program_ram[0x7f99] = 0x22; // RET - Disable Memory Test
698   program_ram[0xbaa9] = 0x22; // RET - Disable Program Checksum
699}
700
701static DRIVER_INIT( pexp0019 )
702{
703    UINT8 *super_data = memory_region(REGION_USER1);
704
705    /* Distribute Superboard Data */
706    memcpy(s1000_ram, &super_data[0], 0x1000);
707    memcpy(s3000_ram, &super_data[0x3000], 0x1000);
708    memcpy(s5000_ram, &super_data[0x5000], 0x1000);
709    memcpy(s7000_ram, &super_data[0x7000], 0x1000);
710    memcpy(sb000_ram, &super_data[0xb000], 0x1000);
711    memcpy(sd000_ram, &super_data[0xd000], 0x1000);
712    memcpy(sf000_ram, &super_data[0xf000], 0x1000);
713
714   /* External RAM callback */
715   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
716
717    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
718   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
719
720   // For testing only, cannot stay in final driver
721   program_ram[0xc1e4] = 0x22; // RET - Disable Memory Test
722   program_ram[0xc15f] = 0x22; // RET - Disable Program Checksum
723    program_ram[0xc421] = 0x22; // RET - Disable 2nd Memory Test
724}
725
726static DRIVER_INIT( pexs0006 )
727{
728    UINT8 *super_data = memory_region(REGION_USER1);
729
730    /* Distribute Superboard Data */
731    memcpy(s1000_ram, &super_data[0], 0x1000);
732    memcpy(s3000_ram, &super_data[0x3000], 0x1000);
733    memcpy(s5000_ram, &super_data[0x5000], 0x1000);
734    memcpy(s7000_ram, &super_data[0x7000], 0x1000);
735    memcpy(sb000_ram, &super_data[0xb000], 0x1000);
736    memcpy(sd000_ram, &super_data[0xd000], 0x1000);
737    memcpy(sf000_ram, &super_data[0xf000], 0x1000);
738
739   /* External RAM callback */
740   i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr);
741
742    /* EEPROM is a X2404P 4K-bit Serial I2C Bus */
743   i2cmem_init(0, I2CMEM_SLAVE_ADDRESS, 8, EEPROM_NVRAM_SIZE, NULL);
744
745   // For testing only, cannot stay in final driver
746   program_ram[0x9bd4] = 0x22; // RET - Disable Memory Test
747    program_ram[0x9e9c] = 0x22; // RET - Disable 2nd Memory Test
748}
749
750
493751/*************************
494752* Memory map information *
495753*************************/
496754
497755static ADDRESS_MAP_START( peplus_map, ADDRESS_SPACE_PROGRAM, 8 )
498    AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE(&program_ram)
756   AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE(&program_ram)
499757ADDRESS_MAP_END
500758
501759static ADDRESS_MAP_START( peplus_datamap, ADDRESS_SPACE_DATA, 8 )
502    // Battery-backed RAM
503    AM_RANGE(0x0000, 0x0fff) AM_RAM AM_READWRITE(peplus_cmos_r, peplus_cmos_w) AM_BASE(&cmos_ram)
760   // Battery-backed RAM
761   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_READWRITE(peplus_cmos_r, peplus_cmos_w) AM_BASE(&cmos_ram)
504762
505    // CRT Controller
506    AM_RANGE(0x2008, 0x2008) AM_WRITE(peplus_crtc_mode_w)
507    AM_RANGE(0x2080, 0x2080) AM_WRITE(peplus_crtc_register_w)
508    AM_RANGE(0x2081, 0x2081) AM_WRITE(peplus_crtc_address_w)
509    AM_RANGE(0x2083, 0x2083) AM_WRITE(peplus_crtc_display_w)
763   // Superboard Data
764   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_READWRITE(peplus_s1000_r, peplus_s1000_w) AM_BASE(&s1000_ram)
510765
511    // Sound and Dipswitches
766   // CRT Controller
767   AM_RANGE(0x2008, 0x2008) AM_WRITE(peplus_crtc_mode_w)
768   AM_RANGE(0x2080, 0x2080) AM_READ(peplus_crtc_lpen1_r) AM_WRITE(peplus_crtc_register_w)
769   AM_RANGE(0x2081, 0x2081) AM_READ(peplus_crtc_lpen2_r) AM_WRITE(peplus_crtc_address_w)
770   AM_RANGE(0x2083, 0x2083) AM_READ(peplus_crtc_display_r) AM_WRITE(peplus_crtc_display_w)
771
772    // Superboard Data
773   AM_RANGE(0x3000, 0x3fff) AM_RAM AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE(&s3000_ram)
774
775   // Sound and Dipswitches
512776   AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_control_port_0_w)
513777   AM_RANGE(0x4004, 0x4004) AM_READ(input_port_3_r) AM_WRITE(AY8910_write_port_0_w)
514778
515    // Background Color Latch
516    AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w)
779    // Superboard Data
780   AM_RANGE(0x5000, 0x5fff) AM_RAM AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_BASE(&s5000_ram)
517781
518    // Video RAM
519    AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(&videoram)
782   // Background Color Latch
783   AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w)
520784
521    // Input Bank A, Output Bank C
522    AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w)
785    // Bogus Location for Video RAM
786   AM_RANGE(0x06001, 0x06400) AM_RAM AM_BASE(&videoram)
523787
524    // Drop Door, I2C EEPROM Writes
525    AM_RANGE(0x9000, 0x9000) AM_READ(peplus_dropdoor_r) AM_WRITE(peplus_eeprom_w)
788    // Superboard Data
789   AM_RANGE(0x7000, 0x7fff) AM_RAM AM_READWRITE(peplus_s7000_r, peplus_s7000_w) AM_BASE(&s7000_ram)
526790
527    // Input Banks B & C, Output Bank B
528    AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) AM_WRITE(peplus_output_bank_b_w)
791   // Input Bank A, Output Bank C
792   AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w)
529793
530    // Output Bank A
531    AM_RANGE(0xc000, 0xc000) AM_READ(peplus_c000_r) AM_WRITE(peplus_output_bank_a_w)
794   // Drop Door, I2C EEPROM Writes
795   AM_RANGE(0x9000, 0x9000) AM_READ(peplus_dropdoor_r) AM_WRITE(i2c_nvram_w)
532796
533    // DUART
534    AM_RANGE(0xe000, 0xe005) AM_READWRITE(peplus_duart_r, peplus_duart_w)
797   // Input Banks B & C, Output Bank B
798   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) AM_WRITE(peplus_output_bank_b_w)
799
800    // Superboard Data
801   AM_RANGE(0xb000, 0xbfff) AM_RAM AM_READWRITE(peplus_sb000_r, peplus_sb000_w) AM_BASE(&sb000_ram)
802
803   // Output Bank A
804   AM_RANGE(0xc000, 0xc000) AM_READ(peplus_watchdog_r) AM_WRITE(peplus_output_bank_a_w)
805
806    // Superboard Data
807   AM_RANGE(0xd000, 0xdfff) AM_RAM AM_READWRITE(peplus_sd000_r, peplus_sd000_w) AM_BASE(&sd000_ram)
808
809   // DUART
810   AM_RANGE(0xe000, 0xe005) AM_READWRITE(peplus_duart_r, peplus_duart_w)
811
812    // Superboard Data
813   AM_RANGE(0xf000, 0xffff) AM_RAM AM_READWRITE(peplus_sf000_r, peplus_sf000_w) AM_BASE(&sf000_ram)
535814ADDRESS_MAP_END
536815
537816static ADDRESS_MAP_START( peplus_iomap, ADDRESS_SPACE_IO, 8 )
538    ADDRESS_MAP_FLAGS(AMEF_ABITS(8))
817   ADDRESS_MAP_FLAGS(AMEF_ABITS(8))
539818
540    // I/O Ports
541   AM_RANGE(0x00, 0x03) AM_WRITE(peplus_io_w) AM_BASE(&io_port)
819   // I/O Ports
820   AM_RANGE(0x00, 0x03) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_BASE(&io_port)
542821ADDRESS_MAP_END
543822
544823/*************************
545824*      Input ports       *
546825*************************/
547826
548static INPUT_PORTS_START( peplus )
827static INPUT_PORTS_START( peplus_poker )
549828   PORT_START_TAG("IN0")
550    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
551    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
552    PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
829   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
830   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
831   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
553832   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
554    PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
555    PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
556    PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
557    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
558    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
559    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
833   PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
834   PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
835   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
836   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
837   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
838   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
560839   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN )
561    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
840   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
562841   PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T)
563842   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y)
564    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
565    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
843   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
844   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
566845
567    PORT_START_TAG("DOOR")
568    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
569    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
846   PORT_START_TAG("DOOR")
847   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O) PORT_TOGGLE
848   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
570849
571    PORT_START_TAG("SENSOR")
572    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
850   PORT_START_TAG("SENSOR")
851   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Coin In") PORT_IMPULSE(1)
573852
574    PORT_START_TAG("SW1")
853   PORT_START_TAG("SW1")
575854   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
576855   PORT_DIPSETTING(    0x01, "60HZ" )
577856   PORT_DIPSETTING(    0x00, "50HZ" )
r1281r1282
598877   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
599878INPUT_PORTS_END
600879
601static INPUT_PORTS_START( pepp0188 )
880static INPUT_PORTS_START( peplus_keno )
602881   PORT_START_TAG("IN0")
603    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
604    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
605    PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
606   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
607    PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
608    PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
609    PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
610    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
611    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
612    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
882   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
883   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
884   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNKNOWN )
885   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
886   PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_UNKNOWN )
887   PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_UNKNOWN )
888   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Erase") PORT_CODE(KEYCODE_B)
889   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("Light Pen") PORT_CODE(KEYCODE_A)
890   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
891   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
613892   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN )
614    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
893   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
615894   PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T)
616895   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y)
617    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
618    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
896   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
897   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
619898
620    PORT_START_TAG("DOOR")
621    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
622    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
899   PORT_START_TAG("DOOR")
900   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
901   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
623902
624    PORT_START_TAG("SENSOR")
625    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
903   PORT_START_TAG("SENSOR")
904   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Coin In") PORT_IMPULSE(1)
626905
627    PORT_START_TAG("SW1")
906   PORT_START_TAG("SW1")
628907   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
629908   PORT_DIPSETTING(    0x01, "60HZ" )
630909   PORT_DIPSETTING(    0x00, "50HZ" )
r1281r1282
649928   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
650929   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
651930   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
652INPUT_PORTS_END
653931
654static INPUT_PORTS_START( peset038 )
655   PORT_START_TAG("IN0")
656    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L)
657    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K)
658    PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
659   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
660    PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
661    PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
662    PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
663    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
664    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q)
665    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W)
666   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN )
667    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R)
668   PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T)
669   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y)
670    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
671    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
672
673    PORT_START_TAG("DOOR")
674    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O)
675    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I)
676
677    PORT_START_TAG("SENSOR")
678    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M)
679
680    PORT_START_TAG("SW1")
681   PORT_DIPNAME( 0x01, 0x01, "Line Frequency" )
682   PORT_DIPSETTING(    0x01, "60HZ" )
683   PORT_DIPSETTING(    0x00, "50HZ" )
684   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
685   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
686   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
687   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
688   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
689   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
690   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
691   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
692   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
693   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
694   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
695   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
696   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
697   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
698   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
699   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
700   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
701   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
702   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
703   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
704   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
932    PORT_START_TAG("TOUCH_X")
933    PORT_BIT( 0xff, 0x08, IPT_LIGHTGUN_X ) PORT_MINMAX(0x00, 0x28) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13)
934    PORT_START_TAG("TOUCH_Y")
935   PORT_BIT( 0xff, 0x08, IPT_LIGHTGUN_Y ) PORT_MINMAX(0x00, 0x19) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13)
705936INPUT_PORTS_END
706937
707
708938/*************************
709939*     Machine Driver     *
710940*************************/
711941
712942static MACHINE_DRIVER_START( peplus )
713943   // basic machine hardware
714    MDRV_CPU_ADD_TAG("main", I8052, 3686400*2)
944   MDRV_CPU_ADD_TAG("main", I8052, 3686400*2)
715945   MDRV_CPU_PROGRAM_MAP(peplus_map, 0)
716    MDRV_CPU_DATA_MAP(peplus_datamap, 0)
717    MDRV_CPU_IO_MAP(peplus_iomap, 0)
946   MDRV_CPU_DATA_MAP(peplus_datamap, 0)
947   MDRV_CPU_IO_MAP(peplus_iomap, 0)
718948   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
719949
720950   MDRV_SCREEN_REFRESH_RATE(60)
721951   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
722952
953   MDRV_NVRAM_HANDLER(peplus)
954
723955   // video hardware
724956   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
725957   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r1281r1282
734966   MDRV_VIDEO_UPDATE(peplus)
735967
736968   // sound hardware
737    MDRV_SOUND_ADD(AY8912, 20000000/12)
969   MDRV_SOUND_ADD(AY8912, 20000000/12)
738970   MDRV_SPEAKER_STANDARD_MONO("mono")
739971   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
740972MACHINE_DRIVER_END
741973
742static MACHINE_DRIVER_START( pepp0188 )
743   MDRV_IMPORT_FROM(peplus)
744MACHINE_DRIVER_END
745
746static MACHINE_DRIVER_START( peset038 )
747   MDRV_IMPORT_FROM(peplus)
748MACHINE_DRIVER_END
749
750
751974/*************************
752975*        Rom Load        *
753976*************************/
754977
755978ROM_START( peplus )
756979   ROM_REGION( 0x10000, REGION_CPU1, 0 )
757    ROM_LOAD( "pp0516.u68",   0x00000, 0x10000, CRC(d9da6e13) SHA1(421678d9cb42daaf5b21074cc3900db914dd26cf) )
980   ROM_LOAD( "pp0516.u68",   0x00000, 0x10000, CRC(d9da6e13) SHA1(421678d9cb42daaf5b21074cc3900db914dd26cf) )
758981
759982   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
760983   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
761    ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
762    ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
763    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
984   ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
985   ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
986   ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
764987
765988   ROM_REGION( 0x100, REGION_PROMS, 0 )
766989   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
767990ROM_END
768991
992ROM_START( pepp0158 )
993   ROM_REGION( 0x10000, REGION_CPU1, 0 )
994   ROM_LOAD( "pp0158.u68",   0x00000, 0x10000, CRC(5976cd19) SHA1(6a461ea9ddf78dffa3cf8b65903ebf3127f23d45) )
995
996   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
997   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
998   ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
999   ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
1000   ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
1001
1002   ROM_REGION( 0x100, REGION_PROMS, 0 )
1003   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
1004ROM_END
1005
7691006ROM_START( pepp0188 )
7701007   ROM_REGION( 0x10000, REGION_CPU1, 0 )
771    ROM_LOAD( "pp0188.u68",   0x00000, 0x10000, CRC(cf36a53c) SHA1(99b578538ab24d9ff91971b1f77599272d1dbfc6) )
1008   ROM_LOAD( "pp0188.u68",   0x00000, 0x10000, CRC(cf36a53c) SHA1(99b578538ab24d9ff91971b1f77599272d1dbfc6) )
7721009
7731010   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
7741011   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
775    ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
776    ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
777    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
1012   ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
1013   ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
1014   ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
7781015
7791016   ROM_REGION( 0x100, REGION_PROMS, 0 )
7801017   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
r1281r1282
7821019
7831020ROM_START( peset038 )
7841021   ROM_REGION( 0x10000, REGION_CPU1, 0 )
785    ROM_LOAD( "set038.u68",   0x00000, 0x10000, CRC(9c4b1d1a) SHA1(8a65cd1d8e2d74c7b66f4dfc73e7afca8458e979) )
1022   ROM_LOAD( "set038.u68",   0x00000, 0x10000, CRC(9c4b1d1a) SHA1(8a65cd1d8e2d74c7b66f4dfc73e7afca8458e979) )
7861023
7871024   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
7881025   ROM_LOAD( "mro-cg740.u72",    0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) )
789    ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
790    ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
791    ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
1026   ROM_LOAD( "mgo-cg740.u73",    0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) )
1027   ROM_LOAD( "mbo-cg740.u74",    0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) )
1028   ROM_LOAD( "mxo-cg740.u75",    0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) )
7921029
7931030   ROM_REGION( 0x100, REGION_PROMS, 0 )
7941031   ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) )
7951032ROM_END
7961033
1034ROM_START( pebe0014 )
1035   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1036   ROM_LOAD( "be0014.u68",   0x00000, 0x10000, CRC(232b32b7) SHA1(a3af9414577642fedc23b4c1911901cd31e9d6e0) )
7971037
1038   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
1039   ROM_LOAD( "mro-cg2036.u72",    0x00000, 0x8000, CRC(0a168d06) SHA1(7ed4fb5c7bcacab077bcec030f0465c6eaf3ce1c) )
1040   ROM_LOAD( "mgo-cg2036.u73",    0x08000, 0x8000, CRC(826b4090) SHA1(34390484c0faffe9340fd93d273b9292d09f97fd) )
1041   ROM_LOAD( "mbo-cg2036.u74",    0x10000, 0x8000, CRC(46aac851) SHA1(28d84b49c6cebcf2894b5a15d935618f84093caa) )
1042   ROM_LOAD( "mxo-cg2036.u75",    0x18000, 0x8000, CRC(60204a56) SHA1(2e3420da9e79ba304ca866d124788f84861380a7) )
1043
1044   ROM_REGION( 0x100, REGION_PROMS, 0 )
1045   ROM_LOAD( "cap707.u50", 0x0000, 0x0100, CRC(9851ba36) SHA1(5a0a43c1e212ae8c173102ede9c57a3d95752f99) )
1046ROM_END
1047
1048ROM_START( peke1012 )
1049   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1050   ROM_LOAD( "ke1012.u68",   0x00000, 0x10000, CRC(470e8c10) SHA1(f8a65a3a73477e9e9d2f582eeefa93b470497dfa) )
1051
1052   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) // BAD DUMPS
1053   ROM_LOAD( "mro-cg1267.u72",    0x00000, 0x8000, CRC(16498b57) SHA1(9c22726299af7204c4be1c6d8afc4c1b512ad918) )
1054   ROM_LOAD( "mgo-cg1267.u73",    0x08000, 0x8000, CRC(80847c5a) SHA1(8422cd13a91c3c462af5efcfca8615e7eeaa2e52) )
1055   ROM_LOAD( "mbo-cg1267.u74",    0x10000, 0x8000, CRC(ce7af8a7) SHA1(38675122c764b8fa9260246ea99ac0f0750da277) )
1056   ROM_LOAD( "mxo-cg1267.u75",    0x18000, 0x8000, CRC(3aac0d4a) SHA1(764da54bdb2f2c49551cf1d10286de9450abad2f) )
1057
1058   ROM_REGION( 0x100, REGION_PROMS, 0 )
1059   ROM_LOAD( "cap1267.u50", 0x0000, 0x0100, CRC(7051db57) SHA1(76751a3cc47d506983205decb07e99ca0c178a42) )
1060ROM_END
1061
1062ROM_START( peps0615 )
1063   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1064   ROM_LOAD( "ps0615.u68",   0x00000, 0x10000, CRC(d27dd6ab) SHA1(b3f065f507191682edbd93b07b72ed87bf6ae9b1) )
1065
1066   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
1067   ROM_LOAD( "mro-cg2246.u72",    0x00000, 0x8000, CRC(7c08c355) SHA1(2a154b81c6d9671cea55a924bffb7f5461747142) )
1068   ROM_LOAD( "mgo-cg2246.u73",    0x08000, 0x8000, CRC(b3c16487) SHA1(c97232fadd086f604eaeb3cd3c2d1c8fe0dcfa70) )
1069   ROM_LOAD( "mbo-cg2246.u74",    0x10000, 0x8000, CRC(e61331f5) SHA1(4364edc625d64151cbae40780b54cb1981086647) )
1070   ROM_LOAD( "mxo-cg2246.u75",    0x18000, 0x8000, CRC(f0f4a27d) SHA1(3a10ab196aeaa5b50d47b9d3c5b378cfadd6fe96) )
1071
1072   ROM_REGION( 0x100, REGION_PROMS, 0 ) // WRONG CAP
1073   ROM_LOAD( "cap2234.u50", 0x0000, 0x0100, CRC(a930e283) SHA1(61bce50fa13b3e980ece3e72d068835e19bd5049) )
1074ROM_END
1075
1076ROM_START( peps0716 )
1077   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1078   ROM_LOAD( "ps0716.u68",   0x00000, 0x10000, CRC(7615d7b6) SHA1(91fe62eec720a0dc2ebf48835065148f19499d16) )
1079
1080   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
1081   ROM_LOAD( "mro-cg2266.u72",    0x00000, 0x8000, CRC(590accd8) SHA1(4e1c963c50799eaa49970e25ecf9cb01eb6b09e1) )
1082   ROM_LOAD( "mgo-cg2266.u73",    0x08000, 0x8000, CRC(b87ffa05) SHA1(92126b670b9cabeb5e2cc35b6e9c458088b18eea) )
1083   ROM_LOAD( "mbo-cg2266.u74",    0x10000, 0x8000, CRC(e3df30e1) SHA1(c7d2ae9a7c7e53bfb6197b635efcb5dc231e4fe0) )
1084   ROM_LOAD( "mxo-cg2266.u75",    0x18000, 0x8000, CRC(56271442) SHA1(61ad0756b9f6412516e46ef6625a4c3899104d4e) )
1085
1086   ROM_REGION( 0x100, REGION_PROMS, 0 ) // WRONG CAP
1087   ROM_LOAD( "cap2265.u50", 0x0000, 0x0100, CRC(dfb82a2f) SHA1(c96947bb475bf4497ff2e44053941625a3a7bf62) )
1088ROM_END
1089
1090ROM_START( pexp0019 )
1091   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1092    ROM_LOAD( "xp000019.u67",   0x00000, 0x10000, CRC(8ac876eb) SHA1(105b4aee2692ccb20795586ccbdf722c59db66cf) )
1093
1094    ROM_REGION( 0x10000, REGION_USER1, 0 )
1095    ROM_LOAD( "x002025p.u66",   0x00000, 0x10000, CRC(f3dac423) SHA1(e9394d330deb3b8a1001e57e72a506cd9098f161) )
1096
1097   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
1098   ROM_LOAD( "mro-cg2185.u77",    0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) )
1099   ROM_LOAD( "mgo-cg2185.u78",    0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) )
1100   ROM_LOAD( "mbo-cg2185.u79",    0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) )
1101   ROM_LOAD( "mxo-cg2185.u80",    0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) )
1102
1103   ROM_REGION( 0x100, REGION_PROMS, 0 ) // WRONG CAP
1104   ROM_LOAD( "cap2234.u43", 0x0000, 0x0100, CRC(a930e283) SHA1(61bce50fa13b3e980ece3e72d068835e19bd5049) )
1105ROM_END
1106
1107ROM_START( pexs0006 )
1108   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1109    ROM_LOAD( "xs000006.u67",   0x00000, 0x10000, CRC(4b11ca18) SHA1(f64a1fbd089c01bc35a5484e60b8834a2db4a79f) )
1110
1111    ROM_REGION( 0x10000, REGION_USER1, 0 )
1112    ROM_LOAD( "x000998s.u66",   0x00000, 0x10000, CRC(e29d4346) SHA1(93901ff65c8973e34ac1f0dd68bb4c4973da5621) )
1113
1114   ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
1115   ROM_LOAD( "mro-cg2361.u77",    0x00000, 0x8000, CRC(c0eba866) SHA1(8f217aeb3e8028a5633d95e5612f1b55e601650f) )
1116   ROM_LOAD( "mgo-cg2361.u78",    0x08000, 0x8000, CRC(345eaea2) SHA1(18ebb94a323e1cf671201db8b9f85d4f30d8b5ec) )
1117   ROM_LOAD( "mbo-cg2361.u79",    0x10000, 0x8000, CRC(fa130af6) SHA1(aca5e52e00bc75a4801fd3f6c564e62ed4251d8e) )
1118   ROM_LOAD( "mxo-cg2361.u80",    0x18000, 0x8000, CRC(7de1812c) SHA1(c7e23a10f20fc8b618df21dd33ac456e1d2cfe33) )
1119
1120   ROM_REGION( 0x100, REGION_PROMS, 0 )
1121   ROM_LOAD( "cap2361.u43", 0x0000, 0x0100, CRC(051aea66) SHA1(2abf32caaeb821ca50a6398581de69bbfe5930e9) )
1122ROM_END
1123
7981124/*************************
7991125*      Game Drivers      *
8001126*************************/
8011127
802/*    YEAR  NAME      PARENT  MACHINE   INPUT     INIT      ROT    COMPANY                                  FULLNAME                                             FLAGS   */
803GAME( 1987, peplus,   0,      peplus,   peplus,   peplus,   ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0516) Double Bonus Poker",    0 )
804GAME( 1987, pepp0188, 0,      pepp0188, pepp0188, pepp0188, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0188) Standard Draw Poker",   0 )
805GAME( 1987, peset038, 0,      peset038, peset038, peset038, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (Set038) Set Chip",              0 )
1128/*    YEAR  NAME      PARENT  MACHINE  INPUT          INIT      ROT    COMPANY                                  FULLNAME                                                      FLAGS   */
1129GAME( 1987, peplus,   0,      peplus,  peplus_poker,  peplus,   ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0516) Double Bonus Poker",             0 )
1130GAME( 1987, pepp0158, 0,      peplus,  peplus_poker,  pepp0158, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0158) 4 of a Kind Bonus Poker",        0 )
1131GAME( 1987, pepp0188, 0,      peplus,  peplus_poker,  pepp0188, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PP0188) Standard Draw Poker",            0 )
1132GAME( 1987, peset038, 0,      peplus,  peplus_poker,  peset038, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (Set038) Set Chip",                       0 )
1133GAME( 1994, pebe0014, 0,      peplus,  peplus_poker,  pebe0014, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (BE0014) Blackjack",                      0 )
1134GAME( 1994, peke1012, 0,      peplus,  peplus_keno,   peke1012, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (KE1012) Keno",                           0 )
1135GAME( 1996, peps0615, 0,      peplus,  peplus_poker,  peps0615, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PS0615) Chaos Slots",                    0 )
1136GAME( 1996, peps0716, 0,      peplus,  peplus_poker,  peps0716, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (PS0716) Quarter Mania Slots",            0 )
1137GAME( 1995, pexp0019, 0,      peplus,  peplus_poker,  pexp0019, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (XP000019) Deuces Wild Poker",            0 )
1138GAME( 1997, pexs0006, 0,      peplus,  peplus_poker,  pexs0006, ROT0,  "IGT - International Gaming Technology", "Player's Edge Plus (XS000006) Triple Triple Diamond Slots",  0 )
src/mame/drivers/ddayjlc.c
r1281r1282
339339   SET_TILE_INFO(2, code, 0, 0);
340340}
341341
342VIDEO_START( ddayjlc )
342static VIDEO_START( ddayjlc )
343343{
344344   bg_tilemap = tilemap_create(get_tile_info_bg,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
345345}
346346
347VIDEO_UPDATE( ddayjlc )
347static VIDEO_UPDATE( ddayjlc )
348348{
349349   UINT32 i;
350350   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
src/mame/drivers/segas16a.c
r1281r1282
234234 *
235235 *************************************/
236236
237MACHINE_RESET( system16a )
237static MACHINE_RESET( system16a )
238238{
239239   fd1094_machine_init();
240240
src/mame/drivers/konamigx.c
r1281r1282
118118VIDEO_START(racinfrc);
119119VIDEO_UPDATE(konamigx);
120120
121MACHINE_START(konamigx);
122MACHINE_RESET(konamigx);
121static MACHINE_START(konamigx);
122static MACHINE_RESET(konamigx);
123123
124124WRITE32_HANDLER( konamigx_palette_w );
125125WRITE32_HANDLER( konamigx_palette2_w );
r1281r1282
34153415/**********************************************************************************/
34163416/* initializers */
34173417
3418MACHINE_START( konamigx )
3418static MACHINE_START( konamigx )
34193419{
34203420   state_save_register_global(konamigx_wrport1_1);
34213421   state_save_register_global_array(sndto020);
34223422   state_save_register_global_array(sndto000);
34233423}
34243424
3425MACHINE_RESET(konamigx)
3425static MACHINE_RESET(konamigx)
34263426{
34273427   int i;
34283428
src/mame/drivers/statriv2.c
r1281r1282
117117}
118118
119119
120WRITE8_HANDLER( statriv2_videoram_w )
120static WRITE8_HANDLER( statriv2_videoram_w )
121121{
122122   statriv2_videoram[offset] = data;
123123   tilemap_mark_tile_dirty(statriv2_tilemap,offset & 0x3ff);
124124}
125125
126126
127VIDEO_START (statriv2)
127static VIDEO_START (statriv2)
128128{
129129   statriv2_tilemap = tilemap_create(get_statriv2_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,16,64, 16);
130130}
131131
132VIDEO_UPDATE (statriv2)
132static VIDEO_UPDATE (statriv2)
133133{
134134   tilemap_draw(bitmap,cliprect,statriv2_tilemap,0,0);
135135   return 0;
136136}
137137
138PALETTE_INIT(statriv2)
138static PALETTE_INIT(statriv2)
139139{
140140   int i;
141141
src/mame/drivers/carrera.c
r1281r1282
242242   GFXDECODE_ENTRY( REGION_GFX1, 0, tiles8x8_layout, 0, 16 )
243243GFXDECODE_END
244244
245VIDEO_START(carrera)
245static VIDEO_START(carrera)
246246{
247247}
248248
249VIDEO_UPDATE(carrera)
249static VIDEO_UPDATE(carrera)
250250{
251251
252252   int x,y;
r1281r1282
277277   unknown_r,
278278};
279279
280PALETTE_INIT(carrera)
280static PALETTE_INIT(carrera)
281281{
282282   int x;
283283   UINT8 *src = memory_region ( REGION_PROMS );
src/mame/drivers/thunderj.c
r1281r1282
159159 *
160160 *************************************/
161161
162READ16_HANDLER( thunderj_video_control_r )
162static READ16_HANDLER( thunderj_video_control_r )
163163{
164164   /* Sigh. CPU #1 reads the video controller register twice per frame, once at
165165       the beginning of interrupt and once near the end. It stores these values in a
src/mame/drivers/ladybug.c
r1281r1282
955955ROM_END
956956
957957
958DRIVER_INIT( dorodon )
958static DRIVER_INIT( dorodon )
959959{
960960   /* Decode the opcodes */
961961
r1281r1282
972972   }
973973}
974974
975DRIVER_INIT( sraider )
975static DRIVER_INIT( sraider )
976976{
977977}
978978
src/mame/drivers/yamato.c
r1281r1282
6868#include "sound/ay8910.h"
6969#include "includes/cclimber.h"
7070
71PALETTE_INIT( yamato )
71static PALETTE_INIT( yamato )
7272{
7373   int i;
7474   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
r1281r1282
156156   }
157157}
158158
159PALETTE_INIT( toprollr )
159static PALETTE_INIT( toprollr )
160160{
161161   int i;
162162
src/mame/drivers/stvinit.c
r1281r1282
179179*/
180180
181181
182READ32_HANDLER( stv_speedup_r )
182static READ32_HANDLER( stv_speedup_r )
183183{
184184   if (activecpu_get_pc()==0x60154b4) cpu_spinuntil_int(); // bios menus..
185185
186186   return stv_workram_h[0x0335d0/4];
187187}
188188
189READ32_HANDLER( stv_speedup2_r )
189static READ32_HANDLER( stv_speedup2_r )
190190{
191191   if (activecpu_get_pc()==0x6013af0) cpu_spinuntil_int(); // for use in japan
192192
src/mame/drivers/ttchamp.c
r1281r1282
4545static UINT16 *peno_vram;
4646
4747
48VIDEO_START(ttchamp)
48static VIDEO_START(ttchamp)
4949{
5050}
5151
52VIDEO_UPDATE(ttchamp)
52static VIDEO_UPDATE(ttchamp)
5353{
5454   int y,x,count;
5555//  int i;
src/mame/drivers/egghunt.c
r1281r1282
110110   SET_TILE_INFO(0, code, colour, 0);
111111}
112112
113READ8_HANDLER( egghunt_bgram_r )
113static READ8_HANDLER( egghunt_bgram_r )
114114{
115115   if (egghunt_vidram_bank)
116116   {
r1281r1282
122122   }
123123}
124124
125WRITE8_HANDLER( egghunt_bgram_w )
125static WRITE8_HANDLER( egghunt_bgram_w )
126126{
127127   if (egghunt_vidram_bank)
128128   {
r1281r1282
135135   }
136136}
137137
138WRITE8_HANDLER( egghunt_atram_w )
138static WRITE8_HANDLER( egghunt_atram_w )
139139{
140140   egghunt_atram[offset] = data;
141141   tilemap_mark_tile_dirty(bg_tilemap,offset);
142142}
143143
144144
145VIDEO_START(egghunt)
145static VIDEO_START(egghunt)
146146{
147147   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,64, 32);
148148   egghunt_bgram = auto_malloc(0x1000);
149149   egghunt_spram = auto_malloc(0x1000);
150150}
151151
152VIDEO_UPDATE(egghunt)
152static VIDEO_UPDATE(egghunt)
153153{
154154   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
155155   draw_sprites(machine,bitmap,cliprect);
156156   return 0;
157157}
158158
159WRITE8_HANDLER( egghunt_gfx_banking_w )
159static WRITE8_HANDLER( egghunt_gfx_banking_w )
160160{
161161   // data & 0x03 is used for tile banking
162162   // data & 0x30 is used for sprites banking
r1281r1282
165165   tilemap_mark_all_tiles_dirty(bg_tilemap);
166166}
167167
168WRITE8_HANDLER( egghunt_vidram_bank_w )
168static WRITE8_HANDLER( egghunt_vidram_bank_w )
169169{
170170   egghunt_vidram_bank = data & 1;
171171}
172172
173WRITE8_HANDLER( egghunt_soundlatch_w )
173static WRITE8_HANDLER( egghunt_soundlatch_w )
174174{
175175   soundlatch_w(0,data);
176176   cpunum_set_input_line(1,0,HOLD_LINE);
177177}
178178
179READ8_HANDLER( egghunt_okibanking_r )
179static READ8_HANDLER( egghunt_okibanking_r )
180180{
181181   return egghunt_okibanking;
182182}
183183
184WRITE8_HANDLER( egghunt_okibanking_w )
184static WRITE8_HANDLER( egghunt_okibanking_w )
185185{
186186   egghunt_okibanking = data;
187187   OKIM6295_set_bank_base(0, (data & 0x10) ? 0x40000 : 0);
src/mame/drivers/segac2.c
r1281r1282
135135}
136136
137137
138MACHINE_RESET( segac2 )
138static MACHINE_RESET( segac2 )
139139{
140140   /* set up interrupts and such */
141141   machine_reset_genesis(machine);
src/mame/drivers/pandoras.c
r1281r1282
9595   }
9696}
9797
98WRITE8_HANDLER( pandoras_cpua_irqtrigger_w ){
98static WRITE8_HANDLER( pandoras_cpua_irqtrigger_w ){
9999   if (!firq_old_data_a && data){
100100      cpunum_set_input_line(0,M6809_FIRQ_LINE,HOLD_LINE);
101101   }
r1281r1282
103103   firq_old_data_a = data;
104104}
105105
106WRITE8_HANDLER( pandoras_cpub_irqtrigger_w ){
106static WRITE8_HANDLER( pandoras_cpub_irqtrigger_w ){
107107   if (!firq_old_data_b && data){
108108      cpunum_set_input_line(1,M6809_FIRQ_LINE,HOLD_LINE);
109109   }
r1281r1282
111111   firq_old_data_b = data;
112112}
113113
114WRITE8_HANDLER( pandoras_i8039_irqtrigger_w )
114static WRITE8_HANDLER( pandoras_i8039_irqtrigger_w )
115115{
116116   cpunum_set_input_line(3, 0, ASSERT_LINE);
117117}
r1281r1282
126126   i8039_status = (data & 0x20) >> 5;
127127}
128128
129WRITE8_HANDLER( pandoras_z80_irqtrigger_w )
129static WRITE8_HANDLER( pandoras_z80_irqtrigger_w )
130130{
131131   cpunum_set_input_line_and_vector(2,0,HOLD_LINE,0xff);
132132}
src/mame/drivers/taito_f2.c
r1281r1282
825825}
826826
827827
828READ16_HANDLER( taitof2_sound_r )
828static READ16_HANDLER( taitof2_sound_r )
829829{
830830   if (offset == 1)
831831      return (taitosound_comm16_lsb_r(0,mem_mask));
832832   else return 0;
833833}
834834
835READ16_HANDLER( taitof2_msb_sound_r )
835static READ16_HANDLER( taitof2_msb_sound_r )
836836{
837837   if (offset == 1)
838838      return (taitosound_comm16_msb_r(0,mem_mask));
r1281r1282
38503850                      MACHINE DRIVERS
38513851***********************************************************/
38523852
3853MACHINE_START( f2 )
3853static MACHINE_START( f2 )
38543854{
38553855   state_save_register_global(banknum);
38563856   state_save_register_func_postload(reset_sound_region);
38573857}
38583858
3859MACHINE_RESET( qcrayon )
3859static MACHINE_RESET( qcrayon )
38603860{
38613861   /* point to the extra ROM */
38623862   memory_set_bankptr(1,memory_region(REGION_USER1));
r1281r1282
58505850ROM_END
58515851
58525852
5853DRIVER_INIT( finalb )
5853static DRIVER_INIT( finalb )
58545854{
58555855   int i;
58565856   UINT8 data;
r1281r1282
58775877   }
58785878}
58795879
5880DRIVER_INIT( mjnquest )
5880static DRIVER_INIT( mjnquest )
58815881{
58825882   int i;
58835883   UINT8 *gfx = memory_region(REGION_GFX2);
r1281r1282
58945894   }
58955895}
58965896
5897DRIVER_INIT( yesnoj )
5897static DRIVER_INIT( yesnoj )
58985898{
58995899   yesnoj_dsw = 0;
59005900   state_save_register_global(yesnoj_dsw);
59015901}
59025902
5903DRIVER_INIT( driveout )
5903static DRIVER_INIT( driveout )
59045904{
59055905   state_save_register_global(driveout_sound_latch);
59065906   state_save_register_global(oki_bank);
src/mame/drivers/gottlieb.c
r1281r1282
187187
188188static UINT8 *audiobuffer_region;
189189
190MACHINE_RESET( gottlieb )
190static MACHINE_RESET( gottlieb )
191191{
192192   audiobuffer_region = memory_region(REGION_USER1);
193193}
r1281r1282
195195
196196static int track[2];
197197
198READ8_HANDLER( gottlieb_track_0_r )
198static READ8_HANDLER( gottlieb_track_0_r )
199199{
200200   return input_port_2_r(offset) - track[0];
201201}
202202
203READ8_HANDLER( gottlieb_track_1_r )
203static READ8_HANDLER( gottlieb_track_1_r )
204204{
205205   return input_port_3_r(offset) - track[1];
206206}
207207
208WRITE8_HANDLER( gottlieb_track_reset_w )
208static WRITE8_HANDLER( gottlieb_track_reset_w )
209209{
210210   /* reset the trackball counters */
211211   track[0] = input_port_2_r(offset);
r1281r1282
214214
215215static int joympx;
216216
217READ8_HANDLER( stooges_IN4_r )
217static READ8_HANDLER( stooges_IN4_r )
218218{
219219   int joy;
220220
r1281r1282
235235   return joy | (readinputportbytag("IN4") & 0xf0);
236236}
237237
238WRITE8_HANDLER( reactor_output_w )
238static WRITE8_HANDLER( reactor_output_w )
239239{
240240   set_led_status(0,data & 0x20);
241241   set_led_status(1,data & 0x40);
r1281r1282
243243   gottlieb_video_outputs_w(offset,data);
244244}
245245
246WRITE8_HANDLER( stooges_output_w )
246static WRITE8_HANDLER( stooges_output_w )
247247{
248248   joympx = (data >> 5) & 0x03;
249249   gottlieb_video_outputs_w(offset,data);
r1281r1282
276276 * This gives a total of 1+3+3+19*53=1014 bytes, the 10 last bytes are ignored
277277 */
278278
279READ8_HANDLER( gottlieb_laserdisc_status_r )
279static READ8_HANDLER( gottlieb_laserdisc_status_r )
280280{
281281   int tmp;
282282   switch (offset)
r1281r1282
317317   return 0;
318318}
319319
320WRITE8_HANDLER( gottlieb_laserdisc_mpx_w )
320static WRITE8_HANDLER( gottlieb_laserdisc_mpx_w )
321321{
322322   lasermpx = data & 1;
323323   if (lasermpx==0) skipfirstbyte=1;   /* first byte of the 1K buffer (0x67) is not returned... */
324324}
325325
326WRITE8_HANDLER( gottlieb_laserdisc_command_w )
326static WRITE8_HANDLER( gottlieb_laserdisc_command_w )
327327{
328328   static int loop;
329329   int cmd;
src/mame/drivers/sandscrp.c
r1281r1282
9090                                Sand Scorpion
9191***************************************************************************/
9292
93WRITE16_HANDLER( sandscrp_coin_counter_w )
93static WRITE16_HANDLER( sandscrp_coin_counter_w )
9494{
9595   if (ACCESSING_LSB)
9696   {
r1281r1282
164164                                Sand Scorpion
165165***************************************************************************/
166166
167WRITE8_HANDLER( sandscrp_bankswitch_w )
167static WRITE8_HANDLER( sandscrp_bankswitch_w )
168168{
169169   UINT8 *RAM = memory_region(REGION_CPU1);
170170   int bank = data & 0x07;
src/mame/drivers/gpworld.c
r1281r1282
202202}
203203
204204
205VIDEO_UPDATE( gpworld )
205static VIDEO_UPDATE( gpworld )
206206{
207207   fillbitmap(bitmap, 0, cliprect);
208208
src/mame/drivers/acommand.c
r1281r1282
145145}
146146
147147
148VIDEO_START( acommand )
148static VIDEO_START( acommand )
149149{
150150   tx_tilemap = tilemap_create(ac_get_tx_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,512,32);
151151   bg_tilemap = tilemap_create(ac_get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN,16,16,256,16);
r1281r1282
211211#endif
212212static UINT16 led0;
213213
214VIDEO_UPDATE( acommand )
214static VIDEO_UPDATE( acommand )
215215{
216216   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
217217   draw_sprites(machine,bitmap,cliprect,0,0);
src/mame/drivers/tubep.c
r1281r1282
1212this allowed me to emulate the background-drawing circuit.
1313
1414----
15Tube Panic
16Nichibutsu 1984
1715
1816CPU
191784P0100B
r1281r1282
9795
9896----
9997
98*/
10099
101100
102
103***************************************************************************/
104
105101#include "driver.h"
106102#include "cpu/z80/z80.h"
107103#include "cpu/m6805/m6805.h"
108104#include "sound/ay8910.h"
109105#include "sound/msm5205.h"
106
110107#include "tubep.h"
111108
112109/* Global variables */
r1281r1282
117114static mame_timer *interrupt_timer;
118115
119116
117static int curr_scanline=0;
118
119
120
121
120122/*************************************
121123 *
122124 *  Main CPU on main PCB
r1281r1282
154156}
155157
156158
157static ADDRESS_MAP_START( tubep_map, ADDRESS_SPACE_PROGRAM, 8 )
159static ADDRESS_MAP_START( tubep_main_map, ADDRESS_SPACE_PROGRAM, 8 )
158160   AM_RANGE(0x0000, 0x7fff) AM_ROM
159161   AM_RANGE(0xa000, 0xa7ff) AM_RAM
160162   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE(&tubep_textram)   /* RAM on GFX PCB @B13 */
r1281r1282
165167
166168static WRITE8_HANDLER( main_cpu_irq_line_clear_w )
167169{
168//  cpunum_set_input_line(0,CLEAR_LINE);
169//not used - handled by MAME anyway (because it is usual Vblank int)
170   cpunum_set_input_line(0, 0, CLEAR_LINE);
171   logerror("CPU#0 VBLANK int clear at scanline=%3i\n", curr_scanline);
170172   return;
171173}
172174
175
173176static WRITE8_HANDLER( tubep_soundlatch_w )
174177{
175178   sound_latch = (data&0x7f) | 0x80;
176179}
177180
178static ADDRESS_MAP_START( tubep_portmap, ADDRESS_SPACE_IO, 8 )
181static ADDRESS_MAP_START( tubep_main_portmap, ADDRESS_SPACE_IO, 8 )
179182   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
180183   AM_RANGE(0x80, 0x80) AM_READ(input_port_3_r)
181184   AM_RANGE(0x90, 0x90) AM_READ(input_port_4_r)
r1281r1282
191194ADDRESS_MAP_END
192195
193196
197
194198/*************************************
195199 *
196200 *  Slave CPU on main PCB
197201 *
198202 *************************************/
199203
204static WRITE8_HANDLER( second_cpu_irq_line_clear_w )
205{
206   cpunum_set_input_line(1, 0, CLEAR_LINE);
207   logerror("CPU#1 VBLANK int clear at scanline=%3i\n", curr_scanline);
208   return;
209}
200210
201static ADDRESS_MAP_START( tubep_g_map, ADDRESS_SPACE_PROGRAM, 8 )
211
212static ADDRESS_MAP_START( tubep_second_map, ADDRESS_SPACE_PROGRAM, 8 )
202213   AM_RANGE(0x0000, 0x7fff) AM_ROM
203214   AM_RANGE(0xa000, 0xa000) AM_WRITE(tubep_background_a000_w)
204215   AM_RANGE(0xc000, 0xc000) AM_WRITE(tubep_background_c000_w)
r1281r1282
208219   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(2)                           /* program copies here part of shared ram ?? */
209220ADDRESS_MAP_END
210221
222
223static ADDRESS_MAP_START( tubep_second_portmap, ADDRESS_SPACE_IO, 8 )
224   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
225   AM_RANGE(0x7f, 0x7f) AM_WRITE(second_cpu_irq_line_clear_w)
226ADDRESS_MAP_END
227
228
211229static READ8_HANDLER( tubep_soundlatch_r )
212230{
213231    int res;
r1281r1282
215233   res = sound_latch;
216234   sound_latch = 0; /* "=0" ????  or "&= 0x7f" ?????  works either way */
217235
218   /*logerror("SOUND COMM READ %2x\n",res);*/
219
220236   return res;
221237}
222238
r1281r1282
239255   AM_RANGE(0xe000, 0xe7ff) AM_RAM      /* 6116 #3 */
240256ADDRESS_MAP_END
241257
258
242259static ADDRESS_MAP_START( tubep_sound_portmap, ADDRESS_SPACE_IO, 8 )
243260   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
244261   AM_RANGE(0x00, 0x00) AM_WRITE(AY8910_control_port_0_w)
r1281r1282
252269ADDRESS_MAP_END
253270
254271
255/*************************************
256 *
257 *  Save state setup
258 *
259 *************************************/
260
261
262static TIMER_CALLBACK( scanline_callback )
272static TIMER_CALLBACK( tubep_scanline_callback )
263273{
264274   int scanline = param;
265275
266   /* interrupt is generated whenever line V6 from video part goes lo->hi */
267   /* that is when scanline is 64 and 192 accordingly */
276curr_scanline = scanline;//for debugging
268277
269   cpunum_set_input_line(2,0,ASSERT_LINE);   /* sound cpu interrupt (music tempo) */
270278
271   scanline += 128;
272   scanline &= 255;
279   /* CPU #0 interrupt */
280   /* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
281   if (scanline==240)
282   {
283      logerror("VBLANK CPU#0\n");
284      cpunum_set_input_line(0, 0, ASSERT_LINE);
285   }
273286
287
288   /* CPU #1 interrupt */
289   /* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
290   if (scanline==16)
291   {
292      logerror("/VBLANK CPU#1\n");
293      cpunum_set_input_line(1, 0, ASSERT_LINE);
294   }
295
296
297   /* CPU #3 MS2010-A NMI */
298   /* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
299   if (scanline==16)
300   {
301      logerror("/nmi CPU#3\n");
302      tubep_vblank_end(); /* switch buffered sprite RAM page */
303      cpunum_set_input_line(3, INPUT_LINE_NMI, ASSERT_LINE);
304   }
305   /* CPU #3 MS2010-A NMI */
306   /* deactivates at the start of VBLANK signal which happens at the beginning of scanline number 240*/
307   if (scanline==240)
308   {
309      logerror("CPU#3 nmi clear\n");
310      cpunum_set_input_line(3, INPUT_LINE_NMI, CLEAR_LINE);
311   }
312
313
314   /* sound CPU interrupt */
315   /* activates whenever line V6 from video part goes lo->hi that is when the scanline becomes 64 and 192 */
316   if ((scanline==64) || (scanline==192))
317   {
318      cpunum_set_input_line(2,0,ASSERT_LINE);   /* sound cpu interrupt (music tempo) */
319   }
320
321
322   video_screen_update_partial(0, video_screen_get_vpos(0));
323
324//debug
325logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(0));
326
327   scanline ++;
328   if (scanline>=264)
329      scanline=0;
330
274331   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, time_zero);
275332}
276333
277334
335
336/*************************************
337 *
338 *  Save state setup
339 *
340 *************************************/
341
278342static void tubep_setup_save_state(void)
279343{
280344   /* Set up save state */
r1281r1282
284348}
285349
286350
351
287352static MACHINE_START( tubep )
288353{
289354   /* Create interrupt timer */
290   interrupt_timer = mame_timer_alloc(scanline_callback);
355   interrupt_timer = mame_timer_alloc(tubep_scanline_callback);
291356
292357   tubep_setup_save_state();
293358}
294359
360
295361static MACHINE_RESET( tubep )
296362{
297   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64, time_zero);
363   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero);
298364}
299365
300static MACHINE_START( rjammer )
301{
302   tubep_setup_save_state();
303}
304366
305static MACHINE_RESET( rjammer )
306{}
307367
368/*************************************
369 *
370 *  NSC8105 memory handlers
371 *
372 *************************************/
308373
374/* MS2010-A CPU (equivalent to NSC8105 with one new opcode: 0xec) on graphics PCB */
375static ADDRESS_MAP_START( nsc_map, ADDRESS_SPACE_PROGRAM, 8 )
376   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(3) AM_BASE(&tubep_sprite_colorsharedram)
377   AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE(2)
378   AM_RANGE(0x2000, 0x2009) AM_WRITE(tubep_sprite_control_w)
379   AM_RANGE(0x200a, 0x200b) AM_WRITE(MWA8_NOP) /* not used by the games - perhaps designed for debugging */
380   AM_RANGE(0xc000, 0xffff) AM_ROM
381ADDRESS_MAP_END
382
383
384
309385/*************************************
310386 *
311387 *  Roller Jammer memory handlers
312388 *
313389 *************************************/
314390
315
316391static WRITE8_HANDLER( rjammer_LS259_w )
317392{
318393   switch(offset)
r1281r1282
329404   }
330405}
331406
407
332408static WRITE8_HANDLER( rjammer_soundlatch_w )
333409{
334410   sound_latch = data;
335411   cpunum_set_input_line(2, INPUT_LINE_NMI, PULSE_LINE);
336412}
337413
338static ADDRESS_MAP_START( rjammer_portmap, ADDRESS_SPACE_IO, 8 )
414
415static ADDRESS_MAP_START( rjammer_main_map, ADDRESS_SPACE_PROGRAM, 8 )
416   AM_RANGE(0x0000, 0x9fff) AM_ROM
417   AM_RANGE(0xa000, 0xa7ff) AM_RAM                           /* MB8416 SRAM on daughterboard on main PCB (there are two SRAMs, this is the one on the left) */
418   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE(&tubep_textram)/* RAM on GFX PCB @B13 */
419   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)                  /* MB8416 SRAM on daughterboard (the one on the right) */
420ADDRESS_MAP_END
421
422
423static ADDRESS_MAP_START( rjammer_main_portmap, ADDRESS_SPACE_IO, 8 )
339424   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
340425   AM_RANGE(0x00, 0x00) AM_READ(input_port_2_r)   /* a bug in game code (during attract mode) */
341426   AM_RANGE(0x80, 0x80) AM_READ(input_port_2_r)
r1281r1282
350435ADDRESS_MAP_END
351436
352437
353static ADDRESS_MAP_START( rjammer_map, ADDRESS_SPACE_PROGRAM, 8 )
354   AM_RANGE(0x0000, 0x9fff) AM_ROM
355   AM_RANGE(0xa000, 0xa7ff) AM_RAM                           /* MB8416 SRAM on daughterboard on main PCB (there are two SRAMs, this is the one on the left) */
356   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE(&tubep_textram)/* RAM on GFX PCB @B13 */
357   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)                  /* MB8416 SRAM on daughterboard (the one on the right) */
438static ADDRESS_MAP_START( rjammer_second_map, ADDRESS_SPACE_PROGRAM, 8 )
439   AM_RANGE(0x0000, 0x7fff) AM_ROM
440   AM_RANGE(0xa000, 0xa7ff) AM_RAM                     /* M5M5117P @21G */
441   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)            /* MB8416 on daughterboard (the one on the right) */
442   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&rjammer_backgroundram)/* M5M5117P @19B (background) */
443   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(2)
358444ADDRESS_MAP_END
359445
360446
361static ADDRESS_MAP_START( rjammer_slave_portmap, ADDRESS_SPACE_IO, 8 )
447static ADDRESS_MAP_START( rjammer_second_portmap, ADDRESS_SPACE_IO, 8 )
362448   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
363449   AM_RANGE(0xb0, 0xb0) AM_WRITE(rjammer_background_page_w)
364450   AM_RANGE(0xd0, 0xd0) AM_WRITE(rjammer_background_LS377_w)
365451ADDRESS_MAP_END
366452
367453
368static ADDRESS_MAP_START( rjammer_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
369   AM_RANGE(0x0000, 0x7fff) AM_ROM
370   AM_RANGE(0xa000, 0xa7ff) AM_RAM                     /* M5M5117P @21G */
371   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)            /* MB8416 on daughterboard (the one on the right) */
372   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&rjammer_backgroundram)/* M5M5117P @19B (background) */
373   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(2)
374ADDRESS_MAP_END
454static TIMER_CALLBACK( rjammer_scanline_callback )
455{
456   int scanline = param;
375457
458curr_scanline = scanline;//for debugging
376459
377/*************************************
378 *
379 *  NSC8105 memory handlers
380 *
381 *************************************/
382460
461   /* CPU #0 interrupt */
462   /* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
463   if (scanline==240)
464   {
465      logerror("VBLANK CPU#0\n");
466      cpunum_set_input_line(0, 0, ASSERT_LINE);
467   }
383468
384/* MS2010-A CPU (equivalent to NSC8105 with one new opcode: 0xec) on graphics PCB */
385static ADDRESS_MAP_START( nsc_map, ADDRESS_SPACE_PROGRAM, 8 )
386   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(3) AM_BASE(&tubep_sprite_colorsharedram)
387   AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE(2)
388   AM_RANGE(0x2000, 0x2009) AM_WRITE(tubep_sprite_control_w)
389   AM_RANGE(0x200a, 0x200b) AM_WRITE(MWA8_NOP) /* not used by the games - perhaps designed for debugging */
390   AM_RANGE(0xc000, 0xffff) AM_ROM
391ADDRESS_MAP_END
392469
470   /* CPU #1 interrupt */
471   /* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
472   if (scanline==16)
473   {
474      logerror("/VBLANK CPU#1\n");
475      cpunum_set_input_line(1, 0, HOLD_LINE);
476   }
393477
478
479   /* CPU #3 MS2010-A NMI */
480   /* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
481   if (scanline==16)
482   {
483      logerror("/nmi CPU#3\n");
484      tubep_vblank_end(); /* switch buffered sprite RAM page */
485      cpunum_set_input_line(3, INPUT_LINE_NMI, ASSERT_LINE);
486   }
487   /* CPU #3 MS2010-A NMI */
488   /* deactivates at the start of VBLANK signal which happens at the beginning of scanline number 240*/
489   if (scanline==240)
490   {
491      logerror("CPU#3 nmi clear\n");
492      cpunum_set_input_line(3, INPUT_LINE_NMI, CLEAR_LINE);
493   }
494
495
496   /* sound CPU interrupt */
497   /* activates whenever line V6 from video part goes lo->hi that is when the scanline becomes 64 and 192 */
498   if ((scanline==64) || (scanline==192))
499   {
500      cpunum_set_input_line(2,0,ASSERT_LINE);   /* sound cpu interrupt (music tempo) */
501   }
502
503
504   video_screen_update_partial(0, video_screen_get_vpos(0));
505
506logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(0));
507
508   scanline ++;
509   if (scanline>=264)
510      scanline=0;
511
512   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, time_zero);
513}
514
515
516static MACHINE_START( rjammer )
517{
518   /* Create interrupt timer */
519   interrupt_timer = mame_timer_alloc(rjammer_scanline_callback);
520
521   tubep_setup_save_state();
522}
523
524static MACHINE_RESET( rjammer )
525{
526   mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0, time_zero);
527}
528
529
530
394531/*************************************
395532 *
396533 *  Sound CPU
397534 *
398535 *************************************/
399536
400
401537static READ8_HANDLER( rjammer_soundlatch_r )
402538{
403539    int res = sound_latch;
404540   return res;
405541}
406542
543
407544static WRITE8_HANDLER( rjammer_voice_startstop_w )
408545{
409546   /* bit 0 of data selects voice start/stop (reset pin on MSM5205)*/
r1281r1282
412549
413550   return;
414551}
552
553
415554static WRITE8_HANDLER( rjammer_voice_frequency_select_w )
416555{
417556   /* bit 0 of data selects voice frequency on MSM5205 */
r1281r1282
424563   return;
425564}
426565
566
427567static void rjammer_adpcm_vck (int data)
428568{
429569   ls74 = (ls74+1) & 1;
r1281r1282
440580
441581}
442582
583
443584static WRITE8_HANDLER( rjammer_voice_input_w )
444585{
445586   /* 8 bits of adpcm data for MSM5205 */
r1281r1282
456597   return;
457598}
458599
600
459601static WRITE8_HANDLER( rjammer_voice_intensity_control_w )
460602{
461603   /* 4 LSB bits select the intensity (analog circuit that alters the output from MSM5205) */
462   // need to buffer the data
604   /* need to buffer the data */
463605   return;
464606}
465607
608
466609static ADDRESS_MAP_START( rjammer_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
467610   AM_RANGE(0x0000, 0x7fff) AM_ROM
468611   AM_RANGE(0xe000, 0xe7ff) AM_RAM      /* M5M5117P (M58125P @2C on schematics) */
469612ADDRESS_MAP_END
470613
614
471615static ADDRESS_MAP_START( rjammer_sound_portmap, ADDRESS_SPACE_IO, 8 )
472616   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
473617   AM_RANGE(0x00, 0x00) AM_READ(rjammer_soundlatch_r)
r1281r1282
510654}
511655
512656
657
513658/*************************************
514659 *
515660 *  Game-specific port definitions
r1281r1282
703848INPUT_PORTS_END
704849
705850
851
706852/*************************************
707853 *
708854 *  Graphics definitions
709855 *
710856 *************************************/
711857
712
713858static const gfx_layout charlayout =
714859{
715860   8, 8,   /* 8*8 characters */
r1281r1282
720865   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
721866   8*8 /* every char takes 8 consecutive bytes */
722867};
868
723869static GFXDECODE_START( tubep )
724870   GFXDECODE_ENTRY( REGION_GFX1,      0, charlayout,       0, 32 )   /* 32 color codes */
725871GFXDECODE_END
r1281r1282
729875GFXDECODE_END
730876
731877
878
732879/*************************************
733880 *
734881 *  Sound definitions
735882 *
736883 *************************************/
737884
738
739885static struct AY8910interface ay8910_interface_1 =
740886{
741887   0,
r1281r1282
767913};
768914
769915
916
770917/*************************************
771918 *
772919 *  Machine driver
773920 *
774921 *************************************/
775922
776
777923static MACHINE_DRIVER_START( tubep )
778924
779925   /* basic machine hardware */
780926   MDRV_CPU_ADD_TAG("main",Z80,16000000 / 4)   /* 4 MHz */
781   MDRV_CPU_PROGRAM_MAP(tubep_map,0)
782   MDRV_CPU_IO_MAP(tubep_portmap,0)
783   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
927   MDRV_CPU_PROGRAM_MAP(tubep_main_map,0)
928   MDRV_CPU_IO_MAP(tubep_main_portmap,0)
784929
785930   MDRV_CPU_ADD_TAG("slave",Z80,16000000 / 4)   /* 4 MHz */
786   MDRV_CPU_PROGRAM_MAP(tubep_g_map,0)
787   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
931   MDRV_CPU_PROGRAM_MAP(tubep_second_map,0)
932   MDRV_CPU_IO_MAP(tubep_second_portmap,0)
788933
934   /* audio CPU */
789935   MDRV_CPU_ADD_TAG("sound",Z80,19968000 / 8)   /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */
790   /* audio CPU */
791936   MDRV_CPU_PROGRAM_MAP(tubep_sound_map,0)
792937   MDRV_CPU_IO_MAP(tubep_sound_portmap,0)
793938
794   MDRV_CPU_ADD_TAG("nsc",NSC8105,6000000/4)   /* 6 MHz Xtal - divided internally ??? */
939   MDRV_CPU_ADD_TAG("nsc",NSC8105,6000000 / 2)   /* 6 MHz Xtal - divided internally ??? */
795940   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
796   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
797941
798942   MDRV_SCREEN_REFRESH_RATE(60)
799943   MDRV_INTERLEAVE(100)
r1281r1282
804948   /* video hardware */
805949   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
806950   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
807   MDRV_SCREEN_SIZE(32*8, 32*8)
951   MDRV_SCREEN_SIZE(256, 264)
808952   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
809953   MDRV_GFXDECODE(tubep)
810954   MDRV_PALETTE_LENGTH(32 + 256*64)
r1281r1282
812956
813957   MDRV_PALETTE_INIT(tubep)
814958   MDRV_VIDEO_START(tubep)
815   MDRV_VIDEO_EOF(tubep)
816959   MDRV_VIDEO_UPDATE(tubep)
817960
818961   /* sound hardware */
r1281r1282
844987
845988
846989static MACHINE_DRIVER_START( rjammer )
847   MDRV_IMPORT_FROM( tubep )
848990
849991   /* basic machine hardware */
850   MDRV_CPU_MODIFY("main")
851   MDRV_CPU_PROGRAM_MAP(rjammer_map,0)
852   MDRV_CPU_IO_MAP(rjammer_portmap,0)
992   MDRV_CPU_ADD_TAG("main",Z80,16000000 / 4)   /* 4 MHz */
993   MDRV_CPU_PROGRAM_MAP(rjammer_main_map,0)
994   MDRV_CPU_IO_MAP(rjammer_main_portmap,0)
853995
854   MDRV_CPU_MODIFY("slave")
855   MDRV_CPU_PROGRAM_MAP(rjammer_slave_map,0)
856   MDRV_CPU_IO_MAP(rjammer_slave_portmap,0)
996   MDRV_CPU_ADD_TAG("slave",Z80,16000000 / 4)   /* 4 MHz */
997   MDRV_CPU_PROGRAM_MAP(rjammer_second_map,0)
998   MDRV_CPU_IO_MAP(rjammer_second_portmap,0)
857999
858   MDRV_CPU_MODIFY("sound")   /* Xtal3 divided by LS669 (on Qc output) (signal RH0) */
1000   /* audio CPU */
1001   MDRV_CPU_ADD_TAG("sound",Z80,19968000 / 8)   /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */
8591002   MDRV_CPU_PROGRAM_MAP(rjammer_sound_map,0)
8601003   MDRV_CPU_IO_MAP(rjammer_sound_portmap,0)
8611004
1005   MDRV_CPU_ADD_TAG("nsc",NSC8105,6000000/4)   /* 6 MHz Xtal - divided internally ??? */
1006   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
1007
1008   MDRV_SCREEN_REFRESH_RATE(60)
1009
8621010   MDRV_MACHINE_START(rjammer)
8631011   MDRV_MACHINE_RESET(rjammer)
8641012
1013
8651014   /* video hardware */
1015   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
1016   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1017   MDRV_SCREEN_SIZE(256, 264)
1018   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
8661019   MDRV_GFXDECODE(rjammer)
8671020   MDRV_PALETTE_LENGTH(64)
8681021   MDRV_COLORTABLE_LENGTH(2*16 + 16*2)
8691022
8701023   MDRV_PALETTE_INIT(rjammer)
1024   MDRV_VIDEO_START(tubep)
8711025   MDRV_VIDEO_UPDATE(rjammer)
8721026
8731027   /* sound hardware */
1028   MDRV_SPEAKER_STANDARD_MONO("mono")
1029
1030   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
1031   MDRV_SOUND_CONFIG(ay8910_interface_1)
1032   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
1033
1034   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
1035   MDRV_SOUND_CONFIG(ay8910_interface_2)
1036   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
1037
1038   MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2)
1039   MDRV_SOUND_CONFIG(ay8910_interface_3)
1040   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
1041
8741042   MDRV_SOUND_ADD(MSM5205, 384000)
8751043   MDRV_SOUND_CONFIG(msm5205_interface)
8761044   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
8771045MACHINE_DRIVER_END
8781046
8791047
1048
8801049/*************************************
8811050 *
8821051 *  ROM definition(s)
8831052 *
8841053 *************************************/
8851054
886
8871055ROM_START( tubep )
8881056   ROM_REGION( 0x10000,REGION_CPU1, 0 ) /* Z80 (master) cpu code */
8891057   ROM_LOAD( "tp-p.5", 0x0000, 0x2000, CRC(d5e0cc2f) SHA1(db9b062b14af52bb5458fe71996da295a69148ac) )
r1281r1282
10651233ROM_END
10661234
10671235
1236
10681237/*************************************
10691238 *
10701239 *  Game driver(s)
10711240 *
10721241 *************************************/
10731242
1074
1075/*     year  rom     parent  machine  inp   init */
1243/*     year  rom      parent  machine  inp   init */
10761244GAME( 1984, tubep,   0,      tubep,   tubep,   0, ROT0, "Nichibutsu + Fujitek", "Tube Panic", GAME_SUPPORTS_SAVE )
10771245GAME( 1984, tubepb,  tubep,  tubepb,  tubepb,  0, ROT0, "bootleg", "Tube Panic (bootleg)", GAME_SUPPORTS_SAVE )
10781246GAME( 1984, rjammer, 0,      rjammer, rjammer, 0, ROT0, "Nichibutsu + Alice", "Roller Jammer", GAME_SUPPORTS_SAVE )
src/mame/drivers/ppmast93.c
r1281r1282
134134static tilemap *ppmast93_fg_tilemap, *ppmast93_bg_tilemap;
135135UINT8 *ppmast93_fgram, *ppmast93_bgram;
136136
137WRITE8_HANDLER( ppmast93_fgram_w )
137static WRITE8_HANDLER( ppmast93_fgram_w )
138138{
139139   ppmast93_fgram[offset] = data;
140140   tilemap_mark_tile_dirty(ppmast93_fg_tilemap,offset/2);
141141}
142142
143WRITE8_HANDLER( ppmast93_bgram_w )
143static WRITE8_HANDLER( ppmast93_bgram_w )
144144{
145145   ppmast93_bgram[offset] = data;
146146   tilemap_mark_tile_dirty(ppmast93_bg_tilemap,offset/2);
147147}
148148
149WRITE8_HANDLER( ppmast93_port4_w )
149static WRITE8_HANDLER( ppmast93_port4_w )
150150{
151151   UINT8 *rom = memory_region(REGION_CPU1);
152152   int bank;
r1281r1282
327327         0);
328328}
329329
330VIDEO_START( ppmast93 )
330static VIDEO_START( ppmast93 )
331331{
332332   ppmast93_bg_tilemap = tilemap_create(get_ppmast93_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32, 32);
333333   ppmast93_fg_tilemap = tilemap_create(get_ppmast93_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32, 32);
r1281r1282
335335   tilemap_set_transparent_pen(ppmast93_fg_tilemap,0);
336336}
337337
338VIDEO_UPDATE( ppmast93 )
338static VIDEO_UPDATE( ppmast93 )
339339{
340340   tilemap_draw(bitmap,cliprect,ppmast93_bg_tilemap,0,0);
341341   tilemap_draw(bitmap,cliprect,ppmast93_fg_tilemap,0,0);
src/mame/drivers/homedata.c
r1281r1282
395395   reikaids_upd7807_portc_w(0,0xff);
396396}
397397
398READ8_HANDLER( reikaids_io_r )
398static READ8_HANDLER( reikaids_io_r )
399399{
400400   int res = readinputport(2);   // bit 4 = coin, bit 5 = service
401401
src/mame/drivers/exidy.c
r1281r1282
13511351}
13521352
13531353
1354DRIVER_INIT( sidetrac )
1354static DRIVER_INIT( sidetrac )
13551355{
13561356   exidy_common_init(sidetrac_palette, exidy_1bpp_colortable, 0x00, 0x00);
13571357
r1281r1282
13601360}
13611361
13621362
1363DRIVER_INIT( targ )
1363static DRIVER_INIT( targ )
13641364{
13651365   exidy_common_init(targ_palette, exidy_1bpp_colortable, 0x00, 0x00);
13661366   targ_spec_flag = 1;
13671367}
13681368
13691369
1370DRIVER_INIT( spectar )
1370static DRIVER_INIT( spectar )
13711371{
13721372   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
13731373}
13741374
1375DRIVER_INIT( rallys )
1375static DRIVER_INIT( rallys )
13761376{
13771377   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
13781378
r1281r1282
13831383   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5301, 0x5301, 0, 0, exidy_sprite2_ypos_w);
13841384}
13851385
1386DRIVER_INIT( phantoma )
1386static DRIVER_INIT( phantoma )
13871387{
13881388   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
13891389
r1281r1282
13991399}
14001400
14011401
1402DRIVER_INIT( mtrap )
1402static DRIVER_INIT( mtrap )
14031403{
14041404   exidy_common_init(NULL, exidy_1bpp_colortable, 0x14, 0x00);
14051405}
14061406
14071407
1408DRIVER_INIT( venture )
1408static DRIVER_INIT( venture )
14091409{
14101410   exidy_common_init(NULL, exidy_1bpp_colortable, 0x04, 0x04);
14111411}
14121412
14131413
1414DRIVER_INIT( teetert )
1414static DRIVER_INIT( teetert )
14151415{
14161416   exidy_common_init(NULL, exidy_1bpp_colortable, 0x0c, 0x0c);
14171417
r1281r1282
14201420}
14211421
14221422
1423DRIVER_INIT( pepper2 )
1423static DRIVER_INIT( pepper2 )
14241424{
14251425   exidy_common_init(NULL, exidy_2bpp_colortable, 0x14, 0x04);
14261426
r1281r1282
14321432}
14331433
14341434
1435DRIVER_INIT( fax )
1435static DRIVER_INIT( fax )
14361436{
14371437   exidy_common_init(NULL, exidy_2bpp_colortable, 0x04, 0x04);
14381438
src/mame/drivers/xxmissio.c
r1281r1282
2727
2828WRITE8_HANDLER( xxmissio_paletteram_w );
2929
30WRITE8_HANDLER( xxmissio_bank_sel_w )
30static WRITE8_HANDLER( xxmissio_bank_sel_w )
3131{
3232   memory_set_bank(1, data & 7);
3333}
3434
35READ8_HANDLER( xxmissio_status_r )
35static READ8_HANDLER( xxmissio_status_r )
3636{
3737   xxmissio_status = (xxmissio_status | 2) & ( readinputportbytag("IN2") | 0xfd );
3838   return xxmissio_status;
3939}
4040
41WRITE8_HANDLER ( xxmissio_status_m_w )
41static WRITE8_HANDLER ( xxmissio_status_m_w )
4242{
4343   switch (data)
4444   {
r1281r1282
5757   }
5858}
5959
60WRITE8_HANDLER ( xxmissio_status_s_w )
60static WRITE8_HANDLER ( xxmissio_status_s_w )
6161{
6262   switch (data)
6363   {
src/mame/drivers/hng64.c
r1281r1282
483483
484484static UINT32 no_machine_error_code;
485485static int hng64_interrupt_level_request;
486WRITE32_HANDLER( hng64_videoram_w );
486static WRITE32_HANDLER( hng64_videoram_w );
487487
488488/* 3D stuff */
489489static UINT32 *hng64_3d_1;
r1281r1282
512512*/
513513
514514
515WRITE32_HANDLER( hng64_videoram_w )
515static WRITE32_HANDLER( hng64_videoram_w )
516516{
517517   int realoff;
518518   COMBINE_DATA(&hng64_videoram[offset]);
r1281r1282
562562}
563563
564564
565READ32_HANDLER( hng64_random_read )
565static READ32_HANDLER( hng64_random_read )
566566{
567567   return mame_rand(Machine)&0xffffffff;
568568}
569569
570570
571READ32_HANDLER( hng64_com_r )
571static READ32_HANDLER( hng64_com_r )
572572{
573573   logerror("com read  (PC=%08x): %08x %08x = %08x\n", activecpu_get_pc(), (offset*4)+0xc0000000, ~mem_mask, hng64_com_ram[offset]);
574574   return hng64_com_ram[offset] ;
r1281r1282
585585static UINT32 hng64_com_shared_a;
586586static UINT32 hng64_com_shared_b;
587587
588WRITE32_HANDLER( hng64_com_share_w )
588static WRITE32_HANDLER( hng64_com_share_w )
589589{
590590   logerror("commw  (PC=%08x): %08x %08x %08x\n", activecpu_get_pc(), data, (offset*4)+0xc0001000, ~mem_mask);
591591
r1281r1282
593593   if (offset==0x1) COMBINE_DATA(&hng64_com_shared_b);
594594}
595595
596READ32_HANDLER( hng64_com_share_r )
596static READ32_HANDLER( hng64_com_share_r )
597597{
598598   logerror("commr  (PC=%08x): %08x %08x\n", activecpu_get_pc(), (offset*4)+0xc0001000, ~mem_mask);
599599
r1281r1282
663663}
664664
665665
666WRITE32_HANDLER( hng_dma_start_w )
666static WRITE32_HANDLER( hng_dma_start_w )
667667{
668668   logerror ("DMA Start Write %08x\n",data);
669669   hng_dma_start = data;
670670}
671671
672WRITE32_HANDLER( hng_dma_dst_w )
672static WRITE32_HANDLER( hng_dma_dst_w )
673673{
674674   logerror ("DMA Dst Write %08x\n",data);
675675   hng_dma_dst = data;
676676}
677677
678WRITE32_HANDLER( hng_dma_len_w )
678static WRITE32_HANDLER( hng_dma_len_w )
679679{
680680   logerror ("DMA Len Write %08x\n",data);
681681   hng_dma_len = data;
r1281r1282
683683
684684}
685685
686#ifdef UNUSED_FUNCTION
686687READ32_HANDLER( hng64_videoram_r )
687688{
688689   return hng64_videoram[offset];
r1281r1282
697698{
698699   return hng_cart[offset];
699700}
701#endif
700702
701READ32_HANDLER( hng64_sram_r )
703static READ32_HANDLER( hng64_sram_r )
702704{
703705   logerror("HNG64 reading from SRAM 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, hng64_sram[offset], activecpu_get_pc());
704706   return hng64_sram[offset];
705707}
706708
707WRITE32_HANDLER( hng64_sram_w )
709static WRITE32_HANDLER( hng64_sram_w )
708710{
709711   logerror("HNG64 writing to SRAM 0x%08x == 0x%08x & 0x%08x. (PC=%08x)\n", offset*4, data, ~mem_mask, activecpu_get_pc());
710712   COMBINE_DATA (&hng64_sram[offset]);
711713}
712714
713WRITE32_HANDLER( hng64_dualport_w )
715static WRITE32_HANDLER( hng64_dualport_w )
714716{
715717   logerror("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], activecpu_get_pc());
716718   COMBINE_DATA (&hng64_dualport[offset]);
717719}
718720
719READ32_HANDLER( hng64_dualport_r )
721static READ32_HANDLER( hng64_dualport_r )
720722{
721723   logerror("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], activecpu_get_pc());
722724
r1281r1282
747749//   <ElSemi> 30100000-3011ffff is framebuffer A0
748750//   <ElSemi> 30120000-3013ffff is framebuffer A1
749751//   <ElSemi> 30140000-3015ffff is ZBuffer A
750READ32_HANDLER( hng64_3d_1_r )
752static READ32_HANDLER( hng64_3d_1_r )
751753{
752754   return hng64_3d_1[offset] ;
753755}
754756
757#ifdef UNUSED_FUNCTION
755758WRITE32_HANDLER( hng64_3d_1_w )
756759{
757760   fatalerror("WRITE32_HANDLER( hng64_3d_1_w )");
758761}
762#endif
759763
760READ32_HANDLER( hng64_3d_2_r )
764static READ32_HANDLER( hng64_3d_2_r )
761765{
762766   return hng64_3d_2[offset] ;
763767}
764768
765WRITE32_HANDLER( hng64_3d_2_w )
769static WRITE32_HANDLER( hng64_3d_2_w )
766770{
767771   COMBINE_DATA (&hng64_3d_1[offset]) ;
768772   COMBINE_DATA (&hng64_3d_2[offset]) ;
r1281r1282
864868<ElSemi> 0x60000000-0x60001000 Comm dualport ram
865869*/
866870
867WRITE32_HANDLER( hng64_soundram_w )
871static WRITE32_HANDLER( hng64_soundram_w )
868872{
869873   UINT32 mem_mask32 = mem_mask;
870874   UINT32 data32 = data;
r1281r1282
883887   COMBINE_DATA(&hng64_soundram[offset * 2 + 1]);
884888}
885889
886READ32_HANDLER( hng64_soundram_r )
890static READ32_HANDLER( hng64_soundram_r )
887891{
888892   UINT16 datalo = hng64_soundram[offset * 2 + 0];
889893   UINT16 datahi = hng64_soundram[offset * 2 + 1];
r1281r1282
11401144   hng64_com_mmu_mem[7] = 0xf0;
11411145}
11421146
1143READ8_HANDLER( hng64_comm_memory_r )
1147static READ8_HANDLER( hng64_comm_memory_r )
11441148{
11451149   UINT32 physical_address = KL5C80_translate_address(offset) ;
11461150   logerror("READING 0x%02x from 0x%04x (0x%05x)\n", hng64_com_virtual_mem[physical_address], offset, physical_address) ;
r1281r1282
11551159   return hng64_com_virtual_mem[physical_address] ;
11561160}
11571161
1158WRITE8_HANDLER( hng64_comm_memory_w )
1162static WRITE8_HANDLER( hng64_comm_memory_w )
11591163{
11601164//  UINT32 physical_address = KL5C80_translate_address(offset) ;
11611165//  logerror("WRITING 0x%02x to 0x%04x (0x%05x)\n", hng64_com_virtual_mem[physical_address], offset, physical_address) ;
r1281r1282
11651169
11661170
11671171/* KL5C80 I/O handlers */
1168WRITE8_HANDLER( hng64_comm_io_mmu )
1172static WRITE8_HANDLER( hng64_comm_io_mmu )
11691173{
11701174   hng64_com_mmu_mem[offset] = data;
11711175
r1281r1282
13971401   GFXDECODE_ENTRY( REGION_GFX2, 0, hng64_16_layout,     0x0, 0x10 )  /* sprite tiles */
13981402GFXDECODE_END
13991403
1400DRIVER_INIT( hng64 )
1404static DRIVER_INIT( hng64 )
14011405{
14021406   hng64_soundram=auto_malloc(0x200000);
14031407}
14041408
1405DRIVER_INIT(hng64_fght)
1409static DRIVER_INIT(hng64_fght)
14061410{
14071411   no_machine_error_code=0x01010101;
14081412   driver_init_hng64(machine);
14091413}
14101414
1411DRIVER_INIT(hng64_race)
1415static DRIVER_INIT(hng64_race)
14121416{
14131417   no_machine_error_code=0x02020202;
14141418   driver_init_hng64(machine);
r1281r1282
14501454
14511455
14521456
1453MACHINE_RESET(hyperneo)
1457static MACHINE_RESET(hyperneo)
14541458{
14551459   int i ;
14561460
src/mame/drivers/gladiatr.c
r1281r1282
205205
206206
207207/*Rom bankswitching*/
208WRITE8_HANDLER( gladiatr_bankswitch_w )
208static WRITE8_HANDLER( gladiatr_bankswitch_w )
209209{
210210   UINT8 *rom = memory_region(REGION_CPU1) + 0x10000;
211211
r1281r1282
326326
327327#if 1
328328/* !!!!! patch to IRQ timming for 2nd CPU !!!!! */
329WRITE8_HANDLER( gladiatr_irq_patch_w )
329static WRITE8_HANDLER( gladiatr_irq_patch_w )
330330{
331331   cpunum_set_input_line(1,0,HOLD_LINE);
332332}
src/mame/drivers/imolagp.c
r1281r1282
158158   }
159159}
160160
161VIDEO_START( imolagp )
161static VIDEO_START( imolagp )
162162{
163163   int i;
164164   for( i=0; i<3; i++ )
r1281r1282
170170}
171171
172172
173VIDEO_UPDATE( imolagp )
173static VIDEO_UPDATE( imolagp )
174174{
175175   int scroll2 = imola_scroll^0x03;
176176   int pass;
r1281r1282
521521   {0},       /* Port C write */
522522};
523523
524DRIVER_INIT( imolagp )
524static DRIVER_INIT( imolagp )
525525{
526526   ppi8255_init(&ppi8255_intf);
527527}
src/mame/drivers/puckpkmn.c
r1281r1282
266266
267267****************************************************************************/
268268
269DRIVER_INIT( puckpkmn )
269static DRIVER_INIT( puckpkmn )
270270{
271271   UINT8 *rom   =   memory_region(REGION_CPU1);
272272   size_t len      =   memory_region_length(REGION_CPU1);
src/mame/drivers/stepstag.c
r1281r1282
110110
111111GFXDECODE_END
112112
113VIDEO_START(stepstag)
113static VIDEO_START(stepstag)
114114{
115115}
116VIDEO_UPDATE(stepstag)
116static VIDEO_UPDATE(stepstag)
117117{
118118
119119   return 0;
src/mame/drivers/goindol.c
r1281r1282
3434extern int goindol_char_bank;
3535
3636
37WRITE8_HANDLER( goindol_bankswitch_w )
37static WRITE8_HANDLER( goindol_bankswitch_w )
3838{
3939   int bankaddress;
4040   UINT8 *RAM = memory_region(REGION_CPU1);
r1281r1282
411411
412412
413413
414DRIVER_INIT( goindol )
414static DRIVER_INIT( goindol )
415415{
416416   UINT8 *rom = memory_region(REGION_CPU1);
417417
src/mame/drivers/eolith16.c
r1281r1282
9898   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNUSED )
9999INPUT_PORTS_END
100100
101VIDEO_START( eolith16 )
101static VIDEO_START( eolith16 )
102102{
103103   vram = auto_malloc(0x10000*2);
104104}
105105
106VIDEO_UPDATE( eolith16 )
106static VIDEO_UPDATE( eolith16 )
107107{
108108   int x,y,count;
109109   int color;
r1281r1282
137137}
138138
139139// setup a custom palette because pixels use 8 bits per color
140PALETTE_INIT( eolith16 )
140static PALETTE_INIT( eolith16 )
141141{
142142   int c;
143143
r1281r1282
250250   ROM_LOAD( "kd.u28", 0x000000, 0x080000, CRC(c12112a1) SHA1(729bbaca6db933a730099a4a560a10ed99cae1c3) )
251251ROM_END
252252
253DRIVER_INIT( eolith16 )
253static DRIVER_INIT( eolith16 )
254254{
255255   init_eolith_speedup(machine);
256256}
src/mame/drivers/groundfx.c
r1281r1282
488488}
489489
490490
491DRIVER_INIT( groundfx )
491static DRIVER_INIT( groundfx )
492492{
493493   UINT32 offset,i;
494494   UINT8 *gfx = memory_region(REGION_GFX3);
src/mame/drivers/fastlane.c
r1281r1282
3838   }
3939}
4040
41WRITE8_HANDLER( k007121_registers_w )
41static WRITE8_HANDLER( k007121_registers_w )
4242{
4343   if (offset < 8)
4444      K007121_ctrl_0_w(offset,data);
src/mame/drivers/segald.c
r1281r1282
7878}
7979
8080
81VIDEO_UPDATE( astron )
81static VIDEO_UPDATE( astron )
8282{
8383   fillbitmap(bitmap, 0, cliprect);
8484
src/mame/drivers/cabal.c
r1281r1282
103103}
104104
105105
106WRITE16_HANDLER( cabal_sound_irq_trigger_word_w )
106static WRITE16_HANDLER( cabal_sound_irq_trigger_word_w )
107107{
108108   seibu_main_word_w(4,data,mem_mask);
109109
r1281r1282
111111   cpu_spinuntil_time(MAME_TIME_IN_USEC(50));
112112}
113113
114WRITE16_HANDLER( cabalbl_sound_irq_trigger_word_w )
114static WRITE16_HANDLER( cabalbl_sound_irq_trigger_word_w )
115115{
116116   cpunum_set_input_line( 1, INPUT_LINE_NMI, PULSE_LINE );
117117}
src/mame/drivers/cidelsa.c
r1281r1282
5757   NULL
5858};
5959
60READ8_HANDLER ( cidelsa_input_port_0_r )
60static READ8_HANDLER ( cidelsa_input_port_0_r )
6161{
6262   return (readinputportbytag("IN0") & 0x7f) + (cdp1869_pcb ? 0x80 : 0x00);
6363}
r1281r1282
6767static int draco_sound;
6868static int draco_ay_latch;
6969
70WRITE8_HANDLER ( draco_sound_bankswitch_w )
70static WRITE8_HANDLER ( draco_sound_bankswitch_w )
7171{
7272   memory_set_bank(1, (data & 0x08) >> 3);
7373}
7474
75WRITE8_HANDLER ( draco_sound_g_w )
75static WRITE8_HANDLER ( draco_sound_g_w )
7676{
7777   /*
7878
r1281r1282
101101   }
102102}
103103
104READ8_HANDLER ( draco_sound_in_r )
104static READ8_HANDLER ( draco_sound_in_r )
105105{
106106   return draco_sound & 0x07;
107107}
108108
109READ8_HANDLER ( draco_sound_ay8910_r )
109static READ8_HANDLER ( draco_sound_ay8910_r )
110110{
111111   return draco_ay_latch;
112112}
113113
114WRITE8_HANDLER ( draco_sound_ay8910_w )
114static WRITE8_HANDLER ( draco_sound_ay8910_w )
115115{
116116   draco_ay_latch = data;
117117}
118118
119WRITE8_HANDLER ( draco_ay8910_port_a_w )
119static WRITE8_HANDLER ( draco_ay8910_port_a_w )
120120{
121121   /*
122122      bit   description
r1281r1282
132132    */
133133}
134134
135WRITE8_HANDLER ( draco_ay8910_port_b_w )
135static WRITE8_HANDLER ( draco_ay8910_port_b_w )
136136{
137137   /*
138138      bit   description
r1281r1282
158158
159159/* Read/Write Handlers */
160160
161WRITE8_HANDLER ( destryer_out1_w )
161static WRITE8_HANDLER ( destryer_out1_w )
162162{
163163   /*
164164      bit   description
r1281r1282
174174    */
175175}
176176
177WRITE8_HANDLER ( altair_out1_w )
177static WRITE8_HANDLER ( altair_out1_w )
178178{
179179   /*
180180      bit   description
r1281r1282
194194   set_led_status(2, data & 0x20); // FIRE
195195}
196196
197WRITE8_HANDLER ( draco_out1_w )
197static WRITE8_HANDLER ( draco_out1_w )
198198{
199199   /*
200200      bit   description
r1281r1282
212212    draco_sound = (data & 0xe0) >> 5;
213213}
214214
215WRITE8_HANDLER ( cidelsa_charram_w )
215static WRITE8_HANDLER ( cidelsa_charram_w )
216216{
217217   int addr = cdp1869_get_cma(offset);
218218   cidelsa_pcb[addr] = activecpu_get_reg(CDP1802_Q);
219219   cdp1869_charram_w(offset, data);
220220}
221221
222READ8_HANDLER ( cidelsa_charram_r )
222static READ8_HANDLER ( cidelsa_charram_r )
223223{
224224   int addr = cdp1869_get_cma(offset);
225225   cdp1869_pcb = cidelsa_pcb[addr];
r1281r1282
676676   cdp1802_mode = CDP1802_MODE_RUN;
677677}
678678
679DRIVER_INIT( cidelsa )
679static DRIVER_INIT( cidelsa )
680680{
681681   cdp1869_configure(&destryer_CDP1869_interface);
682682
r1281r1282
692692   cidelsa_get_color_bits
693693};
694694
695DRIVER_INIT( draco )
695static DRIVER_INIT( draco )
696696{
697697   UINT8 *ROM = memory_region(REGION_CPU2);
698698   memory_configure_bank(1, 0, 2, &ROM[0x000], 0x400);
src/mame/drivers/hotblock.c
r1281r1282
8080
8181
8282
83WRITE8_HANDLER( hotblock_port0_w )
83static WRITE8_HANDLER( hotblock_port0_w )
8484{
8585//  popmessage("port4_w: pc = %06x : data %04x",activecpu_get_pc(),data);
8686   hotblock_port0=data;
8787}
8888
89WRITE8_HANDLER( hotblock_video_write )
89static WRITE8_HANDLER( hotblock_video_write )
9090{
9191   /* right?, anything else?? */
9292   if(hotblock_port0 &0x20) // port 0 = a8 e8 -- palette
r1281r1282
114114
115115
116116
117VIDEO_START(hotblock)
117static VIDEO_START(hotblock)
118118{
119119   hotblock_pal=auto_malloc(0x10000);
120120}
121121
122VIDEO_UPDATE(hotblock)
122static VIDEO_UPDATE(hotblock)
123123{
124124
125125   int y,x,count;
src/mame/drivers/srmp5.c
r1281r1282
5959#define SPRITE_DATA_GRANULARITY 0x80
6060
6161
62VIDEO_UPDATE( srmp5 )
62static VIDEO_UPDATE( srmp5 )
6363{
6464   // sprite/tile flipping is not implemented
6565   int x,y,address,xs,ys,height,width,xw,yw,sprite,xb,yb,sizex,sizey;
src/mame/drivers/suprloco.c
r1281r1282
255255
256256
257257
258DRIVER_INIT( suprloco )
258static DRIVER_INIT( suprloco )
259259{
260260   /* convert graphics to 4bpp from 3bpp */
261261
src/mame/drivers/hal21.c
r1281r1282
173173   gfx_drawmode_table[7] = DRAWMODE_NONE;
174174}
175175
176VIDEO_START( aso )
176static VIDEO_START( aso )
177177{
178178   snk_blink_parity = 0;
179179}
r1281r1282
306306   }
307307}
308308
309VIDEO_UPDATE( aso )
309static VIDEO_UPDATE( aso )
310310{
311311   int attr, msbs, spsy, spsx, bgsy, bgsx, bank, i;
312312
r1281r1282
674674
675675/**************************************************************************/
676676
677DRIVER_INIT( aso )
677static DRIVER_INIT( aso )
678678{
679679   hal21_vreg = auto_malloc(16);
680680   snk_gamegroup = 0;
681681}
682682
683DRIVER_INIT( hal21 )
683static DRIVER_INIT( hal21 )
684684{
685685   hal21_vreg = auto_malloc(24);
686686   hal21_sndfifo = hal21_vreg + 8;
687687   snk_gamegroup = 1;
688688}
689689
690MACHINE_RESET( aso )
690static MACHINE_RESET( aso )
691691{
692692   memset(hal21_vreg, 0, 8);
693693   hal21_sound_scheduler(0, 0);
src/mame/drivers/vendetta.c
r1281r1282
252252   cpunum_set_input_line_and_vector( 1, 0, HOLD_LINE, 0xff );
253253}
254254
255READ8_HANDLER( vendetta_sound_interrupt_r )
255static READ8_HANDLER( vendetta_sound_interrupt_r )
256256{
257257   cpunum_set_input_line_and_vector( 1, 0, HOLD_LINE, 0xff );
258258   return 0x00;
259259}
260260
261READ8_HANDLER( vendetta_sound_r )
261static READ8_HANDLER( vendetta_sound_r )
262262{
263263   return K053260_0_r(2 + offset);
264264}
src/mame/drivers/destroyr.c
r1281r1282
6060}
6161
6262
63WRITE8_HANDLER( destroyr_misc_w )
63static WRITE8_HANDLER( destroyr_misc_w )
6464{
6565   /* bits 0 to 2 connect to the sound circuits */
6666
r1281r1282
7676}
7777
7878
79WRITE8_HANDLER( destroyr_cursor_load_w )
79static WRITE8_HANDLER( destroyr_cursor_load_w )
8080{
8181   destroyr_cursor = data;
8282
r1281r1282
8484}
8585
8686
87WRITE8_HANDLER( destroyr_interrupt_ack_w )
87static WRITE8_HANDLER( destroyr_interrupt_ack_w )
8888{
8989   cpunum_set_input_line(0, 0, CLEAR_LINE);
9090}
9191
9292
93WRITE8_HANDLER( destroyr_output_w )
93static WRITE8_HANDLER( destroyr_output_w )
9494{
9595   offset &= 15;
9696
r1281r1282
130130}
131131
132132
133READ8_HANDLER( destroyr_input_r )
133static READ8_HANDLER( destroyr_input_r )
134134{
135135   offset &= 15;
136136
r1281r1282
157157}
158158
159159
160READ8_HANDLER( destroyr_scanline_r )
160static READ8_HANDLER( destroyr_scanline_r )
161161{
162162   return video_screen_get_vpos(0);
163163}
src/mame/drivers/thoop2.c
r1281r1282
7777   }
7878}
7979
80WRITE16_HANDLER( thoop2_coin_w )
80static WRITE16_HANDLER( thoop2_coin_w )
8181{
8282   if (ACCESSING_LSB){
8383      switch ((offset >> 3)){
src/mame/drivers/wwfwfest.c
r1281r1282
390390   dd3_ymirq_handler
391391};
392392
393VIDEO_EOF( wwfwfest )
393static VIDEO_EOF( wwfwfest )
394394{
395395   buffer_spriteram16_w(0,0,0);
396396}
src/mame/drivers/pktgaldx.c
r1281r1282
103103
104104/* Pocket Gal Deluxe (bootleg!) */
105105
106READ16_HANDLER( pckgaldx_unknown_r )
106static READ16_HANDLER( pckgaldx_unknown_r )
107107{
108108   return 0xffff;
109109}
110110
111WRITE16_HANDLER( paletteram16_xRGB_w )
111static WRITE16_HANDLER( paletteram16_xRGB_w )
112112{
113113   int pen;
114114   int r,g,b;
r1281r1282
127127   palette_set_color(Machine,pen,MAKE_RGB(r,g,b));
128128}
129129
130READ16_HANDLER( pckgaldx_protection_r )
130static READ16_HANDLER( pckgaldx_protection_r )
131131{
132132   logerror("pckgaldx_protection_r address %06x\n",activecpu_get_pc());
133133   return -1;
src/mame/drivers/nwk-tr.c
r1281r1282
535535   cpunum_set_input_line(0, INPUT_LINE_IRQ0, ASSERT_LINE);
536536}
537537
538VIDEO_START( nwktr )
538static VIDEO_START( nwktr )
539539{
540540   voodoo_start(0, 0, VOODOO_1, 2, 2, 2);
541541   voodoo_set_vblank_callback(0, voodoo_vblank_0);
r1281r1282
544544}
545545
546546
547VIDEO_UPDATE( nwktr )
547static VIDEO_UPDATE( nwktr )
548548{
549549   fillbitmap(bitmap, machine->remapped_colortable[0], cliprect);
550550
src/mame/drivers/pkscram.c
r1281r1282
224224   }
225225}
226226
227VIDEO_START( pkscramble )
227static VIDEO_START( pkscramble )
228228{
229229   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN,      8, 8,32,32);
230230   md_tilemap = tilemap_create(get_md_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8,32,32);
r1281r1282
234234   tilemap_set_transparent_pen(fg_tilemap,15);
235235}
236236
237VIDEO_UPDATE( pkscramble )
237static VIDEO_UPDATE( pkscramble )
238238{
239239   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
240240   tilemap_draw(bitmap,cliprect,md_tilemap,0,0);
r1281r1282
270270   irqhandler
271271};
272272
273MACHINE_RESET( pkscramble)
273static MACHINE_RESET( pkscramble)
274274{
275275   out = 0;
276276   interrupt_line_active=0;
src/mame/drivers/fortecar.c
r1281r1282
3030   AM_RANGE(0xd800, 0xffff) AM_RAM AM_BASE(&fortecar_ram)
3131ADDRESS_MAP_END
3232
33#ifdef UNUSED_FUNCTION
3334READ8_HANDLER( fortecar_read62 )
3435{
3536   return mame_rand(Machine);
3637}
38#endif
3739
3840static ADDRESS_MAP_START( fortecar_ports, ADDRESS_SPACE_IO, 8 )
3941   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
r1281r1282
112114   GFXDECODE_ENTRY( REGION_GFX1, 0, tiles8x8_layout, 0, 16 )
113115GFXDECODE_END
114116
115VIDEO_START(fortecar)
117static VIDEO_START(fortecar)
116118{
117119}
118120
119VIDEO_UPDATE(fortecar)
121static VIDEO_UPDATE(fortecar)
120122{
121123   int x,y,count;
122124   count = 0;
src/mame/drivers/gunpey.c
r1281r1282
5050static UINT16 *unkram;
5151static UINT16 *mainram;
5252
53VIDEO_START( gunpey )
53static VIDEO_START( gunpey )
5454{
5555}
5656
57VIDEO_UPDATE( gunpey )
57static VIDEO_UPDATE( gunpey )
5858{
5959
6060   return 0;
src/mame/drivers/taito_f3.c
r1281r1282
405405}
406406
407407
408NVRAM_HANDLER( taito_f3 )
408static NVRAM_HANDLER( taito_f3 )
409409{
410410   if (read_or_write)
411411      EEPROM_save(file);
src/mame/drivers/gaelco2.c
r1281r1282
660660}
661661
662662/* the game expects this value each frame to know that the DS5002FP is alive */
663READ16_HANDLER ( dallas_kludge_r )
663static READ16_HANDLER ( dallas_kludge_r )
664664{
665665   return 0x0200;
666666}
src/mame/drivers/homerun.c
r1281r1282
4646};
4747
4848
49MACHINE_RESET( homerun )
49static MACHINE_RESET( homerun )
5050{
5151   ppi8255_init(&ppi8255_intf);
5252}
src/mame/drivers/champbas.c
r1281r1282
6868extern VIDEO_START( champbas );
6969extern VIDEO_UPDATE( champbas );
7070
71WRITE8_HANDLER( champbas_dac_w )
71static WRITE8_HANDLER( champbas_dac_w )
7272{
7373   DAC_signed_data_w(0,data<<2);
7474}
r1281r1282
8484}
8585
8686/* champbja another protection */
87READ8_HANDLER( champbja_alt_protection_r )
87static READ8_HANDLER( champbja_alt_protection_r )
8888{
8989   UINT8 data = 0;
9090/*
src/mame/drivers/ssozumo.c
r1281r1282
4848}
4949
5050
51WRITE8_HANDLER( ssozumo_sh_command_w )
51static WRITE8_HANDLER( ssozumo_sh_command_w )
5252{
5353   soundlatch_w(offset, data);
5454   cpunum_set_input_line(1, M6502_IRQ_LINE, HOLD_LINE);
src/mame/drivers/mcr.c
r1281r1282
906906   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
907907
908908   PORT_START_TAG("SSIO.IP3")   /* DIPSW @ B3 */
909   PORT_DIPNAME( 0x01, 0x00, "Coin Meters" )
909   PORT_DIPNAME( 0x01, 0x00, "Coin Meters" )            PORT_DIPLOCATION("SW1:1")
910910   PORT_DIPSETTING(    0x01, "1" )
911911   PORT_DIPSETTING(    0x00, "2" )
912   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
912   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )         PORT_DIPLOCATION("SW1:2")
913913   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
914914   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
915   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) )
915   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("SW1:3")
916916   PORT_DIPSETTING(    0x04, DEF_STR( No ) )
917917   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
918   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
918   PORT_DIPUNUSED_DIPLOC( 0x08, 0x00, "SW1:4" )
919   PORT_DIPUNUSED_DIPLOC( 0x10, 0x00, "SW1:5" )
920   PORT_DIPUNUSED_DIPLOC( 0x20, 0x00, "SW1:6" )
921   PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "SW1:7" )
922   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW1:8" )
923   // According to the manual, SW1 is a bank of *10* switches (9 is unused and 10 is freeze)
924   // Where are the values for the other two bits read?
919925
920926   PORT_START_TAG("SSIO.IP4")   /* J6 1-8 */
921927   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL
src/mame/drivers/ninjaw.c
r1281r1282
199199
200200extern const char layout_darius[];
201201
202MACHINE_START( ninjaw );
203MACHINE_RESET( ninjaw );
202static MACHINE_START( ninjaw );
203static MACHINE_RESET( ninjaw );
204204
205205VIDEO_START( ninjaw );
206206VIDEO_UPDATE( ninjaw );
r1281r1282
282282
283283/**** sound pan control ****/
284284static int ninjaw_pandata[4];
285WRITE8_HANDLER( ninjaw_pancontrol )
285static WRITE8_HANDLER( ninjaw_pancontrol )
286286{
287287  offset = offset&3;
288288  ninjaw_pandata[offset] = (float)data * (100.f / 255.0f);
r1281r1282
951951ROM_END
952952
953953
954MACHINE_START( ninjaw )
954static MACHINE_START( ninjaw )
955955{
956956   cpua_ctrl = 0xff;
957957   state_save_register_global(cpua_ctrl);
r1281r1282
961961   state_save_register_func_postload(reset_sound_region);
962962}
963963
964MACHINE_RESET( ninjaw )
964static MACHINE_RESET( ninjaw )
965965{
966966  /**** mixer control enable ****/
967967  sound_global_enable( 1 );   /* mixer enabled */
src/mame/drivers/matmania.c
r1281r1282
5959
6060
6161
62WRITE8_HANDLER( matmania_sh_command_w )
62static WRITE8_HANDLER( matmania_sh_command_w )
6363{
6464   soundlatch_w(offset,data);
6565   cpunum_set_input_line(1,M6502_IRQ_LINE,HOLD_LINE);
6666}
6767
68WRITE8_HANDLER( matmania_dac_w )
68static WRITE8_HANDLER( matmania_dac_w )
6969{
7070   DAC_signed_data_w(0,data);
7171}
7272
7373
74WRITE8_HANDLER( maniach_sh_command_w )
74static WRITE8_HANDLER( maniach_sh_command_w )
7575{
7676   soundlatch_w(offset,data);
7777   cpunum_set_input_line(1,M6809_IRQ_LINE,HOLD_LINE);
src/mame/drivers/megasys1.c
r1281r1282
149149
150150
151151
152MACHINE_RESET( megasys1 )
152static MACHINE_RESET( megasys1 )
153153{
154154   megasys1_ignore_oki_status = 1;   /* ignore oki status due 'protection' */
155155   ip_select = 0;   /* reset protection */
156156}
157157
158MACHINE_RESET( megasys1_hachoo )
158static MACHINE_RESET( megasys1_hachoo )
159159{
160160   megasys1_ignore_oki_status = 0;   /* strangely hachoo need real oki status */
161161   ip_select = 0;   /* reset protection */
r1281r1282
34523452
34533453INPUT_PORTS_END
34543454
3455READ16_HANDLER( soldamj_spriteram16_r )
3455static READ16_HANDLER( soldamj_spriteram16_r )
34563456{
34573457   return spriteram16[offset];
34583458}
3459WRITE16_HANDLER( soldamj_spriteram16_w )
3459static WRITE16_HANDLER( soldamj_spriteram16_w )
34603460{
34613461   if (offset < 0x800/2)   COMBINE_DATA(&spriteram16[offset]);
34623462}
src/mame/drivers/crshrace.c
r1281r1282
736736}
737737
738738
739DRIVER_INIT( crshrace )
739static DRIVER_INIT( crshrace )
740740{
741741   #if CRSHRACE_3P_HACK
742742   crshrace_patch_code(0x003778);
743743   #endif
744744}
745745
746DRIVER_INIT( crshrac2 )
746static DRIVER_INIT( crshrac2 )
747747{
748748   #if CRSHRACE_3P_HACK
749749   crshrace_patch_code(0x003796);
src/mame/drivers/airbustr.c
r1281r1282
750750
751751/* Driver Initialization */
752752
753DRIVER_INIT( airbustr )
753static DRIVER_INIT( airbustr )
754754{
755755   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, devram_r); // protection device lives here
756756}
src/mame/drivers/clshroad.c
r1281r1282
4343
4444
4545
46MACHINE_RESET( clshroad )
46static MACHINE_RESET( clshroad )
4747{
4848   flip_screen_set(0);
4949}
r1281r1282
5151
5252/* Shared RAM with the sound CPU */
5353
54READ8_HANDLER ( clshroad_sharedram_r )   {   return clshroad_sharedram[offset];   }
55WRITE8_HANDLER( clshroad_sharedram_w )   {   clshroad_sharedram[offset] = data;   }
54static READ8_HANDLER ( clshroad_sharedram_r )   {   return clshroad_sharedram[offset];   }
55static WRITE8_HANDLER( clshroad_sharedram_w )   {   clshroad_sharedram[offset] = data;   }
5656
57READ8_HANDLER( clshroad_input_r )
57static READ8_HANDLER( clshroad_input_r )
5858{
5959   return   ((~readinputportbytag("IN0") & (1 << offset)) ? 1 : 0) |
6060         ((~readinputportbytag("IN1") & (1 << offset)) ? 2 : 0) |
src/mame/drivers/pacman.c
r1281r1282
364364 *
365365 *************************************/
366366
367MACHINE_RESET( mschamp )
367static MACHINE_RESET( mschamp )
368368{
369369   UINT8 *rom = memory_region(REGION_CPU1) + 0x10000;
370370   int whichbank = readinputportbytag("GAME") & 1;
src/mame/drivers/chqflag.c
r1281r1282
139139   return 0xff;
140140}
141141
142WRITE8_HANDLER( chqflag_sh_irqtrigger_w )
142static WRITE8_HANDLER( chqflag_sh_irqtrigger_w )
143143{
144144   cpunum_set_input_line(1,0,HOLD_LINE);
145145}
src/mame/drivers/bwing.c
r1281r1282
378378//****************************************************************************
379379// Hardware Definitions
380380
381MACHINE_RESET( bwing )
381static MACHINE_RESET( bwing )
382382{
383383   bwp3_nmimask = 0;
384384   fftail = ffhead = ffcount = 0;
src/mame/drivers/lsasquad.c
r1281r1282
185185
186186MACHINE_RESET(daikaiju);
187187
188WRITE8_HANDLER( lsasquad_bankswitch_w )
188static WRITE8_HANDLER( lsasquad_bankswitch_w )
189189{
190190   UINT8 *ROM = memory_region(REGION_CPU1);
191191
src/mame/drivers/konamim2.c
r1281r1282
107107static UINT32 irq_enable;
108108static UINT32 irq_active;
109109
110VIDEO_START( m2 )
110static VIDEO_START( m2 )
111111{
112112}
113113
114VIDEO_UPDATE( m2 )
114static VIDEO_UPDATE( m2 )
115115{
116116   int i, j;
117117
src/mame/drivers/cave.c
r1281r1282
308308static int cave_default_eeprom_length;
309309static int cave_region_byte;
310310
311READ16_HANDLER( cave_input1_r )
311static READ16_HANDLER( cave_input1_r )
312312{
313313   return readinputport(1) | ((EEPROM_read_bit() & 0x01) << 11);
314314}
315315
316READ16_HANDLER( guwange_input1_r )
316static READ16_HANDLER( guwange_input1_r )
317317{
318318   return readinputport(1) | ((EEPROM_read_bit() & 0x01) << 7);
319319}
320320
321READ16_HANDLER( gaia_dsw_r )
321static READ16_HANDLER( gaia_dsw_r )
322322{
323323   return readinputport(2) | (readinputport(3) << 8);
324324}
325325
326WRITE16_HANDLER( cave_eeprom_msb_w )
326static WRITE16_HANDLER( cave_eeprom_msb_w )
327327{
328328   if (data & ~0xfe00)
329329      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",activecpu_get_pc(),data);
r1281r1282
346346   }
347347}
348348
349WRITE16_HANDLER( sailormn_eeprom_msb_w )
349static WRITE16_HANDLER( sailormn_eeprom_msb_w )
350350{
351351   sailormn_tilebank_w    ( data &  0x0100 );
352352   cave_eeprom_msb_w(offset,data & ~0x0100,mem_mask);
353353}
354354
355WRITE16_HANDLER( hotdogst_eeprom_msb_w )
355static WRITE16_HANDLER( hotdogst_eeprom_msb_w )
356356{
357357   if ( ACCESSING_MSB )  // even address
358358   {
r1281r1282
367367   }
368368}
369369
370WRITE16_HANDLER( cave_eeprom_lsb_w )
370static WRITE16_HANDLER( cave_eeprom_lsb_w )
371371{
372372   if (data & ~0x00ef)
373373      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",activecpu_get_pc(),data);
r1281r1282
391391}
392392
393393/*  - No eeprom or lockouts */
394WRITE16_HANDLER( gaia_coin_lsb_w )
394static WRITE16_HANDLER( gaia_coin_lsb_w )
395395{
396396   if ( ACCESSING_LSB )  // odd address
397397   {
r1281r1282
402402
403403/*  - No coin lockouts
404404    - Writing 0xcf00 shouldn't send a 1 bit to the eeprom   */
405WRITE16_HANDLER( metmqstr_eeprom_msb_w )
405static WRITE16_HANDLER( metmqstr_eeprom_msb_w )
406406{
407407   if (data & ~0xff00)
408408      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",activecpu_get_pc(),data);
r1281r1282
426426   }
427427}
428428
429NVRAM_HANDLER( cave )
429static NVRAM_HANDLER( cave )
430430{
431431   if (read_or_write)
432432      EEPROM_save(file);
r1281r1282
457457//  "*10010xxxx"    // erase all    1 00 10xxxx
458458};
459459
460NVRAM_HANDLER( korokoro )
460static NVRAM_HANDLER( korokoro )
461461{
462462   if (read_or_write)
463463      EEPROM_save(file);
r1281r1282
570570                                    Donpachi
571571***************************************************************************/
572572
573READ16_HANDLER( donpachi_videoregs_r )
573static READ16_HANDLER( donpachi_videoregs_r )
574574{
575575   switch( offset )
576576   {
r1281r1282
818818#endif
819819}
820820
821WRITE16_HANDLER( korokoro_leds_w )
821static WRITE16_HANDLER( korokoro_leds_w )
822822{
823823   COMBINE_DATA( &leds[0] );
824824
r1281r1282
843843
844844static int hopper;
845845
846WRITE16_HANDLER( korokoro_eeprom_msb_w )
846static WRITE16_HANDLER( korokoro_eeprom_msb_w )
847847{
848848   if (data & ~0x7000)
849849   {
r1281r1282
867867   }
868868}
869869
870READ16_HANDLER( korokoro_input0_r )
870static READ16_HANDLER( korokoro_input0_r )
871871{
872872   return readinputport(0) | (hopper ? 0 : 0x8000);
873873}
874874
875READ16_HANDLER( korokoro_input1_r )
875static READ16_HANDLER( korokoro_input1_r )
876876{
877877   return readinputport(1) | ((EEPROM_read_bit() & 0x01) << 12);
878878}
r1281r1282
10001000                                Power Instinct 2
10011001***************************************************************************/
10021002
1003READ16_HANDLER( pwrinst2_eeprom_r )
1003static READ16_HANDLER( pwrinst2_eeprom_r )
10041004{
10051005   return ~8 + ((EEPROM_read_bit() & 1) ? 8 : 0);
10061006}
r1281r1282
10201020   }
10211021   COMBINE_DATA(&VCTRL[offset]);
10221022}
1023WRITE16_HANDLER( pwrinst2_vctrl_0_w )   { vctrl_w(cave_vctrl_0, offset, data, mem_mask); }
1024WRITE16_HANDLER( pwrinst2_vctrl_1_w )   { vctrl_w(cave_vctrl_1, offset, data, mem_mask); }
1025WRITE16_HANDLER( pwrinst2_vctrl_2_w )   { vctrl_w(cave_vctrl_2, offset, data, mem_mask); }
1026WRITE16_HANDLER( pwrinst2_vctrl_3_w )   { vctrl_w(cave_vctrl_3, offset, data, mem_mask); }
1023static WRITE16_HANDLER( pwrinst2_vctrl_0_w )   { vctrl_w(cave_vctrl_0, offset, data, mem_mask); }
1024static WRITE16_HANDLER( pwrinst2_vctrl_1_w )   { vctrl_w(cave_vctrl_1, offset, data, mem_mask); }
1025static WRITE16_HANDLER( pwrinst2_vctrl_2_w )   { vctrl_w(cave_vctrl_2, offset, data, mem_mask); }
1026static WRITE16_HANDLER( pwrinst2_vctrl_3_w )   { vctrl_w(cave_vctrl_3, offset, data, mem_mask); }
10271027
10281028static ADDRESS_MAP_START( pwrinst2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
10291029   AM_RANGE(0x000000, 0x1fffff) AM_READ(MRA16_ROM               )   // ROM
r1281r1282
11891189                                Hotdog Storm
11901190***************************************************************************/
11911191
1192WRITE8_HANDLER( hotdogst_rombank_w )
1192static WRITE8_HANDLER( hotdogst_rombank_w )
11931193{
11941194   UINT8 *RAM = memory_region(REGION_CPU2);
11951195   int bank = data & 0x0f;
r1281r1282
11981198   memory_set_bankptr(2, &RAM[ 0x4000 * bank ]);
11991199}
12001200
1201WRITE8_HANDLER( hotdogst_okibank_w )
1201static WRITE8_HANDLER( hotdogst_okibank_w )
12021202{
12031203   UINT8 *RAM = memory_region(REGION_SOUND1);
12041204   int bank1 = (data >> 0) & 0x3;
r1281r1282
12421242                                Mazinger Z
12431243***************************************************************************/
12441244
1245WRITE8_HANDLER( mazinger_rombank_w )
1245static WRITE8_HANDLER( mazinger_rombank_w )
12461246{
12471247   UINT8 *RAM = memory_region(REGION_CPU2);
12481248   int bank = data & 0x07;
r1281r1282
12861286                                Metamoqester
12871287***************************************************************************/
12881288
1289WRITE8_HANDLER( metmqstr_rombank_w )
1289static WRITE8_HANDLER( metmqstr_rombank_w )
12901290{
12911291   UINT8 *ROM = memory_region(REGION_CPU2);
12921292   int bank = data & 0xf;
r1281r1282
12951295   memory_set_bankptr(1, &ROM[ 0x4000 * bank ]);
12961296}
12971297
1298WRITE8_HANDLER( metmqstr_okibank0_w )
1298static WRITE8_HANDLER( metmqstr_okibank0_w )
12991299{
13001300   UINT8 *ROM = memory_region(REGION_SOUND1);
13011301   int bank1 = (data >> 0) & 0x7;
r1281r1282
13041304   memcpy(ROM + 0x20000 * 1, ROM + 0x40000 + 0x20000 * bank2, 0x20000);
13051305}
13061306
1307WRITE8_HANDLER( metmqstr_okibank1_w )
1307static WRITE8_HANDLER( metmqstr_okibank1_w )
13081308{
13091309   UINT8 *ROM = memory_region(REGION_SOUND2);
13101310   int bank1 = (data >> 0) & 0x7;
r1281r1282
13491349                                Power Instinct 2
13501350***************************************************************************/
13511351
1352WRITE8_HANDLER( pwrinst2_rombank_w )
1352static WRITE8_HANDLER( pwrinst2_rombank_w )
13531353{
13541354   UINT8 *ROM = memory_region(REGION_CPU2);
13551355   int bank = data & 0x07;
r1281r1282
14071407   mirror_ram[offset] = data;
14081408}
14091409
1410WRITE8_HANDLER( sailormn_rombank_w )
1410static WRITE8_HANDLER( sailormn_rombank_w )
14111411{
14121412   UINT8 *RAM = memory_region(REGION_CPU2);
14131413   int bank = data & 0x1f;
r1281r1282
14161416   memory_set_bankptr(1, &RAM[ 0x4000 * bank ]);
14171417}
14181418
1419WRITE8_HANDLER( sailormn_okibank0_w )
1419static WRITE8_HANDLER( sailormn_okibank0_w )
14201420{
14211421   UINT8 *RAM = memory_region(REGION_SOUND1);
14221422   int bank1 = (data >> 0) & 0xf;
r1281r1282
14251425   memcpy(RAM + 0x20000 * 1, RAM + 0x40000 + 0x20000 * bank2, 0x20000);
14261426}
14271427
1428WRITE8_HANDLER( sailormn_okibank1_w )
1428static WRITE8_HANDLER( sailormn_okibank1_w )
14291429{
14301430   UINT8 *RAM = memory_region(REGION_SOUND2);
14311431   int bank1 = (data >> 0) & 0xf;
r1281r1282
20882088
20892089***************************************************************************/
20902090
2091MACHINE_RESET( cave )
2091static MACHINE_RESET( cave )
20922092{
20932093   soundbuf.len = 0;
20942094
r1281r1282
42074207   irq_level = 1;
42084208}
42094209
4210DRIVER_INIT( agallet )
4210static DRIVER_INIT( agallet )
42114211{
42124212   init_cave(machine);
42134213
r1281r1282
42234223   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r);
42244224}
42254225
4226DRIVER_INIT( dfeveron )
4226static DRIVER_INIT( dfeveron )
42274227{
42284228   init_cave(machine);
42294229
r1281r1282
42354235   cave_kludge = 2;
42364236}
42374237
4238DRIVER_INIT( feversos )
4238static DRIVER_INIT( feversos )
42394239{
42404240   init_cave(machine);
42414241
r1281r1282
42474247   cave_kludge = 2;
42484248}
42494249
4250DRIVER_INIT( ddonpach )
4250static DRIVER_INIT( ddonpach )
42514251{
42524252   init_cave(machine);
42534253
r1281r1282
42604260   time_vblank_irq = 90;
42614261}
42624262
4263DRIVER_INIT( donpachi )
4263static DRIVER_INIT( donpachi )
42644264{
42654265   init_cave(machine);
42664266
r1281r1282
42754275   NMK112_set_paged_table(0, 0);   // chip #0 (music) is not paged
42764276}
42774277
4278DRIVER_INIT( esprade )
4278static DRIVER_INIT( esprade )
42794279{
42804280   init_cave(machine);
42814281
r1281r1282
42944294#endif
42954295}
42964296
4297DRIVER_INIT( gaia )
4297static DRIVER_INIT( gaia )
42984298{
42994299   init_cave(machine);
43004300
r1281r1282
43054305   time_vblank_irq = 2000;   /**/
43064306}
43074307
4308DRIVER_INIT( guwange )
4308static DRIVER_INIT( guwange )
43094309{
43104310   init_cave(machine);
43114311
r1281r1282
43174317   time_vblank_irq = 2000;   /**/
43184318}
43194319
4320DRIVER_INIT( hotdogst )
4320static DRIVER_INIT( hotdogst )
43214321{
43224322   init_cave(machine);
43234323
r1281r1282
43304330   time_vblank_irq = 2000;   /**/
43314331}
43324332
4333DRIVER_INIT( mazinger )
4333static DRIVER_INIT( mazinger )
43344334{
43354335   UINT8 *buffer;
43364336   UINT8 *src = memory_region(REGION_GFX1);
r1281r1282
43624362}
43634363
43644364
4365DRIVER_INIT( metmqstr )
4365static DRIVER_INIT( metmqstr )
43664366{
43674367   init_cave(machine);
43684368
r1281r1282
43734373}
43744374
43754375
4376DRIVER_INIT( pwrins2j )
4376static DRIVER_INIT( pwrins2j )
43774377{
43784378   UINT8 *buffer;
43794379   UINT8 *src = memory_region(REGION_GFX1);
r1281r1282
44034403
44044404}
44054405
4406DRIVER_INIT( pwrinst2 )
4406static DRIVER_INIT( pwrinst2 )
44074407{
44084408   /* this patch fixes on of the moves, why is it needed? is the rom bad or is there another
44094409       problem? does the Japan set need it or not? */
r1281r1282
44194419}
44204420
44214421
4422DRIVER_INIT( sailormn )
4422static DRIVER_INIT( sailormn )
44234423{
44244424   UINT8 *buffer;
44254425   UINT8 *src = memory_region(REGION_GFX1);
r1281r1282
44494449   time_vblank_irq = 2000;
44504450}
44514451
4452DRIVER_INIT( uopoko )
4452static DRIVER_INIT( uopoko )
44534453{
44544454   init_cave(machine);
44554455
r1281r1282
44624462   time_vblank_irq = 2000;   /**/
44634463}
44644464
4465DRIVER_INIT( korokoro )
4465static DRIVER_INIT( korokoro )
44664466{
44674467   init_cave(machine);
44684468
src/mame/drivers/brkthru.c
r1281r1282
6565
6666static int nmi_enable;
6767
68WRITE8_HANDLER( brkthru_1803_w )
68static WRITE8_HANDLER( brkthru_1803_w )
6969{
7070   /* bit 0 = NMI enable */
7171   nmi_enable = ~data & 1;
7272
7373   /* bit 1 = ? maybe IRQ acknowledge */
7474}
75WRITE8_HANDLER( darwin_0803_w )
75static WRITE8_HANDLER( darwin_0803_w )
7676{
7777   /* bit 0 = NMI enable */
7878   /*nmi_enable = ~data & 1;*/
r1281r1282
8181   /* bit 1 = ? maybe IRQ acknowledge */
8282}
8383
84WRITE8_HANDLER( brkthru_soundlatch_w )
84static WRITE8_HANDLER( brkthru_soundlatch_w )
8585{
8686   soundlatch_w(offset,data);
8787   cpunum_set_input_line(1,INPUT_LINE_NMI,PULSE_LINE);
src/mame/drivers/comebaby.c
r1281r1282
5858
5959#include "driver.h"
6060
61VIDEO_START(comebaby)
61static VIDEO_START(comebaby)
6262{
6363}
6464
65VIDEO_UPDATE(comebaby)
65static VIDEO_UPDATE(comebaby)
6666{
6767   return 0;
6868}
src/mame/drivers/dec8.c
r1281r1282
409409   flip_screen_set(data & 0x08);
410410}
411411
412WRITE8_HANDLER( csilver_control_w )
412static WRITE8_HANDLER( csilver_control_w )
413413{
414414   UINT8 *RAM = memory_region(REGION_CPU1);
415415
src/mame/drivers/rcorsair.c
r1281r1282
104104   GFXDECODE_ENTRY( REGION_GFX1, 0, tiles8x8_layout, 0, 16 )
105105GFXDECODE_END
106106
107VIDEO_START( rcorsair )
107static VIDEO_START( rcorsair )
108108{
109109}
110110
111VIDEO_UPDATE( rcorsair )
111static VIDEO_UPDATE( rcorsair )
112112{
113113
114114   return 0;
src/mame/drivers/mnight.c
r1281r1282
2929
3030static int mnight_bank_latch = 255, main_cpu_num;
3131
32MACHINE_RESET( mnight )
32static MACHINE_RESET( mnight )
3333{
3434   main_cpu_num = 0;
3535}
r1281r1282
3939   cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0xd7);   /* RST 10h */
4040}
4141
42READ8_HANDLER( mnight_bankselect_r )
42static READ8_HANDLER( mnight_bankselect_r )
4343{
4444   return mnight_bank_latch;
4545}
4646
47WRITE8_HANDLER( mnight_bankselect_w )
47static WRITE8_HANDLER( mnight_bankselect_w )
4848{
4949   UINT8 *RAM = memory_region(REGION_CPU1+main_cpu_num);
5050   int bankaddress;
src/mame/drivers/battlane.c
r1281r1282
3232/* CPU interrupt control register */
3333int battlane_cpu_control;
3434
35WRITE8_HANDLER( battlane_cpu_command_w )
35static WRITE8_HANDLER( battlane_cpu_command_w )
3636{
3737   battlane_cpu_control = data;
3838
src/mame/drivers/cherrym2.c
r1281r1282
5151   SET_TILE_INFO(0, code, color, 0);
5252}
5353
54VIDEO_START(cm2)
54static VIDEO_START(cm2)
5555{
5656   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
5757      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
5858}
5959
60VIDEO_UPDATE(cm2)
60static VIDEO_UPDATE(cm2)
6161{
6262  tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
6363   return 0;
src/mame/drivers/rbmk.c
r1281r1282
447447   GFXDECODE_ENTRY( REGION_GFX2, 0, rbmk8_layout,   0x100, 16  )
448448GFXDECODE_END
449449
450VIDEO_START(rbmk)
450static VIDEO_START(rbmk)
451451{
452452}
453453
454VIDEO_UPDATE(rbmk)
454static VIDEO_UPDATE(rbmk)
455455{
456456   int x,y;
457457   int count = 0;
r1281r1282
480480   return 0;
481481}
482482
483NVRAM_HANDLER( syf )
483static NVRAM_HANDLER( syf )
484484{
485485   if (read_or_write)
486486      EEPROM_save(file);
src/mame/drivers/thepit.c
r1281r1282
10351035   return 0; // the value read from the configuration reads is discarded
10361036}
10371037
1038DRIVER_INIT( rtriv )
1038static DRIVER_INIT( rtriv )
10391039{
10401040   // Set-up the weirdest questions read ever done
10411041   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4fff, 0, 0, rtriv_question_r);
src/mame/drivers/trvmadns.c
r1281r1282
261261   SET_TILE_INFO(0,tile,color,flag);
262262}
263263
264VIDEO_START( trvmadns )
264static VIDEO_START( trvmadns )
265265{
266266   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
267267
268268   tilemap_set_transparent_pen(bg_tilemap,1);
269269}
270270
271VIDEO_UPDATE( trvmadns )
271static VIDEO_UPDATE( trvmadns )
272272{
273273   fillbitmap(bitmap,machine->pens[0xd],cliprect);
274274
src/mame/drivers/rpunch.c
r1281r1282
150150}
151151
152152
153MACHINE_RESET( rpunch )
153static MACHINE_RESET( rpunch )
154154{
155155   memcpy(memory_region(REGION_SOUND1), memory_region(REGION_SOUND1) + 0x20000, 0x20000);
156156}
src/mame/drivers/changela.c
r1281r1282
4242UINT8 changela_collision_reset;
4343UINT8 changela_tree_collision_reset;
4444
45MACHINE_RESET (changela)
45static MACHINE_RESET (changela)
4646{
4747   mcu_PC1=0;
4848   mcu_PC0=0;
r1281r1282
7676
7777
7878
79READ8_HANDLER( changela_68705_portA_r )
79static READ8_HANDLER( changela_68705_portA_r )
8080{
8181   return (portA_out & ddrA) | (portA_in & ~ddrA);
8282}
8383
84WRITE8_HANDLER( changela_68705_portA_w )
84static WRITE8_HANDLER( changela_68705_portA_w )
8585{
8686   portA_out = data;
8787}
8888
89WRITE8_HANDLER( changela_68705_ddrA_w )
89static WRITE8_HANDLER( changela_68705_ddrA_w )
9090{
9191   ddrA = data;
9292}
9393
9494
95READ8_HANDLER( changela_68705_portB_r )
95static READ8_HANDLER( changela_68705_portB_r )
9696{
9797   return (portB_out & ddrB) | (readinputport(4) & ~ddrB);
9898}
9999
100WRITE8_HANDLER( changela_68705_portB_w )
100static WRITE8_HANDLER( changela_68705_portB_w )
101101{
102102   portB_out = data;
103103}
104104
105WRITE8_HANDLER( changela_68705_ddrB_w )
105static WRITE8_HANDLER( changela_68705_ddrB_w )
106106{
107107   ddrB = data;
108108}
109109
110110
111READ8_HANDLER( changela_68705_portC_r )
111static READ8_HANDLER( changela_68705_portC_r )
112112{
113113   return (portC_out & ddrC) | (portC_in & ~ddrC);
114114}
115115
116WRITE8_HANDLER( changela_68705_portC_w )
116static WRITE8_HANDLER( changela_68705_portC_w )
117117{
118118   /* PC3 is connected to the CLOCK input of the LS374,
119119        so we latch the data on positive going edge of the clock */
r1281r1282
131131   portC_out = data;
132132}
133133
134WRITE8_HANDLER( changela_68705_ddrC_w )
134static WRITE8_HANDLER( changela_68705_ddrC_w )
135135{
136136   ddrC = data;
137137}
src/mame/drivers/rabbit.c
r1281r1282
169169   get_rabbit_tilemap_info(machine,tileinfo,tile_index,3,0);
170170}
171171
172WRITE32_HANDLER( rabbit_tilemap0_w )
172static WRITE32_HANDLER( rabbit_tilemap0_w )
173173{
174174   COMBINE_DATA(&rabbit_tilemap_ram[0][offset]);
175175   tilemap_mark_tile_dirty(rabbit_tilemap[0],offset);
176176}
177177
178WRITE32_HANDLER( rabbit_tilemap1_w )
178static WRITE32_HANDLER( rabbit_tilemap1_w )
179179{
180180   COMBINE_DATA(&rabbit_tilemap_ram[1][offset]);
181181   tilemap_mark_tile_dirty(rabbit_tilemap[1],offset);
182182}
183183
184WRITE32_HANDLER( rabbit_tilemap2_w )
184static WRITE32_HANDLER( rabbit_tilemap2_w )
185185{
186186   COMBINE_DATA(&rabbit_tilemap_ram[2][offset]);
187187   tilemap_mark_tile_dirty(rabbit_tilemap[2],offset);
188188}
189189
190190
191WRITE32_HANDLER( rabbit_tilemap3_w )
191static WRITE32_HANDLER( rabbit_tilemap3_w )
192192{
193193   COMBINE_DATA(&rabbit_tilemap_ram[3][offset]);
194194   tilemap_mark_tile_dirty(rabbit_tilemap[3],offset);
r1281r1282
332332
333333
334334}
335VIDEO_START(rabbit)
335static VIDEO_START(rabbit)
336336{
337337   /* the tilemaps are bigger than the regions the cpu can see, need to allocate the ram here */
338338   /* or maybe not for this game/hw .... */
r1281r1282
405405         tran ? 0 : TILEMAP_DRAW_OPAQUE,0);
406406}
407407
408VIDEO_UPDATE(rabbit)
408static VIDEO_UPDATE(rabbit)
409409{
410410   int prilevel;
411411
r1281r1282
443443}
444444
445445
446READ32_HANDLER( rabbit_input_r )
446static READ32_HANDLER( rabbit_input_r )
447447{
448448   int rv;
449449
r1281r1282
453453   return rv;
454454}
455455
456READ32_HANDLER( tmmjprd_input_r )
456static READ32_HANDLER( tmmjprd_input_r )
457457{
458458   int rv;
459459
r1281r1282
475475   palette_set_color(Machine,offset^0xff,MAKE_RGB(r,g,b));
476476}
477477
478READ32_HANDLER( rabbit_tilemap0_r )
478static READ32_HANDLER( rabbit_tilemap0_r )
479479{
480480   return rabbit_tilemap_ram[0][offset];
481481}
482482
483READ32_HANDLER( rabbit_tilemap1_r )
483static READ32_HANDLER( rabbit_tilemap1_r )
484484{
485485   return rabbit_tilemap_ram[1][offset];
486486}
487487
488READ32_HANDLER( rabbit_tilemap2_r )
488static READ32_HANDLER( rabbit_tilemap2_r )
489489{
490490   return rabbit_tilemap_ram[2][offset];
491491}
492492
493READ32_HANDLER( rabbit_tilemap3_r )
493static READ32_HANDLER( rabbit_tilemap3_r )
494494{
495495   return rabbit_tilemap_ram[3][offset];
496496}
r1281r1282
518518ADDRESS_MAP_END
519519
520520/* rom bank is used when testing roms, not currently hooked up */
521WRITE32_HANDLER ( rabbit_rombank_w )
521static WRITE32_HANDLER ( rabbit_rombank_w )
522522{
523523   UINT8 *dataroms = memory_region(REGION_USER1);
524524   int bank;
r1281r1282
707707
708708
709709
710WRITE32_HANDLER( rabbit_blitter_w )
710static WRITE32_HANDLER( rabbit_blitter_w )
711711{
712712   COMBINE_DATA(&rabbit_blitterregs[offset]);
713713
r1281r1282
717717   }
718718}
719719
720WRITE32_HANDLER( rabbit_eeprom_write )
720static WRITE32_HANDLER( rabbit_eeprom_write )
721721{
722722   // don't disturb the EEPROM if we're not actually writing to it
723723   // (in particular, data & 0x100 here with mask = ffff00ff looks to be the watchdog)
r1281r1282
11201120   get_rabbit_tilemap_info(machine,tileinfo,tile_index,3,0);
11211121}
11221122
1123VIDEO_START(tmmjprd)
1123static VIDEO_START(tmmjprd)
11241124{
11251125   /* NOTE tilemap sizes are different.. game can also select between 16x16 and 8x8.. it NEEDS this to work */
11261126
r1281r1282
11511151}
11521152
11531153
1154VIDEO_UPDATE( tmmjprd )
1154static VIDEO_UPDATE( tmmjprd )
11551155{
11561156   tilemap_set_scrolly(rabbit_tilemap[3], 0, rabbit_tilemap_regs[3][2] >> 20);
11571157   tilemap_set_scrolly(rabbit_tilemap[2], 0, rabbit_tilemap_regs[2][2] >> 20);
r1281r1282
12031203MACHINE_DRIVER_END
12041204
12051205
1206DRIVER_INIT(rabbit)
1206static DRIVER_INIT(rabbit)
12071207{
12081208   rabbit_banking = 1;
12091209   rabbit_vblirqlevel = 6;
r1281r1282
12111211   /* 5 and 1 are also valid and might be raster related */
12121212}
12131213
1214DRIVER_INIT(tmmjprd)
1214static DRIVER_INIT(tmmjprd)
12151215{
12161216   rabbit_banking = 0;
12171217   rabbit_vblirqlevel = 5;
src/mame/drivers/asuka.c
r1281r1282
840840                 MACHINE DRIVERS
841841***********************************************************/
842842
843VIDEO_EOF( asuka )
843static VIDEO_EOF( asuka )
844844{
845845   PC090OJ_eof_callback();
846846}
src/mame/drivers/triplhnt.c
r1281r1282
9090}
9191
9292
93WRITE8_HANDLER( triplhnt_misc_w )
93static WRITE8_HANDLER( triplhnt_misc_w )
9494{
9595   triplhnt_update_misc(offset);
9696}
9797
9898
99READ8_HANDLER( triplhnt_cmos_r )
99static READ8_HANDLER( triplhnt_cmos_r )
100100{
101101   triplhnt_cmos_latch = offset;
102102
r1281r1282
104104}
105105
106106
107READ8_HANDLER( triplhnt_input_port_4_r )
107static READ8_HANDLER( triplhnt_input_port_4_r )
108108{
109109   watchdog_reset_w(0, 0);
110110
r1281r1282
112112}
113113
114114
115READ8_HANDLER( triplhnt_misc_r )
115static READ8_HANDLER( triplhnt_misc_r )
116116{
117117   triplhnt_update_misc(offset);
118118
r1281r1282
120120}
121121
122122
123READ8_HANDLER( triplhnt_da_latch_r )
123static READ8_HANDLER( triplhnt_da_latch_r )
124124{
125125   int cross_x = readinputport(8);
126126   int cross_y = readinputport(9);
src/mame/drivers/backfire.c
r1281r1282
4747
4848
4949
50VIDEO_START(backfire)
50static VIDEO_START(backfire)
5151{
5252   /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */
5353   deco16_pf1_data = auto_malloc(0x2000);
r1281r1282
169169
170170
171171
172VIDEO_UPDATE(backfire)
172static VIDEO_UPDATE(backfire)
173173{
174174   /* screen 1 uses pf1 as the forground and pf3 as the background */
175175   /* screen 2 uses pf2 as the foreground and pf4 as the background */
r1281r1282
282282
283283/* map 32-bit writes to 16-bit */
284284
285READ32_HANDLER( backfire_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
286READ32_HANDLER( backfire_pf2_rowscroll_r ) { return deco16_pf2_rowscroll[offset]^0xffff0000; }
287READ32_HANDLER( backfire_pf3_rowscroll_r ) { return deco16_pf3_rowscroll[offset]^0xffff0000; }
288READ32_HANDLER( backfire_pf4_rowscroll_r ) { return deco16_pf4_rowscroll[offset]^0xffff0000; }
289WRITE32_HANDLER( backfire_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf1_rowscroll[offset]); }
290WRITE32_HANDLER( backfire_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf2_rowscroll[offset]); }
291WRITE32_HANDLER( backfire_pf3_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf3_rowscroll[offset]); }
292WRITE32_HANDLER( backfire_pf4_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf4_rowscroll[offset]); }
293READ32_HANDLER ( backfire_pf12_control_r ) { return deco16_pf12_control[offset]^0xffff0000; }
294READ32_HANDLER ( backfire_pf34_control_r ) { return deco16_pf34_control[offset]^0xffff0000; }
295WRITE32_HANDLER( backfire_pf12_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf12_control[offset]); }
296WRITE32_HANDLER( backfire_pf34_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf34_control[offset]); }
297READ32_HANDLER( backfire_pf1_data_r ) {   return deco16_pf1_data[offset]^0xffff0000; }
298READ32_HANDLER( backfire_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
299READ32_HANDLER( backfire_pf3_data_r ) {   return deco16_pf3_data[offset]^0xffff0000; }
300READ32_HANDLER( backfire_pf4_data_r ) {   return deco16_pf4_data[offset]^0xffff0000; }
301WRITE32_HANDLER( backfire_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
302WRITE32_HANDLER( backfire_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
303WRITE32_HANDLER( backfire_pf3_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf3_data_w(offset,data,mem_mask); }
304WRITE32_HANDLER( backfire_pf4_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf4_data_w(offset,data,mem_mask); }
285static READ32_HANDLER( backfire_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
286static READ32_HANDLER( backfire_pf2_rowscroll_r ) { return deco16_pf2_rowscroll[offset]^0xffff0000; }
287static READ32_HANDLER( backfire_pf3_rowscroll_r ) { return deco16_pf3_rowscroll[offset]^0xffff0000; }
288static READ32_HANDLER( backfire_pf4_rowscroll_r ) { return deco16_pf4_rowscroll[offset]^0xffff0000; }
289static WRITE32_HANDLER( backfire_pf1_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf1_rowscroll[offset]); }
290static WRITE32_HANDLER( backfire_pf2_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf2_rowscroll[offset]); }
291static WRITE32_HANDLER( backfire_pf3_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf3_rowscroll[offset]); }
292static WRITE32_HANDLER( backfire_pf4_rowscroll_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf4_rowscroll[offset]); }
293static READ32_HANDLER ( backfire_pf12_control_r ) { return deco16_pf12_control[offset]^0xffff0000; }
294static READ32_HANDLER ( backfire_pf34_control_r ) { return deco16_pf34_control[offset]^0xffff0000; }
295static WRITE32_HANDLER( backfire_pf12_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf12_control[offset]); }
296static WRITE32_HANDLER( backfire_pf34_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf34_control[offset]); }
297static READ32_HANDLER( backfire_pf1_data_r ) {   return deco16_pf1_data[offset]^0xffff0000; }
298static READ32_HANDLER( backfire_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
299static READ32_HANDLER( backfire_pf3_data_r ) {   return deco16_pf3_data[offset]^0xffff0000; }
300static READ32_HANDLER( backfire_pf4_data_r ) {   return deco16_pf4_data[offset]^0xffff0000; }
301static WRITE32_HANDLER( backfire_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
302static WRITE32_HANDLER( backfire_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
303static WRITE32_HANDLER( backfire_pf3_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf3_data_w(offset,data,mem_mask); }
304static WRITE32_HANDLER( backfire_pf4_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf4_data_w(offset,data,mem_mask); }
305305
306#ifdef UNUSED_FUNCTION
306307READ32_HANDLER( backfire_unknown_wheel_r )
307308{
308309   return readinputport(4);
r1281r1282
317318{
318319   return mame_rand(Machine);
319320}
321#endif
320322
321323
322324static ADDRESS_MAP_START( backfire_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/starwars.c
r1281r1282
4949 *
5050 *************************************/
5151
52MACHINE_RESET( starwars )
52static MACHINE_RESET( starwars )
5353{
5454   /* ESB-specific */
5555   if (starwars_is_esb)
r1281r1282
8888 *
8989 *************************************/
9090
91READ8_HANDLER( esb_slapstic_r )
91static READ8_HANDLER( esb_slapstic_r )
9292{
9393   int result = slapstic_base[offset];
9494   int new_bank = slapstic_tweak(offset);
r1281r1282
103103}
104104
105105
106WRITE8_HANDLER( esb_slapstic_w )
106static WRITE8_HANDLER( esb_slapstic_w )
107107{
108108   int new_bank = slapstic_tweak(offset);
109109
src/mame/drivers/tankbatt.c
r1281r1282
7171extern VIDEO_START( tankbatt );
7272extern VIDEO_UPDATE( tankbatt );
7373
74WRITE8_HANDLER( tankbatt_led_w )
74static WRITE8_HANDLER( tankbatt_led_w )
7575{
7676   set_led_status(offset,data & 1);
7777}
7878
79READ8_HANDLER( tankbatt_in0_r )
79static READ8_HANDLER( tankbatt_in0_r )
8080{
8181   int val;
8282
r1281r1282
8484   return ((val << (7-offset)) & 0x80);
8585}
8686
87READ8_HANDLER( tankbatt_in1_r )
87static READ8_HANDLER( tankbatt_in1_r )
8888{
8989   int val;
9090
r1281r1282
9292   return ((val << (7-offset)) & 0x80);
9393}
9494
95READ8_HANDLER( tankbatt_dsw_r )
95static READ8_HANDLER( tankbatt_dsw_r )
9696{
9797   int val;
9898
r1281r1282
100100   return ((val << (7-offset)) & 0x80);
101101}
102102
103WRITE8_HANDLER( tankbatt_interrupt_enable_w )
103static WRITE8_HANDLER( tankbatt_interrupt_enable_w )
104104{
105105   tankbatt_nmi_enable = !data;
106106   tankbatt_sound_enable = !data;
r1281r1282
114114//  interrupt_enable_w (offset, !data);
115115}
116116
117WRITE8_HANDLER( tankbatt_demo_interrupt_enable_w )
117static WRITE8_HANDLER( tankbatt_demo_interrupt_enable_w )
118118{
119119   tankbatt_nmi_enable = data;
120120   if (data != 0)
r1281r1282
125125//  interrupt_enable_w (offset, data);
126126}
127127
128WRITE8_HANDLER( tankbatt_sh_expl_w )
128static WRITE8_HANDLER( tankbatt_sh_expl_w )
129129{
130130   if (tankbatt_sound_enable)
131131      sample_start (1, 3, 0);
132132}
133133
134WRITE8_HANDLER( tankbatt_sh_engine_w )
134static WRITE8_HANDLER( tankbatt_sh_engine_w )
135135{
136136   if (tankbatt_sound_enable)
137137   {
r1281r1282
143143   else sample_stop (2);
144144}
145145
146WRITE8_HANDLER( tankbatt_sh_fire_w )
146static WRITE8_HANDLER( tankbatt_sh_fire_w )
147147{
148148   if (tankbatt_sound_enable)
149149      sample_start (0, 0, 0);
src/mame/drivers/cherrym.c
r1281r1282
1414
1515static tilemap *bg_tilemap;
1616
17PALETTE_INIT( cm )
17static PALETTE_INIT( cm )
1818{
1919   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
2020   int i;
r1281r1282
9696}
9797#endif
9898
99VIDEO_START(cm)
99static VIDEO_START(cm)
100100{
101101   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
102102      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
103103}
104104
105VIDEO_UPDATE(cm)
105static VIDEO_UPDATE(cm)
106106{
107107   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
108108//  draw_sprites(machine, bitmap, cliprect);
src/mame/drivers/segas18.c
r1281r1282
196196}
197197
198198
199MACHINE_RESET( system18 )
199static MACHINE_RESET( system18 )
200200{
201201   segaic16_memory_mapper_reset();
202202   segaic16_tilemap_reset(0);
src/mame/drivers/meijinsn.c
r1281r1282
212212   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
213213INPUT_PORTS_END
214214
215VIDEO_START(meijinsn)
215static VIDEO_START(meijinsn)
216216{
217217}
218218
219PALETTE_INIT( meijinsn )
219static PALETTE_INIT( meijinsn )
220220{
221221   int i;
222222   static const int resistances_b[2]  = { 470, 220 };
r1281r1282
255255}
256256
257257
258VIDEO_UPDATE(meijinsn)
258static VIDEO_UPDATE(meijinsn)
259259{
260260   int offs;
261261
r1281r1282
293293   soundlatch_r
294294};
295295
296MACHINE_RESET( meijinsn )
296static MACHINE_RESET( meijinsn )
297297{
298298   deposits1 = 0;
299299   deposits2 = 0;
src/mame/drivers/ltcasino.c
r1281r1282
3434   SET_TILE_INFO(0,tileno,0,0);
3535}
3636
37VIDEO_START(ltcasino)
37static VIDEO_START(ltcasino)
3838{
3939   ltcasino_tilemap = tilemap_create(get_ltcasino_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
4040}
4141
4242
43WRITE8_HANDLER( ltcasino_tile_num_w )
43static WRITE8_HANDLER( ltcasino_tile_num_w )
4444{
4545   ltcasino_tile_num_ram[offset] = data;
4646   tilemap_mark_tile_dirty(ltcasino_tilemap,offset);
4747}
4848
49WRITE8_HANDLER( ltcasino_tile_atr_w )
49static WRITE8_HANDLER( ltcasino_tile_atr_w )
5050{
5151   ltcasino_tile_atr_ram[offset] = data;
5252   tilemap_mark_tile_dirty(ltcasino_tilemap,offset);
r1281r1282
638638GFXDECODE_END
639639
640640
641VIDEO_UPDATE(ltcasino)
641static VIDEO_UPDATE(ltcasino)
642642{
643643   tilemap_draw(bitmap,cliprect,ltcasino_tilemap,0,0);
644644   return 0;
src/mame/drivers/crospang.c
r1281r1282
662662   }
663663}
664664
665DRIVER_INIT( crospang )
665static DRIVER_INIT( crospang )
666666{
667667   tumblepb_gfx1_rearrange();
668668}
src/mame/drivers/coolridr.c
r1281r1282
7474
7575/* video */
7676
77VIDEO_START(coolridr)
77static VIDEO_START(coolridr)
7878{
7979}
8080
81VIDEO_UPDATE(coolridr)
81static VIDEO_UPDATE(coolridr)
8282{
8383   return 0;
8484}
r1281r1282
171171   }
172172}
173173
174MACHINE_RESET ( coolridr )
174static MACHINE_RESET ( coolridr )
175175{
176176
177177//  cpunum_set_input_line(0, INPUT_LINE_HALT, ASSERT_LINE);
src/mame/drivers/exctsccr.c
r1281r1282
5050extern WRITE8_HANDLER( exctscc2_mcu_control_w );
5151
5252
53WRITE8_HANDLER( exctsccr_DAC_data_w )
53static WRITE8_HANDLER( exctsccr_DAC_data_w )
5454{
5555   DAC_signed_data_w(offset,data << 2);
5656}
r1281r1282
590590
591591/* The games need a different MCU control */
592592
593DRIVER_INIT( exctsccr )
593static DRIVER_INIT( exctsccr )
594594{
595595#if MCU_HACK
596596   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa006, 0xa006, 0, 0, exctsccr_mcu_control_w);
r1281r1282
599599#endif
600600}
601601
602DRIVER_INIT( exctscc2 )
602static DRIVER_INIT( exctscc2 )
603603{
604604#if MCU_HACK
605605   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa006, 0xa006, 0, 0, exctscc2_mcu_control_w);
src/mame/drivers/mquake.c
r1281r1282
431431 *
432432 *************************************/
433433
434DRIVER_INIT(mquake)
434static DRIVER_INIT(mquake)
435435{
436436   static const amiga_machine_interface mquake_intf =
437437   {
src/mame/drivers/funybubl.c
r1281r1282
7777
7878
7979
80WRITE8_HANDLER( funybubl_soundcommand_w )
80static WRITE8_HANDLER( funybubl_soundcommand_w )
8181{
8282   soundlatch_w(0,data);
8383   cpunum_set_input_line(1,0, HOLD_LINE);
8484}
8585
86WRITE8_HANDLER( funybubl_oki_bank_sw )
86static WRITE8_HANDLER( funybubl_oki_bank_sw )
8787{
8888   OKIM6295_set_bank_base(0, ((data & 1) * 0x40000));
8989}
r1281r1282
233233
234234
235235
236DRIVER_INIT( funybubl )
236static DRIVER_INIT( funybubl )
237237{
238238   funybubl_banked_videoram = auto_malloc (0x2000);
239239
src/mame/drivers/nmk16.c
r1281r1282
193193   machine_reset_seibu_sound_1(machine);
194194}
195195
196WRITE16_HANDLER ( ssmissin_sound_w )
196static WRITE16_HANDLER ( ssmissin_sound_w )
197197{
198198   if (ACCESSING_LSB)
199199   {
r1281r1282
204204
205205
206206
207WRITE8_HANDLER ( ssmissin_soundbank_w )
207static WRITE8_HANDLER ( ssmissin_soundbank_w )
208208{
209209   UINT8 *rom = memory_region(REGION_SOUND1);
210210   int bank;
r1281r1282
51425142}
51435143
51445144/* NO NMK004, it has a PIC instead */
5145READ16_HANDLER( vandykeb_r ) { return 0x0000; };
5145static READ16_HANDLER( vandykeb_r ) { return 0x0000; };
51465146static DRIVER_INIT (vandykeb)
51475147{
51485148   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08000e, 0x08000f, 0, 0, vandykeb_r );
src/mame/drivers/miniboy7.c
r1281r1282
134134
135135static tilemap *bg_tilemap;
136136
137WRITE8_HANDLER( miniboy7_videoram_w )
137static WRITE8_HANDLER( miniboy7_videoram_w )
138138{
139139   videoram[offset] = data;
140140   tilemap_mark_tile_dirty(bg_tilemap, offset);
141141}
142142
143WRITE8_HANDLER( miniboy7_colorram_w )
143static WRITE8_HANDLER( miniboy7_colorram_w )
144144{
145145   colorram[offset] = data;
146146   tilemap_mark_tile_dirty(bg_tilemap, offset);
r1281r1282
165165   SET_TILE_INFO(bank, code, color, 0);
166166}
167167
168VIDEO_START( miniboy7 )
168static VIDEO_START( miniboy7 )
169169{
170170   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
171171      TILEMAP_TYPE_PEN, 8, 8, 37, 37);
172172}
173173
174VIDEO_UPDATE( miniboy7 )
174static VIDEO_UPDATE( miniboy7 )
175175{
176176   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
177177   return 0;
src/osd/windows/verinfo.c
r1281r1282
234234   v.product_name = "MESS";
235235   begin_year = 1998;
236236#elif defined(WINUI)
237   // MAME32
238   v.author = "Christopher Kirmse and Michael Soderstrom";
239   v.comments = "Multiple Arcade Machine Emulator for Win32";
237   // MAMEUI
238   v.author = "Christopher Kirmse and the MAMEUI team";
239   v.comments = "Multiple Arcade Machine Emulator with GUI";
240240   v.company_name = "MAME Team";
241   v.file_description = "Multiple Arcade Machine Emulator for Win32";
242   v.internal_name = "MAME32";
243   v.original_filename = "MAME32";
244   v.product_name = "MAME32";
241   v.file_description = "Multiple Arcade Machine Emulator with GUI";
242   v.internal_name = "MAMEUI";
243   v.original_filename = "MAMEUI";
244   v.product_name = "MAMEUI";
245245   begin_year = 1997;
246246#else
247247   // MAME
src/osd/windows/input.c
r1281r1282
107107{
108108   DIMOUSESTATE2         state;
109109   mouse_state *         partner;
110   LONG               raw_x, raw_y, raw_z;
110111};
111112
112113
r1281r1282
270271static void rawinput_keyboard_update(HANDLE device, RAWKEYBOARD *data);
271272static void rawinput_mouse_enum(PRAWINPUTDEVICELIST device);
272273static void rawinput_mouse_update(HANDLE device, RAWMOUSE *data);
273static INT32 rawinput_mouse_axis_get_state(void *device_internal, void *item_internal);
274static void rawinput_mouse_poll(device_info *devinfo);
274275
275276// misc utilities
276277static TCHAR *reg_query_string(HKEY key, const TCHAR *path);
r1281r1282
19631964   devinfo = rawinput_device_create(&mouse_list, device);
19641965   if (devinfo == NULL)
19651966      return;
1967   devinfo->poll = rawinput_mouse_poll;
19661968
19671969   // allocate a second device for the gun (unless we are using the shared axis mode)
19681970   if (!lightgun_shared_axis_mode)
r1281r1282
19861988      const char *name = utf8_from_tstring(default_axis_name[axisnum]);
19871989
19881990      // add to the mouse device and optionally to the gun device as well
1989      input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, rawinput_mouse_axis_get_state);
1991      input_device_item_add(devinfo->device, name, &devinfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
19901992      if (guninfo != NULL && axisnum < 2)
19911993         input_device_item_add(guninfo->device, name, &guninfo->mouse.state.lX + axisnum, ITEM_ID_XAXIS + axisnum, generic_axis_get_state);
19921994
r1281r1282
20272029         // if we got relative data, update it as a mouse
20282030         if (!(data->usFlags & MOUSE_MOVE_ABSOLUTE))
20292031         {
2030            devinfo->mouse.state.lX += data->lLastX * INPUT_RELATIVE_PER_PIXEL;
2031            devinfo->mouse.state.lY += data->lLastY * INPUT_RELATIVE_PER_PIXEL;
2032            devinfo->mouse.raw_x += data->lLastX * INPUT_RELATIVE_PER_PIXEL;
2033            devinfo->mouse.raw_y += data->lLastY * INPUT_RELATIVE_PER_PIXEL;
20322034
20332035            // update zaxis
20342036            if (data->usButtonFlags & RI_MOUSE_WHEEL)
2035               devinfo->mouse.state.lZ += (INT16)data->usButtonData * INPUT_RELATIVE_PER_PIXEL;
2037               devinfo->mouse.raw_z += (INT16)data->usButtonData * INPUT_RELATIVE_PER_PIXEL;
20362038         }
20372039
20382040         // otherwise, update it as a lightgun
20392041         else
20402042         {
2041            devinfo->mouse.state.lX = normalize_absolute_axis(data->lLastX, 0, 0xffff);
2042            devinfo->mouse.state.lY = normalize_absolute_axis(data->lLastY, 0, 0xffff);
2043            devinfo->mouse.raw_x = normalize_absolute_axis(data->lLastX, 0, 0xffff);
2044            devinfo->mouse.raw_y = normalize_absolute_axis(data->lLastY, 0, 0xffff);
20432045
20442046            // also clear the polling function so win32_lightgun_poll isn't called
20452047            devinfo->poll = NULL;
r1281r1282
20622064
20632065
20642066//============================================================
2065//  rawinput_mouse_axis_get_state
2067//  rawinput_mouse_poll
20662068//============================================================
20672069
2068static INT32 rawinput_mouse_axis_get_state(void *device_internal, void *item_internal)
2070static void rawinput_mouse_poll(device_info *devinfo)
20692071{
2070   LONG *axisdata = item_internal;
2071   INT32 result;
2072   poll_if_necessary();
20722073
2073   // return the current state, clearing the existing data to 0 since we accumulate deltas
2074   poll_if_necessary();
2074   // copy the accumulated raw state to the actual state
20752075   osd_lock_acquire(input_lock);
2076   result = *axisdata;
2077   *axisdata = 0;
2076   devinfo->mouse.state.lX = devinfo->mouse.raw_x;
2077   devinfo->mouse.state.lY = devinfo->mouse.raw_y;
2078   devinfo->mouse.state.lZ = devinfo->mouse.raw_z;
2079   devinfo->mouse.raw_x = 0;
2080   devinfo->mouse.raw_y = 0;
2081   devinfo->mouse.raw_z = 0;
20782082   osd_lock_release(input_lock);
2079   return result;
20802083}
20812084
20822085
src/emu/debug/debugvw.c
r1281r1282
945945      valstart++, vallen--;
946946   while (isspace(str[valstart + vallen - 1]) && vallen > 0)
947947      vallen--;
948   if (str[valstart] == '!')
949      valstart++, vallen--;
948950
949951   /* note the register number and info */
950952   regdata->reg[view->total_rows].lastval  =
src/emu/cpu/tms32031/32031ops.c
r1281r1282
375375      SET_MANTISSA(dst, -man);
376376      SET_EXPONENT(dst, EXPONENT(src));
377377   }
378   else if (EXPONENT(src) != -128)
378   else
379379   {
380380      SET_MANTISSA(dst, man ^ 0x80000000);
381381      if (man == 0)
r1281r1282
12631263
12641264#define ABSF(dreg, sreg)                                    \
12651265{                                                      \
1266   if ((INT32)FREGMAN(sreg) >= 0)                              \
1266   INT32 man = FREGMAN(sreg);                                 \
1267   CLR_NZVUF();                                          \
1268   tms32031.r[dreg] = tms32031.r[sreg];                        \
1269   if (man < 0)                                          \
12671270   {                                                   \
1268      tms32031.r[dreg] = tms32031.r[sreg];                     \
1269      CLR_NZVUF();                                       \
1270      OR_NZF(&tms32031.r[dreg]);                              \
1271      SET_MANTISSA(&tms32031.r[dreg], ~man);                     \
1272      if (man == (INT32)0x80000000 && FREGEXP(sreg) == 127)         \
1273         IREG(TMR_ST) |= VFLAG | LVFLAG;                        \
12711274   }                                                   \
1272   else                                                \
1273      negf(&tms32031.r[dreg], &tms32031.r[sreg]);                  \
1275   OR_NZF(&tms32031.r[dreg]);                                 \
12741276}
12751277
12761278static void absf_reg(void)
src/emu/cpu/tms32031/tms32031.c
r1281r1282
779779      case CPUINFO_STR_REGISTER + TMS32031_R5:      sprintf(info->s, " R5:%08X", tms32031.r[TMR_R5].i32[0]); break;
780780      case CPUINFO_STR_REGISTER + TMS32031_R6:      sprintf(info->s, " R6:%08X", tms32031.r[TMR_R6].i32[0]); break;
781781      case CPUINFO_STR_REGISTER + TMS32031_R7:      sprintf(info->s, " R7:%08X", tms32031.r[TMR_R7].i32[0]); break;
782      case CPUINFO_STR_REGISTER + TMS32031_R0F:      sprintf(info->s, "R0F:%8g", dsp_to_double(&tms32031.r[TMR_R0])); break;
783      case CPUINFO_STR_REGISTER + TMS32031_R1F:      sprintf(info->s, "R1F:%8g", dsp_to_double(&tms32031.r[TMR_R1])); break;
784      case CPUINFO_STR_REGISTER + TMS32031_R2F:      sprintf(info->s, "R2F:%8g", dsp_to_double(&tms32031.r[TMR_R2])); break;
785      case CPUINFO_STR_REGISTER + TMS32031_R3F:      sprintf(info->s, "R3F:%8g", dsp_to_double(&tms32031.r[TMR_R3])); break;
786      case CPUINFO_STR_REGISTER + TMS32031_R4F:      sprintf(info->s, "R4F:%8g", dsp_to_double(&tms32031.r[TMR_R4])); break;
787      case CPUINFO_STR_REGISTER + TMS32031_R5F:      sprintf(info->s, "R5F:%8g", dsp_to_double(&tms32031.r[TMR_R5])); break;
788      case CPUINFO_STR_REGISTER + TMS32031_R6F:      sprintf(info->s, "R6F:%8g", dsp_to_double(&tms32031.r[TMR_R6])); break;
789      case CPUINFO_STR_REGISTER + TMS32031_R7F:      sprintf(info->s, "R7F:%8g", dsp_to_double(&tms32031.r[TMR_R7])); break;
782      case CPUINFO_STR_REGISTER + TMS32031_R0F:      sprintf(info->s, "R0F:!%12g", dsp_to_double(&tms32031.r[TMR_R0])); break;
783      case CPUINFO_STR_REGISTER + TMS32031_R1F:      sprintf(info->s, "R1F:!%12g", dsp_to_double(&tms32031.r[TMR_R1])); break;
784      case CPUINFO_STR_REGISTER + TMS32031_R2F:      sprintf(info->s, "R2F:!%12g", dsp_to_double(&tms32031.r[TMR_R2])); break;
785      case CPUINFO_STR_REGISTER + TMS32031_R3F:      sprintf(info->s, "R3F:!%12g", dsp_to_double(&tms32031.r[TMR_R3])); break;
786      case CPUINFO_STR_REGISTER + TMS32031_R4F:      sprintf(info->s, "R4F:!%12g", dsp_to_double(&tms32031.r[TMR_R4])); break;
787      case CPUINFO_STR_REGISTER + TMS32031_R5F:      sprintf(info->s, "R5F:!%12g", dsp_to_double(&tms32031.r[TMR_R5])); break;
788      case CPUINFO_STR_REGISTER + TMS32031_R6F:      sprintf(info->s, "R6F:!%12g", dsp_to_double(&tms32031.r[TMR_R6])); break;
789      case CPUINFO_STR_REGISTER + TMS32031_R7F:      sprintf(info->s, "R7F:!%12g", dsp_to_double(&tms32031.r[TMR_R7])); break;
790790      case CPUINFO_STR_REGISTER + TMS32031_AR0:      sprintf(info->s, "AR0:%08X", tms32031.r[TMR_AR0].i32[0]); break;
791791      case CPUINFO_STR_REGISTER + TMS32031_AR1:      sprintf(info->s, "AR1:%08X", tms32031.r[TMR_AR1].i32[0]); break;
792792      case CPUINFO_STR_REGISTER + TMS32031_AR2:      sprintf(info->s, "AR2:%08X", tms32031.r[TMR_AR2].i32[0]); break;
src/emu/cpu/i8051/i8051.c
r1281r1282
407407#define SERIALPORT_IRQ    ((R_SCON & 0x03) && GET_ES)
408408
409409#if (HAS_I8052 || HAS_I8752)
410#define NO_PENDING_IRQ  !(R_TCON & 0xaa) && !(SERIALPORT_IRQ) && !GET_TF2 && !GET_EXF2
410#define NO_PENDING_IRQ  !(R_TCON & 0xaa) && !(SERIALPORT_IRQ) && !GET_ET2 //!GET_TF2 && !GET_EXF2
411411#else
412412#define NO_PENDING_IRQ  !(R_TCON & 0xaa) && !(SERIALPORT_IRQ)
413413#endif
r1281r1282
15121512   }
15131513#if (HAS_I8052 || HAS_I8752)
15141514   //Timer 2 overflow (Either Timer Overflow OR External Interrupt)
1515   if(!i8051.priority_request && (GET_TF2 || GET_EXF2) && (!i8051.int_vec || (i8051.int_vec && GET_PT2))) {
1515   if(!i8051.priority_request && GET_ET2 && (GET_TF2 || GET_EXF2) && (!i8051.int_vec || (i8051.int_vec && GET_PT2))) {
15161516      //Set vector & priority level request
15171517      i8051.int_vec = V_TF2;
15181518      i8051.priority_request = GET_PT2;
src/emu/eigccx86.h
r1281r1282
496496#define atomic_add32 _atomic_add32
497497INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta)
498498{
499   register INT32 result;
499   register INT32 result = delta;
500500
501501   __asm__ __volatile__ (
502      " mov          %[delta],%[result] ;"
503      " lock ; xadd  %[result],%[ptr]   ;"
504      " add          %[delta],%[result] ;"
505     : [ptr]    "+m"  (*ptr)
506     , [result] "=&r" (result)
507     : [delta]  "rmi" (delta)
502      " lock ; xadd  %[result], %[ptr] ;"
503     : [ptr]    "+m" (*ptr)
504     , [result] "+r" (result)
505     :
508506     : "%cc"
509507   );
510508
511   return result;
509   return result + delta;
512510}
513511
514512
513/*-------------------------------------------------
514    atomic_increment32 - atomically increment the
515    32-bit value in memory at 'ptr', returning the
516    final result.
517-------------------------------------------------*/
518
519#define atomic_increment32 _atomic_increment32
520INLINE INT32 _atomic_increment32(INT32 volatile *ptr)
521{
522   register INT32 result = 1;
523
524   __asm__ __volatile__ (
525      " lock ; xadd  %[result], %[ptr] ;"
526     : [ptr]    "+m" (*ptr)
527     , [result] "+r" (result)
528     :
529     : "%cc"
530   );
531
532   return result + 1;
533}
534
535
536/*-------------------------------------------------
537    atomic_decrement32 - atomically decrement the
538    32-bit value in memory at 'ptr', returning the
539    final result.
540-------------------------------------------------*/
541
542#define atomic_decrement32 _atomic_decrement32
543INLINE INT32 _atomic_decrement32(INT32 volatile *ptr)
544{
545   register INT32 result = -1;
546
547   __asm__ __volatile__ (
548      " lock ; xadd  %[result], %[ptr] ;"
549     : [ptr]    "+m" (*ptr)
550     , [result] "+r" (result)
551     :
552     : "%cc"
553   );
554
555   return result - 1;
556}
557
515558#endif /* __EIGCCX86__ */
src/emu/video/rgbvmx.h
r0r1282
1/***************************************************************************
2
3    rgbvmx.h
4
5    VMX/Altivec optimised RGB utilities.
6
7    Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#ifndef __RGBVMX__
13#define __RGBVMX__
14
15
16/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19
20/* intermediate RGB values are stored in a vector */
21typedef vector signed short rgbint;
22
23/* intermediate RGB values are stored in a vector */
24typedef vector signed short rgbaint;
25
26
27
28/***************************************************************************
29    BASIC CONVERSIONS
30***************************************************************************/
31
32/*-------------------------------------------------
33    rgb_comp_to_rgbint - converts a trio of RGB
34    components to an rgbint type
35-------------------------------------------------*/
36
37INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b)
38{
39   rgbint result = { 0, r, g, b, 0, 0, 0, 0 };
40   *rgb = result;
41}
42
43
44/*-------------------------------------------------
45    rgba_comp_to_rgbint - converts a quad of RGB
46    components to an rgbint type
47-------------------------------------------------*/
48
49INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b)
50{
51   rgbaint result = { a, r, g, b, 0, 0, 0, 0 };
52   *rgb = result;
53}
54
55
56/*-------------------------------------------------
57    rgb_to_rgbint - converts a packed trio of RGB
58    components to an rgbint type
59-------------------------------------------------*/
60
61INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color)
62{
63   vector signed char temp = vec_perm(vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color));
64   *rgb = vec_mergeh((vector signed char)vec_splat_s32(0), temp);
65}
66
67
68/*-------------------------------------------------
69    rgba_to_rgbaint - converts a packed quad of RGB
70    components to an rgbint type
71-------------------------------------------------*/
72
73INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color)
74{
75   vector signed char temp = vec_perm(vec_lde(0, &color), vec_splat_s32(0), vec_lvsl(0, &color));
76   *rgb = vec_mergeh((vector signed char)vec_splat_s32(0), temp);
77}
78
79
80/*-------------------------------------------------
81    rgbint_to_rgb - converts an rgbint back to
82    a packed trio of RGB values
83-------------------------------------------------*/
84
85INLINE rgb_t rgbint_to_rgb(const rgbint *color)
86{
87   vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0);
88   rgb_t result;
89   vec_ste(temp, 0, &result);
90   return result;
91}
92
93
94/*-------------------------------------------------
95    rgbaint_to_rgba - converts an rgbint back to
96    a packed quad of RGB values
97-------------------------------------------------*/
98
99INLINE rgb_t rgbaint_to_rgba(const rgbaint *color)
100{
101   vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0);
102   rgb_t result;
103   vec_ste(temp, 0, &result);
104   return result;
105}
106
107
108/*-------------------------------------------------
109    rgbint_to_rgb_clamp - converts an rgbint back
110    to a packed trio of RGB values, clamping them
111    to bytes first
112-------------------------------------------------*/
113
114INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color)
115{
116   vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0);
117   rgb_t result;
118   vec_ste(temp, 0, &result);
119   return result;
120}
121
122
123/*-------------------------------------------------
124    rgbaint_to_rgba_clamp - converts an rgbint back
125    to a packed quad of RGB values, clamping them
126    to bytes first
127-------------------------------------------------*/
128
129INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color)
130{
131   vector signed int temp = vec_splat((vector signed int)vec_packsu(*color, *color), 0);
132   rgb_t result;
133   vec_ste(temp, 0, &result);
134   return result;
135}
136
137
138
139/***************************************************************************
140    CORE MATH
141***************************************************************************/
142
143/*-------------------------------------------------
144    rgbint_add - add two rgbint values
145-------------------------------------------------*/
146
147INLINE void rgbint_add(rgbint *color1, const rgbint *color2)
148{
149   *color1 = vec_add(*color1, *color2);
150}
151
152
153/*-------------------------------------------------
154    rgbaint_add - add two rgbaint values
155-------------------------------------------------*/
156
157INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2)
158{
159   *color1 = vec_add(*color1, *color2);
160}
161
162
163/*-------------------------------------------------
164    rgbint_sub - subtract two rgbint values
165-------------------------------------------------*/
166
167INLINE void rgbint_sub(rgbint *color1, const rgbint *color2)
168{
169   *color1 = vec_sub(*color1, *color2);
170}
171
172
173/*-------------------------------------------------
174    rgbaint_sub - subtract two rgbaint values
175-------------------------------------------------*/
176
177INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2)
178{
179   *color1 = vec_sub(*color1, *color2);
180}
181
182
183/*-------------------------------------------------
184    rgbint_subr - reverse subtract two rgbint
185    values
186-------------------------------------------------*/
187
188INLINE void rgbint_subr(rgbint *color1, const rgbint *color2)
189{
190   *color1 = vec_sub(*color2, *color1);
191}
192
193
194/*-------------------------------------------------
195    rgbaint_subr - reverse subtract two rgbaint
196    values
197-------------------------------------------------*/
198
199INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2)
200{
201   *color1 = vec_sub(*color2, *color1);
202}
203
204
205
206/***************************************************************************
207    TABLES
208***************************************************************************/
209
210static const struct
211{
212   rgbaint   maxbyte;
213   rgbaint   scale_table[256];
214} rgbvmx_statics =
215{
216   { 255, 255, 255, 255, 255, 255, 255, 255 },
217   {
218      {   1, 256,   1, 256,   1, 256,   1, 256 }, {   2, 255,   2, 255,   2, 255,   2, 255 },
219      {   3, 254,   3, 254,   3, 254,   3, 254 }, {   4, 253,   4, 253,   4, 253,   4, 253 },
220      {   5, 252,   5, 252,   5, 252,   5, 252 }, {   6, 251,   6, 251,   6, 251,   6, 251 },
221      {   7, 250,   7, 250,   7, 250,   7, 250 }, {   8, 249,   8, 249,   8, 249,   8, 249 },
222      {   9, 248,   9, 248,   9, 248,   9, 248 }, {  10, 247,  10, 247,  10, 247,  10, 247 },
223      {  11, 246,  11, 246,  11, 246,  11, 246 }, {  12, 245,  12, 245,  12, 245,  12, 245 },
224      {  13, 244,  13, 244,  13, 244,  13, 244 }, {  14, 243,  14, 243,  14, 243,  14, 243 },
225      {  15, 242,  15, 242,  15, 242,  15, 242 }, {  16, 241,  16, 241,  16, 241,  16, 241 },
226      {  17, 240,  17, 240,  17, 240,  17, 240 }, {  18, 239,  18, 239,  18, 239,  18, 239 },
227      {  19, 238,  19, 238,  19, 238,  19, 238 }, {  20, 237,  20, 237,  20, 237,  20, 237 },
228      {  21, 236,  21, 236,  21, 236,  21, 236 }, {  22, 235,  22, 235,  22, 235,  22, 235 },
229      {  23, 234,  23, 234,  23, 234,  23, 234 }, {  24, 233,  24, 233,  24, 233,  24, 233 },
230      {  25, 232,  25, 232,  25, 232,  25, 232 }, {  26, 231,  26, 231,  26, 231,  26, 231 },
231      {  27, 230,  27, 230,  27, 230,  27, 230 }, {  28, 229,  28, 229,  28, 229,  28, 229 },
232      {  29, 228,  29, 228,  29, 228,  29, 228 }, {  30, 227,  30, 227,  30, 227,  30, 227 },
233      {  31, 226,  31, 226,  31, 226,  31, 226 }, {  32, 225,  32, 225,  32, 225,  32, 225 },
234      {  33, 224,  33, 224,  33, 224,  33, 224 }, {  34, 223,  34, 223,  34, 223,  34, 223 },
235      {  35, 222,  35, 222,  35, 222,  35, 222 }, {  36, 221,  36, 221,  36, 221,  36, 221 },
236      {  37, 220,  37, 220,  37, 220,  37, 220 }, {  38, 219,  38, 219,  38, 219,  38, 219 },
237      {  39, 218,  39, 218,  39, 218,  39, 218 }, {  40, 217,  40, 217,  40, 217,  40, 217 },
238      {  41, 216,  41, 216,  41, 216,  41, 216 }, {  42, 215,  42, 215,  42, 215,  42, 215 },
239      {  43, 214,  43, 214,  43, 214,  43, 214 }, {  44, 213,  44, 213,  44, 213,  44, 213 },
240      {  45, 212,  45, 212,  45, 212,  45, 212 }, {  46, 211,  46, 211,  46, 211,  46, 211 },
241      {  47, 210,  47, 210,  47, 210,  47, 210 }, {  48, 209,  48, 209,  48, 209,  48, 209 },
242      {  49, 208,  49, 208,  49, 208,  49, 208 }, {  50, 207,  50, 207,  50, 207,  50, 207 },
243      {  51, 206,  51, 206,  51, 206,  51, 206 }, {  52, 205,  52, 205,  52, 205,  52, 205 },
244      {  53, 204,  53, 204,  53, 204,  53, 204 }, {  54, 203,  54, 203,  54, 203,  54, 203 },
245      {  55, 202,  55, 202,  55, 202,  55, 202 }, {  56, 201,  56, 201,  56, 201,  56, 201 },
246      {  57, 200,  57, 200,  57, 200,  57, 200 }, {  58, 199,  58, 199,  58, 199,  58, 199 },
247      {  59, 198,  59, 198,  59, 198,  59, 198 }, {  60, 197,  60, 197,  60, 197,  60, 197 },
248      {  61, 196,  61, 196,  61, 196,  61, 196 }, {  62, 195,  62, 195,  62, 195,  62, 195 },
249      {  63, 194,  63, 194,  63, 194,  63, 194 }, {  64, 193,  64, 193,  64, 193,  64, 193 },
250      {  65, 192,  65, 192,  65, 192,  65, 192 }, {  66, 191,  66, 191,  66, 191,  66, 191 },
251      {  67, 190,  67, 190,  67, 190,  67, 190 }, {  68, 189,  68, 189,  68, 189,  68, 189 },
252      {  69, 188,  69, 188,  69, 188,  69, 188 }, {  70, 187,  70, 187,  70, 187,  70, 187 },
253      {  71, 186,  71, 186,  71, 186,  71, 186 }, {  72, 185,  72, 185,  72, 185,  72, 185 },
254      {  73, 184,  73, 184,  73, 184,  73, 184 }, {  74, 183,  74, 183,  74, 183,  74, 183 },
255      {  75, 182,  75, 182,  75, 182,  75, 182 }, {  76, 181,  76, 181,  76, 181,  76, 181 },
256      {  77, 180,  77, 180,  77, 180,  77, 180 }, {  78, 179,  78, 179,  78, 179,  78, 179 },
257      {  79, 178,  79, 178,  79, 178,  79, 178 }, {  80, 177,  80, 177,  80, 177,  80, 177 },
258      {  81, 176,  81, 176,  81, 176,  81, 176 }, {  82, 175,  82, 175,  82, 175,  82, 175 },
259      {  83, 174,  83, 174,  83, 174,  83, 174 }, {  84, 173,  84, 173,  84, 173,  84, 173 },
260      {  85, 172,  85, 172,  85, 172,  85, 172 }, {  86, 171,  86, 171,  86, 171,  86, 171 },
261      {  87, 170,  87, 170,  87, 170,  87, 170 }, {  88, 169,  88, 169,  88, 169,  88, 169 },
262      {  89, 168,  89, 168,  89, 168,  89, 168 }, {  90, 167,  90, 167,  90, 167,  90, 167 },
263      {  91, 166,  91, 166,  91, 166,  91, 166 }, {  92, 165,  92, 165,  92, 165,  92, 165 },
264      {  93, 164,  93, 164,  93, 164,  93, 164 }, {  94, 163,  94, 163,  94, 163,  94, 163 },
265      {  95, 162,  95, 162,  95, 162,  95, 162 }, {  96, 161,  96, 161,  96, 161,  96, 161 },
266      {  97, 160,  97, 160,  97, 160,  97, 160 }, {  98, 159,  98, 159,  98, 159,  98, 159 },
267      {  99, 158,  99, 158,  99, 158,  99, 158 }, { 100, 157, 100, 157, 100, 157, 100, 157 },
268      { 101, 156, 101, 156, 101, 156, 101, 156 }, { 102, 155, 102, 155, 102, 155, 102, 155 },
269      { 103, 154, 103, 154, 103, 154, 103, 154 }, { 104, 153, 104, 153, 104, 153, 104, 153 },
270      { 105, 152, 105, 152, 105, 152, 105, 152 }, { 106, 151, 106, 151, 106, 151, 106, 151 },
271      { 107, 150, 107, 150, 107, 150, 107, 150 }, { 108, 149, 108, 149, 108, 149, 108, 149 },
272      { 109, 148, 109, 148, 109, 148, 109, 148 }, { 110, 147, 110, 147, 110, 147, 110, 147 },
273      { 111, 146, 111, 146, 111, 146, 111, 146 }, { 112, 145, 112, 145, 112, 145, 112, 145 },
274      { 113, 144, 113, 144, 113, 144, 113, 144 }, { 114, 143, 114, 143, 114, 143, 114, 143 },
275      { 115, 142, 115, 142, 115, 142, 115, 142 }, { 116, 141, 116, 141, 116, 141, 116, 141 },
276      { 117, 140, 117, 140, 117, 140, 117, 140 }, { 118, 139, 118, 139, 118, 139, 118, 139 },
277      { 119, 138, 119, 138, 119, 138, 119, 138 }, { 120, 137, 120, 137, 120, 137, 120, 137 },
278      { 121, 136, 121, 136, 121, 136, 121, 136 }, { 122, 135, 122, 135, 122, 135, 122, 135 },
279      { 123, 134, 123, 134, 123, 134, 123, 134 }, { 124, 133, 124, 133, 124, 133, 124, 133 },
280      { 125, 132, 125, 132, 125, 132, 125, 132 }, { 126, 131, 126, 131, 126, 131, 126, 131 },
281      { 127, 130, 127, 130, 127, 130, 127, 130 }, { 128, 129, 128, 129, 128, 129, 128, 129 },
282      { 129, 128, 129, 128, 129, 128, 129, 128 }, { 130, 127, 130, 127, 130, 127, 130, 127 },
283      { 131, 126, 131, 126, 131, 126, 131, 126 }, { 132, 125, 132, 125, 132, 125, 132, 125 },
284      { 133, 124, 133, 124, 133, 124, 133, 124 }, { 134, 123, 134, 123, 134, 123, 134, 123 },
285      { 135, 122, 135, 122, 135, 122, 135, 122 }, { 136, 121, 136, 121, 136, 121, 136, 121 },
286      { 137, 120, 137, 120, 137, 120, 137, 120 }, { 138, 119, 138, 119, 138, 119, 138, 119 },
287      { 139, 118, 139, 118, 139, 118, 139, 118 }, { 140, 117, 140, 117, 140, 117, 140, 117 },
288      { 141, 116, 141, 116, 141, 116, 141, 116 }, { 142, 115, 142, 115, 142, 115, 142, 115 },
289      { 143, 114, 143, 114, 143, 114, 143, 114 }, { 144, 113, 144, 113, 144, 113, 144, 113 },
290      { 145, 112, 145, 112, 145, 112, 145, 112 }, { 146, 111, 146, 111, 146, 111, 146, 111 },
291      { 147, 110, 147, 110, 147, 110, 147, 110 }, { 148, 109, 148, 109, 148, 109, 148, 109 },
292      { 149, 108, 149, 108, 149, 108, 149, 108 }, { 150, 107, 150, 107, 150, 107, 150, 107 },
293      { 151, 106, 151, 106, 151, 106, 151, 106 }, { 152, 105, 152, 105, 152, 105, 152, 105 },
294      { 153, 104, 153, 104, 153, 104, 153, 104 }, { 154, 103, 154, 103, 154, 103, 154, 103 },
295      { 155, 102, 155, 102, 155, 102, 155, 102 }, { 156, 101, 156, 101, 156, 101, 156, 101 },
296      { 157, 100, 157, 100, 157, 100, 157, 100 }, { 158,  99, 158,  99, 158,  99, 158,  99 },
297      { 159,  98, 159,  98, 159,  98, 159,  98 }, { 160,  97, 160,  97, 160,  97, 160,  97 },
298      { 161,  96, 161,  96, 161,  96, 161,  96 }, { 162,  95, 162,  95, 162,  95, 162,  95 },
299      { 163,  94, 163,  94, 163,  94, 163,  94 }, { 164,  93, 164,  93, 164,  93, 164,  93 },
300      { 165,  92, 165,  92, 165,  92, 165,  92 }, { 166,  91, 166,  91, 166,  91, 166,  91 },
301      { 167,  90, 167,  90, 167,  90, 167,  90 }, { 168,  89, 168,  89, 168,  89, 168,  89 },
302      { 169,  88, 169,  88, 169,  88, 169,  88 }, { 170,  87, 170,  87, 170,  87, 170,  87 },
303      { 171,  86, 171,  86, 171,  86, 171,  86 }, { 172,  85, 172,  85, 172,  85, 172,  85 },
304      { 173,  84, 173,  84, 173,  84, 173,  84 }, { 174,  83, 174,  83, 174,  83, 174,  83 },
305      { 175,  82, 175,  82, 175,  82, 175,  82 }, { 176,  81, 176,  81, 176,  81, 176,  81 },
306      { 177,  80, 177,  80, 177,  80, 177,  80 }, { 178,  79, 178,  79, 178,  79, 178,  79 },
307      { 179,  78, 179,  78, 179,  78, 179,  78 }, { 180,  77, 180,  77, 180,  77, 180,  77 },
308      { 181,  76, 181,  76, 181,  76, 181,  76 }, { 182,  75, 182,  75, 182,  75, 182,  75 },
309      { 183,  74, 183,  74, 183,  74, 183,  74 }, { 184,  73, 184,  73, 184,  73, 184,  73 },
310      { 185,  72, 185,  72, 185,  72, 185,  72 }, { 186,  71, 186,  71, 186,  71, 186,  71 },
311      { 187,  70, 187,  70, 187,  70, 187,  70 }, { 188,  69, 188,  69, 188,  69, 188,  69 },
312      { 189,  68, 189,  68, 189,  68, 189,  68 }, { 190,  67, 190,  67, 190,  67, 190,  67 },
313      { 191,  66, 191,  66, 191,  66, 191,  66 }, { 192,  65, 192,  65, 192,  65, 192,  65 },
314      { 193,  64, 193,  64, 193,  64, 193,  64 }, { 194,  63, 194,  63, 194,  63, 194,  63 },
315      { 195,  62, 195,  62, 195,  62, 195,  62 }, { 196,  61, 196,  61, 196,  61, 196,  61 },
316      { 197,  60, 197,  60, 197,  60, 197,  60 }, { 198,  59, 198,  59, 198,  59, 198,  59 },
317      { 199,  58, 199,  58, 199,  58, 199,  58 }, { 200,  57, 200,  57, 200,  57, 200,  57 },
318      { 201,  56, 201,  56, 201,  56, 201,  56 }, { 202,  55, 202,  55, 202,  55, 202,  55 },
319      { 203,  54, 203,  54, 203,  54, 203,  54 }, { 204,  53, 204,  53, 204,  53, 204,  53 },
320      { 205,  52, 205,  52, 205,  52, 205,  52 }, { 206,  51, 206,  51, 206,  51, 206,  51 },
321      { 207,  50, 207,  50, 207,  50, 207,  50 }, { 208,  49, 208,  49, 208,  49, 208,  49 },
322      { 209,  48, 209,  48, 209,  48, 209,  48 }, { 210,  47, 210,  47, 210,  47, 210,  47 },
323      { 211,  46, 211,  46, 211,  46, 211,  46 }, { 212,  45, 212,  45, 212,  45, 212,  45 },
324      { 213,  44, 213,  44, 213,  44, 213,  44 }, { 214,  43, 214,  43, 214,  43, 214,  43 },
325      { 215,  42, 215,  42, 215,  42, 215,  42 }, { 216,  41, 216,  41, 216,  41, 216,  41 },
326      { 217,  40, 217,  40, 217,  40, 217,  40 }, { 218,  39, 218,  39, 218,  39, 218,  39 },
327      { 219,  38, 219,  38, 219,  38, 219,  38 }, { 220,  37, 220,  37, 220,  37, 220,  37 },
328      { 221,  36, 221,  36, 221,  36, 221,  36 }, { 222,  35, 222,  35, 222,  35, 222,  35 },
329      { 223,  34, 223,  34, 223,  34, 223,  34 }, { 224,  33, 224,  33, 224,  33, 224,  33 },
330      { 225,  32, 225,  32, 225,  32, 225,  32 }, { 226,  31, 226,  31, 226,  31, 226,  31 },
331      { 227,  30, 227,  30, 227,  30, 227,  30 }, { 228,  29, 228,  29, 228,  29, 228,  29 },
332      { 229,  28, 229,  28, 229,  28, 229,  28 }, { 230,  27, 230,  27, 230,  27, 230,  27 },
333      { 231,  26, 231,  26, 231,  26, 231,  26 }, { 232,  25, 232,  25, 232,  25, 232,  25 },
334      { 233,  24, 233,  24, 233,  24, 233,  24 }, { 234,  23, 234,  23, 234,  23, 234,  23 },
335      { 235,  22, 235,  22, 235,  22, 235,  22 }, { 236,  21, 236,  21, 236,  21, 236,  21 },
336      { 237,  20, 237,  20, 237,  20, 237,  20 }, { 238,  19, 238,  19, 238,  19, 238,  19 },
337      { 239,  18, 239,  18, 239,  18, 239,  18 }, { 240,  17, 240,  17, 240,  17, 240,  17 },
338      { 241,  16, 241,  16, 241,  16, 241,  16 }, { 242,  15, 242,  15, 242,  15, 242,  15 },
339      { 243,  14, 243,  14, 243,  14, 243,  14 }, { 244,  13, 244,  13, 244,  13, 244,  13 },
340      { 245,  12, 245,  12, 245,  12, 245,  12 }, { 246,  11, 246,  11, 246,  11, 246,  11 },
341      { 247,  10, 247,  10, 247,  10, 247,  10 }, { 248,   9, 248,   9, 248,   9, 248,   9 },
342      { 249,   8, 249,   8, 249,   8, 249,   8 }, { 250,   7, 250,   7, 250,   7, 250,   7 },
343      { 251,   6, 251,   6, 251,   6, 251,   6 }, { 252,   5, 252,   5, 252,   5, 252,   5 },
344      { 253,   4, 253,   4, 253,   4, 253,   4 }, { 254,   3, 254,   3, 254,   3, 254,   3 },
345      { 255,   2, 255,   2, 255,   2, 255,   2 }, { 256,   1, 256,   1, 256,   1, 256,   1 }
346   }
347};
348
349
350
351/***************************************************************************
352    HIGHER LEVEL OPERATIONS
353***************************************************************************/
354
355/*-------------------------------------------------
356    rgbint_blend - blend two colors by the given
357    scale factor
358-------------------------------------------------*/
359
360INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale)
361{
362   *color1 = vec_mergeh(*color1, *color2);
363   vector signed int temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0));
364   temp = vec_sr(temp, vec_splat_s32(8));
365   *color1 = vec_packs(temp, temp);
366}
367
368
369/*-------------------------------------------------
370    rgbaint_blend - blend two colors by the given
371    scale factor
372-------------------------------------------------*/
373
374INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale)
375{
376   *color1 = vec_mergeh(*color1, *color2);
377   vector signed int temp = vec_msum(*color1, rgbvmx_statics.scale_table[color1scale], vec_splat_s32(0));
378   temp = vec_sr(temp, vec_splat_s32(8));
379   *color1 = vec_packs(temp, temp);
380}
381
382
383/*-------------------------------------------------
384    rgbint_scale_and_clamp - scale the given
385    color by an 8.8 scale factor and clamp to
386    byte values
387-------------------------------------------------*/
388
389INLINE void rgbint_scale_and_clamp(rgbint *color, INT16 colorscale)
390{
391   rgbint splatmap = vec_splat((rgbint)vec_lvsl(0, &colorscale), 0);
392   rgbint vecscale = vec_lde(0, &colorscale);
393   vecscale = vec_perm(vecscale, vecscale, splatmap);
394   *color = vec_mergeh(*color, vec_splat_s32(0));
395   vector signed int temp = vec_msum(*color, vecscale, vec_splat_s32(0));
396   temp = vec_sr(temp, vec_splat_s32(8));
397   *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte);
398}
399
400
401/*-------------------------------------------------
402    rgbaint_scale_and_clamp - scale the given
403    color by an 8.8 scale factor and clamp to
404    byte values
405-------------------------------------------------*/
406
407INLINE void rgbaint_scale_and_clamp(rgbaint *color, INT16 colorscale)
408{
409   rgbaint splatmap = vec_splat((rgbaint)vec_lvsl(0, &colorscale), 0);
410   rgbaint vecscale = vec_lde(0, &colorscale);
411   vecscale = vec_perm(vecscale, vecscale, splatmap);
412   *color = vec_mergeh(*color, vec_splat_s32(0));
413   vector signed int temp = vec_msum(*color, vecscale, vec_splat_s32(0));
414   temp = vec_sr(temp, vec_splat_s32(8));
415   *color = vec_min(vec_packs(temp, temp), rgbvmx_statics.maxbyte);
416}
417
418
419/*-------------------------------------------------
420    rgb_bilinear_filter - bilinear filter between
421    four pixel values
422-------------------------------------------------*/
423
424INLINE rgb_t rgb_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
425{
426   rgbint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00));
427   rgbint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01));
428   rgbint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10));
429   rgbint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11));
430
431   /* interleave color01 and color00 at the byte level */
432   color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00);
433   color11 = vec_mergeh((vector signed char)color11, (vector signed char)color10);
434   color01 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01);
435   color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11);
436   color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
437   color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
438   color01 = vec_sr((vector signed int)color01, vec_splat_s32(1));
439   color11 = vec_sl((vector signed int)color11, vec_splat_s32(15));
440   color01 = vec_max(color01, color11);
441   color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0));
442   color01 = vec_sr((vector signed int)color01, vec_splat_s32(15));
443   color01 = vec_packs((vector signed int)color01, (vector signed int)color01);
444   color01 = vec_packsu(color01, color01);
445   rgb_t result;
446   vec_ste((vector signed int)color01, 0, &result);
447   return result;
448}
449
450
451/*-------------------------------------------------
452    rgba_bilinear_filter - bilinear filter between
453    four pixel values
454-------------------------------------------------*/
455
456INLINE rgb_t rgba_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
457{
458   rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00));
459   rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01));
460   rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10));
461   rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11));
462
463   /* interleave color01 and color00 at the byte level */
464   color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00);
465   color11 = vec_mergeh((vector signed char)color11, (vector signed char)color10);
466   color01 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01);
467   color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11);
468   color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
469   color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
470   color01 = vec_sr((vector signed int)color01, vec_splat_s32(1));
471   color11 = vec_sl((vector signed int)color11, vec_splat_s32(15));
472   color01 = vec_max(color01, color11);
473   color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0));
474   color01 = vec_sr((vector signed int)color01, vec_splat_s32(15));
475   color01 = vec_packs((vector signed int)color01, (vector signed int)color01);
476   color01 = vec_packsu(color01, color01);
477   rgb_t result;
478   vec_ste((vector signed int)color01, 0, &result);
479   return result;
480}
481
482
483/*-------------------------------------------------
484    rgbint_bilinear_filter - bilinear filter between
485    four pixel values
486-------------------------------------------------*/
487
488INLINE void rgbint_bilinear_filter(rgbint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
489{
490   rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00));
491   rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01));
492   rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10));
493   rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11));
494
495   /* interleave color01 and color00 at the byte level */
496   color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00);
497   color11 = vec_mergeh((vector signed char)color11, (vector signed char)color10);
498   color01 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01);
499   color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11);
500   color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
501   color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
502   color01 = vec_sr((vector signed int)color01, vec_splat_s32(1));
503   color11 = vec_sl((vector signed int)color11, vec_splat_s32(15));
504   color01 = vec_max(color01, color11);
505   color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0));
506   color01 = vec_sr((vector signed int)color01, vec_splat_s32(15));
507   *color = vec_packs((vector signed int)color01, (vector signed int)color01);
508}
509
510
511/*-------------------------------------------------
512    rgbaint_bilinear_filter - bilinear filter between
513    four pixel values
514-------------------------------------------------*/
515
516INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
517{
518   rgbaint color00 = vec_perm(vec_lde(0, &rgb00), vec_splat_s32(0), vec_lvsl(0, &rgb00));
519   rgbaint color01 = vec_perm(vec_lde(0, &rgb01), vec_splat_s32(0), vec_lvsl(0, &rgb01));
520   rgbaint color10 = vec_perm(vec_lde(0, &rgb10), vec_splat_s32(0), vec_lvsl(0, &rgb10));
521   rgbaint color11 = vec_perm(vec_lde(0, &rgb11), vec_splat_s32(0), vec_lvsl(0, &rgb11));
522
523   /* interleave color01 and color00 at the byte level */
524   color01 = vec_mergeh((vector signed char)color01, (vector signed char)color00);
525   color11 = vec_mergeh((vector signed char)color11, (vector signed char)color10);
526   color01 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color01);
527   color11 = vec_mergeh((vector signed char)vec_splat_s32(0), (vector signed char)color11);
528   color01 = vec_msum(color01, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
529   color11 = vec_msum(color11, rgbvmx_statics.scale_table[u], vec_splat_s32(0));
530   color01 = vec_sr((vector signed int)color01, vec_splat_s32(1));
531   color11 = vec_sl((vector signed int)color11, vec_splat_s32(15));
532   color01 = vec_max(color01, color11);
533   color01 = vec_msum(color01, rgbvmx_statics.scale_table[v], vec_splat_s32(0));
534   color01 = vec_sr((vector signed int)color01, vec_splat_s32(15));
535   *color = vec_packs((vector signed int)color01, (vector signed int)color01);
536}
537
538
539#endif /* __RGBVMX__ */
src/emu/video/vooddefs.h
r1281r1282
16031603struct _raster_info
16041604{
16051605   struct _raster_info *next;         /* pointer to next entry with the same hash */
1606   poly_draw_tri_scanline callback;   /* callback pointer */
1606   poly_draw_scanline callback;      /* callback pointer */
16071607   UINT8      is_generic;            /* TRUE if this is one of the generic rasterizers */
16081608   UINT8      display;            /* display index */
16091609   UINT32      hits;               /* how many hits (pixels) we've used this for */
r1281r1282
34903490
34913491#define RASTERIZER(name, TMUS, FBZCOLORPATH, FBZMODE, ALPHAMODE, FOGMODE, TEXMODE0, TEXMODE1) \
34923492                                                            \
3493static void raster_##name(void *destbase, INT32 y, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid) \
3493static void raster_##name(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid) \
34943494{                                                            \
34953495   const poly_extra_data *extra = extradata;                           \
34963496   voodoo_state *v = extra->state;                                    \
src/emu/video/poly.c
r1281r1282
11/***************************************************************************
22
3    poly.c
3    polynew.c
44
55    Helper routines for polygon rendering.
66
77***************************************************************************/
88
9#ifndef RECURSIVE_INCLUDE
10
11#include "driver.h"
129#include "poly.h"
10#include "eminline.h"
11#include "mame.h"
12#include <math.h>
1313
14
1415/***************************************************************************
16    DEBUGGING
17***************************************************************************/
1518
16    Global variables
19/* keep statistics */
20#define KEEP_STATISTICS               0
1721
22/* turn this on to log the reasons for any long waits */
23#define LOG_WAITS                  0
24
25/* number of profiling ticks before we consider a wait "long" */
26#define LOG_WAIT_THRESHOLD            1000
27
28
29
30/***************************************************************************
31    CONSTANTS
1832***************************************************************************/
1933
20static struct poly_scanline_data scanlines;
34#define SCANLINES_PER_BUCKET         8
35#define CACHE_LINE_SIZE               64         /* this is a general guess */
36#define TOTAL_BUCKETS               (512 / SCANLINES_PER_BUCKET)
37#define UNITS_PER_POLY               (100 / SCANLINES_PER_BUCKET)
2138
2239
2340
24/*------------------------------------------------------------------
25    setup_triangle_n
26------------------------------------------------------------------*/
41/***************************************************************************
42    TYPE DEFINITIONS
43***************************************************************************/
2744
28#define RECURSIVE_INCLUDE
45/* forward definitions */
46typedef struct _polygon_info polygon_info;
2947
30#define FUNC_NAME   setup_triangle_0
31#define NUM_PARAMS   0
32#include "poly.c"
33#undef NUM_PARAMS
34#undef FUNC_NAME
3548
36#define FUNC_NAME   setup_triangle_1
37#define NUM_PARAMS   1
38#include "poly.c"
39#undef NUM_PARAMS
40#undef FUNC_NAME
49/* tri_extent describes start/end points for a scanline */
50typedef struct _tri_extent tri_extent;
51struct _tri_extent
52{
53   INT16      startx;                  /* starting X coordinate (inclusive) */
54   INT16      stopx;                  /* ending X coordinate (exclusive) */
55};
4156
42#define FUNC_NAME   setup_triangle_2
43#define NUM_PARAMS   2
44#include "poly.c"
45#undef NUM_PARAMS
46#undef FUNC_NAME
4757
48#define FUNC_NAME   setup_triangle_3
49#define NUM_PARAMS   3
50#include "poly.c"
51#undef NUM_PARAMS
52#undef FUNC_NAME
58/* single set of polygon per-parameter data */
59typedef struct _poly_param poly_param;
60struct _poly_param
61{
62   float      start;                  /* parameter value at starting X,Y */
63   float      dpdx;                  /* dp/dx relative to starting X */
64   float      dpdy;                  /* dp/dy relative to starting Y */
65};
5366
54#define FUNC_NAME   setup_triangle_4
55#define NUM_PARAMS   4
56#include "poly.c"
57#undef NUM_PARAMS
58#undef FUNC_NAME
5967
60#define FUNC_NAME   setup_triangle_5
61#define NUM_PARAMS   5
62#include "poly.c"
63#undef NUM_PARAMS
64#undef FUNC_NAME
68/* poly edge is used internally for quad rendering */
69typedef struct _poly_edge poly_edge;
70struct _poly_edge
71{
72   poly_edge *         next;               /* next edge in sequence */
73   int               index;               /* index of this edge */
74   const poly_vertex *   v1;                  /* pointer to first vertex */
75   const poly_vertex *   v2;                  /* pointer to second vertex */
76   float             dxdy;               /* dx/dy along the edge */
77   float             dpdy[MAX_VERTEX_PARAMS];/* per-parameter dp/dy values */
78};
6579
66#define FUNC_NAME   setup_triangle_6
67#define NUM_PARAMS   6
68#include "poly.c"
69#undef NUM_PARAMS
70#undef FUNC_NAME
7180
81/* poly section is used internally for quad rendering */
82typedef struct _poly_section poly_section;
83struct _poly_section
84{
85   const poly_edge *   ledge;               /* pointer to left edge */
86   const poly_edge *   redge;               /* pointer to right edge */
87   float             ybottom;            /* bottom of this section */
88};
7289
73#else
7490
75const struct poly_scanline_data *FUNC_NAME(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect)
91/* work_unit_shared is a common set of data shared between tris and quads */
92typedef struct _work_unit_shared work_unit_shared;
93struct _work_unit_shared
7694{
77   INT32 i, y, dy, ey, sx, sdx, ex, edx, temp, longest_scanline;
78   INT64 pstart[MAX_VERTEX_PARAMS], pdelta[MAX_VERTEX_PARAMS];
79   const struct poly_vertex *tv;
80   struct poly_scanline *scan;
81   struct shiftclip;
95   polygon_info *      polygon;            /* pointer to polygon */
96   volatile UINT32      count_next;            /* number of scanlines and index of next item to process */
97   INT16            scanline;            /* starting scanline and count */
98   UINT16            previtem;            /* index of previous item in the same bucket */
99#ifndef PTR64
100   UINT32            dummy;               /* pad to 16 bytes */
101#endif
102};
82103
83   /* first sort by Y */
84   if (v2->y < v1->y) { tv = v1; v1 = v2; v2 = tv; }
85   if (v3->y < v2->y)
104
105/* tri_work_unit is a triangle-specific work-unit */
106typedef struct _tri_work_unit tri_work_unit;
107struct _tri_work_unit
108{
109   work_unit_shared   shared;               /* shared data */
110   tri_extent         extent[SCANLINES_PER_BUCKET]; /* array of scanline extents */
111};
112
113
114/* quad_work_unit is a quad-specific work-unit */
115typedef struct _quad_work_unit quad_work_unit;
116struct _quad_work_unit
117{
118   work_unit_shared   shared;               /* shared data */
119   poly_extent         extent[SCANLINES_PER_BUCKET]; /* array of scanline extents */
120};
121
122
123/* work_unit is a union of the two types */
124typedef union _work_unit work_unit;
125union _work_unit
126{
127   work_unit_shared   shared;               /* shared data */
128   tri_work_unit      tri;               /* triangle work unit */
129   quad_work_unit      quad;               /* quad work unit */
130};
131
132
133/* polygon_info describes a single polygon, which includes the poly_params */
134struct _polygon_info
135{
136   poly_manager *      poly;               /* pointer back to the poly manager */
137   void *            dest;               /* pointer to the destination we are rendering to */
138   void *            extra;               /* extra data pointer */
139   UINT8            numparams;            /* number of parameters for this polygon  */
140   UINT8            numverts;            /* number of vertices in this polygon */
141   poly_draw_scanline    callback;            /* callback to handle a scanline's worth of work */
142   INT32            xorigin;            /* X origin for all parameters */
143   INT32            yorigin;            /* Y origin for all parameters */
144   poly_param         param[MAX_VERTEX_PARAMS];/* array of parameter data */
145};
146
147
148/* full poly manager description */
149struct _poly_manager
150{
151   /* queue management */
152   osd_work_queue *   queue;               /* work queue */
153
154   /* triangle work units */
155   work_unit **      unit;               /* array of work unit pointers */
156   UINT32            unit_next;            /* index of next unit to allocate */
157   UINT32            unit_count;            /* number of work units available */
158   size_t            unit_size;            /* size of each work unit, in bytes */
159
160   /* quad work units */
161   UINT32            quadunit_next;         /* index of next unit to allocate */
162   UINT32            quadunit_count;         /* number of work units available */
163   size_t            quadunit_size;         /* size of each work unit, in bytes */
164
165   /* poly data */
166   polygon_info **      polygon;            /* array of polygon pointers */
167   UINT32            polygon_next;         /* index of next polygon to allocate */
168   UINT32            polygon_count;         /* number of polygon items available */
169   size_t            polygon_size;         /* size of each polygon, in bytes */
170
171   /* extra data */
172   void **            extra;               /* array of extra data pointers */
173   UINT32            extra_next;            /* index of next extra data to allocate */
174   UINT32            extra_count;         /* number of extra data items available */
175   size_t            extra_size;            /* size of each extra data, in bytes */
176
177   /* misc data */
178   UINT8            flags;               /* flags */
179
180   /* buckets */
181   UINT16            unit_bucket[TOTAL_BUCKETS]; /* buckets for tracking unit usage */
182
183   /* statistics */
184   UINT32            triangles;            /* number of triangles queued */
185   UINT32            quads;               /* number of quads queued */
186   UINT64            pixels;               /* number of pixels rendered */
187#if KEEP_STATISTICS
188   UINT32            unit_waits;            /* number of times we waited for a unit */
189   UINT32            unit_max;            /* maximum units used */
190   UINT32            polygon_waits;         /* number of times we waited for a polygon */
191   UINT32            polygon_max;         /* maximum polygons used */
192   UINT32            extra_waits;         /* number of times we waited for an extra data */
193   UINT32            extra_max;            /* maximum extra data used */
194   UINT32            conflicts[WORK_MAX_THREADS]; /* number of conflicts found, per thread */
195   UINT32            resolved[WORK_MAX_THREADS];   /* number of conflicts resolved, per thread */
196#endif
197};
198
199
200
201/***************************************************************************
202    FUNCTION PROTOTYPES
203***************************************************************************/
204
205static void **allocate_array(size_t *itemsize, UINT32 itemcount);
206static void free_array(void **array);
207static void *poly_item_callback(void *param, int threadid);
208
209
210
211/***************************************************************************
212    INLINE FUNCTIONS
213***************************************************************************/
214
215/*-------------------------------------------------
216    round_coordinate - round a coordinate to
217    an integer, following rules that 0.5 rounds
218    down
219-------------------------------------------------*/
220
221INLINE INT32 round_coordinate(float value)
222{
223   INT32 result = floor(value);
224   return result + (value - (float)result > 0.5f);
225}
226
227
228/*-------------------------------------------------
229    convert_tri_extent_to_poly_extent - convert
230    a simple tri_extent to a full poly_extent
231-------------------------------------------------*/
232
233INLINE void convert_tri_extent_to_poly_extent(poly_extent *dstextent, const tri_extent *srcextent, const polygon_info *polygon, INT32 y)
234{
235   /* copy start/stop always */
236   dstextent->startx = srcextent->startx;
237   dstextent->stopx = srcextent->stopx;
238
239   /* if we have parameters, process them as well */
240   if (polygon->numparams > 0)
86241   {
87      tv = v2; v2 = v3; v3 = tv;
88      if (v2->y < v1->y) { tv = v1; v1 = v2; v2 = tv; }
242      float dx = srcextent->startx - polygon->xorigin;
243      float dy = y - polygon->yorigin;
244      int paramnum;
245
246      /* iterate over parameters */
247      for (paramnum = 0; paramnum < polygon->numparams; paramnum++)
248      {
249         dstextent->param[paramnum].start = polygon->param[paramnum].start + dx * polygon->param[paramnum].dpdx + dy * polygon->param[paramnum].dpdy;
250         dstextent->param[paramnum].dpdx = polygon->param[paramnum].dpdx;
251      }
89252   }
253}
90254
91   /* see if we're on-screen */
92   if (v1->y > cliprect->max_y || v3->y < cliprect->min_y)
93      return NULL;
94   if ((v1->x < cliprect->min_x && v2->x < cliprect->min_x && v3->x < cliprect->min_x) ||
95      (v1->x > cliprect->max_x && v2->x > cliprect->max_x && v3->x > cliprect->max_x))
96      return NULL;
97255
98   /* set the final start/end Y values */
99   scanlines.sy = (v1->y < cliprect->min_y) ? cliprect->min_y : v1->y;
100   scanlines.ey = (v3->y > cliprect->max_y) ? cliprect->max_y : v3->y - 1;
256/*-------------------------------------------------
257    interpolate_vertex - interpolate values in
258    a vertex based on p[0] crossing the clipval
259-------------------------------------------------*/
101260
102   /* imagine the triangle divided into two parts vertically, splitting at v2:
261INLINE void interpolate_vertex(poly_vertex *outv, const poly_vertex *v1, const poly_vertex *v2, int paramcount, float clipval)
262{
263   float frac = (clipval - v1->p[0]) / (v2->p[0] - v1->p[0]);
264   int paramnum;
103265
104                * (v1)          ------- part 1 starts here
266   /* create a new one at the intersection point */
267   outv->x = v1->x + frac * (v2->x - v1->x);
268   outv->y = v1->y + frac * (v2->y - v1->y);
269   for (paramnum = 0; paramnum < paramcount; paramnum++)
270      outv->p[paramnum] = v1->p[paramnum] + frac * (v2->p[paramnum] - v1->p[paramnum]);
271}
105272
106        (v2) *                  ------- part 1 ends here, part 2 starts here
107273
108                    * (v3)      ------- part 2 ends here
109    */
274/*-------------------------------------------------
275    copy_vertex - copy vertex data from one to
276    another
277-------------------------------------------------*/
110278
111   /* determine what portion of the triangle lives in the upper part (16.16) */
112   temp = v3->y - v1->y;
113   if (temp <= 0)
114      return NULL;
115   temp = ((v2->y - v1->y) << 16) / temp;
279INLINE void copy_vertex(poly_vertex *outv, const poly_vertex *v, int paramcount)
280{
281   int paramnum;
116282
117   /* compute the length of the longest scanline; this is the dx from v1 to v2 */
118   /* plus the fractional portion of the dx from v1 to v3 at the boundary between */
119   /* the two parts (16.16) */
120   longest_scanline = ((v1->x - v2->x) << 16) + temp * (v3->x - v1->x);
283   outv->x = v->x;
284   outv->y = v->y;
285   for (paramnum = 0; paramnum < paramcount; paramnum++)
286      outv->p[paramnum] = v->p[paramnum];
287}
121288
122   /* if the longest scanline is 0, early out */
123   if (longest_scanline == 0)
124      return NULL;
125289
126   /* the per-pixel deltas for the parameters will be constant across the entire */
127   /* surface of the triangle, so compute those up front (16.16) */
128   if (NUM_PARAMS >= 0)
290/*-------------------------------------------------
291    allocate_polygon - allocate a new polygon
292    object, blocking if we run out
293-------------------------------------------------*/
294
295INLINE polygon_info *allocate_polygon(poly_manager *poly, int miny, int maxy)
296{
297   /* wait for a work item if we have to */
298   if (poly->polygon_next + 1 > poly->polygon_count)
129299   {
130      INT64 value = ((INT64)(v1->p[0] - v2->p[0]) << 32) + (INT64)temp * ((INT64)(v3->p[0] - v1->p[0]) << 16);
131      scanlines.dp[0] = value / longest_scanline;
300      poly_wait(poly, "Out of polygons");
301#if KEEP_STATISTICS
302      poly->polygon_waits++;
303#endif
132304   }
133   if (NUM_PARAMS >= 1)
305   else if (poly->unit_next + (maxy - miny) / SCANLINES_PER_BUCKET + 2 > poly->unit_count)
134306   {
135      INT64 value = ((INT64)(v1->p[1] - v2->p[1]) << 32) + (INT64)temp * ((INT64)(v3->p[1] - v1->p[1]) << 16);
136      scanlines.dp[1] = value / longest_scanline;
307      poly_wait(poly, "Out of work units");
308#if KEEP_STATISTICS
309      poly->unit_waits++;
310#endif
137311   }
138   if (NUM_PARAMS >= 2)
312#if KEEP_STATISTICS
313   poly->polygon_max = MAX(poly->polygon_max, poly->polygon_next + 1);
314#endif
315   return poly->polygon[poly->polygon_next++];
316}
317
318
319
320/***************************************************************************
321    INITIALIZATION/TEARDOWN
322***************************************************************************/
323
324/*-------------------------------------------------
325    poly_alloc - initialize a new polygon
326    manager
327-------------------------------------------------*/
328
329poly_manager *poly_alloc(int max_polys, size_t extra_data_size, UINT8 flags)
330{
331   poly_manager *poly;
332
333   /* allocate the manager itself */
334   poly = malloc_or_die(sizeof(*poly));
335   memset(poly, 0, sizeof(*poly));
336   poly->flags = flags;
337
338   /* allocate polygons */
339   poly->polygon_size = sizeof(polygon_info);
340   poly->polygon_count = MAX(max_polys, 1);
341   poly->polygon_next = 0;
342   poly->polygon = (polygon_info **)allocate_array(&poly->polygon_size, poly->polygon_count);
343
344   /* allocate extra data */
345   poly->extra_size = extra_data_size;
346   poly->extra_count = poly->polygon_count;
347   poly->extra_next = 1;
348   poly->extra = allocate_array(&poly->extra_size, poly->extra_count);
349
350   /* allocate triangle work units */
351   poly->unit_size = (flags & POLYFLAG_ALLOW_QUADS) ? sizeof(quad_work_unit) : sizeof(tri_work_unit);
352   poly->unit_count = MIN(poly->polygon_count * UNITS_PER_POLY, 65535);
353   poly->unit_next = 0;
354   poly->unit = (work_unit **)allocate_array(&poly->unit_size, poly->unit_count);
355
356   /* create the work queue */
357   if (!(flags & POLYFLAG_NO_WORK_QUEUE))
358      poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
359   return poly;
360}
361
362
363/*-------------------------------------------------
364    poly_free - free a polygon manager
365-------------------------------------------------*/
366
367void poly_free(poly_manager *poly)
368{
369#if KEEP_STATISTICS
370{
371   int i, conflicts = 0, resolved = 0;
372   for (i = 0; i < ARRAY_LENGTH(poly->conflicts); i++)
139373   {
140      INT64 value = ((INT64)(v1->p[2] - v2->p[2]) << 32) + (INT64)temp * ((INT64)(v3->p[2] - v1->p[2]) << 16);
141      scanlines.dp[2] = value / longest_scanline;
374      conflicts += poly->conflicts[i];
375      resolved += poly->resolved[i];
142376   }
143   if (NUM_PARAMS >= 3)
377   printf("Total triangles = %d\n", poly->triangles);
378   printf("Total quads = %d\n", poly->quads);
379   if (poly->pixels > 1000000000)
380      printf("Total pixels   = %d%09d\n", (UINT32)(poly->pixels / 1000000000), (UINT32)(poly->pixels % 1000000000));
381   else
382      printf("Total pixels   = %d\n", (UINT32)poly->pixels);
383   printf("Conflicts:  %d resolved, %d total\n", resolved, conflicts);
384   printf("Units:      %5d used, %5d allocated, %5d waits, %4d bytes each, %7d total\n", poly->unit_max, poly->unit_count, poly->unit_waits, poly->unit_size, poly->unit_count * poly->unit_size);
385   printf("Polygons:   %5d used, %5d allocated, %5d waits, %4d bytes each, %7d total\n", poly->polygon_max, poly->polygon_count, poly->polygon_waits, poly->polygon_size, poly->polygon_count * poly->polygon_size);
386   printf("Extra data: %5d used, %5d allocated, %5d waits, %4d bytes each, %7d total\n", poly->extra_max, poly->extra_count, poly->extra_waits, poly->extra_size, poly->extra_count * poly->extra_size);
387}
388#endif
389
390   /* free the work queue */
391   if (poly->queue != NULL)
392      osd_work_queue_free(poly->queue);
393
394   /* free the arrays */
395   free_array(poly->extra);
396   free_array((void **)poly->polygon);
397   free_array((void **)poly->unit);
398
399   /* free the manager itself */
400   free(poly);
401}
402
403
404
405/***************************************************************************
406    COMMON FUNCTIONS
407***************************************************************************/
408
409/*-------------------------------------------------
410    poly_wait - wait for all pending rendering
411    to complete
412-------------------------------------------------*/
413
414void poly_wait(poly_manager *poly, const char *debug_reason)
415{
416   osd_ticks_t time;
417
418   /* remember the start time if we're logging */
419   if (LOG_WAITS)
420      time = osd_profiling_ticks();
421
422   /* wait for all pending work items to complete */
423   if (poly->queue != NULL)
424      osd_work_queue_wait(poly->queue, osd_ticks_per_second() * 100);
425
426   /* if we don't have a queue, just run the whole list now */
427   else
144428   {
145      INT64 value = ((INT64)(v1->p[3] - v2->p[3]) << 32) + (INT64)temp * ((INT64)(v3->p[3] - v1->p[3]) << 16);
146      scanlines.dp[3] = value / longest_scanline;
429      int unitnum;
430      for (unitnum = 0; unitnum < poly->unit_next; unitnum++)
431         poly_item_callback(poly->unit[unitnum], 0);
147432   }
148   if (NUM_PARAMS >= 4)
433
434   /* log any long waits */
435   if (LOG_WAITS)
149436   {
150      INT64 value = ((INT64)(v1->p[4] - v2->p[4]) << 32) + (INT64)temp * ((INT64)(v3->p[4] - v1->p[4]) << 16);
151      scanlines.dp[4] = value / longest_scanline;
437      time = osd_profiling_ticks() - time;
438      if (time > LOG_WAIT_THRESHOLD)
439         logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason);
152440   }
153   if (NUM_PARAMS >= 5)
441
442   /* reset the state */
443   poly->polygon_next = poly->unit_next = 0;
444   memset(poly->unit_bucket, 0xff, sizeof(poly->unit_bucket));
445
446   /* we need to preserve the last extra data that was supplied */
447   if (poly->extra_next > 1)
448      memcpy(poly->extra[0], poly->extra[poly->extra_next - 1], poly->extra_size);
449   poly->extra_next = 1;
450}
451
452
453/*-------------------------------------------------
454    poly_get_extra_data - get a pointer to the
455    extra data for the next polygon
456-------------------------------------------------*/
457
458void *poly_get_extra_data(poly_manager *poly)
459{
460   /* wait for a work item if we have to */
461   if (poly->extra_next + 1 > poly->extra_count)
154462   {
155      INT64 value = ((INT64)(v1->p[5] - v2->p[5]) << 32) + (INT64)temp * ((INT64)(v3->p[5] - v1->p[5]) << 16);
156      scanlines.dp[5] = value / longest_scanline;
463      poly_wait(poly, "Out of extra data");
464#if KEEP_STATISTICS
465      poly->extra_waits++;
466#endif
157467   }
158468
159   /* if the longest scanline was negative, the middle vertex is to the right */
160   if (longest_scanline < 0)
161   {
162      /* the target vertex for the left side is v3 */
163      tv = v3;
469   /* return a pointer to the extra data for the next item */
470#if KEEP_STATISTICS
471   poly->extra_max = MAX(poly->extra_max, poly->extra_next + 1);
472#endif
473   return poly->extra[poly->extra_next++];
474}
164475
165      /* compute the height of the first part of the triangle */
166      dy = v2->y - v1->y;
167476
168      /* start the right hand counter at v1's X */
169      ex = v1->x;
170477
171      /* if there's nothing to draw in part 1, move on to part 2 */
172      if (dy <= 0)
173      {
174         /* the new height is the height of part 2 */
175         dy = v3->y - v2->y;
478/***************************************************************************
479    CORE TRIANGLE RENDERING
480***************************************************************************/
176481
177         /* start the right hand counter at v2's X */
178         ex = v2->x;
482/*-------------------------------------------------
483    poly_render_triangle - render a single
484    triangle given 3 vertexes
485-------------------------------------------------*/
179486
180         /* and match up the last two vertices so that we come out all right in the end */
181         v2 = v3;
487UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3)
488{
489   float dxdy_v1v2, dxdy_v1v3, dxdy_v2v3;
490   const poly_vertex *tv;
491   INT32 curscan, scaninc;
492   polygon_info *polygon;
493   INT32 v1yclip, v3yclip;
494   INT32 v1y, v3y, v1x;
495   INT32 pixels = 0;
496   UINT32 startunit;
497
498   /* first sort by Y */
499   if (v2->y < v1->y)
500   {
501      tv = v1;
502      v1 = v2;
503      v2 = tv;
504   }
505   if (v3->y < v2->y)
506   {
507      tv = v2;
508      v2 = v3;
509      v3 = tv;
510      if (v2->y < v1->y)
511      {
512         tv = v1;
513         v1 = v2;
514         v2 = tv;
182515      }
516   }
183517
184      /* compute the final parameters for the right hand slope */
185      edx = ((v2->x - ex) << 16) / dy;
186      ex = (ex << 16) | 0xffff;
518   /* compute some integral X/Y vertex values */
519   v1x = round_coordinate(v1->x);
520   v1y = round_coordinate(v1->y);
521   v3y = round_coordinate(v3->y);
522
523   /* clip coordinates */
524   v1yclip = v1y;
525   v3yclip = v3y + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
526   if (cliprect != NULL)
527   {
528      v1yclip = MAX(v1yclip, cliprect->min_y);
529      v3yclip = MIN(v3yclip, cliprect->max_y + 1);
187530   }
531   if (v3yclip - v1yclip <= 0)
532      return 0;
188533
189   /* if the longest scanline was positive, the middle vertex is to the left */
190   else
534   /* allocate a new polygon */
535   polygon = allocate_polygon(poly, v1yclip, v3yclip);
536
537   /* fill in the polygon information */
538   polygon->poly = poly;
539   polygon->dest = dest;
540   polygon->callback = callback;
541   polygon->extra = poly->extra[poly->extra_next - 1];
542   polygon->numparams = paramcount;
543   polygon->numverts = 3;
544
545   /* set the start X/Y coordinates */
546   polygon->xorigin = v1x;
547   polygon->yorigin = v1y;
548
549   /* compute the slopes for each portion of the triangle */
550   dxdy_v1v2 = (v2->y == v1->y) ? 0.0f : (v2->x - v1->x) / (v2->y - v1->y);
551   dxdy_v1v3 = (v3->y == v1->y) ? 0.0f : (v3->x - v1->x) / (v3->y - v1->y);
552   dxdy_v2v3 = (v3->y == v2->y) ? 0.0f : (v3->x - v2->x) / (v3->y - v2->y);
553
554   /* compute the X extents for each scanline */
555   startunit = poly->unit_next;
556   for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc)
191557   {
192      /* start the right hand counter at v1's X */
193      ex = v1->x;
558      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
559      UINT32 unit_index = poly->unit_next++;
560      tri_work_unit *unit = &poly->unit[unit_index]->tri;
561      int extnum;
194562
195      /* compute the final parameters for the right hand slope */
196      /* which is guaranteed to be v1->v3, unlike the case above */
197      edx = ((v3->x - ex) << 16) / (v3->y - v1->y);
198      ex = (ex << 16) | 0xffff;
563      /* determine how much to advance to hit the next bucket */
564      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
199565
200      /* compute the height of the first part of the triangle */
201      dy = v2->y - v1->y;
566      /* fill in the work unit basics */
567      unit->shared.polygon = polygon;
568      unit->shared.count_next = MIN(v3yclip - curscan, scaninc);
569      unit->shared.scanline = curscan;
570      unit->shared.previtem = poly->unit_bucket[bucketnum];
571      poly->unit_bucket[bucketnum] = unit_index;
202572
203      /* if there's nothing to draw in part 1, move on to part 2 */
204      if (dy <= 0)
573      /* iterate over extents */
574      for (extnum = 0; extnum < unit->shared.count_next; extnum++)
205575      {
206         /* the new height is the height of part 2 */
207         dy = v3->y - v2->y;
576         float fully = (float)(curscan + extnum) + 0.5f;
577         float startx = v1->x + (fully - v1->y) * dxdy_v1v3;
578         float stopx;
579         INT32 istartx, istopx;
208580
209         /* shuffle the remaining vertices to make it come out all right in the end */
210         v1 = v2;
211         v2 = v3;
581         /* compute the ending X based on which part of the triangle we're in */
582         if (fully < v2->y)
583            stopx = v1->x + (fully - v1->y) * dxdy_v1v2;
584         else
585            stopx = v2->x + (fully - v2->y) * dxdy_v2v3;
586
587         /* clamp to full pixels */
588         istartx = round_coordinate(startx);
589         istopx = round_coordinate(stopx);
590
591         /* force start < stop */
592         if (istartx > istopx)
593         {
594            INT32 temp = istartx;
595            istartx = istopx;
596            istopx = temp;
597         }
598
599         /* include the right edge if requested */
600         if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
601            istopx++;
602
603         /* apply left/right clipping */
604         if (cliprect != NULL)
605         {
606            if (istartx < cliprect->min_x)
607               istartx = cliprect->min_x;
608            if (istopx > cliprect->max_x)
609               istopx = cliprect->max_x + 1;
610         }
611
612         /* set the extent and update the total pixel count */
613         if (istartx >= istopx)
614            istartx = istopx = 0;
615         unit->extent[extnum].startx = istartx;
616         unit->extent[extnum].stopx = istopx;
617         pixels += istopx - istartx;
212618      }
619   }
620#if KEEP_STATISTICS
621   poly->unit_max = MAX(poly->unit_max, poly->unit_next);
622#endif
213623
214      /* the target vertex for the left side is v2 */
215      tv = v2;
624   /* compute parameter starting points and deltas */
625   if (paramcount > 0)
626   {
627      float divisor, dx1, dx2, dy1, dy2, xoffset, yoffset;
628      int paramnum;
629
630      /* compute the divisor */
631      divisor = 1.0f / ((v1->x - v2->x) * (v1->y - v3->y) - (v1->x - v3->x) * (v1->y - v2->y));
632
633      /* compute the dx/dy values */
634      dx1 = v1->y - v3->y;
635      dx2 = v1->y - v2->y;
636      dy1 = v1->x - v2->x;
637      dy2 = v1->x - v3->x;
638
639      /* determine x/y offset for subpixel correction so that the starting values are
640           relative to the integer coordinates */
641      xoffset = v1->x - ((float)polygon->xorigin + 0.5f);
642      yoffset = v1->y - ((float)polygon->yorigin + 0.5f);
643
644      /* iterate over parameters */
645      for (paramnum = 0; paramnum < paramcount; paramnum++)
646      {
647         poly_param *params = &polygon->param[paramnum];
648         params->dpdx = ((v1->p[paramnum] - v2->p[paramnum]) * dx1 - (v1->p[paramnum] - v3->p[paramnum]) * dx2) * divisor;
649         params->dpdy = ((v1->p[paramnum] - v3->p[paramnum]) * dy1 - (v1->p[paramnum] - v2->p[paramnum]) * dy2) * divisor;
650         params->start = v1->p[paramnum] - xoffset * params->dpdx - yoffset * params->dpdy;
651      }
216652   }
217653
218   /* compute the parameters for the left hand slope */
219   sx = v1->x;
220   temp = tv->y - v1->y;
221   sdx = ((tv->x - sx) << 16) / temp;
222   sx = (sx << 16) | 0xffff;
654   /* enqueue the work items */
655   if (poly->queue != NULL)
656      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
223657
224   /* set up the starting values and per-scanline deltas for the parameters */
225   if (NUM_PARAMS >= 0)
658   /* return the total number of pixels in the triangle */
659   poly->triangles++;
660   poly->pixels += pixels;
661   return pixels;
662}
663
664
665/*-------------------------------------------------
666    poly_render_triangle_fan - render a set of
667    triangles in a fan
668-------------------------------------------------*/
669
670UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
671{
672   UINT32 pixels = 0;
673   int vertnum;
674
675   /* iterate over vertices */
676   for (vertnum = 2; vertnum < numverts; vertnum++)
677      pixels += poly_render_triangle(poly, dest, cliprect, callback, paramcount, &v[0], &v[vertnum - 1], &v[vertnum]);
678   return pixels;
679}
680
681
682/*-------------------------------------------------
683    poly_render_triangle_custom - perform a custom
684    render of an object, given specific extents
685-------------------------------------------------*/
686
687UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const poly_extent *extents)
688{
689   INT32 curscan, scaninc;
690   polygon_info *polygon;
691   INT32 v1yclip, v3yclip;
692   INT32 pixels = 0;
693   UINT32 startunit;
694
695   /* clip coordinates */
696   if (cliprect != NULL)
226697   {
227      pstart[0] = ((INT64)v1->p[0] << 16) | 0x8000;
228      pdelta[0] = ((INT64)(tv->p[0] - v1->p[0]) << 16) / temp;
698      v1yclip = MAX(startscanline, cliprect->min_y);
699      v3yclip = MIN(startscanline + numscanlines, cliprect->max_y + 1);
229700   }
230   if (NUM_PARAMS >= 1)
701   else
231702   {
232      pstart[1] = ((INT64)v1->p[1] << 16) | 0x8000;
233      pdelta[1] = ((INT64)(tv->p[1] - v1->p[1]) << 16) / temp;
703      v1yclip = startscanline;
704      v3yclip = startscanline + numscanlines;
234705   }
235   if (NUM_PARAMS >= 2)
706   if (v3yclip - v1yclip <= 0)
707      return 0;
708
709   /* allocate a new polygon */
710   polygon = allocate_polygon(poly, v1yclip, v3yclip);
711
712   /* fill in the polygon information */
713   polygon->poly = poly;
714   polygon->dest = dest;
715   polygon->callback = callback;
716   polygon->extra = poly->extra[poly->extra_next - 1];
717   polygon->numparams = 0;
718   polygon->numverts = 3;
719
720   /* compute the X extents for each scanline */
721   startunit = poly->unit_next;
722   for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc)
236723   {
237      pstart[2] = ((INT64)v1->p[2] << 16) | 0x8000;
238      pdelta[2] = ((INT64)(tv->p[2] - v1->p[2]) << 16) / temp;
724      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
725      UINT32 unit_index = poly->unit_next++;
726      tri_work_unit *unit = &poly->unit[unit_index]->tri;
727      int extnum;
728
729      /* determine how much to advance to hit the next bucket */
730      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
731
732      /* fill in the work unit basics */
733      unit->shared.polygon = polygon;
734      unit->shared.count_next = MIN(v3yclip - curscan, scaninc);
735      unit->shared.scanline = curscan;
736      unit->shared.previtem = poly->unit_bucket[bucketnum];
737      poly->unit_bucket[bucketnum] = unit_index;
738
739      /* iterate over extents */
740      for (extnum = 0; extnum < unit->shared.count_next; extnum++)
741      {
742         const poly_extent *extent = &extents[(curscan + extnum) - startscanline];
743         INT32 istartx = extent->startx, istopx = extent->stopx;
744
745         /* force start < stop */
746         if (istartx > istopx)
747         {
748            INT32 temp = istartx;
749            istartx = istopx;
750            istopx = temp;
751         }
752
753         /* apply left/right clipping */
754         if (cliprect != NULL)
755         {
756            if (istartx < cliprect->min_x)
757               istartx = cliprect->min_x;
758            if (istopx > cliprect->max_x)
759               istopx = cliprect->max_x + 1;
760         }
761
762         /* set the extent and update the total pixel count */
763         unit->extent[extnum].startx = istartx;
764         unit->extent[extnum].stopx = istopx;
765         if (istartx < istopx)
766            pixels += istopx - istartx;
767      }
239768   }
240   if (NUM_PARAMS >= 3)
769#if KEEP_STATISTICS
770   poly->unit_max = MAX(poly->unit_max, poly->unit_next);
771#endif
772
773   /* enqueue the work items */
774   if (poly->queue != NULL)
775      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
776
777   /* return the total number of pixels in the object */
778   poly->triangles++;
779   poly->pixels += pixels;
780   return pixels;
781}
782
783
784
785/***************************************************************************
786    CORE QUAD RENDERING
787***************************************************************************/
788
789/*-------------------------------------------------
790    poly_render_quad - render a single quad
791    given 4 vertexes
792-------------------------------------------------*/
793
794UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4)
795{
796   poly_edge fedgelist[3], bedgelist[3];
797   const poly_edge *ledge, *redge;
798   const poly_vertex *v[4];
799   poly_edge *edgeptr;
800   int minv, maxv, curv;
801   INT32 minyclip, maxyclip;
802   INT32 miny, maxy;
803   INT32 curscan, scaninc;
804   polygon_info *polygon;
805   INT32 pixels = 0;
806   UINT32 startunit;
807
808   assert(poly->flags & POLYFLAG_ALLOW_QUADS);
809
810   /* arrays make things easier */
811   v[0] = v1;
812   v[1] = v2;
813   v[2] = v3;
814   v[3] = v4;
815
816   /* determine min/max Y vertices */
817   if (v[1]->y < v[0]->y)
818      minv = 1, maxv = 0;
819   else
820      minv = 0, maxv = 1;
821   if (v[2]->y < v[minv]->y)
822      minv = 2;
823   else if (v[2]->y > v[maxv]->y)
824      maxv = 2;
825   if (v[3]->y < v[minv]->y)
826      minv = 3;
827   else if (v[3]->y > v[maxv]->y)
828      maxv = 3;
829
830   /* determine start/end scanlines */
831   miny = round_coordinate(v[minv]->y);
832   maxy = round_coordinate(v[maxv]->y);
833
834   /* clip coordinates */
835   minyclip = miny;
836   maxyclip = maxy + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
837   if (cliprect != NULL)
241838   {
242      pstart[3] = ((INT64)v1->p[3] << 16) | 0x8000;
243      pdelta[3] = ((INT64)(tv->p[3] - v1->p[3]) << 16) / temp;
839      minyclip = MAX(minyclip, cliprect->min_y);
840      maxyclip = MIN(maxyclip, cliprect->max_y + 1);
244841   }
245   if (NUM_PARAMS >= 4)
842   if (maxyclip - minyclip <= 0)
843      return 0;
844
845   /* allocate a new polygon */
846   polygon = allocate_polygon(poly, minyclip, maxyclip);
847
848   /* fill in the polygon information */
849   polygon->poly = poly;
850   polygon->dest = dest;
851   polygon->callback = callback;
852   polygon->extra = poly->extra[poly->extra_next - 1];
853   polygon->numparams = paramcount;
854   polygon->numverts = 4;
855
856   /* walk forward to build up the forward edge list */
857   edgeptr = &fedgelist[0];
858   for (curv = minv; curv != maxv; curv = (curv + 1) & 3)
246859   {
247      pstart[4] = ((INT64)v1->p[4] << 16) | 0x8000;
248      pdelta[4] = ((INT64)(tv->p[4] - v1->p[4]) << 16) / temp;
860      int paramnum;
861      float ooy;
862
863      /* set the two vertices */
864      edgeptr->v1 = v[curv];
865      edgeptr->v2 = v[(curv + 1) & 3];
866
867      /* if horizontal, skip altogether */
868      if (edgeptr->v1->y == edgeptr->v2->y)
869         continue;
870
871      /* need dx/dy always, and parameter deltas as necessary */
872      ooy = 1.0f / (edgeptr->v2->y - edgeptr->v1->y);
873      edgeptr->dxdy = (edgeptr->v2->x - edgeptr->v1->x) * ooy;
874      for (paramnum = 0; paramnum < paramcount; paramnum++)
875         edgeptr->dpdy[paramnum] = (edgeptr->v2->p[paramnum] - edgeptr->v1->p[paramnum]) * ooy;
876      edgeptr++;
249877   }
250   if (NUM_PARAMS >= 5)
878
879   /* walk backward to build up the backward edge list */
880   edgeptr = &bedgelist[0];
881   for (curv = minv; curv != maxv; curv = (curv - 1) & 3)
251882   {
252      pstart[5] = ((INT64)v1->p[5] << 16) | 0x8000;
253      pdelta[5] = ((INT64)(tv->p[5] - v1->p[5]) << 16) / temp;
883      int paramnum;
884      float ooy;
885
886      /* set the two vertices */
887      edgeptr->v1 = v[curv];
888      edgeptr->v2 = v[(curv - 1) & 3];
889
890      /* if horizontal, skip altogether */
891      if (edgeptr->v1->y == edgeptr->v2->y)
892         continue;
893
894      /* need dx/dy always, and parameter deltas as necessary */
895      ooy = 1.0f / (edgeptr->v2->y - edgeptr->v1->y);
896      edgeptr->dxdy = (edgeptr->v2->x - edgeptr->v1->x) * ooy;
897      for (paramnum = 0; paramnum < paramcount; paramnum++)
898         edgeptr->dpdy[paramnum] = (edgeptr->v2->p[paramnum] - edgeptr->v1->p[paramnum]) * ooy;
899      edgeptr++;
254900   }
255901
256   /* set up everything for the big loop */
257   scan = &scanlines.scanline[0];
258   y = v1->y;
259   ey = (v3->y < cliprect->max_y) ? v3->y : cliprect->max_y;
902   /* determine which list is left/right: */
903   /* if the first vertex is shared, compare the slopes */
904   /* if the first vertex is not shared, compare the X coordinates */
905   if ((fedgelist[0].v1 == bedgelist[0].v1 && fedgelist[0].dxdy < bedgelist[0].dxdy) ||
906      (fedgelist[0].v1 != bedgelist[0].v1 && fedgelist[0].v1->x < bedgelist[0].v1->x))
907   {
908      ledge = fedgelist;
909      redge = bedgelist;
910   }
911   else
912   {
913      ledge = bedgelist;
914      redge = fedgelist;
915   }
260916
261   /* loop until finished */
262   while (1)
917   /* compute the X extents for each scanline */
918   startunit = poly->unit_next;
919   for (curscan = minyclip; curscan < maxyclip; curscan += scaninc)
263920   {
264      /* handle top clipping */
265      if (y < cliprect->min_y)
266      {
267         /* get the delta */
268         temp = cliprect->min_y - y;
921      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
922      UINT32 unit_index = poly->unit_next++;
923      quad_work_unit *unit = &poly->unit[unit_index]->quad;
924      int extnum;
269925
270         /* limit to the number of scanlines */
271         if (temp > dy)
272            temp = dy;
273         dy -= temp;
926      /* determine how much to advance to hit the next bucket */
927      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
274928
275         /* adjust x,y and all the parameters */
276         y += temp;
277         sx += sdx * temp;
278         ex += edx * temp;
279         if (NUM_PARAMS >= 0) pstart[0] += pdelta[0] * temp;
280         if (NUM_PARAMS >= 1) pstart[1] += pdelta[1] * temp;
281         if (NUM_PARAMS >= 2) pstart[2] += pdelta[2] * temp;
282         if (NUM_PARAMS >= 3) pstart[3] += pdelta[3] * temp;
283         if (NUM_PARAMS >= 4) pstart[4] += pdelta[4] * temp;
284         if (NUM_PARAMS >= 5) pstart[5] += pdelta[5] * temp;
285      }
929      /* fill in the work unit basics */
930      unit->shared.polygon = polygon;
931      unit->shared.count_next = MIN(maxyclip - curscan, scaninc);
932      unit->shared.scanline = curscan;
933      unit->shared.previtem = poly->unit_bucket[bucketnum];
934      poly->unit_bucket[bucketnum] = unit_index;
286935
287      /* loop over scanlines */
288      for (i = 0; i < dy; i++)
936      /* iterate over extents */
937      for (extnum = 0; extnum < unit->shared.count_next; extnum++)
289938      {
290         /* out at the bottom */
291         if (y > ey)
292            break;
939         float fully = (float)(curscan + extnum) + 0.5f;
940         float startx, stopx;
941         INT32 istartx, istopx;
942         int paramnum;
293943
294         /* set the X start/end points */
295         scan->sx = sx >> 16;
296         scan->ex = (ex >> 16) - 1;
944         /* compute the ending X based on which part of the triangle we're in */
945         while (fully > ledge->v2->y && fully < v[maxv]->y)
946            ledge++;
947         while (fully > redge->v2->y && fully < v[maxv]->y)
948            redge++;
949         startx = ledge->v1->x + (fully - ledge->v1->y) * ledge->dxdy;
950         stopx = redge->v1->x + (fully - redge->v1->y) * redge->dxdy;
297951
298         /* compute the parameters only for non-zero scanlines */
299         temp = (ex >> 16) - (sx >> 16);
300         if (temp > 0)
952         /* clamp to full pixels */
953         istartx = round_coordinate(startx);
954         istopx = round_coordinate(stopx);
955
956         /* compute parameter starting points and deltas */
957         if (paramcount > 0)
301958         {
302            if (NUM_PARAMS >= 0)
959            float ldy = fully - ledge->v1->y;
960            float rdy = fully - redge->v1->y;
961            float oox = 1.0f / (stopx - startx);
962
963            /* iterate over parameters */
964            for (paramnum = 0; paramnum < paramcount; paramnum++)
303965            {
304               /* in order to get accurate texturing, we need to account for the fractional */
305               /* pixel we just chopped off */
306               temp = ~sx & 0xffff;
307               scan->p[0] = pstart[0] + ((temp * scanlines.dp[0]) >> 16);
966               float lparam = ledge->v1->p[paramnum] + ldy * ledge->dpdy[paramnum];
967               float rparam = redge->v1->p[paramnum] + rdy * redge->dpdy[paramnum];
968               float dpdx = (rparam - lparam) * oox;
969
970               unit->extent[extnum].param[paramnum].start = lparam;// - ((float)istartx + 0.5f) * dpdx;
971               unit->extent[extnum].param[paramnum].dpdx = dpdx;
308972            }
309            if (NUM_PARAMS >= 1) scan->p[1] = pstart[1] + ((temp * scanlines.dp[1]) >> 16);
310            if (NUM_PARAMS >= 2) scan->p[2] = pstart[2] + ((temp * scanlines.dp[2]) >> 16);
311            if (NUM_PARAMS >= 3) scan->p[3] = pstart[3] + ((temp * scanlines.dp[3]) >> 16);
312            if (NUM_PARAMS >= 4) scan->p[4] = pstart[4] + ((temp * scanlines.dp[4]) >> 16);
313            if (NUM_PARAMS >= 5) scan->p[5] = pstart[5] + ((temp * scanlines.dp[5]) >> 16);
314973         }
315         scan++;
316974
317         /* update the parameters */
318         y += 1;
319         sx += sdx;
320         ex += edx;
321         if (NUM_PARAMS >= 0) pstart[0] += pdelta[0];
322         if (NUM_PARAMS >= 1) pstart[1] += pdelta[1];
323         if (NUM_PARAMS >= 2) pstart[2] += pdelta[2];
324         if (NUM_PARAMS >= 3) pstart[3] += pdelta[3];
325         if (NUM_PARAMS >= 4) pstart[4] += pdelta[4];
326         if (NUM_PARAMS >= 5) pstart[5] += pdelta[5];
975         /* include the right edge if requested */
976         if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
977            istopx++;
978
979         /* apply left/right clipping */
980         if (cliprect != NULL)
981         {
982            if (istartx < cliprect->min_x)
983            {
984               for (paramnum = 0; paramnum < paramcount; paramnum++)
985                  unit->extent[extnum].param[paramnum].start += (cliprect->min_x - istartx) * unit->extent[extnum].param[paramnum].dpdx;
986               istartx = cliprect->min_x;
987            }
988            if (istopx > cliprect->max_x)
989               istopx = cliprect->max_x + 1;
990         }
991
992         /* set the extent and update the total pixel count */
993         if (istartx >= istopx)
994            istartx = istopx = 0;
995         unit->extent[extnum].startx = istartx;
996         unit->extent[extnum].stopx = istopx;
997         pixels += istopx - istartx;
327998      }
999   }
1000#if KEEP_STATISTICS
1001   poly->unit_max = MAX(poly->unit_max, poly->unit_next);
1002#endif
3281003
329      /* out at the bottom */
330      if (y > ey)
331         break;
1004   /* enqueue the work items */
1005   if (poly->queue != NULL)
1006      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
3321007
333      /* compute the height of part 2 */
334      dy = v3->y - y;
335      if (dy <= 0)
336         break;
1008   /* return the total number of pixels in the triangle */
1009   poly->quads++;
1010   poly->pixels += pixels;
1011   return pixels;
1012}
3371013
338      /* if the longest scanline was negative, the middle vertex is to the right */
339      if (longest_scanline < 0)
340      {
341         /* compute the new right slope parameters */
342         ex = v2->x;
343         edx = ((v3->x - ex) << 16) / dy;
344         ex = (ex << 16) | 0xffff;
345      }
3461014
347      /* if the longest scanline was positive, the middle vertex is to the left */
348      else
1015/*-------------------------------------------------
1016    poly_render_quad_fan - render a set of
1017    quads in a fan
1018-------------------------------------------------*/
1019
1020UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
1021{
1022   UINT32 pixels = 0;
1023   int vertnum;
1024
1025   /* iterate over vertices */
1026   for (vertnum = 2; vertnum < numverts; vertnum += 2)
1027      pixels += poly_render_quad(poly, dest, cliprect, callback, paramcount, &v[0], &v[vertnum - 1], &v[vertnum], &v[MIN(vertnum + 1, numverts - 1)]);
1028   return pixels;
1029}
1030
1031
1032
1033/***************************************************************************
1034    CORE POLYGON RENDERING
1035***************************************************************************/
1036
1037/*-------------------------------------------------
1038    poly_render_polygon - render a single polygon up
1039    to 32 vertices
1040-------------------------------------------------*/
1041
1042UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
1043{
1044   poly_edge fedgelist[MAX_POLYGON_VERTS - 1], bedgelist[MAX_POLYGON_VERTS - 1];
1045   const poly_edge *ledge, *redge;
1046   poly_edge *edgeptr;
1047   int minv, maxv, curv;
1048   INT32 minyclip, maxyclip;
1049   INT32 miny, maxy;
1050   INT32 curscan, scaninc;
1051   polygon_info *polygon;
1052   INT32 pixels = 0;
1053   UINT32 startunit;
1054   int vertnum;
1055
1056   assert(poly->flags & POLYFLAG_ALLOW_QUADS);
1057
1058   /* determine min/max Y vertices */
1059   minv = maxv = 0;
1060   for (vertnum = 1; vertnum < numverts; vertnum++)
1061   {
1062      if (v[vertnum].y < v[minv].y)
1063         minv = vertnum;
1064      else if (v[vertnum].y > v[maxv].y)
1065         maxv = vertnum;
1066   }
1067
1068   /* determine start/end scanlines */
1069   miny = round_coordinate(v[minv].y);
1070   maxy = round_coordinate(v[maxv].y);
1071
1072   /* clip coordinates */
1073   minyclip = miny;
1074   maxyclip = maxy + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
1075   if (cliprect != NULL)
1076   {
1077      minyclip = MAX(minyclip, cliprect->min_y);
1078      maxyclip = MIN(maxyclip, cliprect->max_y + 1);
1079   }
1080   if (maxyclip - minyclip <= 0)
1081      return 0;
1082
1083   /* allocate a new polygon */
1084   polygon = allocate_polygon(poly, minyclip, maxyclip);
1085
1086   /* fill in the polygon information */
1087   polygon->poly = poly;
1088   polygon->dest = dest;
1089   polygon->callback = callback;
1090   polygon->extra = poly->extra[poly->extra_next - 1];
1091   polygon->numparams = paramcount;
1092   polygon->numverts = numverts;
1093
1094   /* walk forward to build up the forward edge list */
1095   edgeptr = &fedgelist[0];
1096   for (curv = minv; curv != maxv; curv = (curv == numverts - 1) ? 0 : (curv + 1))
1097   {
1098      int paramnum;
1099      float ooy;
1100
1101      /* set the two vertices */
1102      edgeptr->v1 = &v[curv];
1103      edgeptr->v2 = &v[(curv == numverts - 1) ? 0 : (curv + 1)];
1104
1105      /* if horizontal, skip altogether */
1106      if (edgeptr->v1->y == edgeptr->v2->y)
1107         continue;
1108
1109      /* need dx/dy always, and parameter deltas as necessary */
1110      ooy = 1.0f / (edgeptr->v2->y - edgeptr->v1->y);
1111      edgeptr->dxdy = (edgeptr->v2->x - edgeptr->v1->x) * ooy;
1112      for (paramnum = 0; paramnum < paramcount; paramnum++)
1113         edgeptr->dpdy[paramnum] = (edgeptr->v2->p[paramnum] - edgeptr->v1->p[paramnum]) * ooy;
1114      edgeptr++;
1115   }
1116
1117   /* walk backward to build up the backward edge list */
1118   edgeptr = &bedgelist[0];
1119   for (curv = minv; curv != maxv; curv = (curv == 0) ? (numverts - 1) : (curv - 1))
1120   {
1121      int paramnum;
1122      float ooy;
1123
1124      /* set the two vertices */
1125      edgeptr->v1 = &v[curv];
1126      edgeptr->v2 = &v[(curv == 0) ? (numverts - 1) : (curv - 1)];
1127
1128      /* if horizontal, skip altogether */
1129      if (edgeptr->v1->y == edgeptr->v2->y)
1130         continue;
1131
1132      /* need dx/dy always, and parameter deltas as necessary */
1133      ooy = 1.0f / (edgeptr->v2->y - edgeptr->v1->y);
1134      edgeptr->dxdy = (edgeptr->v2->x - edgeptr->v1->x) * ooy;
1135      for (paramnum = 0; paramnum < paramcount; paramnum++)
1136         edgeptr->dpdy[paramnum] = (edgeptr->v2->p[paramnum] - edgeptr->v1->p[paramnum]) * ooy;
1137      edgeptr++;
1138   }
1139
1140   /* determine which list is left/right: */
1141   /* if the first vertex is shared, compare the slopes */
1142   /* if the first vertex is not shared, compare the X coordinates */
1143   if ((fedgelist[0].v1 == bedgelist[0].v1 && fedgelist[0].dxdy < bedgelist[0].dxdy) ||
1144      (fedgelist[0].v1 != bedgelist[0].v1 && fedgelist[0].v1->x < bedgelist[0].v1->x))
1145   {
1146      ledge = fedgelist;
1147      redge = bedgelist;
1148   }
1149   else
1150   {
1151      ledge = bedgelist;
1152      redge = fedgelist;
1153   }
1154
1155   /* compute the X extents for each scanline */
1156   startunit = poly->unit_next;
1157   for (curscan = minyclip; curscan < maxyclip; curscan += scaninc)
1158   {
1159      UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS;
1160      UINT32 unit_index = poly->unit_next++;
1161      quad_work_unit *unit = &poly->unit[unit_index]->quad;
1162      int extnum;
1163
1164      /* determine how much to advance to hit the next bucket */
1165      scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET;
1166
1167      /* fill in the work unit basics */
1168      unit->shared.polygon = polygon;
1169      unit->shared.count_next = MIN(maxyclip - curscan, scaninc);
1170      unit->shared.scanline = curscan;
1171      unit->shared.previtem = poly->unit_bucket[bucketnum];
1172      poly->unit_bucket[bucketnum] = unit_index;
1173
1174      /* iterate over extents */
1175      for (extnum = 0; extnum < unit->shared.count_next; extnum++)
3491176      {
350         /* compute the new left slope parameters */
351         sx = v2->x;
352         sdx = ((v3->x - sx) << 16) / dy;
353         sx = (sx << 16) | 0xffff;
1177         float fully = (float)(curscan + extnum) + 0.5f;
1178         float startx, stopx;
1179         INT32 istartx, istopx;
1180         int paramnum;
3541181
355         /* set up the starting values and per-scanline deltas for the parameters */
356         if (NUM_PARAMS >= 0)
1182         /* compute the ending X based on which part of the triangle we're in */
1183         while (fully > ledge->v2->y && fully < v[maxv].y)
1184            ledge++;
1185         while (fully > redge->v2->y && fully < v[maxv].y)
1186            redge++;
1187         startx = ledge->v1->x + (fully - ledge->v1->y) * ledge->dxdy;
1188         stopx = redge->v1->x + (fully - redge->v1->y) * redge->dxdy;
1189
1190         /* clamp to full pixels */
1191         istartx = round_coordinate(startx);
1192         istopx = round_coordinate(stopx);
1193
1194         /* compute parameter starting points and deltas */
1195         if (paramcount > 0)
3571196         {
358            pstart[0] = ((INT64)v2->p[0] << 16) | 0x8000;
359            pdelta[0] = ((INT64)(v3->p[0] - v2->p[0]) << 16) / dy;
1197            float ldy = fully - ledge->v1->y;
1198            float rdy = fully - redge->v1->y;
1199            float oox = 1.0f / (stopx - startx);
1200
1201            /* iterate over parameters */
1202            for (paramnum = 0; paramnum < paramcount; paramnum++)
1203            {
1204               float lparam = ledge->v1->p[paramnum] + ldy * ledge->dpdy[paramnum];
1205               float rparam = redge->v1->p[paramnum] + rdy * redge->dpdy[paramnum];
1206               float dpdx = (rparam - lparam) * oox;
1207
1208               unit->extent[extnum].param[paramnum].start = lparam;// - ((float)istartx + 0.5f) * dpdx;
1209               unit->extent[extnum].param[paramnum].dpdx = dpdx;
1210            }
3601211         }
361         if (NUM_PARAMS >= 1)
1212
1213         /* include the right edge if requested */
1214         if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
1215            istopx++;
1216
1217         /* apply left/right clipping */
1218         if (cliprect != NULL)
3621219         {
363            pstart[1] = ((INT64)v2->p[1] << 16) | 0x8000;
364            pdelta[1] = ((INT64)(v3->p[1] - v2->p[1]) << 16) / dy;
1220            if (istartx < cliprect->min_x)
1221            {
1222               for (paramnum = 0; paramnum < paramcount; paramnum++)
1223                  unit->extent[extnum].param[paramnum].start += (cliprect->min_x - istartx) * unit->extent[extnum].param[paramnum].dpdx;
1224               istartx = cliprect->min_x;
1225            }
1226            if (istopx > cliprect->max_x)
1227               istopx = cliprect->max_x + 1;
3651228         }
366         if (NUM_PARAMS >= 2)
1229
1230         /* set the extent and update the total pixel count */
1231         if (istartx >= istopx)
1232            istartx = istopx = 0;
1233         unit->extent[extnum].startx = istartx;
1234         unit->extent[extnum].stopx = istopx;
1235         pixels += istopx - istartx;
1236      }
1237   }
1238#if KEEP_STATISTICS
1239   poly->unit_max = MAX(poly->unit_max, poly->unit_next);
1240#endif
1241
1242   /* enqueue the work items */
1243   if (poly->queue != NULL)
1244      osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE);
1245
1246   /* return the total number of pixels in the triangle */
1247   poly->quads++;
1248   poly->pixels += pixels;
1249   return pixels;
1250}
1251
1252
1253
1254/***************************************************************************
1255    CLIPPING
1256***************************************************************************/
1257
1258/*-------------------------------------------------
1259    poly_zclip_if_less - z clip a polygon against
1260    the given value, returning a set of clipped
1261    vertices
1262-------------------------------------------------*/
1263
1264int poly_zclip_if_less(int numverts, const poly_vertex *v, poly_vertex *outv, int paramcount, float clipval)
1265{
1266   int prevclipped = (v[numverts - 1].p[0] < clipval);
1267   poly_vertex *nextout = outv;
1268   int vertnum;
1269
1270   /* iterate over vertices */
1271   for (vertnum = 0; vertnum < numverts; vertnum++)
1272   {
1273      int thisclipped = (v[vertnum].p[0] < clipval);
1274
1275      /* if we switched from clipped to non-clipped, interpolate a vertex */
1276      if (thisclipped != prevclipped)
1277         interpolate_vertex(nextout++, &v[(vertnum == 0) ? (numverts - 1) : (vertnum - 1)], &v[vertnum], paramcount, clipval);
1278
1279      /* if this vertex is not clipped, copy it in */
1280      if (!thisclipped)
1281         copy_vertex(nextout++, &v[vertnum], paramcount);
1282
1283      /* remember the last state */
1284      prevclipped = thisclipped;
1285   }
1286   return nextout - outv;
1287}
1288
1289
1290
1291/***************************************************************************
1292    INTERNAL FUNCTIONS
1293***************************************************************************/
1294
1295/*-------------------------------------------------
1296    allocate_array - allocate an array of pointers
1297-------------------------------------------------*/
1298
1299static void **allocate_array(size_t *itemsize, UINT32 itemcount)
1300{
1301   void **ptrarray;
1302   int itemnum;
1303
1304   /* fail if 0 */
1305   if (itemcount == 0)
1306      return NULL;
1307
1308   /* round to a cache line boundary */
1309   *itemsize = ((*itemsize + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE) * CACHE_LINE_SIZE;
1310
1311   /* allocate the array */
1312   ptrarray = malloc_or_die(sizeof(*ptrarray) * itemcount);
1313   memset(ptrarray, 0, sizeof(*ptrarray) * itemcount);
1314
1315   /* allocate the actual items */
1316   ptrarray[0] = malloc_or_die(*itemsize * itemcount);
1317   memset(ptrarray[0], 0, *itemsize * itemcount);
1318
1319   /* initialize the pointer array */
1320   for (itemnum = 1; itemnum < itemcount; itemnum++)
1321      ptrarray[itemnum] = (UINT8 *)ptrarray[0] + *itemsize * itemnum;
1322   return ptrarray;
1323}
1324
1325
1326/*-------------------------------------------------
1327    free_array - release an array of pointers
1328-------------------------------------------------*/
1329
1330static void free_array(void **array)
1331{
1332   if (array != NULL)
1333   {
1334      if (array[0] != NULL)
1335         free(array[0]);
1336      free(array);
1337   }
1338}
1339
1340
1341/*-------------------------------------------------
1342    poly_item_callback - callback for each poly
1343    item
1344-------------------------------------------------*/
1345
1346static void *poly_item_callback(void *param, int threadid)
1347{
1348   while (1)
1349   {
1350      work_unit *unit = param;
1351      polygon_info *polygon = unit->shared.polygon;
1352      int count = unit->shared.count_next & 0xffff;
1353      UINT32 orig_count_next;
1354      int curscan;
1355
1356      /* if our previous item isn't done yet, enqueue this item to the end and proceed */
1357      if (unit->shared.previtem != 0xffff)
1358      {
1359         work_unit *prevunit = polygon->poly->unit[unit->shared.previtem];
1360         if (prevunit->shared.count_next != 0)
3671361         {
368            pstart[2] = ((INT64)v2->p[2] << 16) | 0x8000;
369            pdelta[2] = ((INT64)(v3->p[2] - v2->p[2]) << 16) / dy;
1362            UINT32 unitnum = ((UINT8 *)unit - (UINT8 *)polygon->poly->unit[0]) / polygon->poly->unit_size;
1363            UINT32 new_count_next;
1364
1365            /* attempt to atomically swap in this new value */
1366            do
1367            {
1368               orig_count_next = prevunit->shared.count_next;
1369               new_count_next = orig_count_next | (unitnum << 16);
1370            } while (compare_exchange32((volatile INT32 *)&prevunit->shared.count_next, orig_count_next, new_count_next) != orig_count_next);
1371
1372#if KEEP_STATISTICS
1373            /* track resolved conflicts */
1374            polygon->poly->conflicts[threadid]++;
1375            if (orig_count_next != 0)
1376               polygon->poly->resolved[threadid]++;
1377#endif
1378            /* if we succeeded, skip out early so we can do other work */
1379            if (orig_count_next != 0)
1380               break;
3701381         }
371         if (NUM_PARAMS >= 3)
1382      }
1383
1384      /* iterate over extents */
1385      for (curscan = 0; curscan < count; curscan++)
1386      {
1387         if (polygon->numverts == 3)
3721388         {
373            pstart[3] = ((INT64)v2->p[3] << 16) | 0x8000;
374            pdelta[3] = ((INT64)(v3->p[3] - v2->p[3]) << 16) / dy;
1389            poly_extent tmpextent;
1390            convert_tri_extent_to_poly_extent(&tmpextent, &unit->tri.extent[curscan], polygon, unit->shared.scanline + curscan);
1391            (*polygon->callback)(polygon->dest, unit->shared.scanline + curscan, &tmpextent, polygon->extra, threadid);
3751392         }
376         if (NUM_PARAMS >= 4)
377         {
378            pstart[4] = ((INT64)v2->p[4] << 16) | 0x8000;
379            pdelta[4] = ((INT64)(v3->p[4] - v2->p[4]) << 16) / dy;
380         }
381         if (NUM_PARAMS >= 5)
382         {
383            pstart[5] = ((INT64)v2->p[5] << 16) | 0x8000;
384            pdelta[5] = ((INT64)(v3->p[5] - v2->p[5]) << 16) / dy;
385         }
1393         else
1394            (*polygon->callback)(polygon->dest, unit->shared.scanline + curscan, &unit->quad.extent[curscan], polygon->extra, threadid);
3861395      }
387   }
3881396
389   /* apply clipping */
390   while (--scan >= &scanlines.scanline[0])
391   {
392      /* left clip */
393      if (scan->sx < cliprect->min_x)
1397      /* set our count to 0 and re-fetch the original count value */
1398      do
3941399      {
395         temp = cliprect->min_x - scan->sx;
396         scan->sx += temp;
397         if (NUM_PARAMS >= 0) scan->p[0] += scanlines.dp[0] * temp;
398         if (NUM_PARAMS >= 1) scan->p[1] += scanlines.dp[1] * temp;
399         if (NUM_PARAMS >= 2) scan->p[2] += scanlines.dp[2] * temp;
400         if (NUM_PARAMS >= 3) scan->p[3] += scanlines.dp[3] * temp;
401         if (NUM_PARAMS >= 4) scan->p[4] += scanlines.dp[4] * temp;
402         if (NUM_PARAMS >= 5) scan->p[5] += scanlines.dp[5] * temp;
403      }
1400         orig_count_next = unit->shared.count_next;
1401      } while (compare_exchange32((volatile INT32 *)&unit->shared.count_next, orig_count_next, 0) != orig_count_next);
4041402
405      /* right clip */
406      if (scan->ex > cliprect->max_x)
407         scan->ex = cliprect->max_x;
1403      /* if we have no more work to do, do nothing */
1404      orig_count_next >>= 16;
1405      if (orig_count_next == 0)
1406         break;
1407      param = polygon->poly->unit[orig_count_next];
4081408   }
409
410   return &scanlines;
1409   return NULL;
4111410}
412
413#endif
src/emu/video/poly.h
r1281r1282
22
33    poly.h
44
5    Helper routines for polygon rendering.
5    New polygon helper routines.
66
7****************************************************************************
8
9    Pixel model:
10
11    (0.0,0.0)       (1.0,0.0)       (2.0,0.0)       (3.0,0.0)
12        +---------------+---------------+---------------+
13        |               |               |               |
14        |               |               |               |
15        |   (0.5,0.5)   |   (1.5,0.5)   |   (2.5,0.5)   |
16        |       *       |       *       |       *       |
17        |               |               |               |
18        |               |               |               |
19    (0.0,1.0)       (1.0,1.0)       (2.0,1.0)       (3.0,1.0)
20        +---------------+---------------+---------------+
21        |               |               |               |
22        |               |               |               |
23        |   (0.5,1.5)   |   (1.5,1.5)   |   (2.5,1.5)   |
24        |       *       |       *       |       *       |
25        |               |               |               |
26        |               |               |               |
27        |               |               |               |
28        +---------------+---------------+---------------+
29    (0.0,2.0)       (1.0,2.0)       (2.0,2.0)       (3.0,2.0)
30
731***************************************************************************/
832
9/* up to 6 params (Z,U,V,R,G,B), plus it makes the vertex struct a nice size */
10#define MAX_VERTEX_PARAMS      6
11#define MAX_POLY_SCANLINES      512
33#pragma once
1234
13struct poly_vertex
35#ifndef __POLYNEW_H__
36#define __POLYNEW_H__
37
38#include "mamecore.h"
39
40
41/***************************************************************************
42    CONSTANTS
43***************************************************************************/
44
45#define MAX_VERTEX_PARAMS               6
46#define MAX_POLYGON_VERTS               32
47
48#define POLYFLAG_INCLUDE_BOTTOM_EDGE      0x01
49#define POLYFLAG_INCLUDE_RIGHT_EDGE         0x02
50#define POLYFLAG_NO_WORK_QUEUE            0x04
51#define POLYFLAG_ALLOW_QUADS            0x08
52
53
54
55/***************************************************************************
56    TYPE DEFINITIONS
57***************************************************************************/
58
59/* opaque reference to the poly manager */
60typedef struct _poly_manager poly_manager;
61
62
63/* input vertex data */
64typedef struct _poly_vertex poly_vertex;
65struct _poly_vertex
1466{
15   INT32   x;                     /* 16.0 screen X coordinate */
16   INT32   y;                     /* 16.0 screen Y coordinate */
17   INT32   p[MAX_VERTEX_PARAMS];      /* 32.0 interpolated parameter values */
67   float      x;                     /* X coordinate */
68   float      y;                     /* Y coordinate */
69   float      p[MAX_VERTEX_PARAMS];      /* interpolated parameter values */
1870};
1971
20struct poly_scanline
72
73/* poly_param_extent describes information for a single parameter in an extent */
74typedef struct _poly_param_extent poly_param_extent;
75struct _poly_param_extent
2176{
22   INT32   sx, ex;                  /* 16.0 starting and ending X coordinates */
23   INT64   p[MAX_VERTEX_PARAMS];      /* 32.16 starting parameter values (at left) */
77   float      start;                  /* parameter value at starting X,Y */
78   float      dpdx;                  /* dp/dx relative to starting X */
2479};
2580
26struct poly_scanline_data
81
82/* poly_extent describes start/end points for a scanline, along with per-scanline parameters */
83typedef struct _poly_extent poly_extent;
84struct _poly_extent
2785{
28   INT32   sy, ey;                  /* 16.0 starting and ending Y coordinates */
29   INT64   dp[MAX_VERTEX_PARAMS];      /* 32.16 per-pixel deltas for each parameter */
30   struct poly_scanline scanline[MAX_POLY_SCANLINES];
86   INT16      startx;                  /* starting X coordinate (inclusive) */
87   INT16      stopx;                  /* ending X coordinate (exclusive) */
88   poly_param_extent param[MAX_VERTEX_PARAMS];   /* starting and dx values for each parameter */
3189};
3290
33const struct poly_scanline_data *setup_triangle_0(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
34const struct poly_scanline_data *setup_triangle_1(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
35const struct poly_scanline_data *setup_triangle_2(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
36const struct poly_scanline_data *setup_triangle_3(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
37const struct poly_scanline_data *setup_triangle_4(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
38const struct poly_scanline_data *setup_triangle_5(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
39const struct poly_scanline_data *setup_triangle_6(const struct poly_vertex *v1, const struct poly_vertex *v2, const struct poly_vertex *v3, const rectangle *cliprect);
91
92/* callback routine to process a batch of scanlines in a triangle */
93typedef void (*poly_draw_scanline)(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
94
95
96
97/***************************************************************************
98    TYPE DEFINITIONS
99***************************************************************************/
100
101
102/* ----- initialization/teardown ----- */
103
104/* allocate a new poly manager that can render triangles */
105poly_manager *poly_alloc(int max_polys, size_t extra_data_size, UINT8 flags);
106
107/* free a poly manager */
108void poly_free(poly_manager *poly);
109
110
111
112/* ----- common functions ----- */
113
114/* wait until all polygons in the queue have been rendered */
115void poly_wait(poly_manager *poly, const char *debug_reason);
116
117/* get a pointer to the extra data for the next polygon */
118void *poly_get_extra_data(poly_manager *poly);
119
120
121
122/* ----- core triangle rendering ----- */
123
124/* render a single triangle given 3 vertexes */
125UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3);
126
127/* render a set of triangles in a fan */
128UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
129
130/* perform a custom render of an object, given specific extents */
131UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const poly_extent *extents);
132
133
134
135/* ----- core quad rendering ----- */
136
137/* render a single quad given 4 vertexes */
138UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4);
139
140/* render a set of quads in a fan */
141UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
142
143
144
145/* ----- core polygon rendering ----- */
146
147/* render a single polygon up to 32 vertices */
148UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
149
150
151
152/* ----- clipping ----- */
153
154/* zclip (assumes p[0] == z) a polygon */
155int poly_zclip_if_less(int numverts, const poly_vertex *v, poly_vertex *outv, int paramcount, float clipval);
156
157
158#endif   /* __POLY_H__ */
src/emu/video/resnet.c
r1281r1282
450450
451451*****************************************************************************/
452452
453
454/* Datasheets give a maximum of 0.4V to 0.5V
455 * However in the circuit simulated here this will only
456 * occur if (rBias + rOutn) = 50 Ohm, rBias exists.
457 * This is highly unlikely. With the resistor values used
458 * in such circuits VOL is likely to be around 50mV.
459 */
460
461#define   TTL_VOL         (0.05)
462
463
464/* Likely, datasheets give a typical value of 3.4V to 3.6V
465 * for VOH. Modelling the TTL circuit however backs a value
466 * of 4V for typical currents involved in resistor networks.
467 */
468
469#define TTL_VOH         (4.0)
470
453471int compute_res_net(int inputs, int channel, const res_net_info *di)
454472{
455473   double rTotal=0.0;
r1281r1282
463481   double cut = di->rgb[channel].cut;
464482   double vcc = di->vcc;
465483   double ttlHRes = 0;
484   double rGnd = di->rgb[channel].rGnd;
466485   UINT8  OpenCol = di->OpenCol;
467486
468487   /* Global options */
r1281r1282
512531         vBias = 5.0;
513532         break;
514533      case RES_NET_VBIAS_TTL:
515         vBias = 3.6;
534         vBias = TTL_VOH;
516535         break;
517536      case RES_NET_VBIAS_CUSTOM:
518537         /* Fall through */
r1281r1282
525544   {
526545      case RES_NET_VIN_OPEN_COL:
527546         OpenCol = 1;
528         vOL = 0.35;
547         vOL = TTL_VOL;
529548         break;
530549      case RES_NET_VIN_VCC:
531550         vOL = 0.0;
r1281r1282
533552         OpenCol = 0;
534553         break;
535554      case RES_NET_VIN_TTL_OUT:
536         vOL = 0.35;
537         vOH = 3.6;
555         vOL = TTL_VOL;
556         vOH = TTL_VOH;
538557         /* rough estimation from 82s129 (7052) datasheet and from various sources
539558             * 1.4k / 30
540559             */
r1281r1282
583602         vBias = 5.0;
584603         break;
585604      case RES_NET_VBIAS_TTL:
586         vBias = 3.4;
605         vBias = TTL_VOH;
587606         break;
588607      case RES_NET_VBIAS_CUSTOM:
589608         /* Fall through */
r1281r1282
592611         fatalerror("compute_res_net: Unknown vcc type");
593612   }
594613
614   /* Input impedances */
615
616   switch (di->options & RES_NET_MONITOR_MASK)
617   {
618      case RES_NET_MONITOR_INVERT:
619      case RES_NET_MONITOR_SANYO_EZV20:
620         /* Nothing */
621         break;
622      case RES_NET_MONITOR_ELECTROHOME_G07:
623         if (rGnd != 0.0)
624            rGnd = rGnd * 5600 / (rGnd + 5600);
625         else
626            rGnd = 5600;
627         break;
628   }
629
595630   /* compute here - pass a / low inputs */
596631
597632   for (i=0; i<di->rgb[channel].num; i++)
r1281r1282
618653      rTotal += 1.0 / di->rgb[channel].rBias;
619654      v += vBias / di->rgb[channel].rBias;
620655   }
621   if (di->rgb[channel].rGnd != 0.0)
622      rTotal += 1.0 / di->rgb[channel].rGnd;
656   if (rGnd != 0.0)
657      rTotal += 1.0 / rGnd;
623658
624659   /* if the resulting voltage after application of all low inputs is
625660     * greater than vOH, treat high inputs as open collector/high impedance
r1281r1282
666701         v = MAX(0, v-0.7);
667702         v = MIN(v, vcc - 2 * 0.7);
668703         break;
704      case RES_NET_MONITOR_ELECTROHOME_G07:
705         /* Nothing */
706         break;
669707   }
670708
671709   return (int) (v *255 / vcc + 0.4);
src/emu/video/voodoo.c
r1281r1282
137137#include "driver.h"
138138#include "eminline.h"
139139#include "profiler.h"
140#include "video/polynew.h"
140#include "video/poly.h"
141141#include "video/rgbutil.h"
142142#include "voodoo.h"
143143#include "vooddefs.h"
r1281r1282
232232static void dump_rasterizer_stats(voodoo_state *v);
233233
234234/* generic rasterizers */
235static void raster_fastfill(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
236static void raster_generic_0tmu(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
237static void raster_generic_1tmu(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
238static void raster_generic_2tmu(void *dest, INT32 scanline, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid);
235static void raster_fastfill(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
236static void raster_generic_0tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
237static void raster_generic_1tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
238static void raster_generic_2tmu(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
239239
240240
241241
r1281r1282
45904590   int ex = (v->reg[clipLeftRight].u >> 0) & 0x3ff;
45914591   int sy = (v->reg[clipLowYHighY].u >> 16) & 0x3ff;
45924592   int ey = (v->reg[clipLowYHighY].u >> 0) & 0x3ff;
4593   tri_extent extents[256];
4593   poly_extent extents[64];
45944594   UINT16 dithermatrix[16];
45954595   UINT16 *drawbuf = NULL;
45964596   UINT32 pixels = 0;
r1281r1282
52135213    implementation of the 'fastfill' command
52145214-------------------------------------------------*/
52155215
5216static void raster_fastfill(void *destbase, INT32 y, const tri_extent *extent, const poly_params *poly, const void *extradata, int threadid)
5216static void raster_fastfill(void *destbase, INT32 y, const poly_extent *extent, const void *extradata, int threadid)
52175217{
52185218   const poly_extra_data *extra = extradata;
52195219   voodoo_state *v = extra->state;
src/emu/video/resnet.h
r1281r1282
7373#define RES_NET_MONITOR_INVERT      0x1000
7474// SANYO_EZV20 / Nintendo with inverter circuit
7575#define RES_NET_MONITOR_SANYO_EZV20   0x2000
76// Electrohome G07 Series
77// 5.6k input impedance
78#define RES_NET_MONITOR_ELECTROHOME_G07   0x3000
79
7680#define RES_NET_MONITOR_MASK      0x3000
7781
7882/* General defines */
src/emu/video/rgbgen.h
r1281r1282
300300
301301INLINE rgb_t rgb_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
302302{
303   UINT32 agd1 = (rgb01 & 0xff00ff00) - (rgb00 & 0xff00ff00);
304   UINT32 agd2 = (rgb11 & 0xff00ff00) - (rgb10 & 0xff00ff00);
305   UINT32 rbd1 = (rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff);
306   UINT32 rbd2 = (rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff);
307   agd1 >>= 8;
308   agd2 >>= 8;
303   UINT32 ag0, ag1, rb0, rb1;
309304
310   rbd1 *= u;  rgb01 = (rgb00 & 0x00ff00ff);
311   agd1 *= u;  rbd1 >>= 8;
312   rbd2 *= u;  rgb11 = (rgb10 & 0x00ff00ff);
313   agd2 *= u;  rbd2 >>= 8;
305   rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
306   rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
307   ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8);
308   ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8);
314309
315   rgb01 += rbd1;
316   rgb00 += agd1;
310   rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8);
311   ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8);
317312
318   rgb11 += rbd2;
319   rgb10 += agd2;
320
321   rgb01 &= 0x00ff00ff;
322   rgb00 &= 0xff00ff00;
323   rgb10 &= 0xff00ff00;
324   rgb11 &= 0x00ff00ff;
325
326   // ---- rgb11 is now rb for the bottom
327   //      rgb10 is     ag for the bottom
328   //      rgb01 is     rb for the top
329   //      rgb00 is     ag for the top
330
331   rgb10 -= rgb00;  // agd
332   rgb11 -= rgb01;  // rbd
333   rgb10 >>= 8;
334
335   rgb11 *= v;
336   rgb10 *= v;
337   rgb11 >>= 8;
338
339   rgb00 += rgb10;
340   rgb01 += rgb11;
341
342   rgb00 &= 0xff00ff00;
343   rgb01 &= 0x00ff00ff;
344
345   return rgb00 | rgb01;
313   return (ag0 & 0x0000ff00) | (rb0 & 0x00ff00ff);
346314}
347315
348316
r1281r1282
354322
355323INLINE rgb_t rgba_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
356324{
357   UINT32 agd1 = (rgb01 & 0xff00ff00) - (rgb00 & 0xff00ff00);
358   UINT32 agd2 = (rgb11 & 0xff00ff00) - (rgb10 & 0xff00ff00);
359   UINT32 rbd1 = (rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff);
360   UINT32 rbd2 = (rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff);
361   agd1 >>= 8;
362   agd2 >>= 8;
325   UINT32 ag0, ag1, rb0, rb1;
363326
364   rbd1 *= u;  rgb01 = (rgb00 & 0x00ff00ff);
365   agd1 *= u;  rbd1 >>= 8;
366   rbd2 *= u;  rgb11 = (rgb10 & 0x00ff00ff);
367   agd2 *= u;  rbd2 >>= 8;
368
369   rgb01 += rbd1;
370   rgb00 += agd1;
371
372   rgb11 += rbd2;
373   rgb10 += agd2;
374
375   rgb01 &= 0x00ff00ff;
376   rgb00 &= 0xff00ff00;
377   rgb10 &= 0xff00ff00;
378   rgb11 &= 0x00ff00ff;
379
380   // ---- rgb11 is now rb for the bottom
381   //      rgb10 is     ag for the bottom
382   //      rgb01 is     rb for the top
383   //      rgb00 is     ag for the top
384
385   rgb10 -= rgb00;  // agd
386   rgb11 -= rgb01;  // rbd
327   rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
328   rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
329   rgb00 >>= 8;
330   rgb01 >>= 8;
387331   rgb10 >>= 8;
388
389   rgb11 *= v;
390   rgb10 *= v;
391332   rgb11 >>= 8;
333   ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
334   ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
392335
393   rgb00 += rgb10;
394   rgb01 += rgb11;
336   rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8);
337   ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8);
395338
396   rgb00 &= 0xff00ff00;
397   rgb01 &= 0x00ff00ff;
398
399   return rgb00 | rgb01;
339   return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff);
400340}
401341
402342
r1281r1282
408348
409349INLINE void rgbint_bilinear_filter(rgbint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
410350{
411   UINT32 agd1 = (rgb01 & 0xff00ff00) - (rgb00 & 0xff00ff00);
412   UINT32 agd2 = (rgb11 & 0xff00ff00) - (rgb10 & 0xff00ff00);
413   UINT32 rbd1 = (rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff);
414   UINT32 rbd2 = (rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff);
415   agd1 >>= 8;
416   agd2 >>= 8;
351   UINT32 ag0, ag1, rb0, rb1;
417352
418   rbd1 *= u;  rgb01 = (rgb00 & 0x00ff00ff);
419   agd1 *= u;  rbd1 >>= 8;
420   rbd2 *= u;  rgb11 = (rgb10 & 0x00ff00ff);
421   agd2 *= u;  rbd2 >>= 8;
353   rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
354   rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
355   ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8);
356   ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8);
422357
423   rgb01 += rbd1;
424   rgb00 += agd1;
358   rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8);
359   ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8);
425360
426   rgb11 += rbd2;
427   rgb10 += agd2;
428
429   rgb01 &= 0x00ff00ff;
430   rgb00 &= 0xff00ff00;
431   rgb10 &= 0xff00ff00;
432   rgb11 &= 0x00ff00ff;
433
434   // ---- rgb11 is now rb for the bottom
435   //      rgb10 is     ag for the bottom
436   //      rgb01 is     rb for the top
437   //      rgb00 is     ag for the top
438
439   rgb10 -= rgb00;  // agd
440   rgb11 -= rgb01;  // rbd
441   rgb10 >>= 8;
442
443   rgb11 *= v;
444   rgb10 *= v;
445   rgb11 >>= 8;
446
447   rgb00 += rgb10;
448   rgb01 += rgb11;
449
450   color->r = (rgb01 >> 16) & 0xff;
451   color->g = (rgb00 >> 8) & 0xff;
452   color->b = (rgb01 >> 0) & 0xff;
361   color->r = rb0 >> 16;
362   color->g = ag0 >> 8;
363   color->b = rb0;
453364}
454365
455366
r1281r1282
461372
462373INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
463374{
464   UINT32 agd1 = (rgb01 & 0xff00ff00) - (rgb00 & 0xff00ff00);
465   UINT32 agd2 = (rgb11 & 0xff00ff00) - (rgb10 & 0xff00ff00);
466   UINT32 rbd1 = (rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff);
467   UINT32 rbd2 = (rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff);
468   agd1 >>= 8;
469   agd2 >>= 8;
375   UINT32 ag0, ag1, rb0, rb1;
470376
471   rbd1 *= u;  rgb01 = (rgb00 & 0x00ff00ff);
472   agd1 *= u;  rbd1 >>= 8;
473   rbd2 *= u;  rgb11 = (rgb10 & 0x00ff00ff);
474   agd2 *= u;  rbd2 >>= 8;
475
476   rgb01 += rbd1;
477   rgb00 += agd1;
478
479   rgb11 += rbd2;
480   rgb10 += agd2;
481
482   rgb01 &= 0x00ff00ff;
483   rgb00 &= 0xff00ff00;
484   rgb10 &= 0xff00ff00;
485   rgb11 &= 0x00ff00ff;
486
487   // ---- rgb11 is now rb for the bottom
488   //      rgb10 is     ag for the bottom
489   //      rgb01 is     rb for the top
490   //      rgb00 is     ag for the top
491
492   rgb10 -= rgb00;  // agd
493   rgb11 -= rgb01;  // rbd
377   rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
378   rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
379   rgb00 >>= 8;
380   rgb01 >>= 8;
494381   rgb10 >>= 8;
495
496   rgb11 *= v;
497   rgb10 *= v;
498382   rgb11 >>= 8;
383   ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
384   ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
499385
500   rgb00 += rgb10;
501   rgb01 += rgb11;
386   rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8);
387   ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8);
502388
503   color->a = (rgb00 >> 24) & 0xff;
504   color->r = (rgb01 >> 16) & 0xff;
505   color->g = (rgb00 >> 8) & 0xff;
506   color->b = (rgb01 >> 0) & 0xff;
389   color->a = ag0 >> 16;
390   color->r = rb0 >> 16;
391   color->g = ag0;
392   color->b = rb0;
507393}
508394
509395
src/emu/video/rgbutil.h
r1281r1282
1414#define __RGBUTIL__
1515
1616/* use SSE on 64-bit implementations, where it can be assumed */
17#if defined(PTR64) && (defined(__x86_64__) || defined(_MSC_VER))
17#if defined(__SSE__) || (defined(PTR64) && defined(_MSC_VER))
1818#include "rgbsse.h"
19#elif defined(__ALTIVEC__)
20#include "rgbvmx.h"
1921#else
2022#include "rgbgen.h"
2123#endif
src/emu/video/rgbsse.h
r1281r1282
199199    TABLES
200200***************************************************************************/
201201
202static struct
202static const struct
203203{
204204   __m128   dummy_for_alignment;
205205   INT16   zero[8];
r1281r1282
443443}
444444
445445
446#endif /* __RGBUTIL__ */
446/*-------------------------------------------------
447    rgbint_bilinear_filter - bilinear filter between
448    four pixel values
449-------------------------------------------------*/
450
451INLINE void rgbint_bilinear_filter(rgbint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
452{
453   __m128i color00 = _mm_cvtsi32_si128(rgb00);
454   __m128i color01 = _mm_cvtsi32_si128(rgb01);
455   __m128i color10 = _mm_cvtsi32_si128(rgb10);
456   __m128i color11 = _mm_cvtsi32_si128(rgb11);
457
458   /* interleave color01 and color00 at the byte level */
459   color01 = _mm_unpacklo_epi8(color01, color00);
460   color11 = _mm_unpacklo_epi8(color11, color10);
461   color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128());
462   color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128());
463   color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]);
464   color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]);
465   color01 = _mm_slli_epi32(color01, 15);
466   color11 = _mm_srli_epi32(color11, 1);
467   color01 = _mm_max_epi16(color01, color11);
468   color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]);
469   color01 = _mm_srli_epi32(color01, 15);
470   *color = _mm_packs_epi32(color01, color01);
471}
472
473
474/*-------------------------------------------------
475    rgbaint_bilinear_filter - bilinear filter between
476    four pixel values
477-------------------------------------------------*/
478
479INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v)
480{
481   rgbint_bilinear_filter(color, rgb00, rgb01, rgb10, rgb11, u, v);
482}
483
484
485#endif /* __RGBSSE__ */
src/emu/uimenu.c
r1281r1282
100100   const char *    dip_name;
101101   UINT16         total_dip_mask;
102102   UINT16         total_dip_settings;
103   UINT16         dip_invert_mask;
103104   UINT16          selected_dip_feature_mask;
104105};
105106
r1281r1282
22132214      /* indicate the toggle exists in the switch */
22142215      dip_switch_model[model_index].total_dip_mask |= toggle_switch_mask;
22152216
2217      /* if it's inverted, mark it as such */
2218      if (entry->diploc[dip_declaration_index].invert)
2219         dip_switch_model[model_index].dip_invert_mask |= toggle_switch_mask;
2220
22162221      /* if isolated bit is on, set the toggle on */
22172222      if ((1 << value_mask_bit) & entry->default_value)
22182223         dip_switch_model[model_index].total_dip_settings |= toggle_switch_mask;
r1281r1282
22832288      {
22842289         /* yes, draw the switch position for a single toggle switch in a switch field */
22852290         int feature_field_selected = ((bit_mask & dip_switch_model[model_index].selected_dip_feature_mask) != 0);
2286         dip_on = ((bit_mask & dip_switch_model[model_index].total_dip_settings) != 0);
2291         dip_on = ((bit_mask & (dip_switch_model[model_index].total_dip_settings ^ dip_switch_model[model_index].dip_invert_mask)) != 0);
22872292
22882293         render_ui_add_rect(x1, dip_on ? y1_on : y1_off,
22892294                        x2, dip_on ? y2_on : y2_off,
src/emu/eminline.h
r1281r1282
375375-------------------------------------------------*/
376376
377377#ifndef atomic_increment32
378INLINE INT32 atomic_increment32(INT32 volatile *ptr, INT32 delta)
378INLINE INT32 atomic_increment32(INT32 volatile *ptr)
379379{
380380   return atomic_add32(ptr, 1);
381381}
r1281r1282
394394-------------------------------------------------*/
395395
396396#ifndef atomic_decrement32
397INLINE INT32 atomic_decrement32(INT32 volatile *ptr, INT32 delta)
397INLINE INT32 atomic_decrement32(INT32 volatile *ptr)
398398{
399399   return atomic_add32(ptr, -1);
400400}
src/emu/emu.mak
r1281r1282
167167    $(EMUVIDEO)/crtc6845.o \
168168   $(EMUVIDEO)/generic.o \
169169   $(EMUVIDEO)/poly.o \
170   $(EMUVIDEO)/polynew.o \
171170   $(EMUVIDEO)/resnet.o \
172171   $(EMUVIDEO)/s2636.o \
173172   $(EMUVIDEO)/tlc34076.o \
src/emu/inptport.c
r1281r1282
24022402      if (curname == NULL)
24032403         fatalerror("Switch location '%s' missing switch name!", location);
24042404
2405      /* if the number is preceded by a '!' it's active high */
2406      if (*number == '!')
2407      {
2408         in->diploc[index].invert = 1;
2409         number++;
2410      }
2411      else
2412         in->diploc[index].invert = 0;
2413
24052414      /* now scan the switch number */
24062415      if (sscanf(number, "%d", &val) != 1)
24072416         fatalerror("Switch location '%s' has invalid format!", location);
src/emu/eigccppc.h
r1281r1282
380380}
381381
382382
383/*-------------------------------------------------
384    atomic_increment32 - atomically increment the
385    32-bit value in memory at 'ptr', returning the
386    final result.
387-------------------------------------------------*/
388
389#define atomic_increment32 _atomic_increment32
390INLINE INT32 _atomic_increment32(INT32 volatile *ptr)
391{
392   register INT32 result;
393
394   __asm__ __volatile__ (
395      "1: lwarx   %[result], 0, %[ptr]    \n"
396      "   addi    %[result], %[result], 1 \n"
397      "   sync                            \n"
398      "   stwcx.  %[result], 0, %[ptr]    \n"
399      "   bne-    1b                      \n"
400     : [result] "=&b" (result)
401     : [ptr]    "r"   (ptr)
402     : "cr0"
403   );
404
405   return result;
406}
407
408
409/*-------------------------------------------------
410    atomic_decrement32 - atomically decrement the
411    32-bit value in memory at 'ptr', returning the
412    final result.
413-------------------------------------------------*/
414
415#define atomic_decrement32 _atomic_decrement32
416INLINE INT32 _atomic_decrement32(INT32 volatile *ptr)
417{
418   register INT32 result;
419
420   __asm__ __volatile__ (
421      "1: lwarx   %[result], 0, %[ptr]     \n"
422      "   addi    %[result], %[result], -1 \n"
423      "   sync                             \n"
424      "   stwcx.  %[result], 0, %[ptr]     \n"
425      "   bne-    1b                       \n"
426     : [result] "=&b" (result)
427     : [ptr]    "r"   (ptr)
428     : "cr0"
429   );
430
431   return result;
432}
433
383434#endif /* __EIGCCPPC__ */
src/emu/inptport.h
r1281r1282
585585   {
586586      const char *swname;      /* name of the physical DIP switch */
587587      UINT8   swnum;         /* physical switch number */
588      UINT8   invert;         /* is this an active-high DIP? */
588589   } diploc[8];
589590
590591   /* valid if type is IPT_KEYBOARD */
r1281r1282
765766#define PORT_DIPSETTING(default,name) \
766767   INPUT_PORT_UINT32_PAIR(INPUT_TOKEN_DIPSETTING, default), INPUT_PORT_PTR(name),
767768
768/* physical location, of the form: name:sw,[name:]sw,... */
769/* physical location, of the form: name:[!]sw,[name:][!]sw,... */
769770/* note that these are specified LSB-first */
770771#define PORT_DIPLOCATION(location_) \
771772   INPUT_PORT_UINT32(INPUT_TOKEN_DIPLOCATION), INPUT_PORT_PTR(location_),
src/emu/sound/scsp.c
r1281r1282
376376   if(KRS(slot)!=0xf)
377377      rate=2*(octave+KRS(slot))+((FNS(slot)>>9)&1);
378378   else
379      rate=((FNS(slot)>>9)&1);
379      rate=0; //rate=((FNS(slot)>>9)&1);
380380
381381   slot->EG.volume=0;
382382   slot->EG.AR=Get_AR(SCSP,rate,AR(slot));
r1281r1282
397397         slot->EG.volume+=slot->EG.AR;
398398         if(slot->EG.volume>=(0x3ff<<EG_SHIFT))
399399         {
400            slot->EG.state=DECAY1;
401            if(slot->EG.D1R>=(1024<<EG_SHIFT)) //Skip DECAY1, go directly to DECAY2
402               slot->EG.state=DECAY2;
400            if (!LPSLNK(slot))
401            {
402               slot->EG.state=DECAY1;
403               if(slot->EG.D1R>=(1024<<EG_SHIFT)) //Skip DECAY1, go directly to DECAY2
404                  slot->EG.state=DECAY2;
405            }
403406            slot->EG.volume=0x3ff<<EG_SHIFT;
404407         }
405408         if(slot->EG.EGHOLD)
r1281r1282
407410         break;
408411      case DECAY1:
409412         slot->EG.volume-=slot->EG.D1R;
410         if(slot->EG.volume>>(EG_SHIFT+5)>=slot->EG.DL)
413         if(slot->EG.volume>>(EG_SHIFT+5)<=slot->EG.DL)
411414            slot->EG.state=DECAY2;
412415         break;
413416      case DECAY2:
r1281r1282
561564      if(iPAN&0x4) SegaDB-=12;
562565      if(iPAN&0x8) SegaDB-=24;
563566
564      if(iPAN==0xf) PAN=0.0;
567      if((iPAN&0xf)==0xf) PAN=0.0;
565568      else PAN=pow(10.0,SegaDB/20.0);
566569
567570      if(iPAN<0x10)
r1281r1282
11721175            addr&=0x7ffff;
11731176    }
11741177*/
1178    if(addr==LSA(slot))
1179    {
1180       if(LPSLNK(slot) && slot->EG.state==ATTACK)
1181          slot->EG.state = DECAY1;
1182    }
1183
11751184   if(PCM8B(slot))   //8 bit signed
11761185   {
11771186      INT8 *p=(INT8 *) (slot->base+BYTE_XOR_BE((slot->cur_addr>>SHIFT)));
r1281r1282
11931202
11941203   }
11951204
1205   if(SBCTL(slot)&0x1)
1206      sample ^= 0x7FFF;
1207   if(SBCTL(slot)&0x2)
1208      sample = (INT16)(sample^0x8000);
1209
11961210   if(slot->Backwards)
11971211      slot->cur_addr-=step;
11981212   else
docs/messnew.txt
r1281r1282
6161
6262Source Changes:
6363----------------
64- The core is based on MAME 0.120u3.  This incorporates all features of the
64- The core is based on MAME 0.120u4.  This incorporates all features of the
6565  update to this core.  [MAME team]
6666
6767

Previous 15994 Revisions Next


© 1998-2018 The MESS Team